feat: auto generated files and new structure (#4)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 4s
Release / goreleaser (push) Failing after 29s
Publish / Publish provider (push) Failing after 4m24s

## 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:
Marcel S. Henselin 2026-01-29 14:10:25 +00:00 committed by Marcel_Henselin
parent 979220be66
commit 9f41c4da7f
Signed by: tf-provider.git.onstackit.cloud
GPG key ID: 6D7E8A1ED8955A9C
1283 changed files with 273211 additions and 4614 deletions

View file

@ -0,0 +1 @@
6.6.0

3830
pkg/iaasalpha/api_default.go Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,966 @@
/*
STACKIT IaaS API
Testing DefaultApiService
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
package iaasalpha
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"github.com/stackitcloud/stackit-sdk-go/core/config"
)
func Test_iaasalpha_DefaultApiService(t *testing.T) {
t.Run("Test DefaultApiService AddRoutesToRoutingTable", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := RouteListResponse{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
addRoutesToRoutingTablePayload := AddRoutesToRoutingTablePayload{}
resp, reqErr := apiClient.AddRoutesToRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService AddRoutingTableToArea", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := RoutingTable{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
addRoutingTableToAreaPayload := AddRoutingTableToAreaPayload{}
resp, reqErr := apiClient.AddRoutingTableToArea(context.Background(), organizationId, areaId, region).AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService CreateNetwork", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Network{}
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 iaasalpha_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
region := regionValue
createNetworkPayload := CreateNetworkPayload{}
resp, reqErr := apiClient.CreateNetwork(context.Background(), projectId, region).CreateNetworkPayload(createNetworkPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService DeleteNetwork", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
networkIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -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 iaasalpha_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
region := regionValue
networkId := networkIdValue
reqErr := apiClient.DeleteNetwork(context.Background(), projectId, region, networkId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService DeleteRouteFromRoutingTable", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
routeIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
routeId := routeIdValue
reqErr := apiClient.DeleteRouteFromRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService DeleteRoutingTableFromArea", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
reqErr := apiClient.DeleteRoutingTableFromArea(context.Background(), organizationId, areaId, region, routingTableId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService GetNetwork", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
networkIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Network{}
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 iaasalpha_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
region := regionValue
networkId := networkIdValue
resp, reqErr := apiClient.GetNetwork(context.Background(), projectId, region, networkId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService GetRouteOfRoutingTable", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
routeIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Route{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
routeId := routeIdValue
resp, reqErr := apiClient.GetRouteOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService GetRoutingTableOfArea", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := RoutingTable{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
resp, reqErr := apiClient.GetRoutingTableOfArea(context.Background(), organizationId, areaId, region, routingTableId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := NetworkListResponse{}
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 iaasalpha_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
region := regionValue
resp, reqErr := apiClient.ListNetworks(context.Background(), projectId, region).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListNetworksOfRoutingTable", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/networks"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := NetworkListResponse{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
resp, reqErr := apiClient.ListNetworksOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListRoutesOfRoutingTable", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := RouteListResponse{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
resp, reqErr := apiClient.ListRoutesOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListRoutingTablesOfArea", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := RoutingTableListResponse{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
resp, reqErr := apiClient.ListRoutingTablesOfArea(context.Background(), organizationId, areaId, region).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService PartialUpdateNetwork", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
networkIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -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 iaasalpha_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
region := regionValue
networkId := networkIdValue
partialUpdateNetworkPayload := PartialUpdateNetworkPayload{}
reqErr := apiClient.PartialUpdateNetwork(context.Background(), projectId, region, networkId).PartialUpdateNetworkPayload(partialUpdateNetworkPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService UpdateRouteOfRoutingTable", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
routeIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Route{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
routeId := routeIdValue
updateRouteOfRoutingTablePayload := UpdateRouteOfRoutingTablePayload{}
resp, reqErr := apiClient.UpdateRouteOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService UpdateRoutingTableOfArea", func(t *testing.T) {
_apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}"
organizationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1)
areaIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1)
regionValue := "region-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1)
routingTableIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := RoutingTable{}
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 iaasalpha_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)
}
organizationId := organizationIdValue
areaId := areaIdValue
region := regionValue
routingTableId := routingTableIdValue
updateRoutingTableOfAreaPayload := UpdateRoutingTableOfAreaPayload{}
resp, reqErr := apiClient.UpdateRoutingTableOfArea(context.Background(), organizationId, areaId, region, routingTableId).UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
}

628
pkg/iaasalpha/client.go Normal file
View file

@ -0,0 +1,628 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
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 IaaS API API v2alpha1
// 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)
}

View file

@ -0,0 +1,38 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
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/iaasalpha",
Debug: false,
Servers: config.ServerConfigurations{
{
URL: "https://iaas.api.stackit.cloud",
Description: "No description provided",
Variables: map[string]config.ServerVariable{
"region": {
Description: "No description provided",
DefaultValue: "global",
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
return cfg
}

View file

@ -0,0 +1,126 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the AddRoutesToRoutingTablePayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AddRoutesToRoutingTablePayload{}
/*
types and functions for items
*/
// isArray
type AddRoutesToRoutingTablePayloadGetItemsAttributeType = *[]Route
type AddRoutesToRoutingTablePayloadGetItemsArgType = []Route
type AddRoutesToRoutingTablePayloadGetItemsRetType = []Route
func getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(arg AddRoutesToRoutingTablePayloadGetItemsAttributeType) (ret AddRoutesToRoutingTablePayloadGetItemsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutesToRoutingTablePayloadGetItemsAttributeType(arg *AddRoutesToRoutingTablePayloadGetItemsAttributeType, val AddRoutesToRoutingTablePayloadGetItemsRetType) {
*arg = &val
}
// AddRoutesToRoutingTablePayload Object represents a request to add network routes.
type AddRoutesToRoutingTablePayload struct {
// A list of routes.
// REQUIRED
Items AddRoutesToRoutingTablePayloadGetItemsAttributeType `json:"items" required:"true"`
}
type _AddRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload
// NewAddRoutesToRoutingTablePayload instantiates a new AddRoutesToRoutingTablePayload 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 NewAddRoutesToRoutingTablePayload(items AddRoutesToRoutingTablePayloadGetItemsArgType) *AddRoutesToRoutingTablePayload {
this := AddRoutesToRoutingTablePayload{}
setAddRoutesToRoutingTablePayloadGetItemsAttributeType(&this.Items, items)
return &this
}
// NewAddRoutesToRoutingTablePayloadWithDefaults instantiates a new AddRoutesToRoutingTablePayload 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 NewAddRoutesToRoutingTablePayloadWithDefaults() *AddRoutesToRoutingTablePayload {
this := AddRoutesToRoutingTablePayload{}
return &this
}
// GetItems returns the Items field value
func (o *AddRoutesToRoutingTablePayload) GetItems() (ret AddRoutesToRoutingTablePayloadGetItemsRetType) {
ret, _ = o.GetItemsOk()
return ret
}
// GetItemsOk returns a tuple with the Items field value
// and a boolean to check if the value has been set.
func (o *AddRoutesToRoutingTablePayload) GetItemsOk() (ret AddRoutesToRoutingTablePayloadGetItemsRetType, ok bool) {
return getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(o.Items)
}
// SetItems sets field value
func (o *AddRoutesToRoutingTablePayload) SetItems(v AddRoutesToRoutingTablePayloadGetItemsRetType) {
setAddRoutesToRoutingTablePayloadGetItemsAttributeType(&o.Items, v)
}
func (o AddRoutesToRoutingTablePayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(o.Items); ok {
toSerialize["Items"] = val
}
return toSerialize, nil
}
type NullableAddRoutesToRoutingTablePayload struct {
value *AddRoutesToRoutingTablePayload
isSet bool
}
func (v NullableAddRoutesToRoutingTablePayload) Get() *AddRoutesToRoutingTablePayload {
return v.value
}
func (v *NullableAddRoutesToRoutingTablePayload) Set(val *AddRoutesToRoutingTablePayload) {
v.value = val
v.isSet = true
}
func (v NullableAddRoutesToRoutingTablePayload) IsSet() bool {
return v.isSet
}
func (v *NullableAddRoutesToRoutingTablePayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAddRoutesToRoutingTablePayload(val *AddRoutesToRoutingTablePayload) *NullableAddRoutesToRoutingTablePayload {
return &NullableAddRoutesToRoutingTablePayload{value: val, isSet: true}
}
func (v NullableAddRoutesToRoutingTablePayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAddRoutesToRoutingTablePayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,518 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
"time"
)
// checks if the AddRoutingTableToAreaPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AddRoutingTableToAreaPayload{}
/*
types and functions for createdAt
*/
// isDateTime
type AddRoutingTableToAreaPayloadGetCreatedAtAttributeType = *time.Time
type AddRoutingTableToAreaPayloadGetCreatedAtArgType = time.Time
type AddRoutingTableToAreaPayloadGetCreatedAtRetType = time.Time
func getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetCreatedAtAttributeType) (ret AddRoutingTableToAreaPayloadGetCreatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadGetCreatedAtAttributeType(arg *AddRoutingTableToAreaPayloadGetCreatedAtAttributeType, val AddRoutingTableToAreaPayloadGetCreatedAtRetType) {
*arg = &val
}
/*
types and functions for default
*/
// isBoolean
type AddRoutingTableToAreaPayloadgetDefaultAttributeType = *bool
type AddRoutingTableToAreaPayloadgetDefaultArgType = bool
type AddRoutingTableToAreaPayloadgetDefaultRetType = bool
func getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetDefaultAttributeType) (ret AddRoutingTableToAreaPayloadgetDefaultRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadgetDefaultAttributeType(arg *AddRoutingTableToAreaPayloadgetDefaultAttributeType, val AddRoutingTableToAreaPayloadgetDefaultRetType) {
*arg = &val
}
/*
types and functions for description
*/
// isNotNullableString
type AddRoutingTableToAreaPayloadGetDescriptionAttributeType = *string
func getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetDescriptionAttributeType) (ret AddRoutingTableToAreaPayloadGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadGetDescriptionAttributeType(arg *AddRoutingTableToAreaPayloadGetDescriptionAttributeType, val AddRoutingTableToAreaPayloadGetDescriptionRetType) {
*arg = &val
}
type AddRoutingTableToAreaPayloadGetDescriptionArgType = string
type AddRoutingTableToAreaPayloadGetDescriptionRetType = string
/*
types and functions for dynamicRoutes
*/
// isBoolean
type AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType = *bool
type AddRoutingTableToAreaPayloadgetDynamicRoutesArgType = bool
type AddRoutingTableToAreaPayloadgetDynamicRoutesRetType = bool
func getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType) (ret AddRoutingTableToAreaPayloadgetDynamicRoutesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType(arg *AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType, val AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) {
*arg = &val
}
/*
types and functions for id
*/
// isNotNullableString
type AddRoutingTableToAreaPayloadGetIdAttributeType = *string
func getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetIdAttributeType) (ret AddRoutingTableToAreaPayloadGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadGetIdAttributeType(arg *AddRoutingTableToAreaPayloadGetIdAttributeType, val AddRoutingTableToAreaPayloadGetIdRetType) {
*arg = &val
}
type AddRoutingTableToAreaPayloadGetIdArgType = string
type AddRoutingTableToAreaPayloadGetIdRetType = string
/*
types and functions for labels
*/
// isFreeform
type AddRoutingTableToAreaPayloadGetLabelsAttributeType = *map[string]interface{}
type AddRoutingTableToAreaPayloadGetLabelsArgType = map[string]interface{}
type AddRoutingTableToAreaPayloadGetLabelsRetType = map[string]interface{}
func getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetLabelsAttributeType) (ret AddRoutingTableToAreaPayloadGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadGetLabelsAttributeType(arg *AddRoutingTableToAreaPayloadGetLabelsAttributeType, val AddRoutingTableToAreaPayloadGetLabelsRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isNotNullableString
type AddRoutingTableToAreaPayloadGetNameAttributeType = *string
func getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetNameAttributeType) (ret AddRoutingTableToAreaPayloadGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadGetNameAttributeType(arg *AddRoutingTableToAreaPayloadGetNameAttributeType, val AddRoutingTableToAreaPayloadGetNameRetType) {
*arg = &val
}
type AddRoutingTableToAreaPayloadGetNameArgType = string
type AddRoutingTableToAreaPayloadGetNameRetType = string
/*
types and functions for systemRoutes
*/
// isBoolean
type AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType = *bool
type AddRoutingTableToAreaPayloadgetSystemRoutesArgType = bool
type AddRoutingTableToAreaPayloadgetSystemRoutesRetType = bool
func getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType) (ret AddRoutingTableToAreaPayloadgetSystemRoutesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadgetSystemRoutesAttributeType(arg *AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType, val AddRoutingTableToAreaPayloadgetSystemRoutesRetType) {
*arg = &val
}
/*
types and functions for updatedAt
*/
// isDateTime
type AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType = *time.Time
type AddRoutingTableToAreaPayloadGetUpdatedAtArgType = time.Time
type AddRoutingTableToAreaPayloadGetUpdatedAtRetType = time.Time
func getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType) (ret AddRoutingTableToAreaPayloadGetUpdatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAddRoutingTableToAreaPayloadGetUpdatedAtAttributeType(arg *AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType, val AddRoutingTableToAreaPayloadGetUpdatedAtRetType) {
*arg = &val
}
// AddRoutingTableToAreaPayload An object representing a routing table.
type AddRoutingTableToAreaPayload struct {
// Date-time when resource was created.
CreatedAt AddRoutingTableToAreaPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"`
// This is the default routing table. It can't be deleted and is used if the user does not specify it otherwise.
Default AddRoutingTableToAreaPayloadgetDefaultAttributeType `json:"default,omitempty"`
// Description Object. Allows string up to 255 Characters.
Description AddRoutingTableToAreaPayloadGetDescriptionAttributeType `json:"description,omitempty"`
// A config setting for a routing table which allows propagation of dynamic routes to this routing table.
DynamicRoutes AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"`
// Universally Unique Identifier (UUID).
Id AddRoutingTableToAreaPayloadGetIdAttributeType `json:"id,omitempty"`
// Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key.
Labels AddRoutingTableToAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"`
// The name for a General Object. Matches Names and also UUIDs.
// REQUIRED
Name AddRoutingTableToAreaPayloadGetNameAttributeType `json:"name" required:"true"`
// A config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA.
SystemRoutes AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType `json:"systemRoutes,omitempty"`
// Date-time when resource was last updated.
UpdatedAt AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"`
}
type _AddRoutingTableToAreaPayload AddRoutingTableToAreaPayload
// NewAddRoutingTableToAreaPayload instantiates a new AddRoutingTableToAreaPayload 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 NewAddRoutingTableToAreaPayload(name AddRoutingTableToAreaPayloadGetNameArgType) *AddRoutingTableToAreaPayload {
this := AddRoutingTableToAreaPayload{}
setAddRoutingTableToAreaPayloadGetNameAttributeType(&this.Name, name)
return &this
}
// NewAddRoutingTableToAreaPayloadWithDefaults instantiates a new AddRoutingTableToAreaPayload 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 NewAddRoutingTableToAreaPayloadWithDefaults() *AddRoutingTableToAreaPayload {
this := AddRoutingTableToAreaPayload{}
var dynamicRoutes bool = true
this.DynamicRoutes = &dynamicRoutes
var systemRoutes bool = true
this.SystemRoutes = &systemRoutes
return &this
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *AddRoutingTableToAreaPayload) GetCreatedAt() (res AddRoutingTableToAreaPayloadGetCreatedAtRetType) {
res, _ = o.GetCreatedAtOk()
return
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AddRoutingTableToAreaPayload) GetCreatedAtOk() (ret AddRoutingTableToAreaPayloadGetCreatedAtRetType, ok bool) {
return getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt)
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *AddRoutingTableToAreaPayload) HasCreatedAt() bool {
_, ok := o.GetCreatedAtOk()
return ok
}
// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field.
func (o *AddRoutingTableToAreaPayload) SetCreatedAt(v AddRoutingTableToAreaPayloadGetCreatedAtRetType) {
setAddRoutingTableToAreaPayloadGetCreatedAtAttributeType(&o.CreatedAt, v)
}
// GetDefault returns the Default field value if set, zero value otherwise.
func (o *AddRoutingTableToAreaPayload) GetDefault() (res AddRoutingTableToAreaPayloadgetDefaultRetType) {
res, _ = o.GetDefaultOk()
return
}
// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AddRoutingTableToAreaPayload) GetDefaultOk() (ret AddRoutingTableToAreaPayloadgetDefaultRetType, ok bool) {
return getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(o.Default)
}
// HasDefault returns a boolean if a field has been set.
func (o *AddRoutingTableToAreaPayload) HasDefault() bool {
_, ok := o.GetDefaultOk()
return ok
}
// SetDefault gets a reference to the given bool and assigns it to the Default field.
func (o *AddRoutingTableToAreaPayload) SetDefault(v AddRoutingTableToAreaPayloadgetDefaultRetType) {
setAddRoutingTableToAreaPayloadgetDefaultAttributeType(&o.Default, v)
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *AddRoutingTableToAreaPayload) GetDescription() (res AddRoutingTableToAreaPayloadGetDescriptionRetType) {
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 *AddRoutingTableToAreaPayload) GetDescriptionOk() (ret AddRoutingTableToAreaPayloadGetDescriptionRetType, ok bool) {
return getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *AddRoutingTableToAreaPayload) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *AddRoutingTableToAreaPayload) SetDescription(v AddRoutingTableToAreaPayloadGetDescriptionRetType) {
setAddRoutingTableToAreaPayloadGetDescriptionAttributeType(&o.Description, v)
}
// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise.
func (o *AddRoutingTableToAreaPayload) GetDynamicRoutes() (res AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) {
res, _ = o.GetDynamicRoutesOk()
return
}
// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AddRoutingTableToAreaPayload) GetDynamicRoutesOk() (ret AddRoutingTableToAreaPayloadgetDynamicRoutesRetType, ok bool) {
return getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes)
}
// HasDynamicRoutes returns a boolean if a field has been set.
func (o *AddRoutingTableToAreaPayload) HasDynamicRoutes() bool {
_, ok := o.GetDynamicRoutesOk()
return ok
}
// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field.
func (o *AddRoutingTableToAreaPayload) SetDynamicRoutes(v AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) {
setAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType(&o.DynamicRoutes, v)
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *AddRoutingTableToAreaPayload) GetId() (res AddRoutingTableToAreaPayloadGetIdRetType) {
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 *AddRoutingTableToAreaPayload) GetIdOk() (ret AddRoutingTableToAreaPayloadGetIdRetType, ok bool) {
return getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(o.Id)
}
// HasId returns a boolean if a field has been set.
func (o *AddRoutingTableToAreaPayload) HasId() bool {
_, ok := o.GetIdOk()
return ok
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *AddRoutingTableToAreaPayload) SetId(v AddRoutingTableToAreaPayloadGetIdRetType) {
setAddRoutingTableToAreaPayloadGetIdAttributeType(&o.Id, v)
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *AddRoutingTableToAreaPayload) GetLabels() (res AddRoutingTableToAreaPayloadGetLabelsRetType) {
res, _ = o.GetLabelsOk()
return
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AddRoutingTableToAreaPayload) GetLabelsOk() (ret AddRoutingTableToAreaPayloadGetLabelsRetType, ok bool) {
return getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(o.Labels)
}
// HasLabels returns a boolean if a field has been set.
func (o *AddRoutingTableToAreaPayload) HasLabels() bool {
_, ok := o.GetLabelsOk()
return ok
}
// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field.
func (o *AddRoutingTableToAreaPayload) SetLabels(v AddRoutingTableToAreaPayloadGetLabelsRetType) {
setAddRoutingTableToAreaPayloadGetLabelsAttributeType(&o.Labels, v)
}
// GetName returns the Name field value
func (o *AddRoutingTableToAreaPayload) GetName() (ret AddRoutingTableToAreaPayloadGetNameRetType) {
ret, _ = o.GetNameOk()
return ret
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *AddRoutingTableToAreaPayload) GetNameOk() (ret AddRoutingTableToAreaPayloadGetNameRetType, ok bool) {
return getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *AddRoutingTableToAreaPayload) SetName(v AddRoutingTableToAreaPayloadGetNameRetType) {
setAddRoutingTableToAreaPayloadGetNameAttributeType(&o.Name, v)
}
// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise.
func (o *AddRoutingTableToAreaPayload) GetSystemRoutes() (res AddRoutingTableToAreaPayloadgetSystemRoutesRetType) {
res, _ = o.GetSystemRoutesOk()
return
}
// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AddRoutingTableToAreaPayload) GetSystemRoutesOk() (ret AddRoutingTableToAreaPayloadgetSystemRoutesRetType, ok bool) {
return getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes)
}
// HasSystemRoutes returns a boolean if a field has been set.
func (o *AddRoutingTableToAreaPayload) HasSystemRoutes() bool {
_, ok := o.GetSystemRoutesOk()
return ok
}
// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field.
func (o *AddRoutingTableToAreaPayload) SetSystemRoutes(v AddRoutingTableToAreaPayloadgetSystemRoutesRetType) {
setAddRoutingTableToAreaPayloadgetSystemRoutesAttributeType(&o.SystemRoutes, v)
}
// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *AddRoutingTableToAreaPayload) GetUpdatedAt() (res AddRoutingTableToAreaPayloadGetUpdatedAtRetType) {
res, _ = o.GetUpdatedAtOk()
return
}
// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AddRoutingTableToAreaPayload) GetUpdatedAtOk() (ret AddRoutingTableToAreaPayloadGetUpdatedAtRetType, ok bool) {
return getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt)
}
// HasUpdatedAt returns a boolean if a field has been set.
func (o *AddRoutingTableToAreaPayload) HasUpdatedAt() bool {
_, ok := o.GetUpdatedAtOk()
return ok
}
// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field.
func (o *AddRoutingTableToAreaPayload) SetUpdatedAt(v AddRoutingTableToAreaPayloadGetUpdatedAtRetType) {
setAddRoutingTableToAreaPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v)
}
func (o AddRoutingTableToAreaPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok {
toSerialize["CreatedAt"] = val
}
if val, ok := getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(o.Default); ok {
toSerialize["Default"] = val
}
if val, ok := getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok {
toSerialize["DynamicRoutes"] = val
}
if val, ok := getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
if val, ok := getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok {
toSerialize["SystemRoutes"] = val
}
if val, ok := getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok {
toSerialize["UpdatedAt"] = val
}
return toSerialize, nil
}
type NullableAddRoutingTableToAreaPayload struct {
value *AddRoutingTableToAreaPayload
isSet bool
}
func (v NullableAddRoutingTableToAreaPayload) Get() *AddRoutingTableToAreaPayload {
return v.value
}
func (v *NullableAddRoutingTableToAreaPayload) Set(val *AddRoutingTableToAreaPayload) {
v.value = val
v.isSet = true
}
func (v NullableAddRoutingTableToAreaPayload) IsSet() bool {
return v.isSet
}
func (v *NullableAddRoutingTableToAreaPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAddRoutingTableToAreaPayload(val *AddRoutingTableToAreaPayload) *NullableAddRoutingTableToAreaPayload {
return &NullableAddRoutingTableToAreaPayload{value: val, isSet: true}
}
func (v NullableAddRoutingTableToAreaPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAddRoutingTableToAreaPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,144 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
"fmt"
)
// CreateNetworkIPv4 - The create request for an IPv4 network.
type CreateNetworkIPv4 struct {
CreateNetworkIPv4WithPrefix *CreateNetworkIPv4WithPrefix
CreateNetworkIPv4WithPrefixLength *CreateNetworkIPv4WithPrefixLength
}
// CreateNetworkIPv4WithPrefixAsCreateNetworkIPv4 is a convenience function that returns CreateNetworkIPv4WithPrefix wrapped in CreateNetworkIPv4
func CreateNetworkIPv4WithPrefixAsCreateNetworkIPv4(v *CreateNetworkIPv4WithPrefix) CreateNetworkIPv4 {
return CreateNetworkIPv4{
CreateNetworkIPv4WithPrefix: v,
}
}
// CreateNetworkIPv4WithPrefixLengthAsCreateNetworkIPv4 is a convenience function that returns CreateNetworkIPv4WithPrefixLength wrapped in CreateNetworkIPv4
func CreateNetworkIPv4WithPrefixLengthAsCreateNetworkIPv4(v *CreateNetworkIPv4WithPrefixLength) CreateNetworkIPv4 {
return CreateNetworkIPv4{
CreateNetworkIPv4WithPrefixLength: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *CreateNetworkIPv4) UnmarshalJSON(data []byte) error {
var err error
match := 0
// Workaround until upstream issue is fixed:
// https://github.com/OpenAPITools/openapi-generator/issues/21751
// Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226
// try to unmarshal data into CreateNetworkIPv4WithPrefix
dstCreateNetworkIPv41 := &CreateNetworkIPv4{}
err = json.Unmarshal(data, &dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix)
if err == nil {
jsonCreateNetworkIPv4WithPrefix, _ := json.Marshal(&dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix)
if string(jsonCreateNetworkIPv4WithPrefix) != "{}" { // empty struct
dst.CreateNetworkIPv4WithPrefix = dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix
match++
}
}
// try to unmarshal data into CreateNetworkIPv4WithPrefixLength
dstCreateNetworkIPv42 := &CreateNetworkIPv4{}
err = json.Unmarshal(data, &dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength)
if err == nil {
jsonCreateNetworkIPv4WithPrefixLength, _ := json.Marshal(&dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength)
if string(jsonCreateNetworkIPv4WithPrefixLength) != "{}" { // empty struct
dst.CreateNetworkIPv4WithPrefixLength = dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength
match++
}
}
if match > 1 { // more than 1 match
// reset to nil
dst.CreateNetworkIPv4WithPrefix = nil
dst.CreateNetworkIPv4WithPrefixLength = nil
return fmt.Errorf("data matches more than one schema in oneOf(CreateNetworkIPv4)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
return fmt.Errorf("data failed to match schemas in oneOf(CreateNetworkIPv4)")
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src CreateNetworkIPv4) MarshalJSON() ([]byte, error) {
if src.CreateNetworkIPv4WithPrefix != nil {
return json.Marshal(&src.CreateNetworkIPv4WithPrefix)
}
if src.CreateNetworkIPv4WithPrefixLength != nil {
return json.Marshal(&src.CreateNetworkIPv4WithPrefixLength)
}
return []byte("{}"), nil // no data in oneOf schemas => empty JSON object
}
// Get the actual instance
func (obj *CreateNetworkIPv4) GetActualInstance() interface{} {
if obj == nil {
return nil
}
if obj.CreateNetworkIPv4WithPrefix != nil {
return obj.CreateNetworkIPv4WithPrefix
}
if obj.CreateNetworkIPv4WithPrefixLength != nil {
return obj.CreateNetworkIPv4WithPrefixLength
}
// all schemas are nil
return nil
}
type NullableCreateNetworkIPv4 struct {
value *CreateNetworkIPv4
isSet bool
}
func (v NullableCreateNetworkIPv4) Get() *CreateNetworkIPv4 {
return v.value
}
func (v *NullableCreateNetworkIPv4) Set(val *CreateNetworkIPv4) {
v.value = val
v.isSet = true
}
func (v NullableCreateNetworkIPv4) IsSet() bool {
return v.isSet
}
func (v *NullableCreateNetworkIPv4) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateNetworkIPv4(val *CreateNetworkIPv4) *NullableCreateNetworkIPv4 {
return &NullableCreateNetworkIPv4{value: val, isSet: true}
}
func (v NullableCreateNetworkIPv4) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateNetworkIPv4) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,43 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"testing"
)
// isOneOf
func TestCreateNetworkIPv4_UnmarshalJSON(t *testing.T) {
type args struct {
src []byte
}
tests := []struct {
name string
args args
wantErr bool
}{}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := &CreateNetworkIPv4{}
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
}
marshalJson, err := v.MarshalJSON()
if err != nil {
t.Fatalf("failed marshalling CreateNetworkIPv4: %v", err)
}
if string(marshalJson) != string(tt.args.src) {
t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson)
}
})
}
}

View file

@ -0,0 +1,239 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the CreateNetworkIPv4WithPrefix type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateNetworkIPv4WithPrefix{}
/*
types and functions for gateway
*/
// isNullableString
type CreateNetworkIPv4WithPrefixGetGatewayAttributeType = *NullableString
func getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetGatewayAttributeType) (ret CreateNetworkIPv4WithPrefixGetGatewayRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg.Get(), true
}
func setCreateNetworkIPv4WithPrefixGetGatewayAttributeType(arg *CreateNetworkIPv4WithPrefixGetGatewayAttributeType, val CreateNetworkIPv4WithPrefixGetGatewayRetType) {
if IsNil(*arg) {
*arg = NewNullableString(val)
} else {
(*arg).Set(val)
}
}
type CreateNetworkIPv4WithPrefixGetGatewayArgType = *string
type CreateNetworkIPv4WithPrefixGetGatewayRetType = *string
/*
types and functions for nameservers
*/
// isArray
type CreateNetworkIPv4WithPrefixGetNameserversAttributeType = *[]string
type CreateNetworkIPv4WithPrefixGetNameserversArgType = []string
type CreateNetworkIPv4WithPrefixGetNameserversRetType = []string
func getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetNameserversAttributeType) (ret CreateNetworkIPv4WithPrefixGetNameserversRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkIPv4WithPrefixGetNameserversAttributeType(arg *CreateNetworkIPv4WithPrefixGetNameserversAttributeType, val CreateNetworkIPv4WithPrefixGetNameserversRetType) {
*arg = &val
}
/*
types and functions for prefix
*/
// isNotNullableString
type CreateNetworkIPv4WithPrefixGetPrefixAttributeType = *string
func getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetPrefixAttributeType) (ret CreateNetworkIPv4WithPrefixGetPrefixRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(arg *CreateNetworkIPv4WithPrefixGetPrefixAttributeType, val CreateNetworkIPv4WithPrefixGetPrefixRetType) {
*arg = &val
}
type CreateNetworkIPv4WithPrefixGetPrefixArgType = string
type CreateNetworkIPv4WithPrefixGetPrefixRetType = string
// CreateNetworkIPv4WithPrefix The create request for an IPv4 network with a specified prefix.
type CreateNetworkIPv4WithPrefix struct {
// The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway.
Gateway CreateNetworkIPv4WithPrefixGetGatewayAttributeType `json:"gateway,omitempty"`
// A list containing DNS Servers/Nameservers for IPv4.
Nameservers CreateNetworkIPv4WithPrefixGetNameserversAttributeType `json:"nameservers,omitempty"`
// IPv4 Classless Inter-Domain Routing (CIDR).
// REQUIRED
Prefix CreateNetworkIPv4WithPrefixGetPrefixAttributeType `json:"prefix" required:"true"`
}
type _CreateNetworkIPv4WithPrefix CreateNetworkIPv4WithPrefix
// NewCreateNetworkIPv4WithPrefix instantiates a new CreateNetworkIPv4WithPrefix 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 NewCreateNetworkIPv4WithPrefix(prefix CreateNetworkIPv4WithPrefixGetPrefixArgType) *CreateNetworkIPv4WithPrefix {
this := CreateNetworkIPv4WithPrefix{}
setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(&this.Prefix, prefix)
return &this
}
// NewCreateNetworkIPv4WithPrefixWithDefaults instantiates a new CreateNetworkIPv4WithPrefix 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 NewCreateNetworkIPv4WithPrefixWithDefaults() *CreateNetworkIPv4WithPrefix {
this := CreateNetworkIPv4WithPrefix{}
return &this
}
// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *CreateNetworkIPv4WithPrefix) GetGateway() (res CreateNetworkIPv4WithPrefixGetGatewayRetType) {
res, _ = o.GetGatewayOk()
return
}
// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *CreateNetworkIPv4WithPrefix) GetGatewayOk() (ret CreateNetworkIPv4WithPrefixGetGatewayRetType, ok bool) {
return getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(o.Gateway)
}
// HasGateway returns a boolean if a field has been set.
func (o *CreateNetworkIPv4WithPrefix) HasGateway() bool {
_, ok := o.GetGatewayOk()
return ok
}
// SetGateway gets a reference to the given string and assigns it to the Gateway field.
func (o *CreateNetworkIPv4WithPrefix) SetGateway(v CreateNetworkIPv4WithPrefixGetGatewayRetType) {
setCreateNetworkIPv4WithPrefixGetGatewayAttributeType(&o.Gateway, v)
}
// SetGatewayNil sets the value for Gateway to be an explicit nil
func (o *CreateNetworkIPv4WithPrefix) SetGatewayNil() {
o.Gateway = nil
}
// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil
func (o *CreateNetworkIPv4WithPrefix) UnsetGateway() {
o.Gateway = nil
}
// GetNameservers returns the Nameservers field value if set, zero value otherwise.
func (o *CreateNetworkIPv4WithPrefix) GetNameservers() (res CreateNetworkIPv4WithPrefixGetNameserversRetType) {
res, _ = o.GetNameserversOk()
return
}
// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkIPv4WithPrefix) GetNameserversOk() (ret CreateNetworkIPv4WithPrefixGetNameserversRetType, ok bool) {
return getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(o.Nameservers)
}
// HasNameservers returns a boolean if a field has been set.
func (o *CreateNetworkIPv4WithPrefix) HasNameservers() bool {
_, ok := o.GetNameserversOk()
return ok
}
// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field.
func (o *CreateNetworkIPv4WithPrefix) SetNameservers(v CreateNetworkIPv4WithPrefixGetNameserversRetType) {
setCreateNetworkIPv4WithPrefixGetNameserversAttributeType(&o.Nameservers, v)
}
// GetPrefix returns the Prefix field value
func (o *CreateNetworkIPv4WithPrefix) GetPrefix() (ret CreateNetworkIPv4WithPrefixGetPrefixRetType) {
ret, _ = o.GetPrefixOk()
return ret
}
// GetPrefixOk returns a tuple with the Prefix field value
// and a boolean to check if the value has been set.
func (o *CreateNetworkIPv4WithPrefix) GetPrefixOk() (ret CreateNetworkIPv4WithPrefixGetPrefixRetType, ok bool) {
return getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(o.Prefix)
}
// SetPrefix sets field value
func (o *CreateNetworkIPv4WithPrefix) SetPrefix(v CreateNetworkIPv4WithPrefixGetPrefixRetType) {
setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(&o.Prefix, v)
}
func (o CreateNetworkIPv4WithPrefix) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(o.Gateway); ok {
toSerialize["Gateway"] = val
}
if val, ok := getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(o.Nameservers); ok {
toSerialize["Nameservers"] = val
}
if val, ok := getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(o.Prefix); ok {
toSerialize["Prefix"] = val
}
return toSerialize, nil
}
type NullableCreateNetworkIPv4WithPrefix struct {
value *CreateNetworkIPv4WithPrefix
isSet bool
}
func (v NullableCreateNetworkIPv4WithPrefix) Get() *CreateNetworkIPv4WithPrefix {
return v.value
}
func (v *NullableCreateNetworkIPv4WithPrefix) Set(val *CreateNetworkIPv4WithPrefix) {
v.value = val
v.isSet = true
}
func (v NullableCreateNetworkIPv4WithPrefix) IsSet() bool {
return v.isSet
}
func (v *NullableCreateNetworkIPv4WithPrefix) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateNetworkIPv4WithPrefix(val *CreateNetworkIPv4WithPrefix) *NullableCreateNetworkIPv4WithPrefix {
return &NullableCreateNetworkIPv4WithPrefix{value: val, isSet: true}
}
func (v NullableCreateNetworkIPv4WithPrefix) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateNetworkIPv4WithPrefix) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,173 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the CreateNetworkIPv4WithPrefixLength type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateNetworkIPv4WithPrefixLength{}
/*
types and functions for nameservers
*/
// isArray
type CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType = *[]string
type CreateNetworkIPv4WithPrefixLengthGetNameserversArgType = []string
type CreateNetworkIPv4WithPrefixLengthGetNameserversRetType = []string
func getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(arg CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType) (ret CreateNetworkIPv4WithPrefixLengthGetNameserversRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType(arg *CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType, val CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) {
*arg = &val
}
/*
types and functions for prefixLength
*/
// isLong
type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType = *int64
type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthArgType = int64
type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType = int64
func getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType) (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(arg *CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType, val CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) {
*arg = &val
}
// CreateNetworkIPv4WithPrefixLength The create request for an IPv4 network with a wanted prefix length.
type CreateNetworkIPv4WithPrefixLength struct {
// A list containing DNS Servers/Nameservers for IPv4.
Nameservers CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType `json:"nameservers,omitempty"`
// REQUIRED
PrefixLength CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType `json:"prefixLength" required:"true"`
}
type _CreateNetworkIPv4WithPrefixLength CreateNetworkIPv4WithPrefixLength
// NewCreateNetworkIPv4WithPrefixLength instantiates a new CreateNetworkIPv4WithPrefixLength 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 NewCreateNetworkIPv4WithPrefixLength(prefixLength CreateNetworkIPv4WithPrefixLengthGetPrefixLengthArgType) *CreateNetworkIPv4WithPrefixLength {
this := CreateNetworkIPv4WithPrefixLength{}
setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(&this.PrefixLength, prefixLength)
return &this
}
// NewCreateNetworkIPv4WithPrefixLengthWithDefaults instantiates a new CreateNetworkIPv4WithPrefixLength 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 NewCreateNetworkIPv4WithPrefixLengthWithDefaults() *CreateNetworkIPv4WithPrefixLength {
this := CreateNetworkIPv4WithPrefixLength{}
return &this
}
// GetNameservers returns the Nameservers field value if set, zero value otherwise.
func (o *CreateNetworkIPv4WithPrefixLength) GetNameservers() (res CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) {
res, _ = o.GetNameserversOk()
return
}
// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkIPv4WithPrefixLength) GetNameserversOk() (ret CreateNetworkIPv4WithPrefixLengthGetNameserversRetType, ok bool) {
return getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers)
}
// HasNameservers returns a boolean if a field has been set.
func (o *CreateNetworkIPv4WithPrefixLength) HasNameservers() bool {
_, ok := o.GetNameserversOk()
return ok
}
// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field.
func (o *CreateNetworkIPv4WithPrefixLength) SetNameservers(v CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) {
setCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType(&o.Nameservers, v)
}
// GetPrefixLength returns the PrefixLength field value
func (o *CreateNetworkIPv4WithPrefixLength) GetPrefixLength() (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) {
ret, _ = o.GetPrefixLengthOk()
return ret
}
// GetPrefixLengthOk returns a tuple with the PrefixLength field value
// and a boolean to check if the value has been set.
func (o *CreateNetworkIPv4WithPrefixLength) GetPrefixLengthOk() (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType, ok bool) {
return getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength)
}
// SetPrefixLength sets field value
func (o *CreateNetworkIPv4WithPrefixLength) SetPrefixLength(v CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) {
setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(&o.PrefixLength, v)
}
func (o CreateNetworkIPv4WithPrefixLength) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers); ok {
toSerialize["Nameservers"] = val
}
if val, ok := getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok {
toSerialize["PrefixLength"] = val
}
return toSerialize, nil
}
type NullableCreateNetworkIPv4WithPrefixLength struct {
value *CreateNetworkIPv4WithPrefixLength
isSet bool
}
func (v NullableCreateNetworkIPv4WithPrefixLength) Get() *CreateNetworkIPv4WithPrefixLength {
return v.value
}
func (v *NullableCreateNetworkIPv4WithPrefixLength) Set(val *CreateNetworkIPv4WithPrefixLength) {
v.value = val
v.isSet = true
}
func (v NullableCreateNetworkIPv4WithPrefixLength) IsSet() bool {
return v.isSet
}
func (v *NullableCreateNetworkIPv4WithPrefixLength) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateNetworkIPv4WithPrefixLength(val *CreateNetworkIPv4WithPrefixLength) *NullableCreateNetworkIPv4WithPrefixLength {
return &NullableCreateNetworkIPv4WithPrefixLength{value: val, isSet: true}
}
func (v NullableCreateNetworkIPv4WithPrefixLength) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateNetworkIPv4WithPrefixLength) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,144 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
"fmt"
)
// CreateNetworkIPv6 - The create request for an IPv6 network.
type CreateNetworkIPv6 struct {
CreateNetworkIPv6WithPrefix *CreateNetworkIPv6WithPrefix
CreateNetworkIPv6WithPrefixLength *CreateNetworkIPv6WithPrefixLength
}
// CreateNetworkIPv6WithPrefixAsCreateNetworkIPv6 is a convenience function that returns CreateNetworkIPv6WithPrefix wrapped in CreateNetworkIPv6
func CreateNetworkIPv6WithPrefixAsCreateNetworkIPv6(v *CreateNetworkIPv6WithPrefix) CreateNetworkIPv6 {
return CreateNetworkIPv6{
CreateNetworkIPv6WithPrefix: v,
}
}
// CreateNetworkIPv6WithPrefixLengthAsCreateNetworkIPv6 is a convenience function that returns CreateNetworkIPv6WithPrefixLength wrapped in CreateNetworkIPv6
func CreateNetworkIPv6WithPrefixLengthAsCreateNetworkIPv6(v *CreateNetworkIPv6WithPrefixLength) CreateNetworkIPv6 {
return CreateNetworkIPv6{
CreateNetworkIPv6WithPrefixLength: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *CreateNetworkIPv6) UnmarshalJSON(data []byte) error {
var err error
match := 0
// Workaround until upstream issue is fixed:
// https://github.com/OpenAPITools/openapi-generator/issues/21751
// Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226
// try to unmarshal data into CreateNetworkIPv6WithPrefix
dstCreateNetworkIPv61 := &CreateNetworkIPv6{}
err = json.Unmarshal(data, &dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix)
if err == nil {
jsonCreateNetworkIPv6WithPrefix, _ := json.Marshal(&dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix)
if string(jsonCreateNetworkIPv6WithPrefix) != "{}" { // empty struct
dst.CreateNetworkIPv6WithPrefix = dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix
match++
}
}
// try to unmarshal data into CreateNetworkIPv6WithPrefixLength
dstCreateNetworkIPv62 := &CreateNetworkIPv6{}
err = json.Unmarshal(data, &dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength)
if err == nil {
jsonCreateNetworkIPv6WithPrefixLength, _ := json.Marshal(&dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength)
if string(jsonCreateNetworkIPv6WithPrefixLength) != "{}" { // empty struct
dst.CreateNetworkIPv6WithPrefixLength = dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength
match++
}
}
if match > 1 { // more than 1 match
// reset to nil
dst.CreateNetworkIPv6WithPrefix = nil
dst.CreateNetworkIPv6WithPrefixLength = nil
return fmt.Errorf("data matches more than one schema in oneOf(CreateNetworkIPv6)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
return fmt.Errorf("data failed to match schemas in oneOf(CreateNetworkIPv6)")
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src CreateNetworkIPv6) MarshalJSON() ([]byte, error) {
if src.CreateNetworkIPv6WithPrefix != nil {
return json.Marshal(&src.CreateNetworkIPv6WithPrefix)
}
if src.CreateNetworkIPv6WithPrefixLength != nil {
return json.Marshal(&src.CreateNetworkIPv6WithPrefixLength)
}
return []byte("{}"), nil // no data in oneOf schemas => empty JSON object
}
// Get the actual instance
func (obj *CreateNetworkIPv6) GetActualInstance() interface{} {
if obj == nil {
return nil
}
if obj.CreateNetworkIPv6WithPrefix != nil {
return obj.CreateNetworkIPv6WithPrefix
}
if obj.CreateNetworkIPv6WithPrefixLength != nil {
return obj.CreateNetworkIPv6WithPrefixLength
}
// all schemas are nil
return nil
}
type NullableCreateNetworkIPv6 struct {
value *CreateNetworkIPv6
isSet bool
}
func (v NullableCreateNetworkIPv6) Get() *CreateNetworkIPv6 {
return v.value
}
func (v *NullableCreateNetworkIPv6) Set(val *CreateNetworkIPv6) {
v.value = val
v.isSet = true
}
func (v NullableCreateNetworkIPv6) IsSet() bool {
return v.isSet
}
func (v *NullableCreateNetworkIPv6) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateNetworkIPv6(val *CreateNetworkIPv6) *NullableCreateNetworkIPv6 {
return &NullableCreateNetworkIPv6{value: val, isSet: true}
}
func (v NullableCreateNetworkIPv6) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateNetworkIPv6) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,43 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"testing"
)
// isOneOf
func TestCreateNetworkIPv6_UnmarshalJSON(t *testing.T) {
type args struct {
src []byte
}
tests := []struct {
name string
args args
wantErr bool
}{}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := &CreateNetworkIPv6{}
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
}
marshalJson, err := v.MarshalJSON()
if err != nil {
t.Fatalf("failed marshalling CreateNetworkIPv6: %v", err)
}
if string(marshalJson) != string(tt.args.src) {
t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson)
}
})
}
}

View file

@ -0,0 +1,239 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the CreateNetworkIPv6WithPrefix type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateNetworkIPv6WithPrefix{}
/*
types and functions for gateway
*/
// isNullableString
type CreateNetworkIPv6WithPrefixGetGatewayAttributeType = *NullableString
func getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetGatewayAttributeType) (ret CreateNetworkIPv6WithPrefixGetGatewayRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg.Get(), true
}
func setCreateNetworkIPv6WithPrefixGetGatewayAttributeType(arg *CreateNetworkIPv6WithPrefixGetGatewayAttributeType, val CreateNetworkIPv6WithPrefixGetGatewayRetType) {
if IsNil(*arg) {
*arg = NewNullableString(val)
} else {
(*arg).Set(val)
}
}
type CreateNetworkIPv6WithPrefixGetGatewayArgType = *string
type CreateNetworkIPv6WithPrefixGetGatewayRetType = *string
/*
types and functions for nameservers
*/
// isArray
type CreateNetworkIPv6WithPrefixGetNameserversAttributeType = *[]string
type CreateNetworkIPv6WithPrefixGetNameserversArgType = []string
type CreateNetworkIPv6WithPrefixGetNameserversRetType = []string
func getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetNameserversAttributeType) (ret CreateNetworkIPv6WithPrefixGetNameserversRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkIPv6WithPrefixGetNameserversAttributeType(arg *CreateNetworkIPv6WithPrefixGetNameserversAttributeType, val CreateNetworkIPv6WithPrefixGetNameserversRetType) {
*arg = &val
}
/*
types and functions for prefix
*/
// isNotNullableString
type CreateNetworkIPv6WithPrefixGetPrefixAttributeType = *string
func getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetPrefixAttributeType) (ret CreateNetworkIPv6WithPrefixGetPrefixRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(arg *CreateNetworkIPv6WithPrefixGetPrefixAttributeType, val CreateNetworkIPv6WithPrefixGetPrefixRetType) {
*arg = &val
}
type CreateNetworkIPv6WithPrefixGetPrefixArgType = string
type CreateNetworkIPv6WithPrefixGetPrefixRetType = string
// CreateNetworkIPv6WithPrefix The create request for an IPv6 network with a specified prefix.
type CreateNetworkIPv6WithPrefix struct {
// The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway.
Gateway CreateNetworkIPv6WithPrefixGetGatewayAttributeType `json:"gateway,omitempty"`
// A list containing DNS Servers/Nameservers for IPv6.
Nameservers CreateNetworkIPv6WithPrefixGetNameserversAttributeType `json:"nameservers,omitempty"`
// Classless Inter-Domain Routing (CIDR) for IPv6.
// REQUIRED
Prefix CreateNetworkIPv6WithPrefixGetPrefixAttributeType `json:"prefix" required:"true"`
}
type _CreateNetworkIPv6WithPrefix CreateNetworkIPv6WithPrefix
// NewCreateNetworkIPv6WithPrefix instantiates a new CreateNetworkIPv6WithPrefix 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 NewCreateNetworkIPv6WithPrefix(prefix CreateNetworkIPv6WithPrefixGetPrefixArgType) *CreateNetworkIPv6WithPrefix {
this := CreateNetworkIPv6WithPrefix{}
setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(&this.Prefix, prefix)
return &this
}
// NewCreateNetworkIPv6WithPrefixWithDefaults instantiates a new CreateNetworkIPv6WithPrefix 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 NewCreateNetworkIPv6WithPrefixWithDefaults() *CreateNetworkIPv6WithPrefix {
this := CreateNetworkIPv6WithPrefix{}
return &this
}
// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *CreateNetworkIPv6WithPrefix) GetGateway() (res CreateNetworkIPv6WithPrefixGetGatewayRetType) {
res, _ = o.GetGatewayOk()
return
}
// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *CreateNetworkIPv6WithPrefix) GetGatewayOk() (ret CreateNetworkIPv6WithPrefixGetGatewayRetType, ok bool) {
return getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(o.Gateway)
}
// HasGateway returns a boolean if a field has been set.
func (o *CreateNetworkIPv6WithPrefix) HasGateway() bool {
_, ok := o.GetGatewayOk()
return ok
}
// SetGateway gets a reference to the given string and assigns it to the Gateway field.
func (o *CreateNetworkIPv6WithPrefix) SetGateway(v CreateNetworkIPv6WithPrefixGetGatewayRetType) {
setCreateNetworkIPv6WithPrefixGetGatewayAttributeType(&o.Gateway, v)
}
// SetGatewayNil sets the value for Gateway to be an explicit nil
func (o *CreateNetworkIPv6WithPrefix) SetGatewayNil() {
o.Gateway = nil
}
// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil
func (o *CreateNetworkIPv6WithPrefix) UnsetGateway() {
o.Gateway = nil
}
// GetNameservers returns the Nameservers field value if set, zero value otherwise.
func (o *CreateNetworkIPv6WithPrefix) GetNameservers() (res CreateNetworkIPv6WithPrefixGetNameserversRetType) {
res, _ = o.GetNameserversOk()
return
}
// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkIPv6WithPrefix) GetNameserversOk() (ret CreateNetworkIPv6WithPrefixGetNameserversRetType, ok bool) {
return getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(o.Nameservers)
}
// HasNameservers returns a boolean if a field has been set.
func (o *CreateNetworkIPv6WithPrefix) HasNameservers() bool {
_, ok := o.GetNameserversOk()
return ok
}
// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field.
func (o *CreateNetworkIPv6WithPrefix) SetNameservers(v CreateNetworkIPv6WithPrefixGetNameserversRetType) {
setCreateNetworkIPv6WithPrefixGetNameserversAttributeType(&o.Nameservers, v)
}
// GetPrefix returns the Prefix field value
func (o *CreateNetworkIPv6WithPrefix) GetPrefix() (ret CreateNetworkIPv6WithPrefixGetPrefixRetType) {
ret, _ = o.GetPrefixOk()
return ret
}
// GetPrefixOk returns a tuple with the Prefix field value
// and a boolean to check if the value has been set.
func (o *CreateNetworkIPv6WithPrefix) GetPrefixOk() (ret CreateNetworkIPv6WithPrefixGetPrefixRetType, ok bool) {
return getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(o.Prefix)
}
// SetPrefix sets field value
func (o *CreateNetworkIPv6WithPrefix) SetPrefix(v CreateNetworkIPv6WithPrefixGetPrefixRetType) {
setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(&o.Prefix, v)
}
func (o CreateNetworkIPv6WithPrefix) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(o.Gateway); ok {
toSerialize["Gateway"] = val
}
if val, ok := getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(o.Nameservers); ok {
toSerialize["Nameservers"] = val
}
if val, ok := getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(o.Prefix); ok {
toSerialize["Prefix"] = val
}
return toSerialize, nil
}
type NullableCreateNetworkIPv6WithPrefix struct {
value *CreateNetworkIPv6WithPrefix
isSet bool
}
func (v NullableCreateNetworkIPv6WithPrefix) Get() *CreateNetworkIPv6WithPrefix {
return v.value
}
func (v *NullableCreateNetworkIPv6WithPrefix) Set(val *CreateNetworkIPv6WithPrefix) {
v.value = val
v.isSet = true
}
func (v NullableCreateNetworkIPv6WithPrefix) IsSet() bool {
return v.isSet
}
func (v *NullableCreateNetworkIPv6WithPrefix) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateNetworkIPv6WithPrefix(val *CreateNetworkIPv6WithPrefix) *NullableCreateNetworkIPv6WithPrefix {
return &NullableCreateNetworkIPv6WithPrefix{value: val, isSet: true}
}
func (v NullableCreateNetworkIPv6WithPrefix) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateNetworkIPv6WithPrefix) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,173 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the CreateNetworkIPv6WithPrefixLength type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateNetworkIPv6WithPrefixLength{}
/*
types and functions for nameservers
*/
// isArray
type CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType = *[]string
type CreateNetworkIPv6WithPrefixLengthGetNameserversArgType = []string
type CreateNetworkIPv6WithPrefixLengthGetNameserversRetType = []string
func getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(arg CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType) (ret CreateNetworkIPv6WithPrefixLengthGetNameserversRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType(arg *CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType, val CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) {
*arg = &val
}
/*
types and functions for prefixLength
*/
// isLong
type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType = *int64
type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthArgType = int64
type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType = int64
func getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType) (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(arg *CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType, val CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) {
*arg = &val
}
// CreateNetworkIPv6WithPrefixLength The create request for an IPv6 network with a wanted prefix length.
type CreateNetworkIPv6WithPrefixLength struct {
// A list containing DNS Servers/Nameservers for IPv6.
Nameservers CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType `json:"nameservers,omitempty"`
// REQUIRED
PrefixLength CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType `json:"prefixLength" required:"true"`
}
type _CreateNetworkIPv6WithPrefixLength CreateNetworkIPv6WithPrefixLength
// NewCreateNetworkIPv6WithPrefixLength instantiates a new CreateNetworkIPv6WithPrefixLength 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 NewCreateNetworkIPv6WithPrefixLength(prefixLength CreateNetworkIPv6WithPrefixLengthGetPrefixLengthArgType) *CreateNetworkIPv6WithPrefixLength {
this := CreateNetworkIPv6WithPrefixLength{}
setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(&this.PrefixLength, prefixLength)
return &this
}
// NewCreateNetworkIPv6WithPrefixLengthWithDefaults instantiates a new CreateNetworkIPv6WithPrefixLength 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 NewCreateNetworkIPv6WithPrefixLengthWithDefaults() *CreateNetworkIPv6WithPrefixLength {
this := CreateNetworkIPv6WithPrefixLength{}
return &this
}
// GetNameservers returns the Nameservers field value if set, zero value otherwise.
func (o *CreateNetworkIPv6WithPrefixLength) GetNameservers() (res CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) {
res, _ = o.GetNameserversOk()
return
}
// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkIPv6WithPrefixLength) GetNameserversOk() (ret CreateNetworkIPv6WithPrefixLengthGetNameserversRetType, ok bool) {
return getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers)
}
// HasNameservers returns a boolean if a field has been set.
func (o *CreateNetworkIPv6WithPrefixLength) HasNameservers() bool {
_, ok := o.GetNameserversOk()
return ok
}
// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field.
func (o *CreateNetworkIPv6WithPrefixLength) SetNameservers(v CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) {
setCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType(&o.Nameservers, v)
}
// GetPrefixLength returns the PrefixLength field value
func (o *CreateNetworkIPv6WithPrefixLength) GetPrefixLength() (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) {
ret, _ = o.GetPrefixLengthOk()
return ret
}
// GetPrefixLengthOk returns a tuple with the PrefixLength field value
// and a boolean to check if the value has been set.
func (o *CreateNetworkIPv6WithPrefixLength) GetPrefixLengthOk() (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType, ok bool) {
return getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength)
}
// SetPrefixLength sets field value
func (o *CreateNetworkIPv6WithPrefixLength) SetPrefixLength(v CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) {
setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(&o.PrefixLength, v)
}
func (o CreateNetworkIPv6WithPrefixLength) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers); ok {
toSerialize["Nameservers"] = val
}
if val, ok := getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok {
toSerialize["PrefixLength"] = val
}
return toSerialize, nil
}
type NullableCreateNetworkIPv6WithPrefixLength struct {
value *CreateNetworkIPv6WithPrefixLength
isSet bool
}
func (v NullableCreateNetworkIPv6WithPrefixLength) Get() *CreateNetworkIPv6WithPrefixLength {
return v.value
}
func (v *NullableCreateNetworkIPv6WithPrefixLength) Set(val *CreateNetworkIPv6WithPrefixLength) {
v.value = val
v.isSet = true
}
func (v NullableCreateNetworkIPv6WithPrefixLength) IsSet() bool {
return v.isSet
}
func (v *NullableCreateNetworkIPv6WithPrefixLength) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateNetworkIPv6WithPrefixLength(val *CreateNetworkIPv6WithPrefixLength) *NullableCreateNetworkIPv6WithPrefixLength {
return &NullableCreateNetworkIPv6WithPrefixLength{value: val, isSet: true}
}
func (v NullableCreateNetworkIPv6WithPrefixLength) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateNetworkIPv6WithPrefixLength) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,416 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the CreateNetworkPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateNetworkPayload{}
/*
types and functions for dhcp
*/
// isBoolean
type CreateNetworkPayloadgetDhcpAttributeType = *bool
type CreateNetworkPayloadgetDhcpArgType = bool
type CreateNetworkPayloadgetDhcpRetType = bool
func getCreateNetworkPayloadgetDhcpAttributeTypeOk(arg CreateNetworkPayloadgetDhcpAttributeType) (ret CreateNetworkPayloadgetDhcpRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkPayloadgetDhcpAttributeType(arg *CreateNetworkPayloadgetDhcpAttributeType, val CreateNetworkPayloadgetDhcpRetType) {
*arg = &val
}
/*
types and functions for ipv4
*/
// isModel
type CreateNetworkPayloadGetIpv4AttributeType = *CreateNetworkIPv4
type CreateNetworkPayloadGetIpv4ArgType = CreateNetworkIPv4
type CreateNetworkPayloadGetIpv4RetType = CreateNetworkIPv4
func getCreateNetworkPayloadGetIpv4AttributeTypeOk(arg CreateNetworkPayloadGetIpv4AttributeType) (ret CreateNetworkPayloadGetIpv4RetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkPayloadGetIpv4AttributeType(arg *CreateNetworkPayloadGetIpv4AttributeType, val CreateNetworkPayloadGetIpv4RetType) {
*arg = &val
}
/*
types and functions for ipv6
*/
// isModel
type CreateNetworkPayloadGetIpv6AttributeType = *CreateNetworkIPv6
type CreateNetworkPayloadGetIpv6ArgType = CreateNetworkIPv6
type CreateNetworkPayloadGetIpv6RetType = CreateNetworkIPv6
func getCreateNetworkPayloadGetIpv6AttributeTypeOk(arg CreateNetworkPayloadGetIpv6AttributeType) (ret CreateNetworkPayloadGetIpv6RetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkPayloadGetIpv6AttributeType(arg *CreateNetworkPayloadGetIpv6AttributeType, val CreateNetworkPayloadGetIpv6RetType) {
*arg = &val
}
/*
types and functions for labels
*/
// isFreeform
type CreateNetworkPayloadGetLabelsAttributeType = *map[string]interface{}
type CreateNetworkPayloadGetLabelsArgType = map[string]interface{}
type CreateNetworkPayloadGetLabelsRetType = map[string]interface{}
func getCreateNetworkPayloadGetLabelsAttributeTypeOk(arg CreateNetworkPayloadGetLabelsAttributeType) (ret CreateNetworkPayloadGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkPayloadGetLabelsAttributeType(arg *CreateNetworkPayloadGetLabelsAttributeType, val CreateNetworkPayloadGetLabelsRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isNotNullableString
type CreateNetworkPayloadGetNameAttributeType = *string
func getCreateNetworkPayloadGetNameAttributeTypeOk(arg CreateNetworkPayloadGetNameAttributeType) (ret CreateNetworkPayloadGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkPayloadGetNameAttributeType(arg *CreateNetworkPayloadGetNameAttributeType, val CreateNetworkPayloadGetNameRetType) {
*arg = &val
}
type CreateNetworkPayloadGetNameArgType = string
type CreateNetworkPayloadGetNameRetType = string
/*
types and functions for routed
*/
// isBoolean
type CreateNetworkPayloadgetRoutedAttributeType = *bool
type CreateNetworkPayloadgetRoutedArgType = bool
type CreateNetworkPayloadgetRoutedRetType = bool
func getCreateNetworkPayloadgetRoutedAttributeTypeOk(arg CreateNetworkPayloadgetRoutedAttributeType) (ret CreateNetworkPayloadgetRoutedRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkPayloadgetRoutedAttributeType(arg *CreateNetworkPayloadgetRoutedAttributeType, val CreateNetworkPayloadgetRoutedRetType) {
*arg = &val
}
/*
types and functions for routingTableId
*/
// isNotNullableString
type CreateNetworkPayloadGetRoutingTableIdAttributeType = *string
func getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(arg CreateNetworkPayloadGetRoutingTableIdAttributeType) (ret CreateNetworkPayloadGetRoutingTableIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateNetworkPayloadGetRoutingTableIdAttributeType(arg *CreateNetworkPayloadGetRoutingTableIdAttributeType, val CreateNetworkPayloadGetRoutingTableIdRetType) {
*arg = &val
}
type CreateNetworkPayloadGetRoutingTableIdArgType = string
type CreateNetworkPayloadGetRoutingTableIdRetType = string
// CreateNetworkPayload Object that represents the request body for a network create.
type CreateNetworkPayload struct {
// Enable or disable DHCP for a network.
Dhcp CreateNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"`
Ipv4 CreateNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"`
Ipv6 CreateNetworkPayloadGetIpv6AttributeType `json:"ipv6,omitempty"`
// Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key.
Labels CreateNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"`
// The name for a General Object. Matches Names and also UUIDs.
// REQUIRED
Name CreateNetworkPayloadGetNameAttributeType `json:"name" required:"true"`
// Shows if the network is routed and therefore accessible from other networks.
Routed CreateNetworkPayloadgetRoutedAttributeType `json:"routed,omitempty"`
// Universally Unique Identifier (UUID).
RoutingTableId CreateNetworkPayloadGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"`
}
type _CreateNetworkPayload CreateNetworkPayload
// NewCreateNetworkPayload instantiates a new CreateNetworkPayload 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 NewCreateNetworkPayload(name CreateNetworkPayloadGetNameArgType) *CreateNetworkPayload {
this := CreateNetworkPayload{}
setCreateNetworkPayloadGetNameAttributeType(&this.Name, name)
return &this
}
// NewCreateNetworkPayloadWithDefaults instantiates a new CreateNetworkPayload 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 NewCreateNetworkPayloadWithDefaults() *CreateNetworkPayload {
this := CreateNetworkPayload{}
var dhcp bool = true
this.Dhcp = &dhcp
return &this
}
// GetDhcp returns the Dhcp field value if set, zero value otherwise.
func (o *CreateNetworkPayload) GetDhcp() (res CreateNetworkPayloadgetDhcpRetType) {
res, _ = o.GetDhcpOk()
return
}
// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkPayload) GetDhcpOk() (ret CreateNetworkPayloadgetDhcpRetType, ok bool) {
return getCreateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp)
}
// HasDhcp returns a boolean if a field has been set.
func (o *CreateNetworkPayload) HasDhcp() bool {
_, ok := o.GetDhcpOk()
return ok
}
// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field.
func (o *CreateNetworkPayload) SetDhcp(v CreateNetworkPayloadgetDhcpRetType) {
setCreateNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v)
}
// GetIpv4 returns the Ipv4 field value if set, zero value otherwise.
func (o *CreateNetworkPayload) GetIpv4() (res CreateNetworkPayloadGetIpv4RetType) {
res, _ = o.GetIpv4Ok()
return
}
// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkPayload) GetIpv4Ok() (ret CreateNetworkPayloadGetIpv4RetType, ok bool) {
return getCreateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4)
}
// HasIpv4 returns a boolean if a field has been set.
func (o *CreateNetworkPayload) HasIpv4() bool {
_, ok := o.GetIpv4Ok()
return ok
}
// SetIpv4 gets a reference to the given CreateNetworkIPv4 and assigns it to the Ipv4 field.
func (o *CreateNetworkPayload) SetIpv4(v CreateNetworkPayloadGetIpv4RetType) {
setCreateNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v)
}
// GetIpv6 returns the Ipv6 field value if set, zero value otherwise.
func (o *CreateNetworkPayload) GetIpv6() (res CreateNetworkPayloadGetIpv6RetType) {
res, _ = o.GetIpv6Ok()
return
}
// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkPayload) GetIpv6Ok() (ret CreateNetworkPayloadGetIpv6RetType, ok bool) {
return getCreateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6)
}
// HasIpv6 returns a boolean if a field has been set.
func (o *CreateNetworkPayload) HasIpv6() bool {
_, ok := o.GetIpv6Ok()
return ok
}
// SetIpv6 gets a reference to the given CreateNetworkIPv6 and assigns it to the Ipv6 field.
func (o *CreateNetworkPayload) SetIpv6(v CreateNetworkPayloadGetIpv6RetType) {
setCreateNetworkPayloadGetIpv6AttributeType(&o.Ipv6, v)
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *CreateNetworkPayload) GetLabels() (res CreateNetworkPayloadGetLabelsRetType) {
res, _ = o.GetLabelsOk()
return
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkPayload) GetLabelsOk() (ret CreateNetworkPayloadGetLabelsRetType, ok bool) {
return getCreateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels)
}
// HasLabels returns a boolean if a field has been set.
func (o *CreateNetworkPayload) HasLabels() bool {
_, ok := o.GetLabelsOk()
return ok
}
// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field.
func (o *CreateNetworkPayload) SetLabels(v CreateNetworkPayloadGetLabelsRetType) {
setCreateNetworkPayloadGetLabelsAttributeType(&o.Labels, v)
}
// GetName returns the Name field value
func (o *CreateNetworkPayload) GetName() (ret CreateNetworkPayloadGetNameRetType) {
ret, _ = o.GetNameOk()
return ret
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *CreateNetworkPayload) GetNameOk() (ret CreateNetworkPayloadGetNameRetType, ok bool) {
return getCreateNetworkPayloadGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *CreateNetworkPayload) SetName(v CreateNetworkPayloadGetNameRetType) {
setCreateNetworkPayloadGetNameAttributeType(&o.Name, v)
}
// GetRouted returns the Routed field value if set, zero value otherwise.
func (o *CreateNetworkPayload) GetRouted() (res CreateNetworkPayloadgetRoutedRetType) {
res, _ = o.GetRoutedOk()
return
}
// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkPayload) GetRoutedOk() (ret CreateNetworkPayloadgetRoutedRetType, ok bool) {
return getCreateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed)
}
// HasRouted returns a boolean if a field has been set.
func (o *CreateNetworkPayload) HasRouted() bool {
_, ok := o.GetRoutedOk()
return ok
}
// SetRouted gets a reference to the given bool and assigns it to the Routed field.
func (o *CreateNetworkPayload) SetRouted(v CreateNetworkPayloadgetRoutedRetType) {
setCreateNetworkPayloadgetRoutedAttributeType(&o.Routed, v)
}
// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise.
func (o *CreateNetworkPayload) GetRoutingTableId() (res CreateNetworkPayloadGetRoutingTableIdRetType) {
res, _ = o.GetRoutingTableIdOk()
return
}
// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateNetworkPayload) GetRoutingTableIdOk() (ret CreateNetworkPayloadGetRoutingTableIdRetType, ok bool) {
return getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId)
}
// HasRoutingTableId returns a boolean if a field has been set.
func (o *CreateNetworkPayload) HasRoutingTableId() bool {
_, ok := o.GetRoutingTableIdOk()
return ok
}
// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field.
func (o *CreateNetworkPayload) SetRoutingTableId(v CreateNetworkPayloadGetRoutingTableIdRetType) {
setCreateNetworkPayloadGetRoutingTableIdAttributeType(&o.RoutingTableId, v)
}
func (o CreateNetworkPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok {
toSerialize["Dhcp"] = val
}
if val, ok := getCreateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok {
toSerialize["Ipv4"] = val
}
if val, ok := getCreateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok {
toSerialize["Ipv6"] = val
}
if val, ok := getCreateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
if val, ok := getCreateNetworkPayloadGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getCreateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed); ok {
toSerialize["Routed"] = val
}
if val, ok := getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok {
toSerialize["RoutingTableId"] = val
}
return toSerialize, nil
}
type NullableCreateNetworkPayload struct {
value *CreateNetworkPayload
isSet bool
}
func (v NullableCreateNetworkPayload) Get() *CreateNetworkPayload {
return v.value
}
func (v *NullableCreateNetworkPayload) Set(val *CreateNetworkPayload) {
v.value = val
v.isSet = true
}
func (v NullableCreateNetworkPayload) IsSet() bool {
return v.isSet
}
func (v *NullableCreateNetworkPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateNetworkPayload(val *CreateNetworkPayload) *NullableCreateNetworkPayload {
return &NullableCreateNetworkPayload{value: val, isSet: true}
}
func (v NullableCreateNetworkPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateNetworkPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,171 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the DestinationCIDRv4 type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DestinationCIDRv4{}
/*
types and functions for type
*/
// isNotNullableString
type DestinationCIDRv4GetTypeAttributeType = *string
func getDestinationCIDRv4GetTypeAttributeTypeOk(arg DestinationCIDRv4GetTypeAttributeType) (ret DestinationCIDRv4GetTypeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setDestinationCIDRv4GetTypeAttributeType(arg *DestinationCIDRv4GetTypeAttributeType, val DestinationCIDRv4GetTypeRetType) {
*arg = &val
}
type DestinationCIDRv4GetTypeArgType = string
type DestinationCIDRv4GetTypeRetType = string
/*
types and functions for value
*/
// isNotNullableString
type DestinationCIDRv4GetValueAttributeType = *string
func getDestinationCIDRv4GetValueAttributeTypeOk(arg DestinationCIDRv4GetValueAttributeType) (ret DestinationCIDRv4GetValueRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setDestinationCIDRv4GetValueAttributeType(arg *DestinationCIDRv4GetValueAttributeType, val DestinationCIDRv4GetValueRetType) {
*arg = &val
}
type DestinationCIDRv4GetValueArgType = string
type DestinationCIDRv4GetValueRetType = string
// DestinationCIDRv4 IPv4 Classless Inter-Domain Routing (CIDR) Object.
type DestinationCIDRv4 struct {
// REQUIRED
Type DestinationCIDRv4GetTypeAttributeType `json:"type" required:"true"`
// An CIDRv4 string.
// REQUIRED
Value DestinationCIDRv4GetValueAttributeType `json:"value" required:"true"`
}
type _DestinationCIDRv4 DestinationCIDRv4
// NewDestinationCIDRv4 instantiates a new DestinationCIDRv4 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 NewDestinationCIDRv4(types DestinationCIDRv4GetTypeArgType, value DestinationCIDRv4GetValueArgType) *DestinationCIDRv4 {
this := DestinationCIDRv4{}
setDestinationCIDRv4GetTypeAttributeType(&this.Type, types)
setDestinationCIDRv4GetValueAttributeType(&this.Value, value)
return &this
}
// NewDestinationCIDRv4WithDefaults instantiates a new DestinationCIDRv4 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 NewDestinationCIDRv4WithDefaults() *DestinationCIDRv4 {
this := DestinationCIDRv4{}
return &this
}
// GetType returns the Type field value
func (o *DestinationCIDRv4) GetType() (ret DestinationCIDRv4GetTypeRetType) {
ret, _ = o.GetTypeOk()
return ret
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *DestinationCIDRv4) GetTypeOk() (ret DestinationCIDRv4GetTypeRetType, ok bool) {
return getDestinationCIDRv4GetTypeAttributeTypeOk(o.Type)
}
// SetType sets field value
func (o *DestinationCIDRv4) SetType(v DestinationCIDRv4GetTypeRetType) {
setDestinationCIDRv4GetTypeAttributeType(&o.Type, v)
}
// GetValue returns the Value field value
func (o *DestinationCIDRv4) GetValue() (ret DestinationCIDRv4GetValueRetType) {
ret, _ = o.GetValueOk()
return ret
}
// GetValueOk returns a tuple with the Value field value
// and a boolean to check if the value has been set.
func (o *DestinationCIDRv4) GetValueOk() (ret DestinationCIDRv4GetValueRetType, ok bool) {
return getDestinationCIDRv4GetValueAttributeTypeOk(o.Value)
}
// SetValue sets field value
func (o *DestinationCIDRv4) SetValue(v DestinationCIDRv4GetValueRetType) {
setDestinationCIDRv4GetValueAttributeType(&o.Value, v)
}
func (o DestinationCIDRv4) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getDestinationCIDRv4GetTypeAttributeTypeOk(o.Type); ok {
toSerialize["Type"] = val
}
if val, ok := getDestinationCIDRv4GetValueAttributeTypeOk(o.Value); ok {
toSerialize["Value"] = val
}
return toSerialize, nil
}
type NullableDestinationCIDRv4 struct {
value *DestinationCIDRv4
isSet bool
}
func (v NullableDestinationCIDRv4) Get() *DestinationCIDRv4 {
return v.value
}
func (v *NullableDestinationCIDRv4) Set(val *DestinationCIDRv4) {
v.value = val
v.isSet = true
}
func (v NullableDestinationCIDRv4) IsSet() bool {
return v.isSet
}
func (v *NullableDestinationCIDRv4) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDestinationCIDRv4(val *DestinationCIDRv4) *NullableDestinationCIDRv4 {
return &NullableDestinationCIDRv4{value: val, isSet: true}
}
func (v NullableDestinationCIDRv4) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDestinationCIDRv4) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,171 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the DestinationCIDRv6 type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DestinationCIDRv6{}
/*
types and functions for type
*/
// isNotNullableString
type DestinationCIDRv6GetTypeAttributeType = *string
func getDestinationCIDRv6GetTypeAttributeTypeOk(arg DestinationCIDRv6GetTypeAttributeType) (ret DestinationCIDRv6GetTypeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setDestinationCIDRv6GetTypeAttributeType(arg *DestinationCIDRv6GetTypeAttributeType, val DestinationCIDRv6GetTypeRetType) {
*arg = &val
}
type DestinationCIDRv6GetTypeArgType = string
type DestinationCIDRv6GetTypeRetType = string
/*
types and functions for value
*/
// isNotNullableString
type DestinationCIDRv6GetValueAttributeType = *string
func getDestinationCIDRv6GetValueAttributeTypeOk(arg DestinationCIDRv6GetValueAttributeType) (ret DestinationCIDRv6GetValueRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setDestinationCIDRv6GetValueAttributeType(arg *DestinationCIDRv6GetValueAttributeType, val DestinationCIDRv6GetValueRetType) {
*arg = &val
}
type DestinationCIDRv6GetValueArgType = string
type DestinationCIDRv6GetValueRetType = string
// DestinationCIDRv6 IPv6 Classless Inter-Domain Routing (CIDR) Object.
type DestinationCIDRv6 struct {
// REQUIRED
Type DestinationCIDRv6GetTypeAttributeType `json:"type" required:"true"`
// An CIDRv6 string.
// REQUIRED
Value DestinationCIDRv6GetValueAttributeType `json:"value" required:"true"`
}
type _DestinationCIDRv6 DestinationCIDRv6
// NewDestinationCIDRv6 instantiates a new DestinationCIDRv6 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 NewDestinationCIDRv6(types DestinationCIDRv6GetTypeArgType, value DestinationCIDRv6GetValueArgType) *DestinationCIDRv6 {
this := DestinationCIDRv6{}
setDestinationCIDRv6GetTypeAttributeType(&this.Type, types)
setDestinationCIDRv6GetValueAttributeType(&this.Value, value)
return &this
}
// NewDestinationCIDRv6WithDefaults instantiates a new DestinationCIDRv6 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 NewDestinationCIDRv6WithDefaults() *DestinationCIDRv6 {
this := DestinationCIDRv6{}
return &this
}
// GetType returns the Type field value
func (o *DestinationCIDRv6) GetType() (ret DestinationCIDRv6GetTypeRetType) {
ret, _ = o.GetTypeOk()
return ret
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *DestinationCIDRv6) GetTypeOk() (ret DestinationCIDRv6GetTypeRetType, ok bool) {
return getDestinationCIDRv6GetTypeAttributeTypeOk(o.Type)
}
// SetType sets field value
func (o *DestinationCIDRv6) SetType(v DestinationCIDRv6GetTypeRetType) {
setDestinationCIDRv6GetTypeAttributeType(&o.Type, v)
}
// GetValue returns the Value field value
func (o *DestinationCIDRv6) GetValue() (ret DestinationCIDRv6GetValueRetType) {
ret, _ = o.GetValueOk()
return ret
}
// GetValueOk returns a tuple with the Value field value
// and a boolean to check if the value has been set.
func (o *DestinationCIDRv6) GetValueOk() (ret DestinationCIDRv6GetValueRetType, ok bool) {
return getDestinationCIDRv6GetValueAttributeTypeOk(o.Value)
}
// SetValue sets field value
func (o *DestinationCIDRv6) SetValue(v DestinationCIDRv6GetValueRetType) {
setDestinationCIDRv6GetValueAttributeType(&o.Value, v)
}
func (o DestinationCIDRv6) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getDestinationCIDRv6GetTypeAttributeTypeOk(o.Type); ok {
toSerialize["Type"] = val
}
if val, ok := getDestinationCIDRv6GetValueAttributeTypeOk(o.Value); ok {
toSerialize["Value"] = val
}
return toSerialize, nil
}
type NullableDestinationCIDRv6 struct {
value *DestinationCIDRv6
isSet bool
}
func (v NullableDestinationCIDRv6) Get() *DestinationCIDRv6 {
return v.value
}
func (v *NullableDestinationCIDRv6) Set(val *DestinationCIDRv6) {
v.value = val
v.isSet = true
}
func (v NullableDestinationCIDRv6) IsSet() bool {
return v.isSet
}
func (v *NullableDestinationCIDRv6) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDestinationCIDRv6(val *DestinationCIDRv6) *NullableDestinationCIDRv6 {
return &NullableDestinationCIDRv6{value: val, isSet: true}
}
func (v NullableDestinationCIDRv6) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDestinationCIDRv6) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,170 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the Error type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Error{}
/*
types and functions for code
*/
// isLong
type ErrorGetCodeAttributeType = *int64
type ErrorGetCodeArgType = int64
type ErrorGetCodeRetType = int64
func getErrorGetCodeAttributeTypeOk(arg ErrorGetCodeAttributeType) (ret ErrorGetCodeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setErrorGetCodeAttributeType(arg *ErrorGetCodeAttributeType, val ErrorGetCodeRetType) {
*arg = &val
}
/*
types and functions for msg
*/
// isNotNullableString
type ErrorGetMsgAttributeType = *string
func getErrorGetMsgAttributeTypeOk(arg ErrorGetMsgAttributeType) (ret ErrorGetMsgRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setErrorGetMsgAttributeType(arg *ErrorGetMsgAttributeType, val ErrorGetMsgRetType) {
*arg = &val
}
type ErrorGetMsgArgType = string
type ErrorGetMsgRetType = string
// Error Error with HTTP error code and an error message.
type Error struct {
// REQUIRED
Code ErrorGetCodeAttributeType `json:"code" required:"true"`
// An error message.
// REQUIRED
Msg ErrorGetMsgAttributeType `json:"msg" required:"true"`
}
type _Error Error
// NewError instantiates a new Error object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewError(code ErrorGetCodeArgType, msg ErrorGetMsgArgType) *Error {
this := Error{}
setErrorGetCodeAttributeType(&this.Code, code)
setErrorGetMsgAttributeType(&this.Msg, msg)
return &this
}
// NewErrorWithDefaults instantiates a new Error object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewErrorWithDefaults() *Error {
this := Error{}
return &this
}
// GetCode returns the Code field value
func (o *Error) GetCode() (ret ErrorGetCodeRetType) {
ret, _ = o.GetCodeOk()
return ret
}
// GetCodeOk returns a tuple with the Code field value
// and a boolean to check if the value has been set.
func (o *Error) GetCodeOk() (ret ErrorGetCodeRetType, ok bool) {
return getErrorGetCodeAttributeTypeOk(o.Code)
}
// SetCode sets field value
func (o *Error) SetCode(v ErrorGetCodeRetType) {
setErrorGetCodeAttributeType(&o.Code, v)
}
// GetMsg returns the Msg field value
func (o *Error) GetMsg() (ret ErrorGetMsgRetType) {
ret, _ = o.GetMsgOk()
return ret
}
// GetMsgOk returns a tuple with the Msg field value
// and a boolean to check if the value has been set.
func (o *Error) GetMsgOk() (ret ErrorGetMsgRetType, ok bool) {
return getErrorGetMsgAttributeTypeOk(o.Msg)
}
// SetMsg sets field value
func (o *Error) SetMsg(v ErrorGetMsgRetType) {
setErrorGetMsgAttributeType(&o.Msg, v)
}
func (o Error) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getErrorGetCodeAttributeTypeOk(o.Code); ok {
toSerialize["Code"] = val
}
if val, ok := getErrorGetMsgAttributeTypeOk(o.Msg); ok {
toSerialize["Msg"] = val
}
return toSerialize, nil
}
type NullableError struct {
value *Error
isSet bool
}
func (v NullableError) Get() *Error {
return v.value
}
func (v *NullableError) Set(val *Error) {
v.value = val
v.isSet = true
}
func (v NullableError) IsSet() bool {
return v.isSet
}
func (v *NullableError) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableError(val *Error) *NullableError {
return &NullableError{value: val, isSet: true}
}
func (v NullableError) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableError) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,600 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
"time"
)
// checks if the Network type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Network{}
/*
types and functions for createdAt
*/
// isDateTime
type NetworkGetCreatedAtAttributeType = *time.Time
type NetworkGetCreatedAtArgType = time.Time
type NetworkGetCreatedAtRetType = time.Time
func getNetworkGetCreatedAtAttributeTypeOk(arg NetworkGetCreatedAtAttributeType) (ret NetworkGetCreatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetCreatedAtAttributeType(arg *NetworkGetCreatedAtAttributeType, val NetworkGetCreatedAtRetType) {
*arg = &val
}
/*
types and functions for dhcp
*/
// isBoolean
type NetworkgetDhcpAttributeType = *bool
type NetworkgetDhcpArgType = bool
type NetworkgetDhcpRetType = bool
func getNetworkgetDhcpAttributeTypeOk(arg NetworkgetDhcpAttributeType) (ret NetworkgetDhcpRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkgetDhcpAttributeType(arg *NetworkgetDhcpAttributeType, val NetworkgetDhcpRetType) {
*arg = &val
}
/*
types and functions for id
*/
// isNotNullableString
type NetworkGetIdAttributeType = *string
func getNetworkGetIdAttributeTypeOk(arg NetworkGetIdAttributeType) (ret NetworkGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetIdAttributeType(arg *NetworkGetIdAttributeType, val NetworkGetIdRetType) {
*arg = &val
}
type NetworkGetIdArgType = string
type NetworkGetIdRetType = string
/*
types and functions for ipv4
*/
// isModel
type NetworkGetIpv4AttributeType = *NetworkIPv4
type NetworkGetIpv4ArgType = NetworkIPv4
type NetworkGetIpv4RetType = NetworkIPv4
func getNetworkGetIpv4AttributeTypeOk(arg NetworkGetIpv4AttributeType) (ret NetworkGetIpv4RetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetIpv4AttributeType(arg *NetworkGetIpv4AttributeType, val NetworkGetIpv4RetType) {
*arg = &val
}
/*
types and functions for ipv6
*/
// isModel
type NetworkGetIpv6AttributeType = *NetworkIPv6
type NetworkGetIpv6ArgType = NetworkIPv6
type NetworkGetIpv6RetType = NetworkIPv6
func getNetworkGetIpv6AttributeTypeOk(arg NetworkGetIpv6AttributeType) (ret NetworkGetIpv6RetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetIpv6AttributeType(arg *NetworkGetIpv6AttributeType, val NetworkGetIpv6RetType) {
*arg = &val
}
/*
types and functions for labels
*/
// isFreeform
type NetworkGetLabelsAttributeType = *map[string]interface{}
type NetworkGetLabelsArgType = map[string]interface{}
type NetworkGetLabelsRetType = map[string]interface{}
func getNetworkGetLabelsAttributeTypeOk(arg NetworkGetLabelsAttributeType) (ret NetworkGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetLabelsAttributeType(arg *NetworkGetLabelsAttributeType, val NetworkGetLabelsRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isNotNullableString
type NetworkGetNameAttributeType = *string
func getNetworkGetNameAttributeTypeOk(arg NetworkGetNameAttributeType) (ret NetworkGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetNameAttributeType(arg *NetworkGetNameAttributeType, val NetworkGetNameRetType) {
*arg = &val
}
type NetworkGetNameArgType = string
type NetworkGetNameRetType = string
/*
types and functions for routed
*/
// isBoolean
type NetworkgetRoutedAttributeType = *bool
type NetworkgetRoutedArgType = bool
type NetworkgetRoutedRetType = bool
func getNetworkgetRoutedAttributeTypeOk(arg NetworkgetRoutedAttributeType) (ret NetworkgetRoutedRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkgetRoutedAttributeType(arg *NetworkgetRoutedAttributeType, val NetworkgetRoutedRetType) {
*arg = &val
}
/*
types and functions for routingTableId
*/
// isNotNullableString
type NetworkGetRoutingTableIdAttributeType = *string
func getNetworkGetRoutingTableIdAttributeTypeOk(arg NetworkGetRoutingTableIdAttributeType) (ret NetworkGetRoutingTableIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetRoutingTableIdAttributeType(arg *NetworkGetRoutingTableIdAttributeType, val NetworkGetRoutingTableIdRetType) {
*arg = &val
}
type NetworkGetRoutingTableIdArgType = string
type NetworkGetRoutingTableIdRetType = string
/*
types and functions for status
*/
// isNotNullableString
type NetworkGetStatusAttributeType = *string
func getNetworkGetStatusAttributeTypeOk(arg NetworkGetStatusAttributeType) (ret NetworkGetStatusRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetStatusAttributeType(arg *NetworkGetStatusAttributeType, val NetworkGetStatusRetType) {
*arg = &val
}
type NetworkGetStatusArgType = string
type NetworkGetStatusRetType = string
/*
types and functions for updatedAt
*/
// isDateTime
type NetworkGetUpdatedAtAttributeType = *time.Time
type NetworkGetUpdatedAtArgType = time.Time
type NetworkGetUpdatedAtRetType = time.Time
func getNetworkGetUpdatedAtAttributeTypeOk(arg NetworkGetUpdatedAtAttributeType) (ret NetworkGetUpdatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkGetUpdatedAtAttributeType(arg *NetworkGetUpdatedAtAttributeType, val NetworkGetUpdatedAtRetType) {
*arg = &val
}
// Network Object that represents a network. If no routing table is specified, the default routing table is used.
type Network struct {
// Date-time when resource was created.
CreatedAt NetworkGetCreatedAtAttributeType `json:"createdAt,omitempty"`
// Enable or disable DHCP for a network.
Dhcp NetworkgetDhcpAttributeType `json:"dhcp,omitempty"`
// Universally Unique Identifier (UUID).
// REQUIRED
Id NetworkGetIdAttributeType `json:"id" required:"true"`
Ipv4 NetworkGetIpv4AttributeType `json:"ipv4,omitempty"`
Ipv6 NetworkGetIpv6AttributeType `json:"ipv6,omitempty"`
// Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key.
Labels NetworkGetLabelsAttributeType `json:"labels,omitempty"`
// REQUIRED
Name NetworkGetNameAttributeType `json:"name" required:"true"`
// Shows if the network is routed and therefore accessible from other networks.
Routed NetworkgetRoutedAttributeType `json:"routed,omitempty"`
// Universally Unique Identifier (UUID).
RoutingTableId NetworkGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"`
// The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`.
// REQUIRED
Status NetworkGetStatusAttributeType `json:"status" required:"true"`
// Date-time when resource was last updated.
UpdatedAt NetworkGetUpdatedAtAttributeType `json:"updatedAt,omitempty"`
}
type _Network Network
// NewNetwork instantiates a new Network 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 NewNetwork(id NetworkGetIdArgType, name NetworkGetNameArgType, status NetworkGetStatusArgType) *Network {
this := Network{}
setNetworkGetIdAttributeType(&this.Id, id)
setNetworkGetNameAttributeType(&this.Name, name)
setNetworkGetStatusAttributeType(&this.Status, status)
return &this
}
// NewNetworkWithDefaults instantiates a new Network 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 NewNetworkWithDefaults() *Network {
this := Network{}
return &this
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *Network) GetCreatedAt() (res NetworkGetCreatedAtRetType) {
res, _ = o.GetCreatedAtOk()
return
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Network) GetCreatedAtOk() (ret NetworkGetCreatedAtRetType, ok bool) {
return getNetworkGetCreatedAtAttributeTypeOk(o.CreatedAt)
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *Network) HasCreatedAt() bool {
_, ok := o.GetCreatedAtOk()
return ok
}
// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field.
func (o *Network) SetCreatedAt(v NetworkGetCreatedAtRetType) {
setNetworkGetCreatedAtAttributeType(&o.CreatedAt, v)
}
// GetDhcp returns the Dhcp field value if set, zero value otherwise.
func (o *Network) GetDhcp() (res NetworkgetDhcpRetType) {
res, _ = o.GetDhcpOk()
return
}
// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Network) GetDhcpOk() (ret NetworkgetDhcpRetType, ok bool) {
return getNetworkgetDhcpAttributeTypeOk(o.Dhcp)
}
// HasDhcp returns a boolean if a field has been set.
func (o *Network) HasDhcp() bool {
_, ok := o.GetDhcpOk()
return ok
}
// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field.
func (o *Network) SetDhcp(v NetworkgetDhcpRetType) {
setNetworkgetDhcpAttributeType(&o.Dhcp, v)
}
// GetId returns the Id field value
func (o *Network) GetId() (ret NetworkGetIdRetType) {
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 *Network) GetIdOk() (ret NetworkGetIdRetType, ok bool) {
return getNetworkGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *Network) SetId(v NetworkGetIdRetType) {
setNetworkGetIdAttributeType(&o.Id, v)
}
// GetIpv4 returns the Ipv4 field value if set, zero value otherwise.
func (o *Network) GetIpv4() (res NetworkGetIpv4RetType) {
res, _ = o.GetIpv4Ok()
return
}
// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Network) GetIpv4Ok() (ret NetworkGetIpv4RetType, ok bool) {
return getNetworkGetIpv4AttributeTypeOk(o.Ipv4)
}
// HasIpv4 returns a boolean if a field has been set.
func (o *Network) HasIpv4() bool {
_, ok := o.GetIpv4Ok()
return ok
}
// SetIpv4 gets a reference to the given NetworkIPv4 and assigns it to the Ipv4 field.
func (o *Network) SetIpv4(v NetworkGetIpv4RetType) {
setNetworkGetIpv4AttributeType(&o.Ipv4, v)
}
// GetIpv6 returns the Ipv6 field value if set, zero value otherwise.
func (o *Network) GetIpv6() (res NetworkGetIpv6RetType) {
res, _ = o.GetIpv6Ok()
return
}
// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Network) GetIpv6Ok() (ret NetworkGetIpv6RetType, ok bool) {
return getNetworkGetIpv6AttributeTypeOk(o.Ipv6)
}
// HasIpv6 returns a boolean if a field has been set.
func (o *Network) HasIpv6() bool {
_, ok := o.GetIpv6Ok()
return ok
}
// SetIpv6 gets a reference to the given NetworkIPv6 and assigns it to the Ipv6 field.
func (o *Network) SetIpv6(v NetworkGetIpv6RetType) {
setNetworkGetIpv6AttributeType(&o.Ipv6, v)
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *Network) GetLabels() (res NetworkGetLabelsRetType) {
res, _ = o.GetLabelsOk()
return
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Network) GetLabelsOk() (ret NetworkGetLabelsRetType, ok bool) {
return getNetworkGetLabelsAttributeTypeOk(o.Labels)
}
// HasLabels returns a boolean if a field has been set.
func (o *Network) HasLabels() bool {
_, ok := o.GetLabelsOk()
return ok
}
// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field.
func (o *Network) SetLabels(v NetworkGetLabelsRetType) {
setNetworkGetLabelsAttributeType(&o.Labels, v)
}
// GetName returns the Name field value
func (o *Network) GetName() (ret NetworkGetNameRetType) {
ret, _ = o.GetNameOk()
return ret
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *Network) GetNameOk() (ret NetworkGetNameRetType, ok bool) {
return getNetworkGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *Network) SetName(v NetworkGetNameRetType) {
setNetworkGetNameAttributeType(&o.Name, v)
}
// GetRouted returns the Routed field value if set, zero value otherwise.
func (o *Network) GetRouted() (res NetworkgetRoutedRetType) {
res, _ = o.GetRoutedOk()
return
}
// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Network) GetRoutedOk() (ret NetworkgetRoutedRetType, ok bool) {
return getNetworkgetRoutedAttributeTypeOk(o.Routed)
}
// HasRouted returns a boolean if a field has been set.
func (o *Network) HasRouted() bool {
_, ok := o.GetRoutedOk()
return ok
}
// SetRouted gets a reference to the given bool and assigns it to the Routed field.
func (o *Network) SetRouted(v NetworkgetRoutedRetType) {
setNetworkgetRoutedAttributeType(&o.Routed, v)
}
// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise.
func (o *Network) GetRoutingTableId() (res NetworkGetRoutingTableIdRetType) {
res, _ = o.GetRoutingTableIdOk()
return
}
// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Network) GetRoutingTableIdOk() (ret NetworkGetRoutingTableIdRetType, ok bool) {
return getNetworkGetRoutingTableIdAttributeTypeOk(o.RoutingTableId)
}
// HasRoutingTableId returns a boolean if a field has been set.
func (o *Network) HasRoutingTableId() bool {
_, ok := o.GetRoutingTableIdOk()
return ok
}
// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field.
func (o *Network) SetRoutingTableId(v NetworkGetRoutingTableIdRetType) {
setNetworkGetRoutingTableIdAttributeType(&o.RoutingTableId, v)
}
// GetStatus returns the Status field value
func (o *Network) GetStatus() (ret NetworkGetStatusRetType) {
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 *Network) GetStatusOk() (ret NetworkGetStatusRetType, ok bool) {
return getNetworkGetStatusAttributeTypeOk(o.Status)
}
// SetStatus sets field value
func (o *Network) SetStatus(v NetworkGetStatusRetType) {
setNetworkGetStatusAttributeType(&o.Status, v)
}
// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *Network) GetUpdatedAt() (res NetworkGetUpdatedAtRetType) {
res, _ = o.GetUpdatedAtOk()
return
}
// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Network) GetUpdatedAtOk() (ret NetworkGetUpdatedAtRetType, ok bool) {
return getNetworkGetUpdatedAtAttributeTypeOk(o.UpdatedAt)
}
// HasUpdatedAt returns a boolean if a field has been set.
func (o *Network) HasUpdatedAt() bool {
_, ok := o.GetUpdatedAtOk()
return ok
}
// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field.
func (o *Network) SetUpdatedAt(v NetworkGetUpdatedAtRetType) {
setNetworkGetUpdatedAtAttributeType(&o.UpdatedAt, v)
}
func (o Network) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getNetworkGetCreatedAtAttributeTypeOk(o.CreatedAt); ok {
toSerialize["CreatedAt"] = val
}
if val, ok := getNetworkgetDhcpAttributeTypeOk(o.Dhcp); ok {
toSerialize["Dhcp"] = val
}
if val, ok := getNetworkGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getNetworkGetIpv4AttributeTypeOk(o.Ipv4); ok {
toSerialize["Ipv4"] = val
}
if val, ok := getNetworkGetIpv6AttributeTypeOk(o.Ipv6); ok {
toSerialize["Ipv6"] = val
}
if val, ok := getNetworkGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
if val, ok := getNetworkGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getNetworkgetRoutedAttributeTypeOk(o.Routed); ok {
toSerialize["Routed"] = val
}
if val, ok := getNetworkGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok {
toSerialize["RoutingTableId"] = val
}
if val, ok := getNetworkGetStatusAttributeTypeOk(o.Status); ok {
toSerialize["Status"] = val
}
if val, ok := getNetworkGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok {
toSerialize["UpdatedAt"] = val
}
return toSerialize, nil
}
type NullableNetwork struct {
value *Network
isSet bool
}
func (v NullableNetwork) Get() *Network {
return v.value
}
func (v *NullableNetwork) Set(val *Network) {
v.value = val
v.isSet = true
}
func (v NullableNetwork) IsSet() bool {
return v.isSet
}
func (v *NullableNetwork) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNetwork(val *Network) *NullableNetwork {
return &NullableNetwork{value: val, isSet: true}
}
func (v NullableNetwork) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNetwork) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,286 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the NetworkIPv4 type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NetworkIPv4{}
/*
types and functions for gateway
*/
// isNullableString
type NetworkIPv4GetGatewayAttributeType = *NullableString
func getNetworkIPv4GetGatewayAttributeTypeOk(arg NetworkIPv4GetGatewayAttributeType) (ret NetworkIPv4GetGatewayRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg.Get(), true
}
func setNetworkIPv4GetGatewayAttributeType(arg *NetworkIPv4GetGatewayAttributeType, val NetworkIPv4GetGatewayRetType) {
if IsNil(*arg) {
*arg = NewNullableString(val)
} else {
(*arg).Set(val)
}
}
type NetworkIPv4GetGatewayArgType = *string
type NetworkIPv4GetGatewayRetType = *string
/*
types and functions for nameservers
*/
// isArray
type NetworkIPv4GetNameserversAttributeType = *[]string
type NetworkIPv4GetNameserversArgType = []string
type NetworkIPv4GetNameserversRetType = []string
func getNetworkIPv4GetNameserversAttributeTypeOk(arg NetworkIPv4GetNameserversAttributeType) (ret NetworkIPv4GetNameserversRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkIPv4GetNameserversAttributeType(arg *NetworkIPv4GetNameserversAttributeType, val NetworkIPv4GetNameserversRetType) {
*arg = &val
}
/*
types and functions for prefixes
*/
// isArray
type NetworkIPv4GetPrefixesAttributeType = *[]string
type NetworkIPv4GetPrefixesArgType = []string
type NetworkIPv4GetPrefixesRetType = []string
func getNetworkIPv4GetPrefixesAttributeTypeOk(arg NetworkIPv4GetPrefixesAttributeType) (ret NetworkIPv4GetPrefixesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkIPv4GetPrefixesAttributeType(arg *NetworkIPv4GetPrefixesAttributeType, val NetworkIPv4GetPrefixesRetType) {
*arg = &val
}
/*
types and functions for publicIp
*/
// isNotNullableString
type NetworkIPv4GetPublicIpAttributeType = *string
func getNetworkIPv4GetPublicIpAttributeTypeOk(arg NetworkIPv4GetPublicIpAttributeType) (ret NetworkIPv4GetPublicIpRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkIPv4GetPublicIpAttributeType(arg *NetworkIPv4GetPublicIpAttributeType, val NetworkIPv4GetPublicIpRetType) {
*arg = &val
}
type NetworkIPv4GetPublicIpArgType = string
type NetworkIPv4GetPublicIpRetType = string
// NetworkIPv4 Object that represents the IPv4 part of a network.
type NetworkIPv4 struct {
// The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway.
Gateway NetworkIPv4GetGatewayAttributeType `json:"gateway,omitempty"`
// A list containing DNS Servers/Nameservers for IPv4.
Nameservers NetworkIPv4GetNameserversAttributeType `json:"nameservers,omitempty"`
// REQUIRED
Prefixes NetworkIPv4GetPrefixesAttributeType `json:"prefixes" required:"true"`
// String that represents an IPv4 address.
PublicIp NetworkIPv4GetPublicIpAttributeType `json:"publicIp,omitempty"`
}
type _NetworkIPv4 NetworkIPv4
// NewNetworkIPv4 instantiates a new NetworkIPv4 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 NewNetworkIPv4(prefixes NetworkIPv4GetPrefixesArgType) *NetworkIPv4 {
this := NetworkIPv4{}
setNetworkIPv4GetPrefixesAttributeType(&this.Prefixes, prefixes)
return &this
}
// NewNetworkIPv4WithDefaults instantiates a new NetworkIPv4 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 NewNetworkIPv4WithDefaults() *NetworkIPv4 {
this := NetworkIPv4{}
return &this
}
// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *NetworkIPv4) GetGateway() (res NetworkIPv4GetGatewayRetType) {
res, _ = o.GetGatewayOk()
return
}
// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *NetworkIPv4) GetGatewayOk() (ret NetworkIPv4GetGatewayRetType, ok bool) {
return getNetworkIPv4GetGatewayAttributeTypeOk(o.Gateway)
}
// HasGateway returns a boolean if a field has been set.
func (o *NetworkIPv4) HasGateway() bool {
_, ok := o.GetGatewayOk()
return ok
}
// SetGateway gets a reference to the given string and assigns it to the Gateway field.
func (o *NetworkIPv4) SetGateway(v NetworkIPv4GetGatewayRetType) {
setNetworkIPv4GetGatewayAttributeType(&o.Gateway, v)
}
// SetGatewayNil sets the value for Gateway to be an explicit nil
func (o *NetworkIPv4) SetGatewayNil() {
o.Gateway = nil
}
// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil
func (o *NetworkIPv4) UnsetGateway() {
o.Gateway = nil
}
// GetNameservers returns the Nameservers field value if set, zero value otherwise.
func (o *NetworkIPv4) GetNameservers() (res NetworkIPv4GetNameserversRetType) {
res, _ = o.GetNameserversOk()
return
}
// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NetworkIPv4) GetNameserversOk() (ret NetworkIPv4GetNameserversRetType, ok bool) {
return getNetworkIPv4GetNameserversAttributeTypeOk(o.Nameservers)
}
// HasNameservers returns a boolean if a field has been set.
func (o *NetworkIPv4) HasNameservers() bool {
_, ok := o.GetNameserversOk()
return ok
}
// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field.
func (o *NetworkIPv4) SetNameservers(v NetworkIPv4GetNameserversRetType) {
setNetworkIPv4GetNameserversAttributeType(&o.Nameservers, v)
}
// GetPrefixes returns the Prefixes field value
func (o *NetworkIPv4) GetPrefixes() (ret NetworkIPv4GetPrefixesRetType) {
ret, _ = o.GetPrefixesOk()
return ret
}
// GetPrefixesOk returns a tuple with the Prefixes field value
// and a boolean to check if the value has been set.
func (o *NetworkIPv4) GetPrefixesOk() (ret NetworkIPv4GetPrefixesRetType, ok bool) {
return getNetworkIPv4GetPrefixesAttributeTypeOk(o.Prefixes)
}
// SetPrefixes sets field value
func (o *NetworkIPv4) SetPrefixes(v NetworkIPv4GetPrefixesRetType) {
setNetworkIPv4GetPrefixesAttributeType(&o.Prefixes, v)
}
// GetPublicIp returns the PublicIp field value if set, zero value otherwise.
func (o *NetworkIPv4) GetPublicIp() (res NetworkIPv4GetPublicIpRetType) {
res, _ = o.GetPublicIpOk()
return
}
// GetPublicIpOk returns a tuple with the PublicIp field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NetworkIPv4) GetPublicIpOk() (ret NetworkIPv4GetPublicIpRetType, ok bool) {
return getNetworkIPv4GetPublicIpAttributeTypeOk(o.PublicIp)
}
// HasPublicIp returns a boolean if a field has been set.
func (o *NetworkIPv4) HasPublicIp() bool {
_, ok := o.GetPublicIpOk()
return ok
}
// SetPublicIp gets a reference to the given string and assigns it to the PublicIp field.
func (o *NetworkIPv4) SetPublicIp(v NetworkIPv4GetPublicIpRetType) {
setNetworkIPv4GetPublicIpAttributeType(&o.PublicIp, v)
}
func (o NetworkIPv4) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getNetworkIPv4GetGatewayAttributeTypeOk(o.Gateway); ok {
toSerialize["Gateway"] = val
}
if val, ok := getNetworkIPv4GetNameserversAttributeTypeOk(o.Nameservers); ok {
toSerialize["Nameservers"] = val
}
if val, ok := getNetworkIPv4GetPrefixesAttributeTypeOk(o.Prefixes); ok {
toSerialize["Prefixes"] = val
}
if val, ok := getNetworkIPv4GetPublicIpAttributeTypeOk(o.PublicIp); ok {
toSerialize["PublicIp"] = val
}
return toSerialize, nil
}
type NullableNetworkIPv4 struct {
value *NetworkIPv4
isSet bool
}
func (v NullableNetworkIPv4) Get() *NetworkIPv4 {
return v.value
}
func (v *NullableNetworkIPv4) Set(val *NetworkIPv4) {
v.value = val
v.isSet = true
}
func (v NullableNetworkIPv4) IsSet() bool {
return v.isSet
}
func (v *NullableNetworkIPv4) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNetworkIPv4(val *NetworkIPv4) *NullableNetworkIPv4 {
return &NullableNetworkIPv4{value: val, isSet: true}
}
func (v NullableNetworkIPv4) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNetworkIPv4) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,237 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the NetworkIPv6 type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NetworkIPv6{}
/*
types and functions for gateway
*/
// isNullableString
type NetworkIPv6GetGatewayAttributeType = *NullableString
func getNetworkIPv6GetGatewayAttributeTypeOk(arg NetworkIPv6GetGatewayAttributeType) (ret NetworkIPv6GetGatewayRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg.Get(), true
}
func setNetworkIPv6GetGatewayAttributeType(arg *NetworkIPv6GetGatewayAttributeType, val NetworkIPv6GetGatewayRetType) {
if IsNil(*arg) {
*arg = NewNullableString(val)
} else {
(*arg).Set(val)
}
}
type NetworkIPv6GetGatewayArgType = *string
type NetworkIPv6GetGatewayRetType = *string
/*
types and functions for nameservers
*/
// isArray
type NetworkIPv6GetNameserversAttributeType = *[]string
type NetworkIPv6GetNameserversArgType = []string
type NetworkIPv6GetNameserversRetType = []string
func getNetworkIPv6GetNameserversAttributeTypeOk(arg NetworkIPv6GetNameserversAttributeType) (ret NetworkIPv6GetNameserversRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkIPv6GetNameserversAttributeType(arg *NetworkIPv6GetNameserversAttributeType, val NetworkIPv6GetNameserversRetType) {
*arg = &val
}
/*
types and functions for prefixes
*/
// isArray
type NetworkIPv6GetPrefixesAttributeType = *[]string
type NetworkIPv6GetPrefixesArgType = []string
type NetworkIPv6GetPrefixesRetType = []string
func getNetworkIPv6GetPrefixesAttributeTypeOk(arg NetworkIPv6GetPrefixesAttributeType) (ret NetworkIPv6GetPrefixesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkIPv6GetPrefixesAttributeType(arg *NetworkIPv6GetPrefixesAttributeType, val NetworkIPv6GetPrefixesRetType) {
*arg = &val
}
// NetworkIPv6 Object that represents the IPv6 part of a network.
type NetworkIPv6 struct {
// The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway.
Gateway NetworkIPv6GetGatewayAttributeType `json:"gateway,omitempty"`
// A list containing DNS Servers/Nameservers for IPv6.
Nameservers NetworkIPv6GetNameserversAttributeType `json:"nameservers,omitempty"`
// REQUIRED
Prefixes NetworkIPv6GetPrefixesAttributeType `json:"prefixes" required:"true"`
}
type _NetworkIPv6 NetworkIPv6
// NewNetworkIPv6 instantiates a new NetworkIPv6 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 NewNetworkIPv6(prefixes NetworkIPv6GetPrefixesArgType) *NetworkIPv6 {
this := NetworkIPv6{}
setNetworkIPv6GetPrefixesAttributeType(&this.Prefixes, prefixes)
return &this
}
// NewNetworkIPv6WithDefaults instantiates a new NetworkIPv6 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 NewNetworkIPv6WithDefaults() *NetworkIPv6 {
this := NetworkIPv6{}
return &this
}
// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *NetworkIPv6) GetGateway() (res NetworkIPv6GetGatewayRetType) {
res, _ = o.GetGatewayOk()
return
}
// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *NetworkIPv6) GetGatewayOk() (ret NetworkIPv6GetGatewayRetType, ok bool) {
return getNetworkIPv6GetGatewayAttributeTypeOk(o.Gateway)
}
// HasGateway returns a boolean if a field has been set.
func (o *NetworkIPv6) HasGateway() bool {
_, ok := o.GetGatewayOk()
return ok
}
// SetGateway gets a reference to the given string and assigns it to the Gateway field.
func (o *NetworkIPv6) SetGateway(v NetworkIPv6GetGatewayRetType) {
setNetworkIPv6GetGatewayAttributeType(&o.Gateway, v)
}
// SetGatewayNil sets the value for Gateway to be an explicit nil
func (o *NetworkIPv6) SetGatewayNil() {
o.Gateway = nil
}
// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil
func (o *NetworkIPv6) UnsetGateway() {
o.Gateway = nil
}
// GetNameservers returns the Nameservers field value if set, zero value otherwise.
func (o *NetworkIPv6) GetNameservers() (res NetworkIPv6GetNameserversRetType) {
res, _ = o.GetNameserversOk()
return
}
// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NetworkIPv6) GetNameserversOk() (ret NetworkIPv6GetNameserversRetType, ok bool) {
return getNetworkIPv6GetNameserversAttributeTypeOk(o.Nameservers)
}
// HasNameservers returns a boolean if a field has been set.
func (o *NetworkIPv6) HasNameservers() bool {
_, ok := o.GetNameserversOk()
return ok
}
// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field.
func (o *NetworkIPv6) SetNameservers(v NetworkIPv6GetNameserversRetType) {
setNetworkIPv6GetNameserversAttributeType(&o.Nameservers, v)
}
// GetPrefixes returns the Prefixes field value
func (o *NetworkIPv6) GetPrefixes() (ret NetworkIPv6GetPrefixesRetType) {
ret, _ = o.GetPrefixesOk()
return ret
}
// GetPrefixesOk returns a tuple with the Prefixes field value
// and a boolean to check if the value has been set.
func (o *NetworkIPv6) GetPrefixesOk() (ret NetworkIPv6GetPrefixesRetType, ok bool) {
return getNetworkIPv6GetPrefixesAttributeTypeOk(o.Prefixes)
}
// SetPrefixes sets field value
func (o *NetworkIPv6) SetPrefixes(v NetworkIPv6GetPrefixesRetType) {
setNetworkIPv6GetPrefixesAttributeType(&o.Prefixes, v)
}
func (o NetworkIPv6) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getNetworkIPv6GetGatewayAttributeTypeOk(o.Gateway); ok {
toSerialize["Gateway"] = val
}
if val, ok := getNetworkIPv6GetNameserversAttributeTypeOk(o.Nameservers); ok {
toSerialize["Nameservers"] = val
}
if val, ok := getNetworkIPv6GetPrefixesAttributeTypeOk(o.Prefixes); ok {
toSerialize["Prefixes"] = val
}
return toSerialize, nil
}
type NullableNetworkIPv6 struct {
value *NetworkIPv6
isSet bool
}
func (v NullableNetworkIPv6) Get() *NetworkIPv6 {
return v.value
}
func (v *NullableNetworkIPv6) Set(val *NetworkIPv6) {
v.value = val
v.isSet = true
}
func (v NullableNetworkIPv6) IsSet() bool {
return v.isSet
}
func (v *NullableNetworkIPv6) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNetworkIPv6(val *NetworkIPv6) *NullableNetworkIPv6 {
return &NullableNetworkIPv6{value: val, isSet: true}
}
func (v NullableNetworkIPv6) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNetworkIPv6) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,126 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the NetworkListResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NetworkListResponse{}
/*
types and functions for items
*/
// isArray
type NetworkListResponseGetItemsAttributeType = *[]Network
type NetworkListResponseGetItemsArgType = []Network
type NetworkListResponseGetItemsRetType = []Network
func getNetworkListResponseGetItemsAttributeTypeOk(arg NetworkListResponseGetItemsAttributeType) (ret NetworkListResponseGetItemsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNetworkListResponseGetItemsAttributeType(arg *NetworkListResponseGetItemsAttributeType, val NetworkListResponseGetItemsRetType) {
*arg = &val
}
// NetworkListResponse Network list response.
type NetworkListResponse struct {
// A list of networks.
// REQUIRED
Items NetworkListResponseGetItemsAttributeType `json:"items" required:"true"`
}
type _NetworkListResponse NetworkListResponse
// NewNetworkListResponse instantiates a new NetworkListResponse 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 NewNetworkListResponse(items NetworkListResponseGetItemsArgType) *NetworkListResponse {
this := NetworkListResponse{}
setNetworkListResponseGetItemsAttributeType(&this.Items, items)
return &this
}
// NewNetworkListResponseWithDefaults instantiates a new NetworkListResponse 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 NewNetworkListResponseWithDefaults() *NetworkListResponse {
this := NetworkListResponse{}
return &this
}
// GetItems returns the Items field value
func (o *NetworkListResponse) GetItems() (ret NetworkListResponseGetItemsRetType) {
ret, _ = o.GetItemsOk()
return ret
}
// GetItemsOk returns a tuple with the Items field value
// and a boolean to check if the value has been set.
func (o *NetworkListResponse) GetItemsOk() (ret NetworkListResponseGetItemsRetType, ok bool) {
return getNetworkListResponseGetItemsAttributeTypeOk(o.Items)
}
// SetItems sets field value
func (o *NetworkListResponse) SetItems(v NetworkListResponseGetItemsRetType) {
setNetworkListResponseGetItemsAttributeType(&o.Items, v)
}
func (o NetworkListResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getNetworkListResponseGetItemsAttributeTypeOk(o.Items); ok {
toSerialize["Items"] = val
}
return toSerialize, nil
}
type NullableNetworkListResponse struct {
value *NetworkListResponse
isSet bool
}
func (v NullableNetworkListResponse) Get() *NetworkListResponse {
return v.value
}
func (v *NullableNetworkListResponse) Set(val *NetworkListResponse) {
v.value = val
v.isSet = true
}
func (v NullableNetworkListResponse) IsSet() bool {
return v.isSet
}
func (v *NullableNetworkListResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNetworkListResponse(val *NetworkListResponse) *NullableNetworkListResponse {
return &NullableNetworkListResponse{value: val, isSet: true}
}
func (v NullableNetworkListResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNetworkListResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,126 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the NexthopBlackhole type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NexthopBlackhole{}
/*
types and functions for type
*/
// isNotNullableString
type NexthopBlackholeGetTypeAttributeType = *string
func getNexthopBlackholeGetTypeAttributeTypeOk(arg NexthopBlackholeGetTypeAttributeType) (ret NexthopBlackholeGetTypeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNexthopBlackholeGetTypeAttributeType(arg *NexthopBlackholeGetTypeAttributeType, val NexthopBlackholeGetTypeRetType) {
*arg = &val
}
type NexthopBlackholeGetTypeArgType = string
type NexthopBlackholeGetTypeRetType = string
// NexthopBlackhole Object that represents a blackhole route.
type NexthopBlackhole struct {
// REQUIRED
Type NexthopBlackholeGetTypeAttributeType `json:"type" required:"true"`
}
type _NexthopBlackhole NexthopBlackhole
// NewNexthopBlackhole instantiates a new NexthopBlackhole 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 NewNexthopBlackhole(types NexthopBlackholeGetTypeArgType) *NexthopBlackhole {
this := NexthopBlackhole{}
setNexthopBlackholeGetTypeAttributeType(&this.Type, types)
return &this
}
// NewNexthopBlackholeWithDefaults instantiates a new NexthopBlackhole 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 NewNexthopBlackholeWithDefaults() *NexthopBlackhole {
this := NexthopBlackhole{}
return &this
}
// GetType returns the Type field value
func (o *NexthopBlackhole) GetType() (ret NexthopBlackholeGetTypeRetType) {
ret, _ = o.GetTypeOk()
return ret
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *NexthopBlackhole) GetTypeOk() (ret NexthopBlackholeGetTypeRetType, ok bool) {
return getNexthopBlackholeGetTypeAttributeTypeOk(o.Type)
}
// SetType sets field value
func (o *NexthopBlackhole) SetType(v NexthopBlackholeGetTypeRetType) {
setNexthopBlackholeGetTypeAttributeType(&o.Type, v)
}
func (o NexthopBlackhole) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getNexthopBlackholeGetTypeAttributeTypeOk(o.Type); ok {
toSerialize["Type"] = val
}
return toSerialize, nil
}
type NullableNexthopBlackhole struct {
value *NexthopBlackhole
isSet bool
}
func (v NullableNexthopBlackhole) Get() *NexthopBlackhole {
return v.value
}
func (v *NullableNexthopBlackhole) Set(val *NexthopBlackhole) {
v.value = val
v.isSet = true
}
func (v NullableNexthopBlackhole) IsSet() bool {
return v.isSet
}
func (v *NullableNexthopBlackhole) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNexthopBlackhole(val *NexthopBlackhole) *NullableNexthopBlackhole {
return &NullableNexthopBlackhole{value: val, isSet: true}
}
func (v NullableNexthopBlackhole) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNexthopBlackhole) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,126 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the NexthopInternet type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NexthopInternet{}
/*
types and functions for type
*/
// isNotNullableString
type NexthopInternetGetTypeAttributeType = *string
func getNexthopInternetGetTypeAttributeTypeOk(arg NexthopInternetGetTypeAttributeType) (ret NexthopInternetGetTypeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNexthopInternetGetTypeAttributeType(arg *NexthopInternetGetTypeAttributeType, val NexthopInternetGetTypeRetType) {
*arg = &val
}
type NexthopInternetGetTypeArgType = string
type NexthopInternetGetTypeRetType = string
// NexthopInternet Object that represents a route to the internet.
type NexthopInternet struct {
// REQUIRED
Type NexthopInternetGetTypeAttributeType `json:"type" required:"true"`
}
type _NexthopInternet NexthopInternet
// NewNexthopInternet instantiates a new NexthopInternet 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 NewNexthopInternet(types NexthopInternetGetTypeArgType) *NexthopInternet {
this := NexthopInternet{}
setNexthopInternetGetTypeAttributeType(&this.Type, types)
return &this
}
// NewNexthopInternetWithDefaults instantiates a new NexthopInternet 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 NewNexthopInternetWithDefaults() *NexthopInternet {
this := NexthopInternet{}
return &this
}
// GetType returns the Type field value
func (o *NexthopInternet) GetType() (ret NexthopInternetGetTypeRetType) {
ret, _ = o.GetTypeOk()
return ret
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *NexthopInternet) GetTypeOk() (ret NexthopInternetGetTypeRetType, ok bool) {
return getNexthopInternetGetTypeAttributeTypeOk(o.Type)
}
// SetType sets field value
func (o *NexthopInternet) SetType(v NexthopInternetGetTypeRetType) {
setNexthopInternetGetTypeAttributeType(&o.Type, v)
}
func (o NexthopInternet) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getNexthopInternetGetTypeAttributeTypeOk(o.Type); ok {
toSerialize["Type"] = val
}
return toSerialize, nil
}
type NullableNexthopInternet struct {
value *NexthopInternet
isSet bool
}
func (v NullableNexthopInternet) Get() *NexthopInternet {
return v.value
}
func (v *NullableNexthopInternet) Set(val *NexthopInternet) {
v.value = val
v.isSet = true
}
func (v NullableNexthopInternet) IsSet() bool {
return v.isSet
}
func (v *NullableNexthopInternet) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNexthopInternet(val *NexthopInternet) *NullableNexthopInternet {
return &NullableNexthopInternet{value: val, isSet: true}
}
func (v NullableNexthopInternet) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNexthopInternet) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,171 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the NexthopIPv4 type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NexthopIPv4{}
/*
types and functions for type
*/
// isNotNullableString
type NexthopIPv4GetTypeAttributeType = *string
func getNexthopIPv4GetTypeAttributeTypeOk(arg NexthopIPv4GetTypeAttributeType) (ret NexthopIPv4GetTypeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNexthopIPv4GetTypeAttributeType(arg *NexthopIPv4GetTypeAttributeType, val NexthopIPv4GetTypeRetType) {
*arg = &val
}
type NexthopIPv4GetTypeArgType = string
type NexthopIPv4GetTypeRetType = string
/*
types and functions for value
*/
// isNotNullableString
type NexthopIPv4GetValueAttributeType = *string
func getNexthopIPv4GetValueAttributeTypeOk(arg NexthopIPv4GetValueAttributeType) (ret NexthopIPv4GetValueRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNexthopIPv4GetValueAttributeType(arg *NexthopIPv4GetValueAttributeType, val NexthopIPv4GetValueRetType) {
*arg = &val
}
type NexthopIPv4GetValueArgType = string
type NexthopIPv4GetValueRetType = string
// NexthopIPv4 Object that represents an IPv4 address.
type NexthopIPv4 struct {
// REQUIRED
Type NexthopIPv4GetTypeAttributeType `json:"type" required:"true"`
// An IPv4 address.
// REQUIRED
Value NexthopIPv4GetValueAttributeType `json:"value" required:"true"`
}
type _NexthopIPv4 NexthopIPv4
// NewNexthopIPv4 instantiates a new NexthopIPv4 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 NewNexthopIPv4(types NexthopIPv4GetTypeArgType, value NexthopIPv4GetValueArgType) *NexthopIPv4 {
this := NexthopIPv4{}
setNexthopIPv4GetTypeAttributeType(&this.Type, types)
setNexthopIPv4GetValueAttributeType(&this.Value, value)
return &this
}
// NewNexthopIPv4WithDefaults instantiates a new NexthopIPv4 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 NewNexthopIPv4WithDefaults() *NexthopIPv4 {
this := NexthopIPv4{}
return &this
}
// GetType returns the Type field value
func (o *NexthopIPv4) GetType() (ret NexthopIPv4GetTypeRetType) {
ret, _ = o.GetTypeOk()
return ret
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *NexthopIPv4) GetTypeOk() (ret NexthopIPv4GetTypeRetType, ok bool) {
return getNexthopIPv4GetTypeAttributeTypeOk(o.Type)
}
// SetType sets field value
func (o *NexthopIPv4) SetType(v NexthopIPv4GetTypeRetType) {
setNexthopIPv4GetTypeAttributeType(&o.Type, v)
}
// GetValue returns the Value field value
func (o *NexthopIPv4) GetValue() (ret NexthopIPv4GetValueRetType) {
ret, _ = o.GetValueOk()
return ret
}
// GetValueOk returns a tuple with the Value field value
// and a boolean to check if the value has been set.
func (o *NexthopIPv4) GetValueOk() (ret NexthopIPv4GetValueRetType, ok bool) {
return getNexthopIPv4GetValueAttributeTypeOk(o.Value)
}
// SetValue sets field value
func (o *NexthopIPv4) SetValue(v NexthopIPv4GetValueRetType) {
setNexthopIPv4GetValueAttributeType(&o.Value, v)
}
func (o NexthopIPv4) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getNexthopIPv4GetTypeAttributeTypeOk(o.Type); ok {
toSerialize["Type"] = val
}
if val, ok := getNexthopIPv4GetValueAttributeTypeOk(o.Value); ok {
toSerialize["Value"] = val
}
return toSerialize, nil
}
type NullableNexthopIPv4 struct {
value *NexthopIPv4
isSet bool
}
func (v NullableNexthopIPv4) Get() *NexthopIPv4 {
return v.value
}
func (v *NullableNexthopIPv4) Set(val *NexthopIPv4) {
v.value = val
v.isSet = true
}
func (v NullableNexthopIPv4) IsSet() bool {
return v.isSet
}
func (v *NullableNexthopIPv4) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNexthopIPv4(val *NexthopIPv4) *NullableNexthopIPv4 {
return &NullableNexthopIPv4{value: val, isSet: true}
}
func (v NullableNexthopIPv4) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNexthopIPv4) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,171 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the NexthopIPv6 type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NexthopIPv6{}
/*
types and functions for type
*/
// isNotNullableString
type NexthopIPv6GetTypeAttributeType = *string
func getNexthopIPv6GetTypeAttributeTypeOk(arg NexthopIPv6GetTypeAttributeType) (ret NexthopIPv6GetTypeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNexthopIPv6GetTypeAttributeType(arg *NexthopIPv6GetTypeAttributeType, val NexthopIPv6GetTypeRetType) {
*arg = &val
}
type NexthopIPv6GetTypeArgType = string
type NexthopIPv6GetTypeRetType = string
/*
types and functions for value
*/
// isNotNullableString
type NexthopIPv6GetValueAttributeType = *string
func getNexthopIPv6GetValueAttributeTypeOk(arg NexthopIPv6GetValueAttributeType) (ret NexthopIPv6GetValueRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setNexthopIPv6GetValueAttributeType(arg *NexthopIPv6GetValueAttributeType, val NexthopIPv6GetValueRetType) {
*arg = &val
}
type NexthopIPv6GetValueArgType = string
type NexthopIPv6GetValueRetType = string
// NexthopIPv6 Object that represents an IPv6 address.
type NexthopIPv6 struct {
// REQUIRED
Type NexthopIPv6GetTypeAttributeType `json:"type" required:"true"`
// An IPv6 address.
// REQUIRED
Value NexthopIPv6GetValueAttributeType `json:"value" required:"true"`
}
type _NexthopIPv6 NexthopIPv6
// NewNexthopIPv6 instantiates a new NexthopIPv6 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 NewNexthopIPv6(types NexthopIPv6GetTypeArgType, value NexthopIPv6GetValueArgType) *NexthopIPv6 {
this := NexthopIPv6{}
setNexthopIPv6GetTypeAttributeType(&this.Type, types)
setNexthopIPv6GetValueAttributeType(&this.Value, value)
return &this
}
// NewNexthopIPv6WithDefaults instantiates a new NexthopIPv6 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 NewNexthopIPv6WithDefaults() *NexthopIPv6 {
this := NexthopIPv6{}
return &this
}
// GetType returns the Type field value
func (o *NexthopIPv6) GetType() (ret NexthopIPv6GetTypeRetType) {
ret, _ = o.GetTypeOk()
return ret
}
// GetTypeOk returns a tuple with the Type field value
// and a boolean to check if the value has been set.
func (o *NexthopIPv6) GetTypeOk() (ret NexthopIPv6GetTypeRetType, ok bool) {
return getNexthopIPv6GetTypeAttributeTypeOk(o.Type)
}
// SetType sets field value
func (o *NexthopIPv6) SetType(v NexthopIPv6GetTypeRetType) {
setNexthopIPv6GetTypeAttributeType(&o.Type, v)
}
// GetValue returns the Value field value
func (o *NexthopIPv6) GetValue() (ret NexthopIPv6GetValueRetType) {
ret, _ = o.GetValueOk()
return ret
}
// GetValueOk returns a tuple with the Value field value
// and a boolean to check if the value has been set.
func (o *NexthopIPv6) GetValueOk() (ret NexthopIPv6GetValueRetType, ok bool) {
return getNexthopIPv6GetValueAttributeTypeOk(o.Value)
}
// SetValue sets field value
func (o *NexthopIPv6) SetValue(v NexthopIPv6GetValueRetType) {
setNexthopIPv6GetValueAttributeType(&o.Value, v)
}
func (o NexthopIPv6) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getNexthopIPv6GetTypeAttributeTypeOk(o.Type); ok {
toSerialize["Type"] = val
}
if val, ok := getNexthopIPv6GetValueAttributeTypeOk(o.Value); ok {
toSerialize["Value"] = val
}
return toSerialize, nil
}
type NullableNexthopIPv6 struct {
value *NexthopIPv6
isSet bool
}
func (v NullableNexthopIPv6) Get() *NexthopIPv6 {
return v.value
}
func (v *NullableNexthopIPv6) Set(val *NexthopIPv6) {
v.value = val
v.isSet = true
}
func (v NullableNexthopIPv6) IsSet() bool {
return v.isSet
}
func (v *NullableNexthopIPv6) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNexthopIPv6(val *NexthopIPv6) *NullableNexthopIPv6 {
return &NullableNexthopIPv6{value: val, isSet: true}
}
func (v NullableNexthopIPv6) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNexthopIPv6) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,416 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the PartialUpdateNetworkPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &PartialUpdateNetworkPayload{}
/*
types and functions for dhcp
*/
// isBoolean
type PartialUpdateNetworkPayloadgetDhcpAttributeType = *bool
type PartialUpdateNetworkPayloadgetDhcpArgType = bool
type PartialUpdateNetworkPayloadgetDhcpRetType = bool
func getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(arg PartialUpdateNetworkPayloadgetDhcpAttributeType) (ret PartialUpdateNetworkPayloadgetDhcpRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPartialUpdateNetworkPayloadgetDhcpAttributeType(arg *PartialUpdateNetworkPayloadgetDhcpAttributeType, val PartialUpdateNetworkPayloadgetDhcpRetType) {
*arg = &val
}
/*
types and functions for ipv4
*/
// isModel
type PartialUpdateNetworkPayloadGetIpv4AttributeType = *UpdateNetworkIPv4Body
type PartialUpdateNetworkPayloadGetIpv4ArgType = UpdateNetworkIPv4Body
type PartialUpdateNetworkPayloadGetIpv4RetType = UpdateNetworkIPv4Body
func getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(arg PartialUpdateNetworkPayloadGetIpv4AttributeType) (ret PartialUpdateNetworkPayloadGetIpv4RetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPartialUpdateNetworkPayloadGetIpv4AttributeType(arg *PartialUpdateNetworkPayloadGetIpv4AttributeType, val PartialUpdateNetworkPayloadGetIpv4RetType) {
*arg = &val
}
/*
types and functions for ipv6
*/
// isModel
type PartialUpdateNetworkPayloadGetIpv6AttributeType = *UpdateNetworkIPv6Body
type PartialUpdateNetworkPayloadGetIpv6ArgType = UpdateNetworkIPv6Body
type PartialUpdateNetworkPayloadGetIpv6RetType = UpdateNetworkIPv6Body
func getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(arg PartialUpdateNetworkPayloadGetIpv6AttributeType) (ret PartialUpdateNetworkPayloadGetIpv6RetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPartialUpdateNetworkPayloadGetIpv6AttributeType(arg *PartialUpdateNetworkPayloadGetIpv6AttributeType, val PartialUpdateNetworkPayloadGetIpv6RetType) {
*arg = &val
}
/*
types and functions for labels
*/
// isFreeform
type PartialUpdateNetworkPayloadGetLabelsAttributeType = *map[string]interface{}
type PartialUpdateNetworkPayloadGetLabelsArgType = map[string]interface{}
type PartialUpdateNetworkPayloadGetLabelsRetType = map[string]interface{}
func getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(arg PartialUpdateNetworkPayloadGetLabelsAttributeType) (ret PartialUpdateNetworkPayloadGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPartialUpdateNetworkPayloadGetLabelsAttributeType(arg *PartialUpdateNetworkPayloadGetLabelsAttributeType, val PartialUpdateNetworkPayloadGetLabelsRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isNotNullableString
type PartialUpdateNetworkPayloadGetNameAttributeType = *string
func getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(arg PartialUpdateNetworkPayloadGetNameAttributeType) (ret PartialUpdateNetworkPayloadGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPartialUpdateNetworkPayloadGetNameAttributeType(arg *PartialUpdateNetworkPayloadGetNameAttributeType, val PartialUpdateNetworkPayloadGetNameRetType) {
*arg = &val
}
type PartialUpdateNetworkPayloadGetNameArgType = string
type PartialUpdateNetworkPayloadGetNameRetType = string
/*
types and functions for routed
*/
// isBoolean
type PartialUpdateNetworkPayloadgetRoutedAttributeType = *bool
type PartialUpdateNetworkPayloadgetRoutedArgType = bool
type PartialUpdateNetworkPayloadgetRoutedRetType = bool
func getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(arg PartialUpdateNetworkPayloadgetRoutedAttributeType) (ret PartialUpdateNetworkPayloadgetRoutedRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPartialUpdateNetworkPayloadgetRoutedAttributeType(arg *PartialUpdateNetworkPayloadgetRoutedAttributeType, val PartialUpdateNetworkPayloadgetRoutedRetType) {
*arg = &val
}
/*
types and functions for routingTableId
*/
// isNotNullableString
type PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType = *string
func getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(arg PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType) (ret PartialUpdateNetworkPayloadGetRoutingTableIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPartialUpdateNetworkPayloadGetRoutingTableIdAttributeType(arg *PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType, val PartialUpdateNetworkPayloadGetRoutingTableIdRetType) {
*arg = &val
}
type PartialUpdateNetworkPayloadGetRoutingTableIdArgType = string
type PartialUpdateNetworkPayloadGetRoutingTableIdRetType = string
// PartialUpdateNetworkPayload Object that represents the request body for a network update.
type PartialUpdateNetworkPayload struct {
// Enable or disable DHCP for a network.
Dhcp PartialUpdateNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"`
Ipv4 PartialUpdateNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"`
Ipv6 PartialUpdateNetworkPayloadGetIpv6AttributeType `json:"ipv6,omitempty"`
// Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key.
Labels PartialUpdateNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"`
// The name for a General Object. Matches Names and also UUIDs.
Name PartialUpdateNetworkPayloadGetNameAttributeType `json:"name,omitempty"`
// Shows if the network is routed and therefore accessible from other networks.
Routed PartialUpdateNetworkPayloadgetRoutedAttributeType `json:"routed,omitempty"`
// Universally Unique Identifier (UUID).
RoutingTableId PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"`
}
// NewPartialUpdateNetworkPayload instantiates a new PartialUpdateNetworkPayload 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 NewPartialUpdateNetworkPayload() *PartialUpdateNetworkPayload {
this := PartialUpdateNetworkPayload{}
return &this
}
// NewPartialUpdateNetworkPayloadWithDefaults instantiates a new PartialUpdateNetworkPayload 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 NewPartialUpdateNetworkPayloadWithDefaults() *PartialUpdateNetworkPayload {
this := PartialUpdateNetworkPayload{}
return &this
}
// GetDhcp returns the Dhcp field value if set, zero value otherwise.
func (o *PartialUpdateNetworkPayload) GetDhcp() (res PartialUpdateNetworkPayloadgetDhcpRetType) {
res, _ = o.GetDhcpOk()
return
}
// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PartialUpdateNetworkPayload) GetDhcpOk() (ret PartialUpdateNetworkPayloadgetDhcpRetType, ok bool) {
return getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp)
}
// HasDhcp returns a boolean if a field has been set.
func (o *PartialUpdateNetworkPayload) HasDhcp() bool {
_, ok := o.GetDhcpOk()
return ok
}
// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field.
func (o *PartialUpdateNetworkPayload) SetDhcp(v PartialUpdateNetworkPayloadgetDhcpRetType) {
setPartialUpdateNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v)
}
// GetIpv4 returns the Ipv4 field value if set, zero value otherwise.
func (o *PartialUpdateNetworkPayload) GetIpv4() (res PartialUpdateNetworkPayloadGetIpv4RetType) {
res, _ = o.GetIpv4Ok()
return
}
// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PartialUpdateNetworkPayload) GetIpv4Ok() (ret PartialUpdateNetworkPayloadGetIpv4RetType, ok bool) {
return getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4)
}
// HasIpv4 returns a boolean if a field has been set.
func (o *PartialUpdateNetworkPayload) HasIpv4() bool {
_, ok := o.GetIpv4Ok()
return ok
}
// SetIpv4 gets a reference to the given UpdateNetworkIPv4Body and assigns it to the Ipv4 field.
func (o *PartialUpdateNetworkPayload) SetIpv4(v PartialUpdateNetworkPayloadGetIpv4RetType) {
setPartialUpdateNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v)
}
// GetIpv6 returns the Ipv6 field value if set, zero value otherwise.
func (o *PartialUpdateNetworkPayload) GetIpv6() (res PartialUpdateNetworkPayloadGetIpv6RetType) {
res, _ = o.GetIpv6Ok()
return
}
// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PartialUpdateNetworkPayload) GetIpv6Ok() (ret PartialUpdateNetworkPayloadGetIpv6RetType, ok bool) {
return getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6)
}
// HasIpv6 returns a boolean if a field has been set.
func (o *PartialUpdateNetworkPayload) HasIpv6() bool {
_, ok := o.GetIpv6Ok()
return ok
}
// SetIpv6 gets a reference to the given UpdateNetworkIPv6Body and assigns it to the Ipv6 field.
func (o *PartialUpdateNetworkPayload) SetIpv6(v PartialUpdateNetworkPayloadGetIpv6RetType) {
setPartialUpdateNetworkPayloadGetIpv6AttributeType(&o.Ipv6, v)
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *PartialUpdateNetworkPayload) GetLabels() (res PartialUpdateNetworkPayloadGetLabelsRetType) {
res, _ = o.GetLabelsOk()
return
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PartialUpdateNetworkPayload) GetLabelsOk() (ret PartialUpdateNetworkPayloadGetLabelsRetType, ok bool) {
return getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels)
}
// HasLabels returns a boolean if a field has been set.
func (o *PartialUpdateNetworkPayload) HasLabels() bool {
_, ok := o.GetLabelsOk()
return ok
}
// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field.
func (o *PartialUpdateNetworkPayload) SetLabels(v PartialUpdateNetworkPayloadGetLabelsRetType) {
setPartialUpdateNetworkPayloadGetLabelsAttributeType(&o.Labels, v)
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *PartialUpdateNetworkPayload) GetName() (res PartialUpdateNetworkPayloadGetNameRetType) {
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 *PartialUpdateNetworkPayload) GetNameOk() (ret PartialUpdateNetworkPayloadGetNameRetType, ok bool) {
return getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(o.Name)
}
// HasName returns a boolean if a field has been set.
func (o *PartialUpdateNetworkPayload) HasName() bool {
_, ok := o.GetNameOk()
return ok
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *PartialUpdateNetworkPayload) SetName(v PartialUpdateNetworkPayloadGetNameRetType) {
setPartialUpdateNetworkPayloadGetNameAttributeType(&o.Name, v)
}
// GetRouted returns the Routed field value if set, zero value otherwise.
func (o *PartialUpdateNetworkPayload) GetRouted() (res PartialUpdateNetworkPayloadgetRoutedRetType) {
res, _ = o.GetRoutedOk()
return
}
// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PartialUpdateNetworkPayload) GetRoutedOk() (ret PartialUpdateNetworkPayloadgetRoutedRetType, ok bool) {
return getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed)
}
// HasRouted returns a boolean if a field has been set.
func (o *PartialUpdateNetworkPayload) HasRouted() bool {
_, ok := o.GetRoutedOk()
return ok
}
// SetRouted gets a reference to the given bool and assigns it to the Routed field.
func (o *PartialUpdateNetworkPayload) SetRouted(v PartialUpdateNetworkPayloadgetRoutedRetType) {
setPartialUpdateNetworkPayloadgetRoutedAttributeType(&o.Routed, v)
}
// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise.
func (o *PartialUpdateNetworkPayload) GetRoutingTableId() (res PartialUpdateNetworkPayloadGetRoutingTableIdRetType) {
res, _ = o.GetRoutingTableIdOk()
return
}
// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PartialUpdateNetworkPayload) GetRoutingTableIdOk() (ret PartialUpdateNetworkPayloadGetRoutingTableIdRetType, ok bool) {
return getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId)
}
// HasRoutingTableId returns a boolean if a field has been set.
func (o *PartialUpdateNetworkPayload) HasRoutingTableId() bool {
_, ok := o.GetRoutingTableIdOk()
return ok
}
// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field.
func (o *PartialUpdateNetworkPayload) SetRoutingTableId(v PartialUpdateNetworkPayloadGetRoutingTableIdRetType) {
setPartialUpdateNetworkPayloadGetRoutingTableIdAttributeType(&o.RoutingTableId, v)
}
func (o PartialUpdateNetworkPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok {
toSerialize["Dhcp"] = val
}
if val, ok := getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok {
toSerialize["Ipv4"] = val
}
if val, ok := getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok {
toSerialize["Ipv6"] = val
}
if val, ok := getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
if val, ok := getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed); ok {
toSerialize["Routed"] = val
}
if val, ok := getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok {
toSerialize["RoutingTableId"] = val
}
return toSerialize, nil
}
type NullablePartialUpdateNetworkPayload struct {
value *PartialUpdateNetworkPayload
isSet bool
}
func (v NullablePartialUpdateNetworkPayload) Get() *PartialUpdateNetworkPayload {
return v.value
}
func (v *NullablePartialUpdateNetworkPayload) Set(val *PartialUpdateNetworkPayload) {
v.value = val
v.isSet = true
}
func (v NullablePartialUpdateNetworkPayload) IsSet() bool {
return v.isSet
}
func (v *NullablePartialUpdateNetworkPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePartialUpdateNetworkPayload(val *PartialUpdateNetworkPayload) *NullablePartialUpdateNetworkPayload {
return &NullablePartialUpdateNetworkPayload{value: val, isSet: true}
}
func (v NullablePartialUpdateNetworkPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePartialUpdateNetworkPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,362 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
"time"
)
// checks if the Route type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Route{}
/*
types and functions for createdAt
*/
// isDateTime
type RouteGetCreatedAtAttributeType = *time.Time
type RouteGetCreatedAtArgType = time.Time
type RouteGetCreatedAtRetType = time.Time
func getRouteGetCreatedAtAttributeTypeOk(arg RouteGetCreatedAtAttributeType) (ret RouteGetCreatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRouteGetCreatedAtAttributeType(arg *RouteGetCreatedAtAttributeType, val RouteGetCreatedAtRetType) {
*arg = &val
}
/*
types and functions for destination
*/
// isModel
type RouteGetDestinationAttributeType = *RouteDestination
type RouteGetDestinationArgType = RouteDestination
type RouteGetDestinationRetType = RouteDestination
func getRouteGetDestinationAttributeTypeOk(arg RouteGetDestinationAttributeType) (ret RouteGetDestinationRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRouteGetDestinationAttributeType(arg *RouteGetDestinationAttributeType, val RouteGetDestinationRetType) {
*arg = &val
}
/*
types and functions for id
*/
// isNotNullableString
type RouteGetIdAttributeType = *string
func getRouteGetIdAttributeTypeOk(arg RouteGetIdAttributeType) (ret RouteGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRouteGetIdAttributeType(arg *RouteGetIdAttributeType, val RouteGetIdRetType) {
*arg = &val
}
type RouteGetIdArgType = string
type RouteGetIdRetType = string
/*
types and functions for labels
*/
// isFreeform
type RouteGetLabelsAttributeType = *map[string]interface{}
type RouteGetLabelsArgType = map[string]interface{}
type RouteGetLabelsRetType = map[string]interface{}
func getRouteGetLabelsAttributeTypeOk(arg RouteGetLabelsAttributeType) (ret RouteGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRouteGetLabelsAttributeType(arg *RouteGetLabelsAttributeType, val RouteGetLabelsRetType) {
*arg = &val
}
/*
types and functions for nexthop
*/
// isModel
type RouteGetNexthopAttributeType = *RouteNexthop
type RouteGetNexthopArgType = RouteNexthop
type RouteGetNexthopRetType = RouteNexthop
func getRouteGetNexthopAttributeTypeOk(arg RouteGetNexthopAttributeType) (ret RouteGetNexthopRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRouteGetNexthopAttributeType(arg *RouteGetNexthopAttributeType, val RouteGetNexthopRetType) {
*arg = &val
}
/*
types and functions for updatedAt
*/
// isDateTime
type RouteGetUpdatedAtAttributeType = *time.Time
type RouteGetUpdatedAtArgType = time.Time
type RouteGetUpdatedAtRetType = time.Time
func getRouteGetUpdatedAtAttributeTypeOk(arg RouteGetUpdatedAtAttributeType) (ret RouteGetUpdatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRouteGetUpdatedAtAttributeType(arg *RouteGetUpdatedAtAttributeType, val RouteGetUpdatedAtRetType) {
*arg = &val
}
// Route Object represents a network route.
type Route struct {
// Date-time when resource was created.
CreatedAt RouteGetCreatedAtAttributeType `json:"createdAt,omitempty"`
// REQUIRED
Destination RouteGetDestinationAttributeType `json:"destination" required:"true"`
// Universally Unique Identifier (UUID).
Id RouteGetIdAttributeType `json:"id,omitempty"`
// Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key.
Labels RouteGetLabelsAttributeType `json:"labels,omitempty"`
// REQUIRED
Nexthop RouteGetNexthopAttributeType `json:"nexthop" required:"true"`
// Date-time when resource was last updated.
UpdatedAt RouteGetUpdatedAtAttributeType `json:"updatedAt,omitempty"`
}
type _Route Route
// NewRoute instantiates a new Route 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 NewRoute(destination RouteGetDestinationArgType, nexthop RouteGetNexthopArgType) *Route {
this := Route{}
setRouteGetDestinationAttributeType(&this.Destination, destination)
setRouteGetNexthopAttributeType(&this.Nexthop, nexthop)
return &this
}
// NewRouteWithDefaults instantiates a new Route 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 NewRouteWithDefaults() *Route {
this := Route{}
return &this
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *Route) GetCreatedAt() (res RouteGetCreatedAtRetType) {
res, _ = o.GetCreatedAtOk()
return
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Route) GetCreatedAtOk() (ret RouteGetCreatedAtRetType, ok bool) {
return getRouteGetCreatedAtAttributeTypeOk(o.CreatedAt)
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *Route) HasCreatedAt() bool {
_, ok := o.GetCreatedAtOk()
return ok
}
// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field.
func (o *Route) SetCreatedAt(v RouteGetCreatedAtRetType) {
setRouteGetCreatedAtAttributeType(&o.CreatedAt, v)
}
// GetDestination returns the Destination field value
func (o *Route) GetDestination() (ret RouteGetDestinationRetType) {
ret, _ = o.GetDestinationOk()
return ret
}
// GetDestinationOk returns a tuple with the Destination field value
// and a boolean to check if the value has been set.
func (o *Route) GetDestinationOk() (ret RouteGetDestinationRetType, ok bool) {
return getRouteGetDestinationAttributeTypeOk(o.Destination)
}
// SetDestination sets field value
func (o *Route) SetDestination(v RouteGetDestinationRetType) {
setRouteGetDestinationAttributeType(&o.Destination, v)
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *Route) GetId() (res RouteGetIdRetType) {
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 *Route) GetIdOk() (ret RouteGetIdRetType, ok bool) {
return getRouteGetIdAttributeTypeOk(o.Id)
}
// HasId returns a boolean if a field has been set.
func (o *Route) HasId() bool {
_, ok := o.GetIdOk()
return ok
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *Route) SetId(v RouteGetIdRetType) {
setRouteGetIdAttributeType(&o.Id, v)
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *Route) GetLabels() (res RouteGetLabelsRetType) {
res, _ = o.GetLabelsOk()
return
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Route) GetLabelsOk() (ret RouteGetLabelsRetType, ok bool) {
return getRouteGetLabelsAttributeTypeOk(o.Labels)
}
// HasLabels returns a boolean if a field has been set.
func (o *Route) HasLabels() bool {
_, ok := o.GetLabelsOk()
return ok
}
// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field.
func (o *Route) SetLabels(v RouteGetLabelsRetType) {
setRouteGetLabelsAttributeType(&o.Labels, v)
}
// GetNexthop returns the Nexthop field value
func (o *Route) GetNexthop() (ret RouteGetNexthopRetType) {
ret, _ = o.GetNexthopOk()
return ret
}
// GetNexthopOk returns a tuple with the Nexthop field value
// and a boolean to check if the value has been set.
func (o *Route) GetNexthopOk() (ret RouteGetNexthopRetType, ok bool) {
return getRouteGetNexthopAttributeTypeOk(o.Nexthop)
}
// SetNexthop sets field value
func (o *Route) SetNexthop(v RouteGetNexthopRetType) {
setRouteGetNexthopAttributeType(&o.Nexthop, v)
}
// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *Route) GetUpdatedAt() (res RouteGetUpdatedAtRetType) {
res, _ = o.GetUpdatedAtOk()
return
}
// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Route) GetUpdatedAtOk() (ret RouteGetUpdatedAtRetType, ok bool) {
return getRouteGetUpdatedAtAttributeTypeOk(o.UpdatedAt)
}
// HasUpdatedAt returns a boolean if a field has been set.
func (o *Route) HasUpdatedAt() bool {
_, ok := o.GetUpdatedAtOk()
return ok
}
// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field.
func (o *Route) SetUpdatedAt(v RouteGetUpdatedAtRetType) {
setRouteGetUpdatedAtAttributeType(&o.UpdatedAt, v)
}
func (o Route) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getRouteGetCreatedAtAttributeTypeOk(o.CreatedAt); ok {
toSerialize["CreatedAt"] = val
}
if val, ok := getRouteGetDestinationAttributeTypeOk(o.Destination); ok {
toSerialize["Destination"] = val
}
if val, ok := getRouteGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getRouteGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
if val, ok := getRouteGetNexthopAttributeTypeOk(o.Nexthop); ok {
toSerialize["Nexthop"] = val
}
if val, ok := getRouteGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok {
toSerialize["UpdatedAt"] = val
}
return toSerialize, nil
}
type NullableRoute struct {
value *Route
isSet bool
}
func (v NullableRoute) Get() *Route {
return v.value
}
func (v *NullableRoute) Set(val *Route) {
v.value = val
v.isSet = true
}
func (v NullableRoute) IsSet() bool {
return v.isSet
}
func (v *NullableRoute) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRoute(val *Route) *NullableRoute {
return &NullableRoute{value: val, isSet: true}
}
func (v NullableRoute) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRoute) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,163 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
"fmt"
)
// RouteDestination - struct for RouteDestination
type RouteDestination struct {
DestinationCIDRv4 *DestinationCIDRv4
DestinationCIDRv6 *DestinationCIDRv6
}
// DestinationCIDRv4AsRouteDestination is a convenience function that returns DestinationCIDRv4 wrapped in RouteDestination
func DestinationCIDRv4AsRouteDestination(v *DestinationCIDRv4) RouteDestination {
return RouteDestination{
DestinationCIDRv4: v,
}
}
// DestinationCIDRv6AsRouteDestination is a convenience function that returns DestinationCIDRv6 wrapped in RouteDestination
func DestinationCIDRv6AsRouteDestination(v *DestinationCIDRv6) RouteDestination {
return RouteDestination{
DestinationCIDRv6: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *RouteDestination) UnmarshalJSON(data []byte) error {
var err error
// use discriminator value to speed up the lookup
var jsonDict map[string]interface{}
err = newStrictDecoder(data).Decode(&jsonDict)
if err != nil {
return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup")
}
// check if the discriminator value is 'DestinationCIDRv4'
if jsonDict["type"] == "DestinationCIDRv4" {
// try to unmarshal JSON data into DestinationCIDRv4
err = json.Unmarshal(data, &dst.DestinationCIDRv4)
if err == nil {
return nil // data stored in dst.DestinationCIDRv4, return on the first match
} else {
dst.DestinationCIDRv4 = nil
return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv4: %s", err.Error())
}
}
// check if the discriminator value is 'DestinationCIDRv6'
if jsonDict["type"] == "DestinationCIDRv6" {
// try to unmarshal JSON data into DestinationCIDRv6
err = json.Unmarshal(data, &dst.DestinationCIDRv6)
if err == nil {
return nil // data stored in dst.DestinationCIDRv6, return on the first match
} else {
dst.DestinationCIDRv6 = nil
return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv6: %s", err.Error())
}
}
// check if the discriminator value is 'cidrv4'
if jsonDict["type"] == "cidrv4" {
// try to unmarshal JSON data into DestinationCIDRv4
err = json.Unmarshal(data, &dst.DestinationCIDRv4)
if err == nil {
return nil // data stored in dst.DestinationCIDRv4, return on the first match
} else {
dst.DestinationCIDRv4 = nil
return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv4: %s", err.Error())
}
}
// check if the discriminator value is 'cidrv6'
if jsonDict["type"] == "cidrv6" {
// try to unmarshal JSON data into DestinationCIDRv6
err = json.Unmarshal(data, &dst.DestinationCIDRv6)
if err == nil {
return nil // data stored in dst.DestinationCIDRv6, return on the first match
} else {
dst.DestinationCIDRv6 = nil
return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv6: %s", err.Error())
}
}
return nil
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src RouteDestination) MarshalJSON() ([]byte, error) {
if src.DestinationCIDRv4 != nil {
return json.Marshal(&src.DestinationCIDRv4)
}
if src.DestinationCIDRv6 != nil {
return json.Marshal(&src.DestinationCIDRv6)
}
return []byte("{}"), nil // no data in oneOf schemas => empty JSON object
}
// Get the actual instance
func (obj *RouteDestination) GetActualInstance() interface{} {
if obj == nil {
return nil
}
if obj.DestinationCIDRv4 != nil {
return obj.DestinationCIDRv4
}
if obj.DestinationCIDRv6 != nil {
return obj.DestinationCIDRv6
}
// all schemas are nil
return nil
}
type NullableRouteDestination struct {
value *RouteDestination
isSet bool
}
func (v NullableRouteDestination) Get() *RouteDestination {
return v.value
}
func (v *NullableRouteDestination) Set(val *RouteDestination) {
v.value = val
v.isSet = true
}
func (v NullableRouteDestination) IsSet() bool {
return v.isSet
}
func (v *NullableRouteDestination) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRouteDestination(val *RouteDestination) *NullableRouteDestination {
return &NullableRouteDestination{value: val, isSet: true}
}
func (v NullableRouteDestination) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRouteDestination) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,126 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the RouteListResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RouteListResponse{}
/*
types and functions for items
*/
// isArray
type RouteListResponseGetItemsAttributeType = *[]Route
type RouteListResponseGetItemsArgType = []Route
type RouteListResponseGetItemsRetType = []Route
func getRouteListResponseGetItemsAttributeTypeOk(arg RouteListResponseGetItemsAttributeType) (ret RouteListResponseGetItemsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRouteListResponseGetItemsAttributeType(arg *RouteListResponseGetItemsAttributeType, val RouteListResponseGetItemsRetType) {
*arg = &val
}
// RouteListResponse Route list response.
type RouteListResponse struct {
// A list of routes.
// REQUIRED
Items RouteListResponseGetItemsAttributeType `json:"items" required:"true"`
}
type _RouteListResponse RouteListResponse
// NewRouteListResponse instantiates a new RouteListResponse 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 NewRouteListResponse(items RouteListResponseGetItemsArgType) *RouteListResponse {
this := RouteListResponse{}
setRouteListResponseGetItemsAttributeType(&this.Items, items)
return &this
}
// NewRouteListResponseWithDefaults instantiates a new RouteListResponse 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 NewRouteListResponseWithDefaults() *RouteListResponse {
this := RouteListResponse{}
return &this
}
// GetItems returns the Items field value
func (o *RouteListResponse) GetItems() (ret RouteListResponseGetItemsRetType) {
ret, _ = o.GetItemsOk()
return ret
}
// GetItemsOk returns a tuple with the Items field value
// and a boolean to check if the value has been set.
func (o *RouteListResponse) GetItemsOk() (ret RouteListResponseGetItemsRetType, ok bool) {
return getRouteListResponseGetItemsAttributeTypeOk(o.Items)
}
// SetItems sets field value
func (o *RouteListResponse) SetItems(v RouteListResponseGetItemsRetType) {
setRouteListResponseGetItemsAttributeType(&o.Items, v)
}
func (o RouteListResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getRouteListResponseGetItemsAttributeTypeOk(o.Items); ok {
toSerialize["Items"] = val
}
return toSerialize, nil
}
type NullableRouteListResponse struct {
value *RouteListResponse
isSet bool
}
func (v NullableRouteListResponse) Get() *RouteListResponse {
return v.value
}
func (v *NullableRouteListResponse) Set(val *RouteListResponse) {
v.value = val
v.isSet = true
}
func (v NullableRouteListResponse) IsSet() bool {
return v.isSet
}
func (v *NullableRouteListResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRouteListResponse(val *RouteListResponse) *NullableRouteListResponse {
return &NullableRouteListResponse{value: val, isSet: true}
}
func (v NullableRouteListResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRouteListResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,243 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
"fmt"
)
// RouteNexthop - struct for RouteNexthop
type RouteNexthop struct {
NexthopBlackhole *NexthopBlackhole
NexthopIPv4 *NexthopIPv4
NexthopIPv6 *NexthopIPv6
NexthopInternet *NexthopInternet
}
// NexthopBlackholeAsRouteNexthop is a convenience function that returns NexthopBlackhole wrapped in RouteNexthop
func NexthopBlackholeAsRouteNexthop(v *NexthopBlackhole) RouteNexthop {
return RouteNexthop{
NexthopBlackhole: v,
}
}
// NexthopIPv4AsRouteNexthop is a convenience function that returns NexthopIPv4 wrapped in RouteNexthop
func NexthopIPv4AsRouteNexthop(v *NexthopIPv4) RouteNexthop {
return RouteNexthop{
NexthopIPv4: v,
}
}
// NexthopIPv6AsRouteNexthop is a convenience function that returns NexthopIPv6 wrapped in RouteNexthop
func NexthopIPv6AsRouteNexthop(v *NexthopIPv6) RouteNexthop {
return RouteNexthop{
NexthopIPv6: v,
}
}
// NexthopInternetAsRouteNexthop is a convenience function that returns NexthopInternet wrapped in RouteNexthop
func NexthopInternetAsRouteNexthop(v *NexthopInternet) RouteNexthop {
return RouteNexthop{
NexthopInternet: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *RouteNexthop) UnmarshalJSON(data []byte) error {
var err error
// use discriminator value to speed up the lookup
var jsonDict map[string]interface{}
err = newStrictDecoder(data).Decode(&jsonDict)
if err != nil {
return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup")
}
// check if the discriminator value is 'NexthopBlackhole'
if jsonDict["type"] == "NexthopBlackhole" {
// try to unmarshal JSON data into NexthopBlackhole
err = json.Unmarshal(data, &dst.NexthopBlackhole)
if err == nil {
return nil // data stored in dst.NexthopBlackhole, return on the first match
} else {
dst.NexthopBlackhole = nil
return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopBlackhole: %s", err.Error())
}
}
// check if the discriminator value is 'NexthopIPv4'
if jsonDict["type"] == "NexthopIPv4" {
// try to unmarshal JSON data into NexthopIPv4
err = json.Unmarshal(data, &dst.NexthopIPv4)
if err == nil {
return nil // data stored in dst.NexthopIPv4, return on the first match
} else {
dst.NexthopIPv4 = nil
return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv4: %s", err.Error())
}
}
// check if the discriminator value is 'NexthopIPv6'
if jsonDict["type"] == "NexthopIPv6" {
// try to unmarshal JSON data into NexthopIPv6
err = json.Unmarshal(data, &dst.NexthopIPv6)
if err == nil {
return nil // data stored in dst.NexthopIPv6, return on the first match
} else {
dst.NexthopIPv6 = nil
return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv6: %s", err.Error())
}
}
// check if the discriminator value is 'NexthopInternet'
if jsonDict["type"] == "NexthopInternet" {
// try to unmarshal JSON data into NexthopInternet
err = json.Unmarshal(data, &dst.NexthopInternet)
if err == nil {
return nil // data stored in dst.NexthopInternet, return on the first match
} else {
dst.NexthopInternet = nil
return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopInternet: %s", err.Error())
}
}
// check if the discriminator value is 'blackhole'
if jsonDict["type"] == "blackhole" {
// try to unmarshal JSON data into NexthopBlackhole
err = json.Unmarshal(data, &dst.NexthopBlackhole)
if err == nil {
return nil // data stored in dst.NexthopBlackhole, return on the first match
} else {
dst.NexthopBlackhole = nil
return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopBlackhole: %s", err.Error())
}
}
// check if the discriminator value is 'internet'
if jsonDict["type"] == "internet" {
// try to unmarshal JSON data into NexthopInternet
err = json.Unmarshal(data, &dst.NexthopInternet)
if err == nil {
return nil // data stored in dst.NexthopInternet, return on the first match
} else {
dst.NexthopInternet = nil
return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopInternet: %s", err.Error())
}
}
// check if the discriminator value is 'ipv4'
if jsonDict["type"] == "ipv4" {
// try to unmarshal JSON data into NexthopIPv4
err = json.Unmarshal(data, &dst.NexthopIPv4)
if err == nil {
return nil // data stored in dst.NexthopIPv4, return on the first match
} else {
dst.NexthopIPv4 = nil
return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv4: %s", err.Error())
}
}
// check if the discriminator value is 'ipv6'
if jsonDict["type"] == "ipv6" {
// try to unmarshal JSON data into NexthopIPv6
err = json.Unmarshal(data, &dst.NexthopIPv6)
if err == nil {
return nil // data stored in dst.NexthopIPv6, return on the first match
} else {
dst.NexthopIPv6 = nil
return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv6: %s", err.Error())
}
}
return nil
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src RouteNexthop) MarshalJSON() ([]byte, error) {
if src.NexthopBlackhole != nil {
return json.Marshal(&src.NexthopBlackhole)
}
if src.NexthopIPv4 != nil {
return json.Marshal(&src.NexthopIPv4)
}
if src.NexthopIPv6 != nil {
return json.Marshal(&src.NexthopIPv6)
}
if src.NexthopInternet != nil {
return json.Marshal(&src.NexthopInternet)
}
return []byte("{}"), nil // no data in oneOf schemas => empty JSON object
}
// Get the actual instance
func (obj *RouteNexthop) GetActualInstance() interface{} {
if obj == nil {
return nil
}
if obj.NexthopBlackhole != nil {
return obj.NexthopBlackhole
}
if obj.NexthopIPv4 != nil {
return obj.NexthopIPv4
}
if obj.NexthopIPv6 != nil {
return obj.NexthopIPv6
}
if obj.NexthopInternet != nil {
return obj.NexthopInternet
}
// all schemas are nil
return nil
}
type NullableRouteNexthop struct {
value *RouteNexthop
isSet bool
}
func (v NullableRouteNexthop) Get() *RouteNexthop {
return v.value
}
func (v *NullableRouteNexthop) Set(val *RouteNexthop) {
v.value = val
v.isSet = true
}
func (v NullableRouteNexthop) IsSet() bool {
return v.isSet
}
func (v *NullableRouteNexthop) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRouteNexthop(val *RouteNexthop) *NullableRouteNexthop {
return &NullableRouteNexthop{value: val, isSet: true}
}
func (v NullableRouteNexthop) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRouteNexthop) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,518 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
"time"
)
// checks if the RoutingTable type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RoutingTable{}
/*
types and functions for createdAt
*/
// isDateTime
type RoutingTableGetCreatedAtAttributeType = *time.Time
type RoutingTableGetCreatedAtArgType = time.Time
type RoutingTableGetCreatedAtRetType = time.Time
func getRoutingTableGetCreatedAtAttributeTypeOk(arg RoutingTableGetCreatedAtAttributeType) (ret RoutingTableGetCreatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTableGetCreatedAtAttributeType(arg *RoutingTableGetCreatedAtAttributeType, val RoutingTableGetCreatedAtRetType) {
*arg = &val
}
/*
types and functions for default
*/
// isBoolean
type RoutingTablegetDefaultAttributeType = *bool
type RoutingTablegetDefaultArgType = bool
type RoutingTablegetDefaultRetType = bool
func getRoutingTablegetDefaultAttributeTypeOk(arg RoutingTablegetDefaultAttributeType) (ret RoutingTablegetDefaultRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTablegetDefaultAttributeType(arg *RoutingTablegetDefaultAttributeType, val RoutingTablegetDefaultRetType) {
*arg = &val
}
/*
types and functions for description
*/
// isNotNullableString
type RoutingTableGetDescriptionAttributeType = *string
func getRoutingTableGetDescriptionAttributeTypeOk(arg RoutingTableGetDescriptionAttributeType) (ret RoutingTableGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTableGetDescriptionAttributeType(arg *RoutingTableGetDescriptionAttributeType, val RoutingTableGetDescriptionRetType) {
*arg = &val
}
type RoutingTableGetDescriptionArgType = string
type RoutingTableGetDescriptionRetType = string
/*
types and functions for dynamicRoutes
*/
// isBoolean
type RoutingTablegetDynamicRoutesAttributeType = *bool
type RoutingTablegetDynamicRoutesArgType = bool
type RoutingTablegetDynamicRoutesRetType = bool
func getRoutingTablegetDynamicRoutesAttributeTypeOk(arg RoutingTablegetDynamicRoutesAttributeType) (ret RoutingTablegetDynamicRoutesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTablegetDynamicRoutesAttributeType(arg *RoutingTablegetDynamicRoutesAttributeType, val RoutingTablegetDynamicRoutesRetType) {
*arg = &val
}
/*
types and functions for id
*/
// isNotNullableString
type RoutingTableGetIdAttributeType = *string
func getRoutingTableGetIdAttributeTypeOk(arg RoutingTableGetIdAttributeType) (ret RoutingTableGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTableGetIdAttributeType(arg *RoutingTableGetIdAttributeType, val RoutingTableGetIdRetType) {
*arg = &val
}
type RoutingTableGetIdArgType = string
type RoutingTableGetIdRetType = string
/*
types and functions for labels
*/
// isFreeform
type RoutingTableGetLabelsAttributeType = *map[string]interface{}
type RoutingTableGetLabelsArgType = map[string]interface{}
type RoutingTableGetLabelsRetType = map[string]interface{}
func getRoutingTableGetLabelsAttributeTypeOk(arg RoutingTableGetLabelsAttributeType) (ret RoutingTableGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTableGetLabelsAttributeType(arg *RoutingTableGetLabelsAttributeType, val RoutingTableGetLabelsRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isNotNullableString
type RoutingTableGetNameAttributeType = *string
func getRoutingTableGetNameAttributeTypeOk(arg RoutingTableGetNameAttributeType) (ret RoutingTableGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTableGetNameAttributeType(arg *RoutingTableGetNameAttributeType, val RoutingTableGetNameRetType) {
*arg = &val
}
type RoutingTableGetNameArgType = string
type RoutingTableGetNameRetType = string
/*
types and functions for systemRoutes
*/
// isBoolean
type RoutingTablegetSystemRoutesAttributeType = *bool
type RoutingTablegetSystemRoutesArgType = bool
type RoutingTablegetSystemRoutesRetType = bool
func getRoutingTablegetSystemRoutesAttributeTypeOk(arg RoutingTablegetSystemRoutesAttributeType) (ret RoutingTablegetSystemRoutesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTablegetSystemRoutesAttributeType(arg *RoutingTablegetSystemRoutesAttributeType, val RoutingTablegetSystemRoutesRetType) {
*arg = &val
}
/*
types and functions for updatedAt
*/
// isDateTime
type RoutingTableGetUpdatedAtAttributeType = *time.Time
type RoutingTableGetUpdatedAtArgType = time.Time
type RoutingTableGetUpdatedAtRetType = time.Time
func getRoutingTableGetUpdatedAtAttributeTypeOk(arg RoutingTableGetUpdatedAtAttributeType) (ret RoutingTableGetUpdatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTableGetUpdatedAtAttributeType(arg *RoutingTableGetUpdatedAtAttributeType, val RoutingTableGetUpdatedAtRetType) {
*arg = &val
}
// RoutingTable An object representing a routing table.
type RoutingTable struct {
// Date-time when resource was created.
CreatedAt RoutingTableGetCreatedAtAttributeType `json:"createdAt,omitempty"`
// This is the default routing table. It can't be deleted and is used if the user does not specify it otherwise.
Default RoutingTablegetDefaultAttributeType `json:"default,omitempty"`
// Description Object. Allows string up to 255 Characters.
Description RoutingTableGetDescriptionAttributeType `json:"description,omitempty"`
// A config setting for a routing table which allows propagation of dynamic routes to this routing table.
DynamicRoutes RoutingTablegetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"`
// Universally Unique Identifier (UUID).
Id RoutingTableGetIdAttributeType `json:"id,omitempty"`
// Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key.
Labels RoutingTableGetLabelsAttributeType `json:"labels,omitempty"`
// The name for a General Object. Matches Names and also UUIDs.
// REQUIRED
Name RoutingTableGetNameAttributeType `json:"name" required:"true"`
// A config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA.
SystemRoutes RoutingTablegetSystemRoutesAttributeType `json:"systemRoutes,omitempty"`
// Date-time when resource was last updated.
UpdatedAt RoutingTableGetUpdatedAtAttributeType `json:"updatedAt,omitempty"`
}
type _RoutingTable RoutingTable
// NewRoutingTable instantiates a new RoutingTable 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 NewRoutingTable(name RoutingTableGetNameArgType) *RoutingTable {
this := RoutingTable{}
setRoutingTableGetNameAttributeType(&this.Name, name)
return &this
}
// NewRoutingTableWithDefaults instantiates a new RoutingTable 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 NewRoutingTableWithDefaults() *RoutingTable {
this := RoutingTable{}
var dynamicRoutes bool = true
this.DynamicRoutes = &dynamicRoutes
var systemRoutes bool = true
this.SystemRoutes = &systemRoutes
return &this
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *RoutingTable) GetCreatedAt() (res RoutingTableGetCreatedAtRetType) {
res, _ = o.GetCreatedAtOk()
return
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RoutingTable) GetCreatedAtOk() (ret RoutingTableGetCreatedAtRetType, ok bool) {
return getRoutingTableGetCreatedAtAttributeTypeOk(o.CreatedAt)
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *RoutingTable) HasCreatedAt() bool {
_, ok := o.GetCreatedAtOk()
return ok
}
// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field.
func (o *RoutingTable) SetCreatedAt(v RoutingTableGetCreatedAtRetType) {
setRoutingTableGetCreatedAtAttributeType(&o.CreatedAt, v)
}
// GetDefault returns the Default field value if set, zero value otherwise.
func (o *RoutingTable) GetDefault() (res RoutingTablegetDefaultRetType) {
res, _ = o.GetDefaultOk()
return
}
// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RoutingTable) GetDefaultOk() (ret RoutingTablegetDefaultRetType, ok bool) {
return getRoutingTablegetDefaultAttributeTypeOk(o.Default)
}
// HasDefault returns a boolean if a field has been set.
func (o *RoutingTable) HasDefault() bool {
_, ok := o.GetDefaultOk()
return ok
}
// SetDefault gets a reference to the given bool and assigns it to the Default field.
func (o *RoutingTable) SetDefault(v RoutingTablegetDefaultRetType) {
setRoutingTablegetDefaultAttributeType(&o.Default, v)
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *RoutingTable) GetDescription() (res RoutingTableGetDescriptionRetType) {
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 *RoutingTable) GetDescriptionOk() (ret RoutingTableGetDescriptionRetType, ok bool) {
return getRoutingTableGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *RoutingTable) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *RoutingTable) SetDescription(v RoutingTableGetDescriptionRetType) {
setRoutingTableGetDescriptionAttributeType(&o.Description, v)
}
// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise.
func (o *RoutingTable) GetDynamicRoutes() (res RoutingTablegetDynamicRoutesRetType) {
res, _ = o.GetDynamicRoutesOk()
return
}
// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RoutingTable) GetDynamicRoutesOk() (ret RoutingTablegetDynamicRoutesRetType, ok bool) {
return getRoutingTablegetDynamicRoutesAttributeTypeOk(o.DynamicRoutes)
}
// HasDynamicRoutes returns a boolean if a field has been set.
func (o *RoutingTable) HasDynamicRoutes() bool {
_, ok := o.GetDynamicRoutesOk()
return ok
}
// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field.
func (o *RoutingTable) SetDynamicRoutes(v RoutingTablegetDynamicRoutesRetType) {
setRoutingTablegetDynamicRoutesAttributeType(&o.DynamicRoutes, v)
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *RoutingTable) GetId() (res RoutingTableGetIdRetType) {
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 *RoutingTable) GetIdOk() (ret RoutingTableGetIdRetType, ok bool) {
return getRoutingTableGetIdAttributeTypeOk(o.Id)
}
// HasId returns a boolean if a field has been set.
func (o *RoutingTable) HasId() bool {
_, ok := o.GetIdOk()
return ok
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *RoutingTable) SetId(v RoutingTableGetIdRetType) {
setRoutingTableGetIdAttributeType(&o.Id, v)
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *RoutingTable) GetLabels() (res RoutingTableGetLabelsRetType) {
res, _ = o.GetLabelsOk()
return
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RoutingTable) GetLabelsOk() (ret RoutingTableGetLabelsRetType, ok bool) {
return getRoutingTableGetLabelsAttributeTypeOk(o.Labels)
}
// HasLabels returns a boolean if a field has been set.
func (o *RoutingTable) HasLabels() bool {
_, ok := o.GetLabelsOk()
return ok
}
// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field.
func (o *RoutingTable) SetLabels(v RoutingTableGetLabelsRetType) {
setRoutingTableGetLabelsAttributeType(&o.Labels, v)
}
// GetName returns the Name field value
func (o *RoutingTable) GetName() (ret RoutingTableGetNameRetType) {
ret, _ = o.GetNameOk()
return ret
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *RoutingTable) GetNameOk() (ret RoutingTableGetNameRetType, ok bool) {
return getRoutingTableGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *RoutingTable) SetName(v RoutingTableGetNameRetType) {
setRoutingTableGetNameAttributeType(&o.Name, v)
}
// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise.
func (o *RoutingTable) GetSystemRoutes() (res RoutingTablegetSystemRoutesRetType) {
res, _ = o.GetSystemRoutesOk()
return
}
// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RoutingTable) GetSystemRoutesOk() (ret RoutingTablegetSystemRoutesRetType, ok bool) {
return getRoutingTablegetSystemRoutesAttributeTypeOk(o.SystemRoutes)
}
// HasSystemRoutes returns a boolean if a field has been set.
func (o *RoutingTable) HasSystemRoutes() bool {
_, ok := o.GetSystemRoutesOk()
return ok
}
// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field.
func (o *RoutingTable) SetSystemRoutes(v RoutingTablegetSystemRoutesRetType) {
setRoutingTablegetSystemRoutesAttributeType(&o.SystemRoutes, v)
}
// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *RoutingTable) GetUpdatedAt() (res RoutingTableGetUpdatedAtRetType) {
res, _ = o.GetUpdatedAtOk()
return
}
// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RoutingTable) GetUpdatedAtOk() (ret RoutingTableGetUpdatedAtRetType, ok bool) {
return getRoutingTableGetUpdatedAtAttributeTypeOk(o.UpdatedAt)
}
// HasUpdatedAt returns a boolean if a field has been set.
func (o *RoutingTable) HasUpdatedAt() bool {
_, ok := o.GetUpdatedAtOk()
return ok
}
// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field.
func (o *RoutingTable) SetUpdatedAt(v RoutingTableGetUpdatedAtRetType) {
setRoutingTableGetUpdatedAtAttributeType(&o.UpdatedAt, v)
}
func (o RoutingTable) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getRoutingTableGetCreatedAtAttributeTypeOk(o.CreatedAt); ok {
toSerialize["CreatedAt"] = val
}
if val, ok := getRoutingTablegetDefaultAttributeTypeOk(o.Default); ok {
toSerialize["Default"] = val
}
if val, ok := getRoutingTableGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getRoutingTablegetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok {
toSerialize["DynamicRoutes"] = val
}
if val, ok := getRoutingTableGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getRoutingTableGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
if val, ok := getRoutingTableGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getRoutingTablegetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok {
toSerialize["SystemRoutes"] = val
}
if val, ok := getRoutingTableGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok {
toSerialize["UpdatedAt"] = val
}
return toSerialize, nil
}
type NullableRoutingTable struct {
value *RoutingTable
isSet bool
}
func (v NullableRoutingTable) Get() *RoutingTable {
return v.value
}
func (v *NullableRoutingTable) Set(val *RoutingTable) {
v.value = val
v.isSet = true
}
func (v NullableRoutingTable) IsSet() bool {
return v.isSet
}
func (v *NullableRoutingTable) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRoutingTable(val *RoutingTable) *NullableRoutingTable {
return &NullableRoutingTable{value: val, isSet: true}
}
func (v NullableRoutingTable) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRoutingTable) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,126 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the RoutingTableListResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RoutingTableListResponse{}
/*
types and functions for items
*/
// isArray
type RoutingTableListResponseGetItemsAttributeType = *[]RoutingTable
type RoutingTableListResponseGetItemsArgType = []RoutingTable
type RoutingTableListResponseGetItemsRetType = []RoutingTable
func getRoutingTableListResponseGetItemsAttributeTypeOk(arg RoutingTableListResponseGetItemsAttributeType) (ret RoutingTableListResponseGetItemsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRoutingTableListResponseGetItemsAttributeType(arg *RoutingTableListResponseGetItemsAttributeType, val RoutingTableListResponseGetItemsRetType) {
*arg = &val
}
// RoutingTableListResponse Routing table response.
type RoutingTableListResponse struct {
// A list of routing tables.
// REQUIRED
Items RoutingTableListResponseGetItemsAttributeType `json:"items" required:"true"`
}
type _RoutingTableListResponse RoutingTableListResponse
// NewRoutingTableListResponse instantiates a new RoutingTableListResponse 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 NewRoutingTableListResponse(items RoutingTableListResponseGetItemsArgType) *RoutingTableListResponse {
this := RoutingTableListResponse{}
setRoutingTableListResponseGetItemsAttributeType(&this.Items, items)
return &this
}
// NewRoutingTableListResponseWithDefaults instantiates a new RoutingTableListResponse 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 NewRoutingTableListResponseWithDefaults() *RoutingTableListResponse {
this := RoutingTableListResponse{}
return &this
}
// GetItems returns the Items field value
func (o *RoutingTableListResponse) GetItems() (ret RoutingTableListResponseGetItemsRetType) {
ret, _ = o.GetItemsOk()
return ret
}
// GetItemsOk returns a tuple with the Items field value
// and a boolean to check if the value has been set.
func (o *RoutingTableListResponse) GetItemsOk() (ret RoutingTableListResponseGetItemsRetType, ok bool) {
return getRoutingTableListResponseGetItemsAttributeTypeOk(o.Items)
}
// SetItems sets field value
func (o *RoutingTableListResponse) SetItems(v RoutingTableListResponseGetItemsRetType) {
setRoutingTableListResponseGetItemsAttributeType(&o.Items, v)
}
func (o RoutingTableListResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getRoutingTableListResponseGetItemsAttributeTypeOk(o.Items); ok {
toSerialize["Items"] = val
}
return toSerialize, nil
}
type NullableRoutingTableListResponse struct {
value *RoutingTableListResponse
isSet bool
}
func (v NullableRoutingTableListResponse) Get() *RoutingTableListResponse {
return v.value
}
func (v *NullableRoutingTableListResponse) Set(val *RoutingTableListResponse) {
v.value = val
v.isSet = true
}
func (v NullableRoutingTableListResponse) IsSet() bool {
return v.isSet
}
func (v *NullableRoutingTableListResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRoutingTableListResponse(val *RoutingTableListResponse) *NullableRoutingTableListResponse {
return &NullableRoutingTableListResponse{value: val, isSet: true}
}
func (v NullableRoutingTableListResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRoutingTableListResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,192 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the UpdateNetworkIPv4Body type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateNetworkIPv4Body{}
/*
types and functions for gateway
*/
// isNullableString
type UpdateNetworkIPv4BodyGetGatewayAttributeType = *NullableString
func getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(arg UpdateNetworkIPv4BodyGetGatewayAttributeType) (ret UpdateNetworkIPv4BodyGetGatewayRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg.Get(), true
}
func setUpdateNetworkIPv4BodyGetGatewayAttributeType(arg *UpdateNetworkIPv4BodyGetGatewayAttributeType, val UpdateNetworkIPv4BodyGetGatewayRetType) {
if IsNil(*arg) {
*arg = NewNullableString(val)
} else {
(*arg).Set(val)
}
}
type UpdateNetworkIPv4BodyGetGatewayArgType = *string
type UpdateNetworkIPv4BodyGetGatewayRetType = *string
/*
types and functions for nameservers
*/
// isArray
type UpdateNetworkIPv4BodyGetNameserversAttributeType = *[]string
type UpdateNetworkIPv4BodyGetNameserversArgType = []string
type UpdateNetworkIPv4BodyGetNameserversRetType = []string
func getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(arg UpdateNetworkIPv4BodyGetNameserversAttributeType) (ret UpdateNetworkIPv4BodyGetNameserversRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateNetworkIPv4BodyGetNameserversAttributeType(arg *UpdateNetworkIPv4BodyGetNameserversAttributeType, val UpdateNetworkIPv4BodyGetNameserversRetType) {
*arg = &val
}
// UpdateNetworkIPv4Body The config object for a IPv4 network update.
type UpdateNetworkIPv4Body struct {
// The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway.
Gateway UpdateNetworkIPv4BodyGetGatewayAttributeType `json:"gateway,omitempty"`
// A list containing DNS Servers/Nameservers for IPv4.
Nameservers UpdateNetworkIPv4BodyGetNameserversAttributeType `json:"nameservers,omitempty"`
}
// NewUpdateNetworkIPv4Body instantiates a new UpdateNetworkIPv4Body 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 NewUpdateNetworkIPv4Body() *UpdateNetworkIPv4Body {
this := UpdateNetworkIPv4Body{}
return &this
}
// NewUpdateNetworkIPv4BodyWithDefaults instantiates a new UpdateNetworkIPv4Body 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 NewUpdateNetworkIPv4BodyWithDefaults() *UpdateNetworkIPv4Body {
this := UpdateNetworkIPv4Body{}
return &this
}
// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *UpdateNetworkIPv4Body) GetGateway() (res UpdateNetworkIPv4BodyGetGatewayRetType) {
res, _ = o.GetGatewayOk()
return
}
// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateNetworkIPv4Body) GetGatewayOk() (ret UpdateNetworkIPv4BodyGetGatewayRetType, ok bool) {
return getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway)
}
// HasGateway returns a boolean if a field has been set.
func (o *UpdateNetworkIPv4Body) HasGateway() bool {
_, ok := o.GetGatewayOk()
return ok
}
// SetGateway gets a reference to the given string and assigns it to the Gateway field.
func (o *UpdateNetworkIPv4Body) SetGateway(v UpdateNetworkIPv4BodyGetGatewayRetType) {
setUpdateNetworkIPv4BodyGetGatewayAttributeType(&o.Gateway, v)
}
// SetGatewayNil sets the value for Gateway to be an explicit nil
func (o *UpdateNetworkIPv4Body) SetGatewayNil() {
o.Gateway = nil
}
// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil
func (o *UpdateNetworkIPv4Body) UnsetGateway() {
o.Gateway = nil
}
// GetNameservers returns the Nameservers field value if set, zero value otherwise.
func (o *UpdateNetworkIPv4Body) GetNameservers() (res UpdateNetworkIPv4BodyGetNameserversRetType) {
res, _ = o.GetNameserversOk()
return
}
// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateNetworkIPv4Body) GetNameserversOk() (ret UpdateNetworkIPv4BodyGetNameserversRetType, ok bool) {
return getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers)
}
// HasNameservers returns a boolean if a field has been set.
func (o *UpdateNetworkIPv4Body) HasNameservers() bool {
_, ok := o.GetNameserversOk()
return ok
}
// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field.
func (o *UpdateNetworkIPv4Body) SetNameservers(v UpdateNetworkIPv4BodyGetNameserversRetType) {
setUpdateNetworkIPv4BodyGetNameserversAttributeType(&o.Nameservers, v)
}
func (o UpdateNetworkIPv4Body) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway); ok {
toSerialize["Gateway"] = val
}
if val, ok := getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers); ok {
toSerialize["Nameservers"] = val
}
return toSerialize, nil
}
type NullableUpdateNetworkIPv4Body struct {
value *UpdateNetworkIPv4Body
isSet bool
}
func (v NullableUpdateNetworkIPv4Body) Get() *UpdateNetworkIPv4Body {
return v.value
}
func (v *NullableUpdateNetworkIPv4Body) Set(val *UpdateNetworkIPv4Body) {
v.value = val
v.isSet = true
}
func (v NullableUpdateNetworkIPv4Body) IsSet() bool {
return v.isSet
}
func (v *NullableUpdateNetworkIPv4Body) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUpdateNetworkIPv4Body(val *UpdateNetworkIPv4Body) *NullableUpdateNetworkIPv4Body {
return &NullableUpdateNetworkIPv4Body{value: val, isSet: true}
}
func (v NullableUpdateNetworkIPv4Body) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUpdateNetworkIPv4Body) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,192 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the UpdateNetworkIPv6Body type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateNetworkIPv6Body{}
/*
types and functions for gateway
*/
// isNullableString
type UpdateNetworkIPv6BodyGetGatewayAttributeType = *NullableString
func getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(arg UpdateNetworkIPv6BodyGetGatewayAttributeType) (ret UpdateNetworkIPv6BodyGetGatewayRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg.Get(), true
}
func setUpdateNetworkIPv6BodyGetGatewayAttributeType(arg *UpdateNetworkIPv6BodyGetGatewayAttributeType, val UpdateNetworkIPv6BodyGetGatewayRetType) {
if IsNil(*arg) {
*arg = NewNullableString(val)
} else {
(*arg).Set(val)
}
}
type UpdateNetworkIPv6BodyGetGatewayArgType = *string
type UpdateNetworkIPv6BodyGetGatewayRetType = *string
/*
types and functions for nameservers
*/
// isArray
type UpdateNetworkIPv6BodyGetNameserversAttributeType = *[]string
type UpdateNetworkIPv6BodyGetNameserversArgType = []string
type UpdateNetworkIPv6BodyGetNameserversRetType = []string
func getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(arg UpdateNetworkIPv6BodyGetNameserversAttributeType) (ret UpdateNetworkIPv6BodyGetNameserversRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateNetworkIPv6BodyGetNameserversAttributeType(arg *UpdateNetworkIPv6BodyGetNameserversAttributeType, val UpdateNetworkIPv6BodyGetNameserversRetType) {
*arg = &val
}
// UpdateNetworkIPv6Body The config object for a IPv6 network update.
type UpdateNetworkIPv6Body struct {
// The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway.
Gateway UpdateNetworkIPv6BodyGetGatewayAttributeType `json:"gateway,omitempty"`
// A list containing DNS Servers/Nameservers for IPv6.
Nameservers UpdateNetworkIPv6BodyGetNameserversAttributeType `json:"nameservers,omitempty"`
}
// NewUpdateNetworkIPv6Body instantiates a new UpdateNetworkIPv6Body 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 NewUpdateNetworkIPv6Body() *UpdateNetworkIPv6Body {
this := UpdateNetworkIPv6Body{}
return &this
}
// NewUpdateNetworkIPv6BodyWithDefaults instantiates a new UpdateNetworkIPv6Body 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 NewUpdateNetworkIPv6BodyWithDefaults() *UpdateNetworkIPv6Body {
this := UpdateNetworkIPv6Body{}
return &this
}
// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *UpdateNetworkIPv6Body) GetGateway() (res UpdateNetworkIPv6BodyGetGatewayRetType) {
res, _ = o.GetGatewayOk()
return
}
// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateNetworkIPv6Body) GetGatewayOk() (ret UpdateNetworkIPv6BodyGetGatewayRetType, ok bool) {
return getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway)
}
// HasGateway returns a boolean if a field has been set.
func (o *UpdateNetworkIPv6Body) HasGateway() bool {
_, ok := o.GetGatewayOk()
return ok
}
// SetGateway gets a reference to the given string and assigns it to the Gateway field.
func (o *UpdateNetworkIPv6Body) SetGateway(v UpdateNetworkIPv6BodyGetGatewayRetType) {
setUpdateNetworkIPv6BodyGetGatewayAttributeType(&o.Gateway, v)
}
// SetGatewayNil sets the value for Gateway to be an explicit nil
func (o *UpdateNetworkIPv6Body) SetGatewayNil() {
o.Gateway = nil
}
// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil
func (o *UpdateNetworkIPv6Body) UnsetGateway() {
o.Gateway = nil
}
// GetNameservers returns the Nameservers field value if set, zero value otherwise.
func (o *UpdateNetworkIPv6Body) GetNameservers() (res UpdateNetworkIPv6BodyGetNameserversRetType) {
res, _ = o.GetNameserversOk()
return
}
// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateNetworkIPv6Body) GetNameserversOk() (ret UpdateNetworkIPv6BodyGetNameserversRetType, ok bool) {
return getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers)
}
// HasNameservers returns a boolean if a field has been set.
func (o *UpdateNetworkIPv6Body) HasNameservers() bool {
_, ok := o.GetNameserversOk()
return ok
}
// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field.
func (o *UpdateNetworkIPv6Body) SetNameservers(v UpdateNetworkIPv6BodyGetNameserversRetType) {
setUpdateNetworkIPv6BodyGetNameserversAttributeType(&o.Nameservers, v)
}
func (o UpdateNetworkIPv6Body) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway); ok {
toSerialize["Gateway"] = val
}
if val, ok := getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers); ok {
toSerialize["Nameservers"] = val
}
return toSerialize, nil
}
type NullableUpdateNetworkIPv6Body struct {
value *UpdateNetworkIPv6Body
isSet bool
}
func (v NullableUpdateNetworkIPv6Body) Get() *UpdateNetworkIPv6Body {
return v.value
}
func (v *NullableUpdateNetworkIPv6Body) Set(val *UpdateNetworkIPv6Body) {
v.value = val
v.isSet = true
}
func (v NullableUpdateNetworkIPv6Body) IsSet() bool {
return v.isSet
}
func (v *NullableUpdateNetworkIPv6Body) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUpdateNetworkIPv6Body(val *UpdateNetworkIPv6Body) *NullableUpdateNetworkIPv6Body {
return &NullableUpdateNetworkIPv6Body{value: val, isSet: true}
}
func (v NullableUpdateNetworkIPv6Body) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUpdateNetworkIPv6Body) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,128 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the UpdateRouteOfRoutingTablePayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateRouteOfRoutingTablePayload{}
/*
types and functions for labels
*/
// isFreeform
type UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType = *map[string]interface{}
type UpdateRouteOfRoutingTablePayloadGetLabelsArgType = map[string]interface{}
type UpdateRouteOfRoutingTablePayloadGetLabelsRetType = map[string]interface{}
func getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(arg UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType) (ret UpdateRouteOfRoutingTablePayloadGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateRouteOfRoutingTablePayloadGetLabelsAttributeType(arg *UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType, val UpdateRouteOfRoutingTablePayloadGetLabelsRetType) {
*arg = &val
}
// UpdateRouteOfRoutingTablePayload Object that represents the request body for a route update.
type UpdateRouteOfRoutingTablePayload struct {
// Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key.
Labels UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType `json:"labels,omitempty"`
}
// NewUpdateRouteOfRoutingTablePayload instantiates a new UpdateRouteOfRoutingTablePayload 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 NewUpdateRouteOfRoutingTablePayload() *UpdateRouteOfRoutingTablePayload {
this := UpdateRouteOfRoutingTablePayload{}
return &this
}
// NewUpdateRouteOfRoutingTablePayloadWithDefaults instantiates a new UpdateRouteOfRoutingTablePayload 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 NewUpdateRouteOfRoutingTablePayloadWithDefaults() *UpdateRouteOfRoutingTablePayload {
this := UpdateRouteOfRoutingTablePayload{}
return &this
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *UpdateRouteOfRoutingTablePayload) GetLabels() (res UpdateRouteOfRoutingTablePayloadGetLabelsRetType) {
res, _ = o.GetLabelsOk()
return
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateRouteOfRoutingTablePayload) GetLabelsOk() (ret UpdateRouteOfRoutingTablePayloadGetLabelsRetType, ok bool) {
return getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(o.Labels)
}
// HasLabels returns a boolean if a field has been set.
func (o *UpdateRouteOfRoutingTablePayload) HasLabels() bool {
_, ok := o.GetLabelsOk()
return ok
}
// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field.
func (o *UpdateRouteOfRoutingTablePayload) SetLabels(v UpdateRouteOfRoutingTablePayloadGetLabelsRetType) {
setUpdateRouteOfRoutingTablePayloadGetLabelsAttributeType(&o.Labels, v)
}
func (o UpdateRouteOfRoutingTablePayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
return toSerialize, nil
}
type NullableUpdateRouteOfRoutingTablePayload struct {
value *UpdateRouteOfRoutingTablePayload
isSet bool
}
func (v NullableUpdateRouteOfRoutingTablePayload) Get() *UpdateRouteOfRoutingTablePayload {
return v.value
}
func (v *NullableUpdateRouteOfRoutingTablePayload) Set(val *UpdateRouteOfRoutingTablePayload) {
v.value = val
v.isSet = true
}
func (v NullableUpdateRouteOfRoutingTablePayload) IsSet() bool {
return v.isSet
}
func (v *NullableUpdateRouteOfRoutingTablePayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUpdateRouteOfRoutingTablePayload(val *UpdateRouteOfRoutingTablePayload) *NullableUpdateRouteOfRoutingTablePayload {
return &NullableUpdateRouteOfRoutingTablePayload{value: val, isSet: true}
}
func (v NullableUpdateRouteOfRoutingTablePayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUpdateRouteOfRoutingTablePayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

View file

@ -0,0 +1,322 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
import (
"encoding/json"
)
// checks if the UpdateRoutingTableOfAreaPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateRoutingTableOfAreaPayload{}
/*
types and functions for description
*/
// isNotNullableString
type UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType = *string
func getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType, val UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) {
*arg = &val
}
type UpdateRoutingTableOfAreaPayloadGetDescriptionArgType = string
type UpdateRoutingTableOfAreaPayloadGetDescriptionRetType = string
/*
types and functions for dynamicRoutes
*/
// isBoolean
type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType = *bool
type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesArgType = bool
type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType = bool
func getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType) (ret UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType(arg *UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType, val UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) {
*arg = &val
}
/*
types and functions for labels
*/
// isFreeform
type UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType = *map[string]interface{}
type UpdateRoutingTableOfAreaPayloadGetLabelsArgType = map[string]interface{}
type UpdateRoutingTableOfAreaPayloadGetLabelsRetType = map[string]interface{}
func getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateRoutingTableOfAreaPayloadGetLabelsAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType, val UpdateRoutingTableOfAreaPayloadGetLabelsRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isNotNullableString
type UpdateRoutingTableOfAreaPayloadGetNameAttributeType = *string
func getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetNameAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateRoutingTableOfAreaPayloadGetNameAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetNameAttributeType, val UpdateRoutingTableOfAreaPayloadGetNameRetType) {
*arg = &val
}
type UpdateRoutingTableOfAreaPayloadGetNameArgType = string
type UpdateRoutingTableOfAreaPayloadGetNameRetType = string
/*
types and functions for systemRoutes
*/
// isBoolean
type UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType = *bool
type UpdateRoutingTableOfAreaPayloadgetSystemRoutesArgType = bool
type UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType = bool
func getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType) (ret UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType(arg *UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType, val UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) {
*arg = &val
}
// UpdateRoutingTableOfAreaPayload Object that represents the request body for a routing table update.
type UpdateRoutingTableOfAreaPayload struct {
// Description Object. Allows string up to 255 Characters.
Description UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType `json:"description,omitempty"`
// The update config setting for a routing table which allows propagation of dynamic routes to this routing table.
DynamicRoutes UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"`
// Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key.
Labels UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"`
// The name for a General Object. Matches Names and also UUIDs.
Name UpdateRoutingTableOfAreaPayloadGetNameAttributeType `json:"name,omitempty"`
// The update config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA.
SystemRoutes UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType `json:"systemRoutes,omitempty"`
}
// NewUpdateRoutingTableOfAreaPayload instantiates a new UpdateRoutingTableOfAreaPayload 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 NewUpdateRoutingTableOfAreaPayload() *UpdateRoutingTableOfAreaPayload {
this := UpdateRoutingTableOfAreaPayload{}
return &this
}
// NewUpdateRoutingTableOfAreaPayloadWithDefaults instantiates a new UpdateRoutingTableOfAreaPayload 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 NewUpdateRoutingTableOfAreaPayloadWithDefaults() *UpdateRoutingTableOfAreaPayload {
this := UpdateRoutingTableOfAreaPayload{}
return &this
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *UpdateRoutingTableOfAreaPayload) GetDescription() (res UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) {
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 *UpdateRoutingTableOfAreaPayload) GetDescriptionOk() (ret UpdateRoutingTableOfAreaPayloadGetDescriptionRetType, ok bool) {
return getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *UpdateRoutingTableOfAreaPayload) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *UpdateRoutingTableOfAreaPayload) SetDescription(v UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) {
setUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType(&o.Description, v)
}
// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise.
func (o *UpdateRoutingTableOfAreaPayload) GetDynamicRoutes() (res UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) {
res, _ = o.GetDynamicRoutesOk()
return
}
// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateRoutingTableOfAreaPayload) GetDynamicRoutesOk() (ret UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType, ok bool) {
return getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes)
}
// HasDynamicRoutes returns a boolean if a field has been set.
func (o *UpdateRoutingTableOfAreaPayload) HasDynamicRoutes() bool {
_, ok := o.GetDynamicRoutesOk()
return ok
}
// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field.
func (o *UpdateRoutingTableOfAreaPayload) SetDynamicRoutes(v UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) {
setUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType(&o.DynamicRoutes, v)
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *UpdateRoutingTableOfAreaPayload) GetLabels() (res UpdateRoutingTableOfAreaPayloadGetLabelsRetType) {
res, _ = o.GetLabelsOk()
return
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateRoutingTableOfAreaPayload) GetLabelsOk() (ret UpdateRoutingTableOfAreaPayloadGetLabelsRetType, ok bool) {
return getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels)
}
// HasLabels returns a boolean if a field has been set.
func (o *UpdateRoutingTableOfAreaPayload) HasLabels() bool {
_, ok := o.GetLabelsOk()
return ok
}
// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field.
func (o *UpdateRoutingTableOfAreaPayload) SetLabels(v UpdateRoutingTableOfAreaPayloadGetLabelsRetType) {
setUpdateRoutingTableOfAreaPayloadGetLabelsAttributeType(&o.Labels, v)
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *UpdateRoutingTableOfAreaPayload) GetName() (res UpdateRoutingTableOfAreaPayloadGetNameRetType) {
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 *UpdateRoutingTableOfAreaPayload) GetNameOk() (ret UpdateRoutingTableOfAreaPayloadGetNameRetType, ok bool) {
return getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(o.Name)
}
// HasName returns a boolean if a field has been set.
func (o *UpdateRoutingTableOfAreaPayload) HasName() bool {
_, ok := o.GetNameOk()
return ok
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *UpdateRoutingTableOfAreaPayload) SetName(v UpdateRoutingTableOfAreaPayloadGetNameRetType) {
setUpdateRoutingTableOfAreaPayloadGetNameAttributeType(&o.Name, v)
}
// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise.
func (o *UpdateRoutingTableOfAreaPayload) GetSystemRoutes() (res UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) {
res, _ = o.GetSystemRoutesOk()
return
}
// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateRoutingTableOfAreaPayload) GetSystemRoutesOk() (ret UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType, ok bool) {
return getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes)
}
// HasSystemRoutes returns a boolean if a field has been set.
func (o *UpdateRoutingTableOfAreaPayload) HasSystemRoutes() bool {
_, ok := o.GetSystemRoutesOk()
return ok
}
// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field.
func (o *UpdateRoutingTableOfAreaPayload) SetSystemRoutes(v UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) {
setUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType(&o.SystemRoutes, v)
}
func (o UpdateRoutingTableOfAreaPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok {
toSerialize["DynamicRoutes"] = val
}
if val, ok := getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
if val, ok := getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok {
toSerialize["SystemRoutes"] = val
}
return toSerialize, nil
}
type NullableUpdateRoutingTableOfAreaPayload struct {
value *UpdateRoutingTableOfAreaPayload
isSet bool
}
func (v NullableUpdateRoutingTableOfAreaPayload) Get() *UpdateRoutingTableOfAreaPayload {
return v.value
}
func (v *NullableUpdateRoutingTableOfAreaPayload) Set(val *UpdateRoutingTableOfAreaPayload) {
v.value = val
v.isSet = true
}
func (v NullableUpdateRoutingTableOfAreaPayload) IsSet() bool {
return v.isSet
}
func (v *NullableUpdateRoutingTableOfAreaPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUpdateRoutingTableOfAreaPayload(val *UpdateRoutingTableOfAreaPayload) *NullableUpdateRoutingTableOfAreaPayload {
return &NullableUpdateRoutingTableOfAreaPayload{value: val, isSet: true}
}
func (v NullableUpdateRoutingTableOfAreaPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUpdateRoutingTableOfAreaPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha

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

@ -0,0 +1,385 @@
/*
STACKIT IaaS API
This API allows you to create and modify IaaS resources.
API version: 2alpha1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package iaasalpha
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)
}

View file

@ -0,0 +1,85 @@
package wait
import (
"context"
"errors"
"fmt"
"net/http"
"time"
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
"github.com/stackitcloud/stackit-sdk-go/core/wait"
"github.com/stackitcloud/stackit-sdk-go/services/iaasalpha"
)
const (
CreateSuccess = "CREATED"
)
// Interfaces needed for tests
type APIClientInterface interface {
GetNetworkExecute(ctx context.Context, projectId, region, networkId string) (*iaasalpha.Network, error)
}
// CreateNetworkWaitHandler will wait for network creation using network id
func CreateNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, region, networkId string) *wait.AsyncActionHandler[iaasalpha.Network] {
handler := wait.New(func() (waitFinished bool, response *iaasalpha.Network, err error) {
network, err := a.GetNetworkExecute(ctx, projectId, region, networkId)
if err != nil {
return false, network, err
}
if network.Id == nil || network.Status == nil {
return false, network, fmt.Errorf("create failed for network with id %s, the response is not valid: the id or the state are missing", networkId)
}
// The state returns to "CREATED" after a successful creation is completed
if *network.Id == networkId && *network.Status == CreateSuccess {
return true, network, nil
}
return false, network, nil
})
handler.SetSleepBeforeWait(2 * time.Second)
handler.SetTimeout(15 * time.Minute)
return handler
}
// UpdateNetworkWaitHandler will wait for network update
func UpdateNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, region, networkId string) *wait.AsyncActionHandler[iaasalpha.Network] {
handler := wait.New(func() (waitFinished bool, response *iaasalpha.Network, err error) {
network, err := a.GetNetworkExecute(ctx, projectId, region, networkId)
if err != nil {
return false, network, err
}
if network.Id == nil || network.Status == nil {
return false, network, fmt.Errorf("update failed for network with id %s, the response is not valid: the id or the state are missing", networkId)
}
// The state returns to "CREATED" after a successful update is completed
if *network.Id == networkId && *network.Status == CreateSuccess {
return true, network, nil
}
return false, network, nil
})
handler.SetSleepBeforeWait(2 * time.Second)
handler.SetTimeout(15 * time.Minute)
return handler
}
// DeleteNetworkWaitHandler will wait for network deletion
func DeleteNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, region, networkId string) *wait.AsyncActionHandler[iaasalpha.Network] {
handler := wait.New(func() (waitFinished bool, response *iaasalpha.Network, err error) {
network, err := a.GetNetworkExecute(ctx, projectId, region, networkId)
if err == nil {
return false, nil, nil
}
var oapiErr *oapierror.GenericOpenAPIError
ok := errors.As(err, &oapiErr)
if !ok {
return false, network, fmt.Errorf("could not convert error to oapierror.GenericOpenAPIError: %w", err)
}
if oapiErr.StatusCode != http.StatusNotFound {
return false, network, err
}
return true, nil, nil
})
handler.SetTimeout(15 * time.Minute)
return handler
}

View file

@ -0,0 +1,216 @@
package wait
import (
"context"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
"github.com/stackitcloud/stackit-sdk-go/core/utils"
"github.com/stackitcloud/stackit-sdk-go/services/iaasalpha"
)
type apiClientMocked struct {
getNetworkFails bool
isDeleted bool
resourceState string
}
func (a *apiClientMocked) GetNetworkExecute(_ context.Context, _, _, _ string) (*iaasalpha.Network, error) {
if a.isDeleted {
return nil, &oapierror.GenericOpenAPIError{
StatusCode: 404,
}
}
if a.getNetworkFails {
return nil, &oapierror.GenericOpenAPIError{
StatusCode: 500,
}
}
return &iaasalpha.Network{
Id: utils.Ptr("nid"),
Status: &a.resourceState,
}, nil
}
func TestCreateNetworkWaitHandler(t *testing.T) {
tests := []struct {
desc string
getFails bool
resourceState string
wantErr bool
wantResp bool
}{
{
desc: "create_succeeded",
getFails: false,
resourceState: CreateSuccess,
wantErr: false,
wantResp: true,
},
{
desc: "get_fails",
getFails: true,
resourceState: "",
wantErr: true,
wantResp: false,
},
{
desc: "timeout",
getFails: false,
resourceState: "ANOTHER STATE",
wantErr: true,
wantResp: true,
},
}
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
apiClient := &apiClientMocked{
getNetworkFails: tt.getFails,
resourceState: tt.resourceState,
}
var wantRes *iaasalpha.Network
if tt.wantResp {
wantRes = &iaasalpha.Network{
Id: utils.Ptr("nid"),
Status: utils.Ptr(tt.resourceState),
}
}
handler := CreateNetworkWaitHandler(context.Background(), apiClient, "pid", "eu01", "nid")
gotRes, err := handler.SetTimeout(10 * time.Millisecond).SetSleepBeforeWait(1 * time.Millisecond).WaitWithContext(context.Background())
if (err != nil) != tt.wantErr {
t.Fatalf("handler error = %v, wantErr %v", err, tt.wantErr)
}
if !cmp.Equal(gotRes, wantRes) {
t.Fatalf("handler gotRes = %v, want %v", gotRes, wantRes)
}
})
}
}
func TestUpdateNetworkWaitHandler(t *testing.T) {
tests := []struct {
desc string
getFails bool
resourceState string
wantErr bool
wantResp bool
}{
{
desc: "update_succeeded",
getFails: false,
resourceState: CreateSuccess,
wantErr: false,
wantResp: true,
},
{
desc: "get_fails",
getFails: true,
resourceState: "",
wantErr: true,
wantResp: false,
},
{
desc: "timeout",
getFails: false,
resourceState: "ANOTHER STATE",
wantErr: true,
wantResp: true,
},
}
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
apiClient := &apiClientMocked{
getNetworkFails: tt.getFails,
resourceState: tt.resourceState,
}
var wantRes *iaasalpha.Network
if tt.wantResp {
wantRes = &iaasalpha.Network{
Id: utils.Ptr("nid"),
Status: utils.Ptr(tt.resourceState),
}
}
handler := UpdateNetworkWaitHandler(context.Background(), apiClient, "pid", "eu01", "nid")
gotRes, err := handler.SetTimeout(10 * time.Millisecond).SetSleepBeforeWait(1 * time.Millisecond).WaitWithContext(context.Background())
if (err != nil) != tt.wantErr {
t.Fatalf("handler error = %v, wantErr %v", err, tt.wantErr)
}
if !cmp.Equal(gotRes, wantRes) {
t.Fatalf("handler gotRes = %v, want %v", gotRes, wantRes)
}
})
}
}
func TestDeleteNetworkWaitHandler(t *testing.T) {
tests := []struct {
desc string
getFails bool
isDeleted bool
resourceState string
wantErr bool
wantResp bool
}{
{
desc: "delete_succeeded",
getFails: false,
isDeleted: true,
wantErr: false,
wantResp: false,
},
{
desc: "get_fails",
getFails: true,
resourceState: "",
wantErr: true,
wantResp: false,
},
{
desc: "timeout",
getFails: false,
resourceState: "ANOTHER STATE",
wantErr: true,
wantResp: false,
},
}
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
apiClient := &apiClientMocked{
getNetworkFails: tt.getFails,
isDeleted: tt.isDeleted,
resourceState: tt.resourceState,
}
var wantRes *iaasalpha.Network
if tt.wantResp {
wantRes = &iaasalpha.Network{
Id: utils.Ptr("nid"),
Status: utils.Ptr(tt.resourceState),
}
}
handler := DeleteNetworkWaitHandler(context.Background(), apiClient, "pid", "eu01", "nid")
gotRes, err := handler.SetTimeout(10 * time.Millisecond).WaitWithContext(context.Background())
if (err != nil) != tt.wantErr {
t.Fatalf("handler error = %v, wantErr %v", err, tt.wantErr)
}
if !cmp.Equal(gotRes, wantRes) {
t.Fatalf("handler gotRes = %v, want %v", gotRes, wantRes)
}
})
}
}