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

2918
pkg/gitbeta/api_default.go Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,835 @@
/*
STACKIT Git API
Testing DefaultApiService
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
package gitbeta
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"github.com/stackitcloud/stackit-sdk-go/core/config"
)
func Test_gitbeta_DefaultApiService(t *testing.T) {
t.Run("Test DefaultApiService CreateAuthentication", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Authentication{}
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 gitbeta_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
instanceId := instanceIdValue
createAuthenticationPayload := CreateAuthenticationPayload{}
resp, reqErr := apiClient.CreateAuthentication(context.Background(), projectId, instanceId).CreateAuthenticationPayload(createAuthenticationPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Instance{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for gitbeta_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
createInstancePayload := CreateInstancePayload{}
resp, reqErr := apiClient.CreateInstance(context.Background(), projectId).CreateInstancePayload(createInstancePayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService CreateRunner", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Runner{}
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 gitbeta_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
instanceId := instanceIdValue
createRunnerPayload := CreateRunnerPayload{}
resp, reqErr := apiClient.CreateRunner(context.Background(), projectId, instanceId).CreateRunnerPayload(createRunnerPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService DeleteAuthentication", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
authenticationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -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 gitbeta_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
instanceId := instanceIdValue
authenticationId := authenticationIdValue
reqErr := apiClient.DeleteAuthentication(context.Background(), projectId, instanceId, authenticationId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for gitbeta_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
instanceId := instanceIdValue
reqErr := apiClient.DeleteInstance(context.Background(), projectId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService DeleteRunner", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for gitbeta_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
instanceId := instanceIdValue
reqErr := apiClient.DeleteRunner(context.Background(), projectId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService GetAuthentication", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
authenticationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Authentication{}
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 gitbeta_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
instanceId := instanceIdValue
authenticationId := authenticationIdValue
resp, reqErr := apiClient.GetAuthentication(context.Background(), projectId, instanceId, authenticationId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService GetInstance", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Instance{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for gitbeta_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
instanceId := instanceIdValue
resp, reqErr := apiClient.GetInstance(context.Background(), projectId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService GetInstances", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := InstanceList{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for gitbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
resp, reqErr := apiClient.GetInstances(context.Background(), projectId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService GetRunner", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Runner{}
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 gitbeta_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
instanceId := instanceIdValue
resp, reqErr := apiClient.GetRunner(context.Background(), projectId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListAuthentication", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := AuthenticationList{}
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 gitbeta_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
instanceId := instanceIdValue
resp, reqErr := apiClient.ListAuthentication(context.Background(), projectId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListFlavors", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/flavors"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := FlavorsList{}
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 gitbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
resp, reqErr := apiClient.ListFlavors(context.Background(), projectId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListRunnerRuntimes", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/runner-runtimes"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := RunnerRuntimeList{}
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 gitbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
resp, reqErr := apiClient.ListRunnerRuntimes(context.Background(), projectId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService PatchAuthentication", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
authenticationIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Authentication{}
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 gitbeta_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
instanceId := instanceIdValue
authenticationId := authenticationIdValue
patchAuthenticationPayload := PatchAuthenticationPayload{}
resp, reqErr := apiClient.PatchAuthentication(context.Background(), projectId, instanceId, authenticationId).PatchAuthenticationPayload(patchAuthenticationPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService PatchInstance", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}"
projectIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
instanceIdValue := randString(36)
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := Instance{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for gitbeta_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
instanceId := instanceIdValue
patchInstancePayload := PatchInstancePayload{}
resp, reqErr := apiClient.PatchInstance(context.Background(), projectId, instanceId).PatchInstancePayload(patchInstancePayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
}

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

@ -0,0 +1,628 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
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 Git API API v1beta.0.4
// 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 Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
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/gitbeta",
Debug: false,
Servers: config.ServerConfigurations{
{
URL: "https://git.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,486 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
"time"
)
// checks if the Authentication type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Authentication{}
/*
types and functions for auto_discover_url
*/
// isNotNullableString
type AuthenticationGetAutoDiscoverUrlAttributeType = *string
func getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(arg AuthenticationGetAutoDiscoverUrlAttributeType) (ret AuthenticationGetAutoDiscoverUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetAutoDiscoverUrlAttributeType(arg *AuthenticationGetAutoDiscoverUrlAttributeType, val AuthenticationGetAutoDiscoverUrlRetType) {
*arg = &val
}
type AuthenticationGetAutoDiscoverUrlArgType = string
type AuthenticationGetAutoDiscoverUrlRetType = string
/*
types and functions for client_id
*/
// isNotNullableString
type AuthenticationGetClientIdAttributeType = *string
func getAuthenticationGetClientIdAttributeTypeOk(arg AuthenticationGetClientIdAttributeType) (ret AuthenticationGetClientIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetClientIdAttributeType(arg *AuthenticationGetClientIdAttributeType, val AuthenticationGetClientIdRetType) {
*arg = &val
}
type AuthenticationGetClientIdArgType = string
type AuthenticationGetClientIdRetType = string
/*
types and functions for created_at
*/
// isDateTime
type AuthenticationGetCreatedAtAttributeType = *time.Time
type AuthenticationGetCreatedAtArgType = time.Time
type AuthenticationGetCreatedAtRetType = time.Time
func getAuthenticationGetCreatedAtAttributeTypeOk(arg AuthenticationGetCreatedAtAttributeType) (ret AuthenticationGetCreatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetCreatedAtAttributeType(arg *AuthenticationGetCreatedAtAttributeType, val AuthenticationGetCreatedAtRetType) {
*arg = &val
}
/*
types and functions for icon_url
*/
// isNotNullableString
type AuthenticationGetIconUrlAttributeType = *string
func getAuthenticationGetIconUrlAttributeTypeOk(arg AuthenticationGetIconUrlAttributeType) (ret AuthenticationGetIconUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetIconUrlAttributeType(arg *AuthenticationGetIconUrlAttributeType, val AuthenticationGetIconUrlRetType) {
*arg = &val
}
type AuthenticationGetIconUrlArgType = string
type AuthenticationGetIconUrlRetType = string
/*
types and functions for id
*/
// isNotNullableString
type AuthenticationGetIdAttributeType = *string
func getAuthenticationGetIdAttributeTypeOk(arg AuthenticationGetIdAttributeType) (ret AuthenticationGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetIdAttributeType(arg *AuthenticationGetIdAttributeType, val AuthenticationGetIdRetType) {
*arg = &val
}
type AuthenticationGetIdArgType = string
type AuthenticationGetIdRetType = string
/*
types and functions for name
*/
// isNotNullableString
type AuthenticationGetNameAttributeType = *string
func getAuthenticationGetNameAttributeTypeOk(arg AuthenticationGetNameAttributeType) (ret AuthenticationGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetNameAttributeType(arg *AuthenticationGetNameAttributeType, val AuthenticationGetNameRetType) {
*arg = &val
}
type AuthenticationGetNameArgType = string
type AuthenticationGetNameRetType = string
/*
types and functions for provider
*/
// isNotNullableString
type AuthenticationGetProviderAttributeType = *string
func getAuthenticationGetProviderAttributeTypeOk(arg AuthenticationGetProviderAttributeType) (ret AuthenticationGetProviderRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetProviderAttributeType(arg *AuthenticationGetProviderAttributeType, val AuthenticationGetProviderRetType) {
*arg = &val
}
type AuthenticationGetProviderArgType = string
type AuthenticationGetProviderRetType = string
/*
types and functions for scopes
*/
// isNotNullableString
type AuthenticationGetScopesAttributeType = *string
func getAuthenticationGetScopesAttributeTypeOk(arg AuthenticationGetScopesAttributeType) (ret AuthenticationGetScopesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetScopesAttributeType(arg *AuthenticationGetScopesAttributeType, val AuthenticationGetScopesRetType) {
*arg = &val
}
type AuthenticationGetScopesArgType = string
type AuthenticationGetScopesRetType = string
/*
types and functions for status
*/
// isNotNullableString
type AuthenticationGetStatusAttributeType = *string
func getAuthenticationGetStatusAttributeTypeOk(arg AuthenticationGetStatusAttributeType) (ret AuthenticationGetStatusRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationGetStatusAttributeType(arg *AuthenticationGetStatusAttributeType, val AuthenticationGetStatusRetType) {
*arg = &val
}
type AuthenticationGetStatusArgType = string
type AuthenticationGetStatusRetType = string
// Authentication Describes an authentication definition associated to a STACKIT Git instance. The provider type will be an openidConnect type.
type Authentication struct {
// The well-known configuration url to use for this authentication definition.
// REQUIRED
AutoDiscoverUrl AuthenticationGetAutoDiscoverUrlAttributeType `json:"auto_discover_url" required:"true"`
// The IDP client id to use.
// REQUIRED
ClientId AuthenticationGetClientIdAttributeType `json:"client_id" required:"true"`
// REQUIRED
CreatedAt AuthenticationGetCreatedAtAttributeType `json:"created_at" required:"true"`
// The url of the icon to use for this authentication definition.
// REQUIRED
IconUrl AuthenticationGetIconUrlAttributeType `json:"icon_url" required:"true"`
// An auto generated unique uuid which identifies the authentication definition in STACKIT Git instances.
// REQUIRED
Id AuthenticationGetIdAttributeType `json:"id" required:"true"`
// The name to identify an authentication definition associated with a STACKIT Git instance.
// REQUIRED
Name AuthenticationGetNameAttributeType `json:"name" required:"true"`
// The Oauth2 provider to use.
// REQUIRED
Provider AuthenticationGetProviderAttributeType `json:"provider" required:"true"`
// Scopes defines the OIDC scopes to request.
// REQUIRED
Scopes AuthenticationGetScopesAttributeType `json:"scopes" required:"true"`
// The current status of the authentication definition.
// REQUIRED
Status AuthenticationGetStatusAttributeType `json:"status" required:"true"`
}
type _Authentication Authentication
// NewAuthentication instantiates a new Authentication 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 NewAuthentication(autoDiscoverUrl AuthenticationGetAutoDiscoverUrlArgType, clientId AuthenticationGetClientIdArgType, createdAt AuthenticationGetCreatedAtArgType, iconUrl AuthenticationGetIconUrlArgType, id AuthenticationGetIdArgType, name AuthenticationGetNameArgType, provider AuthenticationGetProviderArgType, scopes AuthenticationGetScopesArgType, status AuthenticationGetStatusArgType) *Authentication {
this := Authentication{}
setAuthenticationGetAutoDiscoverUrlAttributeType(&this.AutoDiscoverUrl, autoDiscoverUrl)
setAuthenticationGetClientIdAttributeType(&this.ClientId, clientId)
setAuthenticationGetCreatedAtAttributeType(&this.CreatedAt, createdAt)
setAuthenticationGetIconUrlAttributeType(&this.IconUrl, iconUrl)
setAuthenticationGetIdAttributeType(&this.Id, id)
setAuthenticationGetNameAttributeType(&this.Name, name)
setAuthenticationGetProviderAttributeType(&this.Provider, provider)
setAuthenticationGetScopesAttributeType(&this.Scopes, scopes)
setAuthenticationGetStatusAttributeType(&this.Status, status)
return &this
}
// NewAuthenticationWithDefaults instantiates a new Authentication 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 NewAuthenticationWithDefaults() *Authentication {
this := Authentication{}
return &this
}
// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value
func (o *Authentication) GetAutoDiscoverUrl() (ret AuthenticationGetAutoDiscoverUrlRetType) {
ret, _ = o.GetAutoDiscoverUrlOk()
return ret
}
// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value
// and a boolean to check if the value has been set.
func (o *Authentication) GetAutoDiscoverUrlOk() (ret AuthenticationGetAutoDiscoverUrlRetType, ok bool) {
return getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl)
}
// SetAutoDiscoverUrl sets field value
func (o *Authentication) SetAutoDiscoverUrl(v AuthenticationGetAutoDiscoverUrlRetType) {
setAuthenticationGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v)
}
// GetClientId returns the ClientId field value
func (o *Authentication) GetClientId() (ret AuthenticationGetClientIdRetType) {
ret, _ = o.GetClientIdOk()
return ret
}
// GetClientIdOk returns a tuple with the ClientId field value
// and a boolean to check if the value has been set.
func (o *Authentication) GetClientIdOk() (ret AuthenticationGetClientIdRetType, ok bool) {
return getAuthenticationGetClientIdAttributeTypeOk(o.ClientId)
}
// SetClientId sets field value
func (o *Authentication) SetClientId(v AuthenticationGetClientIdRetType) {
setAuthenticationGetClientIdAttributeType(&o.ClientId, v)
}
// GetCreatedAt returns the CreatedAt field value
func (o *Authentication) GetCreatedAt() (ret AuthenticationGetCreatedAtRetType) {
ret, _ = o.GetCreatedAtOk()
return ret
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value
// and a boolean to check if the value has been set.
func (o *Authentication) GetCreatedAtOk() (ret AuthenticationGetCreatedAtRetType, ok bool) {
return getAuthenticationGetCreatedAtAttributeTypeOk(o.CreatedAt)
}
// SetCreatedAt sets field value
func (o *Authentication) SetCreatedAt(v AuthenticationGetCreatedAtRetType) {
setAuthenticationGetCreatedAtAttributeType(&o.CreatedAt, v)
}
// GetIconUrl returns the IconUrl field value
func (o *Authentication) GetIconUrl() (ret AuthenticationGetIconUrlRetType) {
ret, _ = o.GetIconUrlOk()
return ret
}
// GetIconUrlOk returns a tuple with the IconUrl field value
// and a boolean to check if the value has been set.
func (o *Authentication) GetIconUrlOk() (ret AuthenticationGetIconUrlRetType, ok bool) {
return getAuthenticationGetIconUrlAttributeTypeOk(o.IconUrl)
}
// SetIconUrl sets field value
func (o *Authentication) SetIconUrl(v AuthenticationGetIconUrlRetType) {
setAuthenticationGetIconUrlAttributeType(&o.IconUrl, v)
}
// GetId returns the Id field value
func (o *Authentication) GetId() (ret AuthenticationGetIdRetType) {
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 *Authentication) GetIdOk() (ret AuthenticationGetIdRetType, ok bool) {
return getAuthenticationGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *Authentication) SetId(v AuthenticationGetIdRetType) {
setAuthenticationGetIdAttributeType(&o.Id, v)
}
// GetName returns the Name field value
func (o *Authentication) GetName() (ret AuthenticationGetNameRetType) {
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 *Authentication) GetNameOk() (ret AuthenticationGetNameRetType, ok bool) {
return getAuthenticationGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *Authentication) SetName(v AuthenticationGetNameRetType) {
setAuthenticationGetNameAttributeType(&o.Name, v)
}
// GetProvider returns the Provider field value
func (o *Authentication) GetProvider() (ret AuthenticationGetProviderRetType) {
ret, _ = o.GetProviderOk()
return ret
}
// GetProviderOk returns a tuple with the Provider field value
// and a boolean to check if the value has been set.
func (o *Authentication) GetProviderOk() (ret AuthenticationGetProviderRetType, ok bool) {
return getAuthenticationGetProviderAttributeTypeOk(o.Provider)
}
// SetProvider sets field value
func (o *Authentication) SetProvider(v AuthenticationGetProviderRetType) {
setAuthenticationGetProviderAttributeType(&o.Provider, v)
}
// GetScopes returns the Scopes field value
func (o *Authentication) GetScopes() (ret AuthenticationGetScopesRetType) {
ret, _ = o.GetScopesOk()
return ret
}
// GetScopesOk returns a tuple with the Scopes field value
// and a boolean to check if the value has been set.
func (o *Authentication) GetScopesOk() (ret AuthenticationGetScopesRetType, ok bool) {
return getAuthenticationGetScopesAttributeTypeOk(o.Scopes)
}
// SetScopes sets field value
func (o *Authentication) SetScopes(v AuthenticationGetScopesRetType) {
setAuthenticationGetScopesAttributeType(&o.Scopes, v)
}
// GetStatus returns the Status field value
func (o *Authentication) GetStatus() (ret AuthenticationGetStatusRetType) {
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 *Authentication) GetStatusOk() (ret AuthenticationGetStatusRetType, ok bool) {
return getAuthenticationGetStatusAttributeTypeOk(o.Status)
}
// SetStatus sets field value
func (o *Authentication) SetStatus(v AuthenticationGetStatusRetType) {
setAuthenticationGetStatusAttributeType(&o.Status, v)
}
func (o Authentication) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok {
toSerialize["AutoDiscoverUrl"] = val
}
if val, ok := getAuthenticationGetClientIdAttributeTypeOk(o.ClientId); ok {
toSerialize["ClientId"] = val
}
if val, ok := getAuthenticationGetCreatedAtAttributeTypeOk(o.CreatedAt); ok {
toSerialize["CreatedAt"] = val
}
if val, ok := getAuthenticationGetIconUrlAttributeTypeOk(o.IconUrl); ok {
toSerialize["IconUrl"] = val
}
if val, ok := getAuthenticationGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getAuthenticationGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getAuthenticationGetProviderAttributeTypeOk(o.Provider); ok {
toSerialize["Provider"] = val
}
if val, ok := getAuthenticationGetScopesAttributeTypeOk(o.Scopes); ok {
toSerialize["Scopes"] = val
}
if val, ok := getAuthenticationGetStatusAttributeTypeOk(o.Status); ok {
toSerialize["Status"] = val
}
return toSerialize, nil
}
type NullableAuthentication struct {
value *Authentication
isSet bool
}
func (v NullableAuthentication) Get() *Authentication {
return v.value
}
func (v *NullableAuthentication) Set(val *Authentication) {
v.value = val
v.isSet = true
}
func (v NullableAuthentication) IsSet() bool {
return v.isSet
}
func (v *NullableAuthentication) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAuthentication(val *Authentication) *NullableAuthentication {
return &NullableAuthentication{value: val, isSet: true}
}
func (v NullableAuthentication) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAuthentication) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,125 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the AuthenticationList type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AuthenticationList{}
/*
types and functions for authentication
*/
// isArray
type AuthenticationListGetAuthenticationAttributeType = *[]Authentication
type AuthenticationListGetAuthenticationArgType = []Authentication
type AuthenticationListGetAuthenticationRetType = []Authentication
func getAuthenticationListGetAuthenticationAttributeTypeOk(arg AuthenticationListGetAuthenticationAttributeType) (ret AuthenticationListGetAuthenticationRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAuthenticationListGetAuthenticationAttributeType(arg *AuthenticationListGetAuthenticationAttributeType, val AuthenticationListGetAuthenticationRetType) {
*arg = &val
}
// AuthenticationList A list of authentications belonging to an Instance.
type AuthenticationList struct {
// REQUIRED
Authentication AuthenticationListGetAuthenticationAttributeType `json:"authentication" required:"true"`
}
type _AuthenticationList AuthenticationList
// NewAuthenticationList instantiates a new AuthenticationList 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 NewAuthenticationList(authentication AuthenticationListGetAuthenticationArgType) *AuthenticationList {
this := AuthenticationList{}
setAuthenticationListGetAuthenticationAttributeType(&this.Authentication, authentication)
return &this
}
// NewAuthenticationListWithDefaults instantiates a new AuthenticationList 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 NewAuthenticationListWithDefaults() *AuthenticationList {
this := AuthenticationList{}
return &this
}
// GetAuthentication returns the Authentication field value
func (o *AuthenticationList) GetAuthentication() (ret AuthenticationListGetAuthenticationRetType) {
ret, _ = o.GetAuthenticationOk()
return ret
}
// GetAuthenticationOk returns a tuple with the Authentication field value
// and a boolean to check if the value has been set.
func (o *AuthenticationList) GetAuthenticationOk() (ret AuthenticationListGetAuthenticationRetType, ok bool) {
return getAuthenticationListGetAuthenticationAttributeTypeOk(o.Authentication)
}
// SetAuthentication sets field value
func (o *AuthenticationList) SetAuthentication(v AuthenticationListGetAuthenticationRetType) {
setAuthenticationListGetAuthenticationAttributeType(&o.Authentication, v)
}
func (o AuthenticationList) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getAuthenticationListGetAuthenticationAttributeTypeOk(o.Authentication); ok {
toSerialize["Authentication"] = val
}
return toSerialize, nil
}
type NullableAuthenticationList struct {
value *AuthenticationList
isSet bool
}
func (v NullableAuthenticationList) Get() *AuthenticationList {
return v.value
}
func (v *NullableAuthenticationList) Set(val *AuthenticationList) {
v.value = val
v.isSet = true
}
func (v NullableAuthenticationList) IsSet() bool {
return v.isSet
}
func (v *NullableAuthenticationList) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAuthenticationList(val *AuthenticationList) *NullableAuthenticationList {
return &NullableAuthenticationList{value: val, isSet: true}
}
func (v NullableAuthenticationList) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAuthenticationList) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,413 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the CreateAuthenticationPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateAuthenticationPayload{}
/*
types and functions for auto_discover_url
*/
// isNotNullableString
type CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType = *string
func getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(arg CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType) (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(arg *CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType, val CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) {
*arg = &val
}
type CreateAuthenticationPayloadGetAutoDiscoverUrlArgType = string
type CreateAuthenticationPayloadGetAutoDiscoverUrlRetType = string
/*
types and functions for client_id
*/
// isNotNullableString
type CreateAuthenticationPayloadGetClientIdAttributeType = *string
func getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(arg CreateAuthenticationPayloadGetClientIdAttributeType) (ret CreateAuthenticationPayloadGetClientIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAuthenticationPayloadGetClientIdAttributeType(arg *CreateAuthenticationPayloadGetClientIdAttributeType, val CreateAuthenticationPayloadGetClientIdRetType) {
*arg = &val
}
type CreateAuthenticationPayloadGetClientIdArgType = string
type CreateAuthenticationPayloadGetClientIdRetType = string
/*
types and functions for client_secret
*/
// isNotNullableString
type CreateAuthenticationPayloadGetClientSecretAttributeType = *string
func getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(arg CreateAuthenticationPayloadGetClientSecretAttributeType) (ret CreateAuthenticationPayloadGetClientSecretRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAuthenticationPayloadGetClientSecretAttributeType(arg *CreateAuthenticationPayloadGetClientSecretAttributeType, val CreateAuthenticationPayloadGetClientSecretRetType) {
*arg = &val
}
type CreateAuthenticationPayloadGetClientSecretArgType = string
type CreateAuthenticationPayloadGetClientSecretRetType = string
/*
types and functions for icon_url
*/
// isNotNullableString
type CreateAuthenticationPayloadGetIconUrlAttributeType = *string
func getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(arg CreateAuthenticationPayloadGetIconUrlAttributeType) (ret CreateAuthenticationPayloadGetIconUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAuthenticationPayloadGetIconUrlAttributeType(arg *CreateAuthenticationPayloadGetIconUrlAttributeType, val CreateAuthenticationPayloadGetIconUrlRetType) {
*arg = &val
}
type CreateAuthenticationPayloadGetIconUrlArgType = string
type CreateAuthenticationPayloadGetIconUrlRetType = string
/*
types and functions for name
*/
// isNotNullableString
type CreateAuthenticationPayloadGetNameAttributeType = *string
func getCreateAuthenticationPayloadGetNameAttributeTypeOk(arg CreateAuthenticationPayloadGetNameAttributeType) (ret CreateAuthenticationPayloadGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAuthenticationPayloadGetNameAttributeType(arg *CreateAuthenticationPayloadGetNameAttributeType, val CreateAuthenticationPayloadGetNameRetType) {
*arg = &val
}
type CreateAuthenticationPayloadGetNameArgType = string
type CreateAuthenticationPayloadGetNameRetType = string
/*
types and functions for provider
*/
// isNotNullableString
type CreateAuthenticationPayloadGetProviderAttributeType = *string
func getCreateAuthenticationPayloadGetProviderAttributeTypeOk(arg CreateAuthenticationPayloadGetProviderAttributeType) (ret CreateAuthenticationPayloadGetProviderRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAuthenticationPayloadGetProviderAttributeType(arg *CreateAuthenticationPayloadGetProviderAttributeType, val CreateAuthenticationPayloadGetProviderRetType) {
*arg = &val
}
type CreateAuthenticationPayloadGetProviderArgType = string
type CreateAuthenticationPayloadGetProviderRetType = string
/*
types and functions for scopes
*/
// isNotNullableString
type CreateAuthenticationPayloadGetScopesAttributeType = *string
func getCreateAuthenticationPayloadGetScopesAttributeTypeOk(arg CreateAuthenticationPayloadGetScopesAttributeType) (ret CreateAuthenticationPayloadGetScopesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAuthenticationPayloadGetScopesAttributeType(arg *CreateAuthenticationPayloadGetScopesAttributeType, val CreateAuthenticationPayloadGetScopesRetType) {
*arg = &val
}
type CreateAuthenticationPayloadGetScopesArgType = string
type CreateAuthenticationPayloadGetScopesRetType = string
// CreateAuthenticationPayload Properties to patch on an authentication. All fields are optional.
type CreateAuthenticationPayload struct {
// The well-known configuration url to use for this authentication definition.
// REQUIRED
AutoDiscoverUrl CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType `json:"auto_discover_url" required:"true"`
// The IDP client id to use.
// REQUIRED
ClientId CreateAuthenticationPayloadGetClientIdAttributeType `json:"client_id" required:"true"`
// The IDP client secret to use.
// REQUIRED
ClientSecret CreateAuthenticationPayloadGetClientSecretAttributeType `json:"client_secret" required:"true"`
// The url of the icon to use for this authentication definition.
IconUrl CreateAuthenticationPayloadGetIconUrlAttributeType `json:"icon_url,omitempty"`
// The name to identify an authentication definition associated with a STACKIT Git instance.
// REQUIRED
Name CreateAuthenticationPayloadGetNameAttributeType `json:"name" required:"true"`
// The Oauth2 provider to use.
Provider CreateAuthenticationPayloadGetProviderAttributeType `json:"provider,omitempty"`
// Scopes defines the OIDC scopes to request.
Scopes CreateAuthenticationPayloadGetScopesAttributeType `json:"scopes,omitempty"`
}
type _CreateAuthenticationPayload CreateAuthenticationPayload
// NewCreateAuthenticationPayload instantiates a new CreateAuthenticationPayload 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 NewCreateAuthenticationPayload(autoDiscoverUrl CreateAuthenticationPayloadGetAutoDiscoverUrlArgType, clientId CreateAuthenticationPayloadGetClientIdArgType, clientSecret CreateAuthenticationPayloadGetClientSecretArgType, name CreateAuthenticationPayloadGetNameArgType) *CreateAuthenticationPayload {
this := CreateAuthenticationPayload{}
setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&this.AutoDiscoverUrl, autoDiscoverUrl)
setCreateAuthenticationPayloadGetClientIdAttributeType(&this.ClientId, clientId)
setCreateAuthenticationPayloadGetClientSecretAttributeType(&this.ClientSecret, clientSecret)
setCreateAuthenticationPayloadGetNameAttributeType(&this.Name, name)
return &this
}
// NewCreateAuthenticationPayloadWithDefaults instantiates a new CreateAuthenticationPayload 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 NewCreateAuthenticationPayloadWithDefaults() *CreateAuthenticationPayload {
this := CreateAuthenticationPayload{}
var provider string = "openidConnect"
this.Provider = &provider
var scopes string = "openid profile email"
this.Scopes = &scopes
return &this
}
// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value
func (o *CreateAuthenticationPayload) GetAutoDiscoverUrl() (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) {
ret, _ = o.GetAutoDiscoverUrlOk()
return ret
}
// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value
// and a boolean to check if the value has been set.
func (o *CreateAuthenticationPayload) GetAutoDiscoverUrlOk() (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) {
return getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl)
}
// SetAutoDiscoverUrl sets field value
func (o *CreateAuthenticationPayload) SetAutoDiscoverUrl(v CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) {
setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v)
}
// GetClientId returns the ClientId field value
func (o *CreateAuthenticationPayload) GetClientId() (ret CreateAuthenticationPayloadGetClientIdRetType) {
ret, _ = o.GetClientIdOk()
return ret
}
// GetClientIdOk returns a tuple with the ClientId field value
// and a boolean to check if the value has been set.
func (o *CreateAuthenticationPayload) GetClientIdOk() (ret CreateAuthenticationPayloadGetClientIdRetType, ok bool) {
return getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId)
}
// SetClientId sets field value
func (o *CreateAuthenticationPayload) SetClientId(v CreateAuthenticationPayloadGetClientIdRetType) {
setCreateAuthenticationPayloadGetClientIdAttributeType(&o.ClientId, v)
}
// GetClientSecret returns the ClientSecret field value
func (o *CreateAuthenticationPayload) GetClientSecret() (ret CreateAuthenticationPayloadGetClientSecretRetType) {
ret, _ = o.GetClientSecretOk()
return ret
}
// GetClientSecretOk returns a tuple with the ClientSecret field value
// and a boolean to check if the value has been set.
func (o *CreateAuthenticationPayload) GetClientSecretOk() (ret CreateAuthenticationPayloadGetClientSecretRetType, ok bool) {
return getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret)
}
// SetClientSecret sets field value
func (o *CreateAuthenticationPayload) SetClientSecret(v CreateAuthenticationPayloadGetClientSecretRetType) {
setCreateAuthenticationPayloadGetClientSecretAttributeType(&o.ClientSecret, v)
}
// GetIconUrl returns the IconUrl field value if set, zero value otherwise.
func (o *CreateAuthenticationPayload) GetIconUrl() (res CreateAuthenticationPayloadGetIconUrlRetType) {
res, _ = o.GetIconUrlOk()
return
}
// GetIconUrlOk returns a tuple with the IconUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateAuthenticationPayload) GetIconUrlOk() (ret CreateAuthenticationPayloadGetIconUrlRetType, ok bool) {
return getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl)
}
// HasIconUrl returns a boolean if a field has been set.
func (o *CreateAuthenticationPayload) HasIconUrl() bool {
_, ok := o.GetIconUrlOk()
return ok
}
// SetIconUrl gets a reference to the given string and assigns it to the IconUrl field.
func (o *CreateAuthenticationPayload) SetIconUrl(v CreateAuthenticationPayloadGetIconUrlRetType) {
setCreateAuthenticationPayloadGetIconUrlAttributeType(&o.IconUrl, v)
}
// GetName returns the Name field value
func (o *CreateAuthenticationPayload) GetName() (ret CreateAuthenticationPayloadGetNameRetType) {
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 *CreateAuthenticationPayload) GetNameOk() (ret CreateAuthenticationPayloadGetNameRetType, ok bool) {
return getCreateAuthenticationPayloadGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *CreateAuthenticationPayload) SetName(v CreateAuthenticationPayloadGetNameRetType) {
setCreateAuthenticationPayloadGetNameAttributeType(&o.Name, v)
}
// GetProvider returns the Provider field value if set, zero value otherwise.
func (o *CreateAuthenticationPayload) GetProvider() (res CreateAuthenticationPayloadGetProviderRetType) {
res, _ = o.GetProviderOk()
return
}
// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateAuthenticationPayload) GetProviderOk() (ret CreateAuthenticationPayloadGetProviderRetType, ok bool) {
return getCreateAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider)
}
// HasProvider returns a boolean if a field has been set.
func (o *CreateAuthenticationPayload) HasProvider() bool {
_, ok := o.GetProviderOk()
return ok
}
// SetProvider gets a reference to the given string and assigns it to the Provider field.
func (o *CreateAuthenticationPayload) SetProvider(v CreateAuthenticationPayloadGetProviderRetType) {
setCreateAuthenticationPayloadGetProviderAttributeType(&o.Provider, v)
}
// GetScopes returns the Scopes field value if set, zero value otherwise.
func (o *CreateAuthenticationPayload) GetScopes() (res CreateAuthenticationPayloadGetScopesRetType) {
res, _ = o.GetScopesOk()
return
}
// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateAuthenticationPayload) GetScopesOk() (ret CreateAuthenticationPayloadGetScopesRetType, ok bool) {
return getCreateAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes)
}
// HasScopes returns a boolean if a field has been set.
func (o *CreateAuthenticationPayload) HasScopes() bool {
_, ok := o.GetScopesOk()
return ok
}
// SetScopes gets a reference to the given string and assigns it to the Scopes field.
func (o *CreateAuthenticationPayload) SetScopes(v CreateAuthenticationPayloadGetScopesRetType) {
setCreateAuthenticationPayloadGetScopesAttributeType(&o.Scopes, v)
}
func (o CreateAuthenticationPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok {
toSerialize["AutoDiscoverUrl"] = val
}
if val, ok := getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId); ok {
toSerialize["ClientId"] = val
}
if val, ok := getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret); ok {
toSerialize["ClientSecret"] = val
}
if val, ok := getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl); ok {
toSerialize["IconUrl"] = val
}
if val, ok := getCreateAuthenticationPayloadGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getCreateAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider); ok {
toSerialize["Provider"] = val
}
if val, ok := getCreateAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes); ok {
toSerialize["Scopes"] = val
}
return toSerialize, nil
}
type NullableCreateAuthenticationPayload struct {
value *CreateAuthenticationPayload
isSet bool
}
func (v NullableCreateAuthenticationPayload) Get() *CreateAuthenticationPayload {
return v.value
}
func (v *NullableCreateAuthenticationPayload) Set(val *CreateAuthenticationPayload) {
v.value = val
v.isSet = true
}
func (v NullableCreateAuthenticationPayload) IsSet() bool {
return v.isSet
}
func (v *NullableCreateAuthenticationPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateAuthenticationPayload(val *CreateAuthenticationPayload) *NullableCreateAuthenticationPayload {
return &NullableCreateAuthenticationPayload{value: val, isSet: true}
}
func (v NullableCreateAuthenticationPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateAuthenticationPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,327 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
"fmt"
)
// checks if the CreateInstancePayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateInstancePayload{}
/*
types and functions for acl
*/
// isArray
type CreateInstancePayloadGetAclAttributeType = *[]string
type CreateInstancePayloadGetAclArgType = []string
type CreateInstancePayloadGetAclRetType = []string
func getCreateInstancePayloadGetAclAttributeTypeOk(arg CreateInstancePayloadGetAclAttributeType) (ret CreateInstancePayloadGetAclRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateInstancePayloadGetAclAttributeType(arg *CreateInstancePayloadGetAclAttributeType, val CreateInstancePayloadGetAclRetType) {
*arg = &val
}
/*
types and functions for flavor
*/
// isEnum
// CreateInstancePayloadFlavor the model 'CreateInstancePayload'
// value type for enums
type CreateInstancePayloadFlavor string
// List of Flavor
const (
CREATEINSTANCEPAYLOADFLAVOR__10 CreateInstancePayloadFlavor = "git-10"
CREATEINSTANCEPAYLOADFLAVOR__100 CreateInstancePayloadFlavor = "git-100"
)
// All allowed values of CreateInstancePayload enum
var AllowedCreateInstancePayloadFlavorEnumValues = []CreateInstancePayloadFlavor{
"git-10",
"git-100",
}
func (v *CreateInstancePayloadFlavor) UnmarshalJSON(src []byte) error {
// use a type alias to prevent infinite recursion during unmarshal,
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
type TmpJson CreateInstancePayloadFlavor
var value TmpJson
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue TmpJson
if value == zeroValue {
return nil
}
enumTypeValue := CreateInstancePayloadFlavor(value)
for _, existing := range AllowedCreateInstancePayloadFlavorEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid CreateInstancePayload", value)
}
// NewCreateInstancePayloadFlavorFromValue returns a pointer to a valid CreateInstancePayloadFlavor
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewCreateInstancePayloadFlavorFromValue(v CreateInstancePayloadFlavor) (*CreateInstancePayloadFlavor, error) {
ev := CreateInstancePayloadFlavor(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for CreateInstancePayloadFlavor: valid values are %v", v, AllowedCreateInstancePayloadFlavorEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v CreateInstancePayloadFlavor) IsValid() bool {
for _, existing := range AllowedCreateInstancePayloadFlavorEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to FlavorFlavor value
func (v CreateInstancePayloadFlavor) Ptr() *CreateInstancePayloadFlavor {
return &v
}
type NullableCreateInstancePayloadFlavor struct {
value *CreateInstancePayloadFlavor
isSet bool
}
func (v NullableCreateInstancePayloadFlavor) Get() *CreateInstancePayloadFlavor {
return v.value
}
func (v *NullableCreateInstancePayloadFlavor) Set(val *CreateInstancePayloadFlavor) {
v.value = val
v.isSet = true
}
func (v NullableCreateInstancePayloadFlavor) IsSet() bool {
return v.isSet
}
func (v *NullableCreateInstancePayloadFlavor) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateInstancePayloadFlavor(val *CreateInstancePayloadFlavor) *NullableCreateInstancePayloadFlavor {
return &NullableCreateInstancePayloadFlavor{value: val, isSet: true}
}
func (v NullableCreateInstancePayloadFlavor) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateInstancePayloadFlavor) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type CreateInstancePayloadGetFlavorAttributeType = *CreateInstancePayloadFlavor
type CreateInstancePayloadGetFlavorArgType = CreateInstancePayloadFlavor
type CreateInstancePayloadGetFlavorRetType = CreateInstancePayloadFlavor
func getCreateInstancePayloadGetFlavorAttributeTypeOk(arg CreateInstancePayloadGetFlavorAttributeType) (ret CreateInstancePayloadGetFlavorRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateInstancePayloadGetFlavorAttributeType(arg *CreateInstancePayloadGetFlavorAttributeType, val CreateInstancePayloadGetFlavorRetType) {
*arg = &val
}
/*
types and functions for name
*/
// isNotNullableString
type CreateInstancePayloadGetNameAttributeType = *string
func getCreateInstancePayloadGetNameAttributeTypeOk(arg CreateInstancePayloadGetNameAttributeType) (ret CreateInstancePayloadGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateInstancePayloadGetNameAttributeType(arg *CreateInstancePayloadGetNameAttributeType, val CreateInstancePayloadGetNameRetType) {
*arg = &val
}
type CreateInstancePayloadGetNameArgType = string
type CreateInstancePayloadGetNameRetType = string
// CreateInstancePayload Request a STACKIT Git instance to be created with these properties.
type CreateInstancePayload struct {
// A list of CIDR network addresses that are allowed to access the instance.
Acl CreateInstancePayloadGetAclAttributeType `json:"acl,omitempty"`
Flavor CreateInstancePayloadGetFlavorAttributeType `json:"flavor,omitempty"`
// A user chosen name to distinguish multiple STACKIT Git instances.
// REQUIRED
Name CreateInstancePayloadGetNameAttributeType `json:"name" required:"true"`
}
type _CreateInstancePayload CreateInstancePayload
// NewCreateInstancePayload instantiates a new CreateInstancePayload object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewCreateInstancePayload(name CreateInstancePayloadGetNameArgType) *CreateInstancePayload {
this := CreateInstancePayload{}
setCreateInstancePayloadGetNameAttributeType(&this.Name, name)
return &this
}
// NewCreateInstancePayloadWithDefaults instantiates a new CreateInstancePayload object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewCreateInstancePayloadWithDefaults() *CreateInstancePayload {
this := CreateInstancePayload{}
return &this
}
// GetAcl returns the Acl field value if set, zero value otherwise.
func (o *CreateInstancePayload) GetAcl() (res CreateInstancePayloadGetAclRetType) {
res, _ = o.GetAclOk()
return
}
// GetAclOk returns a tuple with the Acl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateInstancePayload) GetAclOk() (ret CreateInstancePayloadGetAclRetType, ok bool) {
return getCreateInstancePayloadGetAclAttributeTypeOk(o.Acl)
}
// HasAcl returns a boolean if a field has been set.
func (o *CreateInstancePayload) HasAcl() bool {
_, ok := o.GetAclOk()
return ok
}
// SetAcl gets a reference to the given []string and assigns it to the Acl field.
func (o *CreateInstancePayload) SetAcl(v CreateInstancePayloadGetAclRetType) {
setCreateInstancePayloadGetAclAttributeType(&o.Acl, v)
}
// GetFlavor returns the Flavor field value if set, zero value otherwise.
func (o *CreateInstancePayload) GetFlavor() (res CreateInstancePayloadGetFlavorRetType) {
res, _ = o.GetFlavorOk()
return
}
// GetFlavorOk returns a tuple with the Flavor field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateInstancePayload) GetFlavorOk() (ret CreateInstancePayloadGetFlavorRetType, ok bool) {
return getCreateInstancePayloadGetFlavorAttributeTypeOk(o.Flavor)
}
// HasFlavor returns a boolean if a field has been set.
func (o *CreateInstancePayload) HasFlavor() bool {
_, ok := o.GetFlavorOk()
return ok
}
// SetFlavor gets a reference to the given string and assigns it to the Flavor field.
func (o *CreateInstancePayload) SetFlavor(v CreateInstancePayloadGetFlavorRetType) {
setCreateInstancePayloadGetFlavorAttributeType(&o.Flavor, v)
}
// GetName returns the Name field value
func (o *CreateInstancePayload) GetName() (ret CreateInstancePayloadGetNameRetType) {
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 *CreateInstancePayload) GetNameOk() (ret CreateInstancePayloadGetNameRetType, ok bool) {
return getCreateInstancePayloadGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *CreateInstancePayload) SetName(v CreateInstancePayloadGetNameRetType) {
setCreateInstancePayloadGetNameAttributeType(&o.Name, v)
}
func (o CreateInstancePayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateInstancePayloadGetAclAttributeTypeOk(o.Acl); ok {
toSerialize["Acl"] = val
}
if val, ok := getCreateInstancePayloadGetFlavorAttributeTypeOk(o.Flavor); ok {
toSerialize["Flavor"] = val
}
if val, ok := getCreateInstancePayloadGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
return toSerialize, nil
}
type NullableCreateInstancePayload struct {
value *CreateInstancePayload
isSet bool
}
func (v NullableCreateInstancePayload) Get() *CreateInstancePayload {
return v.value
}
func (v *NullableCreateInstancePayload) Set(val *CreateInstancePayload) {
v.value = val
v.isSet = true
}
func (v NullableCreateInstancePayload) IsSet() bool {
return v.isSet
}
func (v *NullableCreateInstancePayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateInstancePayload(val *CreateInstancePayload) *NullableCreateInstancePayload {
return &NullableCreateInstancePayload{value: val, isSet: true}
}
func (v NullableCreateInstancePayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateInstancePayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,58 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"testing"
)
// isEnum
func TestCreateInstancePayloadFlavor_UnmarshalJSON(t *testing.T) {
type args struct {
src []byte
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: `success - possible enum value no. 1`,
args: args{
src: []byte(`"git-10"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 2`,
args: args{
src: []byte(`"git-100"`),
},
wantErr: false,
},
{
name: "fail",
args: args{
src: []byte("\"FOOBAR\""),
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := CreateInstancePayloadFlavor("")
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}

View file

@ -0,0 +1,125 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the CreateRunnerPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateRunnerPayload{}
/*
types and functions for labels
*/
// isArray
type CreateRunnerPayloadGetLabelsAttributeType = *[]string
type CreateRunnerPayloadGetLabelsArgType = []string
type CreateRunnerPayloadGetLabelsRetType = []string
func getCreateRunnerPayloadGetLabelsAttributeTypeOk(arg CreateRunnerPayloadGetLabelsAttributeType) (ret CreateRunnerPayloadGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateRunnerPayloadGetLabelsAttributeType(arg *CreateRunnerPayloadGetLabelsAttributeType, val CreateRunnerPayloadGetLabelsRetType) {
*arg = &val
}
// CreateRunnerPayload Request a runner to be created supporting the requested list of runtime labels.
type CreateRunnerPayload struct {
// REQUIRED
Labels CreateRunnerPayloadGetLabelsAttributeType `json:"labels" required:"true"`
}
type _CreateRunnerPayload CreateRunnerPayload
// NewCreateRunnerPayload instantiates a new CreateRunnerPayload 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 NewCreateRunnerPayload(labels CreateRunnerPayloadGetLabelsArgType) *CreateRunnerPayload {
this := CreateRunnerPayload{}
setCreateRunnerPayloadGetLabelsAttributeType(&this.Labels, labels)
return &this
}
// NewCreateRunnerPayloadWithDefaults instantiates a new CreateRunnerPayload 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 NewCreateRunnerPayloadWithDefaults() *CreateRunnerPayload {
this := CreateRunnerPayload{}
return &this
}
// GetLabels returns the Labels field value
func (o *CreateRunnerPayload) GetLabels() (ret CreateRunnerPayloadGetLabelsRetType) {
ret, _ = o.GetLabelsOk()
return ret
}
// GetLabelsOk returns a tuple with the Labels field value
// and a boolean to check if the value has been set.
func (o *CreateRunnerPayload) GetLabelsOk() (ret CreateRunnerPayloadGetLabelsRetType, ok bool) {
return getCreateRunnerPayloadGetLabelsAttributeTypeOk(o.Labels)
}
// SetLabels sets field value
func (o *CreateRunnerPayload) SetLabels(v CreateRunnerPayloadGetLabelsRetType) {
setCreateRunnerPayloadGetLabelsAttributeType(&o.Labels, v)
}
func (o CreateRunnerPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateRunnerPayloadGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
return toSerialize, nil
}
type NullableCreateRunnerPayload struct {
value *CreateRunnerPayload
isSet bool
}
func (v NullableCreateRunnerPayload) Get() *CreateRunnerPayload {
return v.value
}
func (v *NullableCreateRunnerPayload) Set(val *CreateRunnerPayload) {
v.value = val
v.isSet = true
}
func (v NullableCreateRunnerPayload) IsSet() bool {
return v.isSet
}
func (v *NullableCreateRunnerPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateRunnerPayload(val *CreateRunnerPayload) *NullableCreateRunnerPayload {
return &NullableCreateRunnerPayload{value: val, isSet: true}
}
func (v NullableCreateRunnerPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateRunnerPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,366 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
"fmt"
)
// checks if the FeatureToggle type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &FeatureToggle{}
/*
types and functions for default_email_notifications
*/
// isEnum
// FeatureToggleDefaultEmailNotifications Default email notifications.
// value type for enums
type FeatureToggleDefaultEmailNotifications string
// List of DefaultEmailNotifications
const (
FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ENABLED FeatureToggleDefaultEmailNotifications = "enabled"
FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_DISABLED FeatureToggleDefaultEmailNotifications = "disabled"
FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ONMENTION FeatureToggleDefaultEmailNotifications = "onmention"
FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ANDYOUROWN FeatureToggleDefaultEmailNotifications = "andyourown"
)
// All allowed values of FeatureToggle enum
var AllowedFeatureToggleDefaultEmailNotificationsEnumValues = []FeatureToggleDefaultEmailNotifications{
"enabled",
"disabled",
"onmention",
"andyourown",
}
func (v *FeatureToggleDefaultEmailNotifications) UnmarshalJSON(src []byte) error {
// use a type alias to prevent infinite recursion during unmarshal,
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
type TmpJson FeatureToggleDefaultEmailNotifications
var value TmpJson
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue TmpJson
if value == zeroValue {
return nil
}
enumTypeValue := FeatureToggleDefaultEmailNotifications(value)
for _, existing := range AllowedFeatureToggleDefaultEmailNotificationsEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid FeatureToggle", value)
}
// NewFeatureToggleDefaultEmailNotificationsFromValue returns a pointer to a valid FeatureToggleDefaultEmailNotifications
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewFeatureToggleDefaultEmailNotificationsFromValue(v FeatureToggleDefaultEmailNotifications) (*FeatureToggleDefaultEmailNotifications, error) {
ev := FeatureToggleDefaultEmailNotifications(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for FeatureToggleDefaultEmailNotifications: valid values are %v", v, AllowedFeatureToggleDefaultEmailNotificationsEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v FeatureToggleDefaultEmailNotifications) IsValid() bool {
for _, existing := range AllowedFeatureToggleDefaultEmailNotificationsEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to DefaultEmailNotificationsDefaultEmailNotifications value
func (v FeatureToggleDefaultEmailNotifications) Ptr() *FeatureToggleDefaultEmailNotifications {
return &v
}
type NullableFeatureToggleDefaultEmailNotifications struct {
value *FeatureToggleDefaultEmailNotifications
isSet bool
}
func (v NullableFeatureToggleDefaultEmailNotifications) Get() *FeatureToggleDefaultEmailNotifications {
return v.value
}
func (v *NullableFeatureToggleDefaultEmailNotifications) Set(val *FeatureToggleDefaultEmailNotifications) {
v.value = val
v.isSet = true
}
func (v NullableFeatureToggleDefaultEmailNotifications) IsSet() bool {
return v.isSet
}
func (v *NullableFeatureToggleDefaultEmailNotifications) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFeatureToggleDefaultEmailNotifications(val *FeatureToggleDefaultEmailNotifications) *NullableFeatureToggleDefaultEmailNotifications {
return &NullableFeatureToggleDefaultEmailNotifications{value: val, isSet: true}
}
func (v NullableFeatureToggleDefaultEmailNotifications) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFeatureToggleDefaultEmailNotifications) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type FeatureToggleGetDefaultEmailNotificationsAttributeType = *FeatureToggleDefaultEmailNotifications
type FeatureToggleGetDefaultEmailNotificationsArgType = *FeatureToggleDefaultEmailNotifications
type FeatureToggleGetDefaultEmailNotificationsRetType = *FeatureToggleDefaultEmailNotifications
func getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(arg FeatureToggleGetDefaultEmailNotificationsAttributeType) (ret FeatureToggleGetDefaultEmailNotificationsRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg, true
}
func setFeatureToggleGetDefaultEmailNotificationsAttributeType(arg *FeatureToggleGetDefaultEmailNotificationsAttributeType, val FeatureToggleGetDefaultEmailNotificationsRetType) {
*arg = val
}
/*
types and functions for enable_commit_signatures
*/
// isBoolean
type FeatureTogglegetEnableCommitSignaturesAttributeType = *bool
type FeatureTogglegetEnableCommitSignaturesArgType = *bool
type FeatureTogglegetEnableCommitSignaturesRetType = *bool
func getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(arg FeatureTogglegetEnableCommitSignaturesAttributeType) (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg, true
}
func setFeatureTogglegetEnableCommitSignaturesAttributeType(arg *FeatureTogglegetEnableCommitSignaturesAttributeType, val FeatureTogglegetEnableCommitSignaturesRetType) {
*arg = val
}
/*
types and functions for enable_local_login
*/
// isBoolean
type FeatureTogglegetEnableLocalLoginAttributeType = *bool
type FeatureTogglegetEnableLocalLoginArgType = *bool
type FeatureTogglegetEnableLocalLoginRetType = *bool
func getFeatureTogglegetEnableLocalLoginAttributeTypeOk(arg FeatureTogglegetEnableLocalLoginAttributeType) (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg, true
}
func setFeatureTogglegetEnableLocalLoginAttributeType(arg *FeatureTogglegetEnableLocalLoginAttributeType, val FeatureTogglegetEnableLocalLoginRetType) {
*arg = val
}
// FeatureToggle Feature toggles for the instance.
type FeatureToggle struct {
// Default email notifications.
DefaultEmailNotifications FeatureToggleGetDefaultEmailNotificationsAttributeType `json:"default_email_notifications,omitempty"`
// Enable commit signatures.
EnableCommitSignatures FeatureTogglegetEnableCommitSignaturesAttributeType `json:"enable_commit_signatures,omitempty"`
// Enable local login.
EnableLocalLogin FeatureTogglegetEnableLocalLoginAttributeType `json:"enable_local_login,omitempty"`
}
// NewFeatureToggle instantiates a new FeatureToggle 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 NewFeatureToggle() *FeatureToggle {
this := FeatureToggle{}
return &this
}
// NewFeatureToggleWithDefaults instantiates a new FeatureToggle 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 NewFeatureToggleWithDefaults() *FeatureToggle {
this := FeatureToggle{}
return &this
}
// GetDefaultEmailNotifications returns the DefaultEmailNotifications field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *FeatureToggle) GetDefaultEmailNotifications() (res FeatureToggleGetDefaultEmailNotificationsRetType) {
res, _ = o.GetDefaultEmailNotificationsOk()
return
}
// GetDefaultEmailNotificationsOk returns a tuple with the DefaultEmailNotifications 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 *FeatureToggle) GetDefaultEmailNotificationsOk() (ret FeatureToggleGetDefaultEmailNotificationsRetType, ok bool) {
return getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(o.DefaultEmailNotifications)
}
// HasDefaultEmailNotifications returns a boolean if a field has been set.
func (o *FeatureToggle) HasDefaultEmailNotifications() bool {
_, ok := o.GetDefaultEmailNotificationsOk()
return ok
}
// SetDefaultEmailNotifications gets a reference to the given string and assigns it to the DefaultEmailNotifications field.
func (o *FeatureToggle) SetDefaultEmailNotifications(v FeatureToggleGetDefaultEmailNotificationsRetType) {
setFeatureToggleGetDefaultEmailNotificationsAttributeType(&o.DefaultEmailNotifications, v)
}
// SetDefaultEmailNotificationsNil sets the value for DefaultEmailNotifications to be an explicit nil
func (o *FeatureToggle) SetDefaultEmailNotificationsNil() {
o.DefaultEmailNotifications = nil
}
// UnsetDefaultEmailNotifications ensures that no value is present for DefaultEmailNotifications, not even an explicit nil
func (o *FeatureToggle) UnsetDefaultEmailNotifications() {
o.DefaultEmailNotifications = nil
}
// GetEnableCommitSignatures returns the EnableCommitSignatures field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *FeatureToggle) GetEnableCommitSignatures() (res FeatureTogglegetEnableCommitSignaturesRetType) {
res, _ = o.GetEnableCommitSignaturesOk()
return
}
// GetEnableCommitSignaturesOk returns a tuple with the EnableCommitSignatures 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 *FeatureToggle) GetEnableCommitSignaturesOk() (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) {
return getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures)
}
// HasEnableCommitSignatures returns a boolean if a field has been set.
func (o *FeatureToggle) HasEnableCommitSignatures() bool {
_, ok := o.GetEnableCommitSignaturesOk()
return ok
}
// SetEnableCommitSignatures gets a reference to the given bool and assigns it to the EnableCommitSignatures field.
func (o *FeatureToggle) SetEnableCommitSignatures(v FeatureTogglegetEnableCommitSignaturesRetType) {
setFeatureTogglegetEnableCommitSignaturesAttributeType(&o.EnableCommitSignatures, v)
}
// SetEnableCommitSignaturesNil sets the value for EnableCommitSignatures to be an explicit nil
func (o *FeatureToggle) SetEnableCommitSignaturesNil() {
o.EnableCommitSignatures = nil
}
// UnsetEnableCommitSignatures ensures that no value is present for EnableCommitSignatures, not even an explicit nil
func (o *FeatureToggle) UnsetEnableCommitSignatures() {
o.EnableCommitSignatures = nil
}
// GetEnableLocalLogin returns the EnableLocalLogin field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *FeatureToggle) GetEnableLocalLogin() (res FeatureTogglegetEnableLocalLoginRetType) {
res, _ = o.GetEnableLocalLoginOk()
return
}
// GetEnableLocalLoginOk returns a tuple with the EnableLocalLogin 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 *FeatureToggle) GetEnableLocalLoginOk() (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) {
return getFeatureTogglegetEnableLocalLoginAttributeTypeOk(o.EnableLocalLogin)
}
// HasEnableLocalLogin returns a boolean if a field has been set.
func (o *FeatureToggle) HasEnableLocalLogin() bool {
_, ok := o.GetEnableLocalLoginOk()
return ok
}
// SetEnableLocalLogin gets a reference to the given bool and assigns it to the EnableLocalLogin field.
func (o *FeatureToggle) SetEnableLocalLogin(v FeatureTogglegetEnableLocalLoginRetType) {
setFeatureTogglegetEnableLocalLoginAttributeType(&o.EnableLocalLogin, v)
}
// SetEnableLocalLoginNil sets the value for EnableLocalLogin to be an explicit nil
func (o *FeatureToggle) SetEnableLocalLoginNil() {
o.EnableLocalLogin = nil
}
// UnsetEnableLocalLogin ensures that no value is present for EnableLocalLogin, not even an explicit nil
func (o *FeatureToggle) UnsetEnableLocalLogin() {
o.EnableLocalLogin = nil
}
func (o FeatureToggle) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(o.DefaultEmailNotifications); ok {
toSerialize["DefaultEmailNotifications"] = val
}
if val, ok := getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures); ok {
toSerialize["EnableCommitSignatures"] = val
}
if val, ok := getFeatureTogglegetEnableLocalLoginAttributeTypeOk(o.EnableLocalLogin); ok {
toSerialize["EnableLocalLogin"] = val
}
return toSerialize, nil
}
type NullableFeatureToggle struct {
value *FeatureToggle
isSet bool
}
func (v NullableFeatureToggle) Get() *FeatureToggle {
return v.value
}
func (v *NullableFeatureToggle) Set(val *FeatureToggle) {
v.value = val
v.isSet = true
}
func (v NullableFeatureToggle) IsSet() bool {
return v.isSet
}
func (v *NullableFeatureToggle) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFeatureToggle(val *FeatureToggle) *NullableFeatureToggle {
return &NullableFeatureToggle{value: val, isSet: true}
}
func (v NullableFeatureToggle) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFeatureToggle) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,72 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"testing"
)
// isEnum
func TestFeatureToggleDefaultEmailNotifications_UnmarshalJSON(t *testing.T) {
type args struct {
src []byte
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: `success - possible enum value no. 1`,
args: args{
src: []byte(`"enabled"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 2`,
args: args{
src: []byte(`"disabled"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 3`,
args: args{
src: []byte(`"onmention"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 4`,
args: args{
src: []byte(`"andyourown"`),
},
wantErr: false,
},
{
name: "fail",
args: args{
src: []byte("\"FOOBAR\""),
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := FeatureToggleDefaultEmailNotifications("")
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}

415
pkg/gitbeta/model_flavor.go Normal file
View file

@ -0,0 +1,415 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
"fmt"
)
// checks if the Flavor type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Flavor{}
/*
types and functions for availability
*/
// isEnum
// FlavorAvailability Defines the flavor availability.
// value type for enums
type FlavorAvailability string
// List of Availability
const (
FLAVORAVAILABILITY_AVAILABLE FlavorAvailability = "available"
FLAVORAVAILABILITY_UNAVAILABLE FlavorAvailability = "unavailable"
FLAVORAVAILABILITY_INTERNAL FlavorAvailability = "internal"
FLAVORAVAILABILITY_DEPRECATED FlavorAvailability = "deprecated"
)
// All allowed values of Flavor enum
var AllowedFlavorAvailabilityEnumValues = []FlavorAvailability{
"available",
"unavailable",
"internal",
"deprecated",
}
func (v *FlavorAvailability) UnmarshalJSON(src []byte) error {
// use a type alias to prevent infinite recursion during unmarshal,
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
type TmpJson FlavorAvailability
var value TmpJson
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue TmpJson
if value == zeroValue {
return nil
}
enumTypeValue := FlavorAvailability(value)
for _, existing := range AllowedFlavorAvailabilityEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid Flavor", value)
}
// NewFlavorAvailabilityFromValue returns a pointer to a valid FlavorAvailability
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewFlavorAvailabilityFromValue(v FlavorAvailability) (*FlavorAvailability, error) {
ev := FlavorAvailability(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for FlavorAvailability: valid values are %v", v, AllowedFlavorAvailabilityEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v FlavorAvailability) IsValid() bool {
for _, existing := range AllowedFlavorAvailabilityEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to AvailabilityAvailability value
func (v FlavorAvailability) Ptr() *FlavorAvailability {
return &v
}
type NullableFlavorAvailability struct {
value *FlavorAvailability
isSet bool
}
func (v NullableFlavorAvailability) Get() *FlavorAvailability {
return v.value
}
func (v *NullableFlavorAvailability) Set(val *FlavorAvailability) {
v.value = val
v.isSet = true
}
func (v NullableFlavorAvailability) IsSet() bool {
return v.isSet
}
func (v *NullableFlavorAvailability) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFlavorAvailability(val *FlavorAvailability) *NullableFlavorAvailability {
return &NullableFlavorAvailability{value: val, isSet: true}
}
func (v NullableFlavorAvailability) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFlavorAvailability) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type FlavorGetAvailabilityAttributeType = *FlavorAvailability
type FlavorGetAvailabilityArgType = FlavorAvailability
type FlavorGetAvailabilityRetType = FlavorAvailability
func getFlavorGetAvailabilityAttributeTypeOk(arg FlavorGetAvailabilityAttributeType) (ret FlavorGetAvailabilityRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setFlavorGetAvailabilityAttributeType(arg *FlavorGetAvailabilityAttributeType, val FlavorGetAvailabilityRetType) {
*arg = &val
}
/*
types and functions for description
*/
// isNotNullableString
type FlavorGetDescriptionAttributeType = *string
func getFlavorGetDescriptionAttributeTypeOk(arg FlavorGetDescriptionAttributeType) (ret FlavorGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setFlavorGetDescriptionAttributeType(arg *FlavorGetDescriptionAttributeType, val FlavorGetDescriptionRetType) {
*arg = &val
}
type FlavorGetDescriptionArgType = string
type FlavorGetDescriptionRetType = string
/*
types and functions for display_name
*/
// isNotNullableString
type FlavorGetDisplayNameAttributeType = *string
func getFlavorGetDisplayNameAttributeTypeOk(arg FlavorGetDisplayNameAttributeType) (ret FlavorGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setFlavorGetDisplayNameAttributeType(arg *FlavorGetDisplayNameAttributeType, val FlavorGetDisplayNameRetType) {
*arg = &val
}
type FlavorGetDisplayNameArgType = string
type FlavorGetDisplayNameRetType = string
/*
types and functions for id
*/
// isNotNullableString
type FlavorGetIdAttributeType = *string
func getFlavorGetIdAttributeTypeOk(arg FlavorGetIdAttributeType) (ret FlavorGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setFlavorGetIdAttributeType(arg *FlavorGetIdAttributeType, val FlavorGetIdRetType) {
*arg = &val
}
type FlavorGetIdArgType = string
type FlavorGetIdRetType = string
/*
types and functions for sku
*/
// isNotNullableString
type FlavorGetSkuAttributeType = *string
func getFlavorGetSkuAttributeTypeOk(arg FlavorGetSkuAttributeType) (ret FlavorGetSkuRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setFlavorGetSkuAttributeType(arg *FlavorGetSkuAttributeType, val FlavorGetSkuRetType) {
*arg = &val
}
type FlavorGetSkuArgType = string
type FlavorGetSkuRetType = string
// Flavor Describes a STACKIT Git Flavor.
type Flavor struct {
// Defines the flavor availability.
// REQUIRED
Availability FlavorGetAvailabilityAttributeType `json:"availability" required:"true"`
// Flavor description.
// REQUIRED
Description FlavorGetDescriptionAttributeType `json:"description" required:"true"`
// The display name that will be shown in the Portal.
// REQUIRED
DisplayName FlavorGetDisplayNameAttributeType `json:"display_name" required:"true"`
// Flavor id.
// REQUIRED
Id FlavorGetIdAttributeType `json:"id" required:"true"`
// SAP article number.
// REQUIRED
Sku FlavorGetSkuAttributeType `json:"sku" required:"true"`
}
type _Flavor Flavor
// NewFlavor instantiates a new Flavor 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 NewFlavor(availability FlavorGetAvailabilityArgType, description FlavorGetDescriptionArgType, displayName FlavorGetDisplayNameArgType, id FlavorGetIdArgType, sku FlavorGetSkuArgType) *Flavor {
this := Flavor{}
setFlavorGetAvailabilityAttributeType(&this.Availability, availability)
setFlavorGetDescriptionAttributeType(&this.Description, description)
setFlavorGetDisplayNameAttributeType(&this.DisplayName, displayName)
setFlavorGetIdAttributeType(&this.Id, id)
setFlavorGetSkuAttributeType(&this.Sku, sku)
return &this
}
// NewFlavorWithDefaults instantiates a new Flavor 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 NewFlavorWithDefaults() *Flavor {
this := Flavor{}
return &this
}
// GetAvailability returns the Availability field value
func (o *Flavor) GetAvailability() (ret FlavorGetAvailabilityRetType) {
ret, _ = o.GetAvailabilityOk()
return ret
}
// GetAvailabilityOk returns a tuple with the Availability field value
// and a boolean to check if the value has been set.
func (o *Flavor) GetAvailabilityOk() (ret FlavorGetAvailabilityRetType, ok bool) {
return getFlavorGetAvailabilityAttributeTypeOk(o.Availability)
}
// SetAvailability sets field value
func (o *Flavor) SetAvailability(v FlavorGetAvailabilityRetType) {
setFlavorGetAvailabilityAttributeType(&o.Availability, v)
}
// GetDescription returns the Description field value
func (o *Flavor) GetDescription() (ret FlavorGetDescriptionRetType) {
ret, _ = o.GetDescriptionOk()
return ret
}
// GetDescriptionOk returns a tuple with the Description field value
// and a boolean to check if the value has been set.
func (o *Flavor) GetDescriptionOk() (ret FlavorGetDescriptionRetType, ok bool) {
return getFlavorGetDescriptionAttributeTypeOk(o.Description)
}
// SetDescription sets field value
func (o *Flavor) SetDescription(v FlavorGetDescriptionRetType) {
setFlavorGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value
func (o *Flavor) GetDisplayName() (ret FlavorGetDisplayNameRetType) {
ret, _ = o.GetDisplayNameOk()
return ret
}
// GetDisplayNameOk returns a tuple with the DisplayName field value
// and a boolean to check if the value has been set.
func (o *Flavor) GetDisplayNameOk() (ret FlavorGetDisplayNameRetType, ok bool) {
return getFlavorGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// SetDisplayName sets field value
func (o *Flavor) SetDisplayName(v FlavorGetDisplayNameRetType) {
setFlavorGetDisplayNameAttributeType(&o.DisplayName, v)
}
// GetId returns the Id field value
func (o *Flavor) GetId() (ret FlavorGetIdRetType) {
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 *Flavor) GetIdOk() (ret FlavorGetIdRetType, ok bool) {
return getFlavorGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *Flavor) SetId(v FlavorGetIdRetType) {
setFlavorGetIdAttributeType(&o.Id, v)
}
// GetSku returns the Sku field value
func (o *Flavor) GetSku() (ret FlavorGetSkuRetType) {
ret, _ = o.GetSkuOk()
return ret
}
// GetSkuOk returns a tuple with the Sku field value
// and a boolean to check if the value has been set.
func (o *Flavor) GetSkuOk() (ret FlavorGetSkuRetType, ok bool) {
return getFlavorGetSkuAttributeTypeOk(o.Sku)
}
// SetSku sets field value
func (o *Flavor) SetSku(v FlavorGetSkuRetType) {
setFlavorGetSkuAttributeType(&o.Sku, v)
}
func (o Flavor) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getFlavorGetAvailabilityAttributeTypeOk(o.Availability); ok {
toSerialize["Availability"] = val
}
if val, ok := getFlavorGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getFlavorGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
if val, ok := getFlavorGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getFlavorGetSkuAttributeTypeOk(o.Sku); ok {
toSerialize["Sku"] = val
}
return toSerialize, nil
}
type NullableFlavor struct {
value *Flavor
isSet bool
}
func (v NullableFlavor) Get() *Flavor {
return v.value
}
func (v *NullableFlavor) Set(val *Flavor) {
v.value = val
v.isSet = true
}
func (v NullableFlavor) IsSet() bool {
return v.isSet
}
func (v *NullableFlavor) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFlavor(val *Flavor) *NullableFlavor {
return &NullableFlavor{value: val, isSet: true}
}
func (v NullableFlavor) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFlavor) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,72 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"testing"
)
// isEnum
func TestFlavorAvailability_UnmarshalJSON(t *testing.T) {
type args struct {
src []byte
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: `success - possible enum value no. 1`,
args: args{
src: []byte(`"available"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 2`,
args: args{
src: []byte(`"unavailable"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 3`,
args: args{
src: []byte(`"internal"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 4`,
args: args{
src: []byte(`"deprecated"`),
},
wantErr: false,
},
{
name: "fail",
args: args{
src: []byte("\"FOOBAR\""),
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := FlavorAvailability("")
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}

View file

@ -0,0 +1,125 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the FlavorsList type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &FlavorsList{}
/*
types and functions for flavors
*/
// isArray
type FlavorsListGetFlavorsAttributeType = *[]Flavor
type FlavorsListGetFlavorsArgType = []Flavor
type FlavorsListGetFlavorsRetType = []Flavor
func getFlavorsListGetFlavorsAttributeTypeOk(arg FlavorsListGetFlavorsAttributeType) (ret FlavorsListGetFlavorsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setFlavorsListGetFlavorsAttributeType(arg *FlavorsListGetFlavorsAttributeType, val FlavorsListGetFlavorsRetType) {
*arg = &val
}
// FlavorsList A list of STACKIT Git Flavors.
type FlavorsList struct {
// REQUIRED
Flavors FlavorsListGetFlavorsAttributeType `json:"flavors" required:"true"`
}
type _FlavorsList FlavorsList
// NewFlavorsList instantiates a new FlavorsList 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 NewFlavorsList(flavors FlavorsListGetFlavorsArgType) *FlavorsList {
this := FlavorsList{}
setFlavorsListGetFlavorsAttributeType(&this.Flavors, flavors)
return &this
}
// NewFlavorsListWithDefaults instantiates a new FlavorsList 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 NewFlavorsListWithDefaults() *FlavorsList {
this := FlavorsList{}
return &this
}
// GetFlavors returns the Flavors field value
func (o *FlavorsList) GetFlavors() (ret FlavorsListGetFlavorsRetType) {
ret, _ = o.GetFlavorsOk()
return ret
}
// GetFlavorsOk returns a tuple with the Flavors field value
// and a boolean to check if the value has been set.
func (o *FlavorsList) GetFlavorsOk() (ret FlavorsListGetFlavorsRetType, ok bool) {
return getFlavorsListGetFlavorsAttributeTypeOk(o.Flavors)
}
// SetFlavors sets field value
func (o *FlavorsList) SetFlavors(v FlavorsListGetFlavorsRetType) {
setFlavorsListGetFlavorsAttributeType(&o.Flavors, v)
}
func (o FlavorsList) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getFlavorsListGetFlavorsAttributeTypeOk(o.Flavors); ok {
toSerialize["Flavors"] = val
}
return toSerialize, nil
}
type NullableFlavorsList struct {
value *FlavorsList
isSet bool
}
func (v NullableFlavorsList) Get() *FlavorsList {
return v.value
}
func (v *NullableFlavorsList) Set(val *FlavorsList) {
v.value = val
v.isSet = true
}
func (v NullableFlavorsList) IsSet() bool {
return v.isSet
}
func (v *NullableFlavorsList) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFlavorsList(val *FlavorsList) *NullableFlavorsList {
return &NullableFlavorsList{value: val, isSet: true}
}
func (v NullableFlavorsList) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFlavorsList) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,173 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the GenericErrorResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GenericErrorResponse{}
/*
types and functions for details
*/
// isArray
type GenericErrorResponseGetDetailsAttributeType = *[]string
type GenericErrorResponseGetDetailsArgType = []string
type GenericErrorResponseGetDetailsRetType = []string
func getGenericErrorResponseGetDetailsAttributeTypeOk(arg GenericErrorResponseGetDetailsAttributeType) (ret GenericErrorResponseGetDetailsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setGenericErrorResponseGetDetailsAttributeType(arg *GenericErrorResponseGetDetailsAttributeType, val GenericErrorResponseGetDetailsRetType) {
*arg = &val
}
/*
types and functions for message
*/
// isNotNullableString
type GenericErrorResponseGetMessageAttributeType = *string
func getGenericErrorResponseGetMessageAttributeTypeOk(arg GenericErrorResponseGetMessageAttributeType) (ret GenericErrorResponseGetMessageRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setGenericErrorResponseGetMessageAttributeType(arg *GenericErrorResponseGetMessageAttributeType, val GenericErrorResponseGetMessageRetType) {
*arg = &val
}
type GenericErrorResponseGetMessageArgType = string
type GenericErrorResponseGetMessageRetType = string
// GenericErrorResponse Generic Error Response.
type GenericErrorResponse struct {
Details GenericErrorResponseGetDetailsAttributeType `json:"details,omitempty"`
// REQUIRED
Message GenericErrorResponseGetMessageAttributeType `json:"message" required:"true"`
}
type _GenericErrorResponse GenericErrorResponse
// NewGenericErrorResponse instantiates a new GenericErrorResponse 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 NewGenericErrorResponse(message GenericErrorResponseGetMessageArgType) *GenericErrorResponse {
this := GenericErrorResponse{}
setGenericErrorResponseGetMessageAttributeType(&this.Message, message)
return &this
}
// NewGenericErrorResponseWithDefaults instantiates a new GenericErrorResponse 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 NewGenericErrorResponseWithDefaults() *GenericErrorResponse {
this := GenericErrorResponse{}
return &this
}
// GetDetails returns the Details field value if set, zero value otherwise.
func (o *GenericErrorResponse) GetDetails() (res GenericErrorResponseGetDetailsRetType) {
res, _ = o.GetDetailsOk()
return
}
// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GenericErrorResponse) GetDetailsOk() (ret GenericErrorResponseGetDetailsRetType, ok bool) {
return getGenericErrorResponseGetDetailsAttributeTypeOk(o.Details)
}
// HasDetails returns a boolean if a field has been set.
func (o *GenericErrorResponse) HasDetails() bool {
_, ok := o.GetDetailsOk()
return ok
}
// SetDetails gets a reference to the given []string and assigns it to the Details field.
func (o *GenericErrorResponse) SetDetails(v GenericErrorResponseGetDetailsRetType) {
setGenericErrorResponseGetDetailsAttributeType(&o.Details, v)
}
// GetMessage returns the Message field value
func (o *GenericErrorResponse) GetMessage() (ret GenericErrorResponseGetMessageRetType) {
ret, _ = o.GetMessageOk()
return ret
}
// GetMessageOk returns a tuple with the Message field value
// and a boolean to check if the value has been set.
func (o *GenericErrorResponse) GetMessageOk() (ret GenericErrorResponseGetMessageRetType, ok bool) {
return getGenericErrorResponseGetMessageAttributeTypeOk(o.Message)
}
// SetMessage sets field value
func (o *GenericErrorResponse) SetMessage(v GenericErrorResponseGetMessageRetType) {
setGenericErrorResponseGetMessageAttributeType(&o.Message, v)
}
func (o GenericErrorResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getGenericErrorResponseGetDetailsAttributeTypeOk(o.Details); ok {
toSerialize["Details"] = val
}
if val, ok := getGenericErrorResponseGetMessageAttributeTypeOk(o.Message); ok {
toSerialize["Message"] = val
}
return toSerialize, nil
}
type NullableGenericErrorResponse struct {
value *GenericErrorResponse
isSet bool
}
func (v NullableGenericErrorResponse) Get() *GenericErrorResponse {
return v.value
}
func (v *NullableGenericErrorResponse) Set(val *GenericErrorResponse) {
v.value = val
v.isSet = true
}
func (v NullableGenericErrorResponse) IsSet() bool {
return v.isSet
}
func (v *NullableGenericErrorResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGenericErrorResponse(val *GenericErrorResponse) *NullableGenericErrorResponse {
return &NullableGenericErrorResponse{value: val, isSet: true}
}
func (v NullableGenericErrorResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGenericErrorResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,686 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
"fmt"
"time"
)
// checks if the Instance type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Instance{}
/*
types and functions for acl
*/
// isArray
type InstanceGetAclAttributeType = *[]string
type InstanceGetAclArgType = []string
type InstanceGetAclRetType = []string
func getInstanceGetAclAttributeTypeOk(arg InstanceGetAclAttributeType) (ret InstanceGetAclRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetAclAttributeType(arg *InstanceGetAclAttributeType, val InstanceGetAclRetType) {
*arg = &val
}
/*
types and functions for consumed_disk
*/
// isNotNullableString
type InstanceGetConsumedDiskAttributeType = *string
func getInstanceGetConsumedDiskAttributeTypeOk(arg InstanceGetConsumedDiskAttributeType) (ret InstanceGetConsumedDiskRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetConsumedDiskAttributeType(arg *InstanceGetConsumedDiskAttributeType, val InstanceGetConsumedDiskRetType) {
*arg = &val
}
type InstanceGetConsumedDiskArgType = string
type InstanceGetConsumedDiskRetType = string
/*
types and functions for consumed_object_storage
*/
// isNotNullableString
type InstanceGetConsumedObjectStorageAttributeType = *string
func getInstanceGetConsumedObjectStorageAttributeTypeOk(arg InstanceGetConsumedObjectStorageAttributeType) (ret InstanceGetConsumedObjectStorageRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetConsumedObjectStorageAttributeType(arg *InstanceGetConsumedObjectStorageAttributeType, val InstanceGetConsumedObjectStorageRetType) {
*arg = &val
}
type InstanceGetConsumedObjectStorageArgType = string
type InstanceGetConsumedObjectStorageRetType = string
/*
types and functions for created
*/
// isDateTime
type InstanceGetCreatedAttributeType = *time.Time
type InstanceGetCreatedArgType = time.Time
type InstanceGetCreatedRetType = time.Time
func getInstanceGetCreatedAttributeTypeOk(arg InstanceGetCreatedAttributeType) (ret InstanceGetCreatedRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetCreatedAttributeType(arg *InstanceGetCreatedAttributeType, val InstanceGetCreatedRetType) {
*arg = &val
}
/*
types and functions for feature_toggle
*/
// isModel
type InstanceGetFeatureToggleAttributeType = *FeatureToggle
type InstanceGetFeatureToggleArgType = FeatureToggle
type InstanceGetFeatureToggleRetType = FeatureToggle
func getInstanceGetFeatureToggleAttributeTypeOk(arg InstanceGetFeatureToggleAttributeType) (ret InstanceGetFeatureToggleRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetFeatureToggleAttributeType(arg *InstanceGetFeatureToggleAttributeType, val InstanceGetFeatureToggleRetType) {
*arg = &val
}
/*
types and functions for flavor
*/
// isNotNullableString
type InstanceGetFlavorAttributeType = *string
func getInstanceGetFlavorAttributeTypeOk(arg InstanceGetFlavorAttributeType) (ret InstanceGetFlavorRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetFlavorAttributeType(arg *InstanceGetFlavorAttributeType, val InstanceGetFlavorRetType) {
*arg = &val
}
type InstanceGetFlavorArgType = string
type InstanceGetFlavorRetType = string
/*
types and functions for id
*/
// isNotNullableString
type InstanceGetIdAttributeType = *string
func getInstanceGetIdAttributeTypeOk(arg InstanceGetIdAttributeType) (ret InstanceGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetIdAttributeType(arg *InstanceGetIdAttributeType, val InstanceGetIdRetType) {
*arg = &val
}
type InstanceGetIdArgType = string
type InstanceGetIdRetType = string
/*
types and functions for name
*/
// isNotNullableString
type InstanceGetNameAttributeType = *string
func getInstanceGetNameAttributeTypeOk(arg InstanceGetNameAttributeType) (ret InstanceGetNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetNameAttributeType(arg *InstanceGetNameAttributeType, val InstanceGetNameRetType) {
*arg = &val
}
type InstanceGetNameArgType = string
type InstanceGetNameRetType = string
/*
types and functions for state
*/
// isEnum
// InstanceState The current state of the STACKIT Git instance.
// value type for enums
type InstanceState string
// List of State
const (
INSTANCESTATE_CREATING InstanceState = "Creating"
INSTANCESTATE_WAITING_FOR_RESOURCES InstanceState = "WaitingForResources"
INSTANCESTATE_UPDATING InstanceState = "Updating"
INSTANCESTATE_DELETING InstanceState = "Deleting"
INSTANCESTATE_READY InstanceState = "Ready"
INSTANCESTATE_ERROR InstanceState = "Error"
)
// All allowed values of Instance enum
var AllowedInstanceStateEnumValues = []InstanceState{
"Creating",
"WaitingForResources",
"Updating",
"Deleting",
"Ready",
"Error",
}
func (v *InstanceState) UnmarshalJSON(src []byte) error {
// use a type alias to prevent infinite recursion during unmarshal,
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
type TmpJson InstanceState
var value TmpJson
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue TmpJson
if value == zeroValue {
return nil
}
enumTypeValue := InstanceState(value)
for _, existing := range AllowedInstanceStateEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid Instance", value)
}
// NewInstanceStateFromValue returns a pointer to a valid InstanceState
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewInstanceStateFromValue(v InstanceState) (*InstanceState, error) {
ev := InstanceState(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for InstanceState: valid values are %v", v, AllowedInstanceStateEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v InstanceState) IsValid() bool {
for _, existing := range AllowedInstanceStateEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to StateState value
func (v InstanceState) Ptr() *InstanceState {
return &v
}
type NullableInstanceState struct {
value *InstanceState
isSet bool
}
func (v NullableInstanceState) Get() *InstanceState {
return v.value
}
func (v *NullableInstanceState) Set(val *InstanceState) {
v.value = val
v.isSet = true
}
func (v NullableInstanceState) IsSet() bool {
return v.isSet
}
func (v *NullableInstanceState) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInstanceState(val *InstanceState) *NullableInstanceState {
return &NullableInstanceState{value: val, isSet: true}
}
func (v NullableInstanceState) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInstanceState) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type InstanceGetStateAttributeType = *InstanceState
type InstanceGetStateArgType = InstanceState
type InstanceGetStateRetType = InstanceState
func getInstanceGetStateAttributeTypeOk(arg InstanceGetStateAttributeType) (ret InstanceGetStateRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetStateAttributeType(arg *InstanceGetStateAttributeType, val InstanceGetStateRetType) {
*arg = &val
}
/*
types and functions for url
*/
// isNotNullableString
type InstanceGetUrlAttributeType = *string
func getInstanceGetUrlAttributeTypeOk(arg InstanceGetUrlAttributeType) (ret InstanceGetUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetUrlAttributeType(arg *InstanceGetUrlAttributeType, val InstanceGetUrlRetType) {
*arg = &val
}
type InstanceGetUrlArgType = string
type InstanceGetUrlRetType = string
/*
types and functions for version
*/
// isNotNullableString
type InstanceGetVersionAttributeType = *string
func getInstanceGetVersionAttributeTypeOk(arg InstanceGetVersionAttributeType) (ret InstanceGetVersionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceGetVersionAttributeType(arg *InstanceGetVersionAttributeType, val InstanceGetVersionRetType) {
*arg = &val
}
type InstanceGetVersionArgType = string
type InstanceGetVersionRetType = string
// Instance Describes a STACKIT Git instance.
type Instance struct {
// Restricted ACL for instance access.
// REQUIRED
Acl InstanceGetAclAttributeType `json:"acl" required:"true"`
// How many bytes of disk space is consumed. Read Only.
// REQUIRED
ConsumedDisk InstanceGetConsumedDiskAttributeType `json:"consumed_disk" required:"true"`
// How many bytes of Object Storage is consumed. Read Only.
// REQUIRED
ConsumedObjectStorage InstanceGetConsumedObjectStorageAttributeType `json:"consumed_object_storage" required:"true"`
// The date and time the creation of the STACKIT Git instance was triggered.
// REQUIRED
Created InstanceGetCreatedAttributeType `json:"created" required:"true"`
// REQUIRED
FeatureToggle InstanceGetFeatureToggleAttributeType `json:"feature_toggle" required:"true"`
// Instance flavor.
// REQUIRED
Flavor InstanceGetFlavorAttributeType `json:"flavor" required:"true"`
// A auto generated unique id which identifies the STACKIT Git instances.
// REQUIRED
Id InstanceGetIdAttributeType `json:"id" required:"true"`
// A user chosen name to distinguish multiple STACKIT Git instances.
// REQUIRED
Name InstanceGetNameAttributeType `json:"name" required:"true"`
// The current state of the STACKIT Git instance.
// REQUIRED
State InstanceGetStateAttributeType `json:"state" required:"true"`
// The URL for reaching the STACKIT Git instance.
// REQUIRED
Url InstanceGetUrlAttributeType `json:"url" required:"true"`
// The current version of STACKIT Git deployed to the instance.
// REQUIRED
Version InstanceGetVersionAttributeType `json:"version" required:"true"`
}
type _Instance Instance
// NewInstance instantiates a new Instance object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewInstance(acl InstanceGetAclArgType, consumedDisk InstanceGetConsumedDiskArgType, consumedObjectStorage InstanceGetConsumedObjectStorageArgType, created InstanceGetCreatedArgType, featureToggle InstanceGetFeatureToggleArgType, flavor InstanceGetFlavorArgType, id InstanceGetIdArgType, name InstanceGetNameArgType, state InstanceGetStateArgType, url InstanceGetUrlArgType, version InstanceGetVersionArgType) *Instance {
this := Instance{}
setInstanceGetAclAttributeType(&this.Acl, acl)
setInstanceGetConsumedDiskAttributeType(&this.ConsumedDisk, consumedDisk)
setInstanceGetConsumedObjectStorageAttributeType(&this.ConsumedObjectStorage, consumedObjectStorage)
setInstanceGetCreatedAttributeType(&this.Created, created)
setInstanceGetFeatureToggleAttributeType(&this.FeatureToggle, featureToggle)
setInstanceGetFlavorAttributeType(&this.Flavor, flavor)
setInstanceGetIdAttributeType(&this.Id, id)
setInstanceGetNameAttributeType(&this.Name, name)
setInstanceGetStateAttributeType(&this.State, state)
setInstanceGetUrlAttributeType(&this.Url, url)
setInstanceGetVersionAttributeType(&this.Version, version)
return &this
}
// NewInstanceWithDefaults instantiates a new Instance object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewInstanceWithDefaults() *Instance {
this := Instance{}
return &this
}
// GetAcl returns the Acl field value
func (o *Instance) GetAcl() (ret InstanceGetAclRetType) {
ret, _ = o.GetAclOk()
return ret
}
// GetAclOk returns a tuple with the Acl field value
// and a boolean to check if the value has been set.
func (o *Instance) GetAclOk() (ret InstanceGetAclRetType, ok bool) {
return getInstanceGetAclAttributeTypeOk(o.Acl)
}
// SetAcl sets field value
func (o *Instance) SetAcl(v InstanceGetAclRetType) {
setInstanceGetAclAttributeType(&o.Acl, v)
}
// GetConsumedDisk returns the ConsumedDisk field value
func (o *Instance) GetConsumedDisk() (ret InstanceGetConsumedDiskRetType) {
ret, _ = o.GetConsumedDiskOk()
return ret
}
// GetConsumedDiskOk returns a tuple with the ConsumedDisk field value
// and a boolean to check if the value has been set.
func (o *Instance) GetConsumedDiskOk() (ret InstanceGetConsumedDiskRetType, ok bool) {
return getInstanceGetConsumedDiskAttributeTypeOk(o.ConsumedDisk)
}
// SetConsumedDisk sets field value
func (o *Instance) SetConsumedDisk(v InstanceGetConsumedDiskRetType) {
setInstanceGetConsumedDiskAttributeType(&o.ConsumedDisk, v)
}
// GetConsumedObjectStorage returns the ConsumedObjectStorage field value
func (o *Instance) GetConsumedObjectStorage() (ret InstanceGetConsumedObjectStorageRetType) {
ret, _ = o.GetConsumedObjectStorageOk()
return ret
}
// GetConsumedObjectStorageOk returns a tuple with the ConsumedObjectStorage field value
// and a boolean to check if the value has been set.
func (o *Instance) GetConsumedObjectStorageOk() (ret InstanceGetConsumedObjectStorageRetType, ok bool) {
return getInstanceGetConsumedObjectStorageAttributeTypeOk(o.ConsumedObjectStorage)
}
// SetConsumedObjectStorage sets field value
func (o *Instance) SetConsumedObjectStorage(v InstanceGetConsumedObjectStorageRetType) {
setInstanceGetConsumedObjectStorageAttributeType(&o.ConsumedObjectStorage, v)
}
// GetCreated returns the Created field value
func (o *Instance) GetCreated() (ret InstanceGetCreatedRetType) {
ret, _ = o.GetCreatedOk()
return ret
}
// GetCreatedOk returns a tuple with the Created field value
// and a boolean to check if the value has been set.
func (o *Instance) GetCreatedOk() (ret InstanceGetCreatedRetType, ok bool) {
return getInstanceGetCreatedAttributeTypeOk(o.Created)
}
// SetCreated sets field value
func (o *Instance) SetCreated(v InstanceGetCreatedRetType) {
setInstanceGetCreatedAttributeType(&o.Created, v)
}
// GetFeatureToggle returns the FeatureToggle field value
func (o *Instance) GetFeatureToggle() (ret InstanceGetFeatureToggleRetType) {
ret, _ = o.GetFeatureToggleOk()
return ret
}
// GetFeatureToggleOk returns a tuple with the FeatureToggle field value
// and a boolean to check if the value has been set.
func (o *Instance) GetFeatureToggleOk() (ret InstanceGetFeatureToggleRetType, ok bool) {
return getInstanceGetFeatureToggleAttributeTypeOk(o.FeatureToggle)
}
// SetFeatureToggle sets field value
func (o *Instance) SetFeatureToggle(v InstanceGetFeatureToggleRetType) {
setInstanceGetFeatureToggleAttributeType(&o.FeatureToggle, v)
}
// GetFlavor returns the Flavor field value
func (o *Instance) GetFlavor() (ret InstanceGetFlavorRetType) {
ret, _ = o.GetFlavorOk()
return ret
}
// GetFlavorOk returns a tuple with the Flavor field value
// and a boolean to check if the value has been set.
func (o *Instance) GetFlavorOk() (ret InstanceGetFlavorRetType, ok bool) {
return getInstanceGetFlavorAttributeTypeOk(o.Flavor)
}
// SetFlavor sets field value
func (o *Instance) SetFlavor(v InstanceGetFlavorRetType) {
setInstanceGetFlavorAttributeType(&o.Flavor, v)
}
// GetId returns the Id field value
func (o *Instance) GetId() (ret InstanceGetIdRetType) {
ret, _ = o.GetIdOk()
return ret
}
// GetIdOk returns a tuple with the Id field value
// and a boolean to check if the value has been set.
func (o *Instance) GetIdOk() (ret InstanceGetIdRetType, ok bool) {
return getInstanceGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *Instance) SetId(v InstanceGetIdRetType) {
setInstanceGetIdAttributeType(&o.Id, v)
}
// GetName returns the Name field value
func (o *Instance) GetName() (ret InstanceGetNameRetType) {
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 *Instance) GetNameOk() (ret InstanceGetNameRetType, ok bool) {
return getInstanceGetNameAttributeTypeOk(o.Name)
}
// SetName sets field value
func (o *Instance) SetName(v InstanceGetNameRetType) {
setInstanceGetNameAttributeType(&o.Name, v)
}
// GetState returns the State field value
func (o *Instance) GetState() (ret InstanceGetStateRetType) {
ret, _ = o.GetStateOk()
return ret
}
// GetStateOk returns a tuple with the State field value
// and a boolean to check if the value has been set.
func (o *Instance) GetStateOk() (ret InstanceGetStateRetType, ok bool) {
return getInstanceGetStateAttributeTypeOk(o.State)
}
// SetState sets field value
func (o *Instance) SetState(v InstanceGetStateRetType) {
setInstanceGetStateAttributeType(&o.State, v)
}
// GetUrl returns the Url field value
func (o *Instance) GetUrl() (ret InstanceGetUrlRetType) {
ret, _ = o.GetUrlOk()
return ret
}
// GetUrlOk returns a tuple with the Url field value
// and a boolean to check if the value has been set.
func (o *Instance) GetUrlOk() (ret InstanceGetUrlRetType, ok bool) {
return getInstanceGetUrlAttributeTypeOk(o.Url)
}
// SetUrl sets field value
func (o *Instance) SetUrl(v InstanceGetUrlRetType) {
setInstanceGetUrlAttributeType(&o.Url, v)
}
// GetVersion returns the Version field value
func (o *Instance) GetVersion() (ret InstanceGetVersionRetType) {
ret, _ = o.GetVersionOk()
return ret
}
// GetVersionOk returns a tuple with the Version field value
// and a boolean to check if the value has been set.
func (o *Instance) GetVersionOk() (ret InstanceGetVersionRetType, ok bool) {
return getInstanceGetVersionAttributeTypeOk(o.Version)
}
// SetVersion sets field value
func (o *Instance) SetVersion(v InstanceGetVersionRetType) {
setInstanceGetVersionAttributeType(&o.Version, v)
}
func (o Instance) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getInstanceGetAclAttributeTypeOk(o.Acl); ok {
toSerialize["Acl"] = val
}
if val, ok := getInstanceGetConsumedDiskAttributeTypeOk(o.ConsumedDisk); ok {
toSerialize["ConsumedDisk"] = val
}
if val, ok := getInstanceGetConsumedObjectStorageAttributeTypeOk(o.ConsumedObjectStorage); ok {
toSerialize["ConsumedObjectStorage"] = val
}
if val, ok := getInstanceGetCreatedAttributeTypeOk(o.Created); ok {
toSerialize["Created"] = val
}
if val, ok := getInstanceGetFeatureToggleAttributeTypeOk(o.FeatureToggle); ok {
toSerialize["FeatureToggle"] = val
}
if val, ok := getInstanceGetFlavorAttributeTypeOk(o.Flavor); ok {
toSerialize["Flavor"] = val
}
if val, ok := getInstanceGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getInstanceGetNameAttributeTypeOk(o.Name); ok {
toSerialize["Name"] = val
}
if val, ok := getInstanceGetStateAttributeTypeOk(o.State); ok {
toSerialize["State"] = val
}
if val, ok := getInstanceGetUrlAttributeTypeOk(o.Url); ok {
toSerialize["Url"] = val
}
if val, ok := getInstanceGetVersionAttributeTypeOk(o.Version); ok {
toSerialize["Version"] = val
}
return toSerialize, nil
}
type NullableInstance struct {
value *Instance
isSet bool
}
func (v NullableInstance) Get() *Instance {
return v.value
}
func (v *NullableInstance) Set(val *Instance) {
v.value = val
v.isSet = true
}
func (v NullableInstance) IsSet() bool {
return v.isSet
}
func (v *NullableInstance) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInstance(val *Instance) *NullableInstance {
return &NullableInstance{value: val, isSet: true}
}
func (v NullableInstance) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInstance) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,125 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the InstanceList type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &InstanceList{}
/*
types and functions for instances
*/
// isArray
type InstanceListGetInstancesAttributeType = *[]Instance
type InstanceListGetInstancesArgType = []Instance
type InstanceListGetInstancesRetType = []Instance
func getInstanceListGetInstancesAttributeTypeOk(arg InstanceListGetInstancesAttributeType) (ret InstanceListGetInstancesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInstanceListGetInstancesAttributeType(arg *InstanceListGetInstancesAttributeType, val InstanceListGetInstancesRetType) {
*arg = &val
}
// InstanceList A list of STACKIT Git instances.
type InstanceList struct {
// REQUIRED
Instances InstanceListGetInstancesAttributeType `json:"instances" required:"true"`
}
type _InstanceList InstanceList
// NewInstanceList instantiates a new InstanceList object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewInstanceList(instances InstanceListGetInstancesArgType) *InstanceList {
this := InstanceList{}
setInstanceListGetInstancesAttributeType(&this.Instances, instances)
return &this
}
// NewInstanceListWithDefaults instantiates a new InstanceList object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewInstanceListWithDefaults() *InstanceList {
this := InstanceList{}
return &this
}
// GetInstances returns the Instances field value
func (o *InstanceList) GetInstances() (ret InstanceListGetInstancesRetType) {
ret, _ = o.GetInstancesOk()
return ret
}
// GetInstancesOk returns a tuple with the Instances field value
// and a boolean to check if the value has been set.
func (o *InstanceList) GetInstancesOk() (ret InstanceListGetInstancesRetType, ok bool) {
return getInstanceListGetInstancesAttributeTypeOk(o.Instances)
}
// SetInstances sets field value
func (o *InstanceList) SetInstances(v InstanceListGetInstancesRetType) {
setInstanceListGetInstancesAttributeType(&o.Instances, v)
}
func (o InstanceList) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getInstanceListGetInstancesAttributeTypeOk(o.Instances); ok {
toSerialize["Instances"] = val
}
return toSerialize, nil
}
type NullableInstanceList struct {
value *InstanceList
isSet bool
}
func (v NullableInstanceList) Get() *InstanceList {
return v.value
}
func (v *NullableInstanceList) Set(val *InstanceList) {
v.value = val
v.isSet = true
}
func (v NullableInstanceList) IsSet() bool {
return v.isSet
}
func (v *NullableInstanceList) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInstanceList(val *InstanceList) *NullableInstanceList {
return &NullableInstanceList{value: val, isSet: true}
}
func (v NullableInstanceList) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInstanceList) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,86 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"testing"
)
// isEnum
func TestInstanceState_UnmarshalJSON(t *testing.T) {
type args struct {
src []byte
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: `success - possible enum value no. 1`,
args: args{
src: []byte(`"Creating"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 2`,
args: args{
src: []byte(`"WaitingForResources"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 3`,
args: args{
src: []byte(`"Updating"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 4`,
args: args{
src: []byte(`"Deleting"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 5`,
args: args{
src: []byte(`"Ready"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 6`,
args: args{
src: []byte(`"Error"`),
},
wantErr: false,
},
{
name: "fail",
args: args{
src: []byte("\"FOOBAR\""),
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := InstanceState("")
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}

View file

@ -0,0 +1,128 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the InternalServerErrorResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &InternalServerErrorResponse{}
/*
types and functions for error
*/
// isNotNullableString
type InternalServerErrorResponseGetErrorAttributeType = *string
func getInternalServerErrorResponseGetErrorAttributeTypeOk(arg InternalServerErrorResponseGetErrorAttributeType) (ret InternalServerErrorResponseGetErrorRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setInternalServerErrorResponseGetErrorAttributeType(arg *InternalServerErrorResponseGetErrorAttributeType, val InternalServerErrorResponseGetErrorRetType) {
*arg = &val
}
type InternalServerErrorResponseGetErrorArgType = string
type InternalServerErrorResponseGetErrorRetType = string
// InternalServerErrorResponse Internal server error.
type InternalServerErrorResponse struct {
Error InternalServerErrorResponseGetErrorAttributeType `json:"error,omitempty"`
}
// NewInternalServerErrorResponse instantiates a new InternalServerErrorResponse 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 NewInternalServerErrorResponse() *InternalServerErrorResponse {
this := InternalServerErrorResponse{}
return &this
}
// NewInternalServerErrorResponseWithDefaults instantiates a new InternalServerErrorResponse 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 NewInternalServerErrorResponseWithDefaults() *InternalServerErrorResponse {
this := InternalServerErrorResponse{}
return &this
}
// GetError returns the Error field value if set, zero value otherwise.
func (o *InternalServerErrorResponse) GetError() (res InternalServerErrorResponseGetErrorRetType) {
res, _ = o.GetErrorOk()
return
}
// GetErrorOk returns a tuple with the Error field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *InternalServerErrorResponse) GetErrorOk() (ret InternalServerErrorResponseGetErrorRetType, ok bool) {
return getInternalServerErrorResponseGetErrorAttributeTypeOk(o.Error)
}
// HasError returns a boolean if a field has been set.
func (o *InternalServerErrorResponse) HasError() bool {
_, ok := o.GetErrorOk()
return ok
}
// SetError gets a reference to the given string and assigns it to the Error field.
func (o *InternalServerErrorResponse) SetError(v InternalServerErrorResponseGetErrorRetType) {
setInternalServerErrorResponseGetErrorAttributeType(&o.Error, v)
}
func (o InternalServerErrorResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getInternalServerErrorResponseGetErrorAttributeTypeOk(o.Error); ok {
toSerialize["Error"] = val
}
return toSerialize, nil
}
type NullableInternalServerErrorResponse struct {
value *InternalServerErrorResponse
isSet bool
}
func (v NullableInternalServerErrorResponse) Get() *InternalServerErrorResponse {
return v.value
}
func (v *NullableInternalServerErrorResponse) Set(val *InternalServerErrorResponse) {
v.value = val
v.isSet = true
}
func (v NullableInternalServerErrorResponse) IsSet() bool {
return v.isSet
}
func (v *NullableInternalServerErrorResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInternalServerErrorResponse(val *InternalServerErrorResponse) *NullableInternalServerErrorResponse {
return &NullableInternalServerErrorResponse{value: val, isSet: true}
}
func (v NullableInternalServerErrorResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInternalServerErrorResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,374 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the PatchAuthenticationPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &PatchAuthenticationPayload{}
/*
types and functions for auto_discover_url
*/
// isNotNullableString
type PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType = *string
func getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(arg PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType) (ret PatchAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType(arg *PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType, val PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) {
*arg = &val
}
type PatchAuthenticationPayloadGetAutoDiscoverUrlArgType = string
type PatchAuthenticationPayloadGetAutoDiscoverUrlRetType = string
/*
types and functions for client_id
*/
// isNotNullableString
type PatchAuthenticationPayloadGetClientIdAttributeType = *string
func getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(arg PatchAuthenticationPayloadGetClientIdAttributeType) (ret PatchAuthenticationPayloadGetClientIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchAuthenticationPayloadGetClientIdAttributeType(arg *PatchAuthenticationPayloadGetClientIdAttributeType, val PatchAuthenticationPayloadGetClientIdRetType) {
*arg = &val
}
type PatchAuthenticationPayloadGetClientIdArgType = string
type PatchAuthenticationPayloadGetClientIdRetType = string
/*
types and functions for client_secret
*/
// isNotNullableString
type PatchAuthenticationPayloadGetClientSecretAttributeType = *string
func getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(arg PatchAuthenticationPayloadGetClientSecretAttributeType) (ret PatchAuthenticationPayloadGetClientSecretRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchAuthenticationPayloadGetClientSecretAttributeType(arg *PatchAuthenticationPayloadGetClientSecretAttributeType, val PatchAuthenticationPayloadGetClientSecretRetType) {
*arg = &val
}
type PatchAuthenticationPayloadGetClientSecretArgType = string
type PatchAuthenticationPayloadGetClientSecretRetType = string
/*
types and functions for icon_url
*/
// isNotNullableString
type PatchAuthenticationPayloadGetIconUrlAttributeType = *string
func getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(arg PatchAuthenticationPayloadGetIconUrlAttributeType) (ret PatchAuthenticationPayloadGetIconUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchAuthenticationPayloadGetIconUrlAttributeType(arg *PatchAuthenticationPayloadGetIconUrlAttributeType, val PatchAuthenticationPayloadGetIconUrlRetType) {
*arg = &val
}
type PatchAuthenticationPayloadGetIconUrlArgType = string
type PatchAuthenticationPayloadGetIconUrlRetType = string
/*
types and functions for provider
*/
// isNotNullableString
type PatchAuthenticationPayloadGetProviderAttributeType = *string
func getPatchAuthenticationPayloadGetProviderAttributeTypeOk(arg PatchAuthenticationPayloadGetProviderAttributeType) (ret PatchAuthenticationPayloadGetProviderRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchAuthenticationPayloadGetProviderAttributeType(arg *PatchAuthenticationPayloadGetProviderAttributeType, val PatchAuthenticationPayloadGetProviderRetType) {
*arg = &val
}
type PatchAuthenticationPayloadGetProviderArgType = string
type PatchAuthenticationPayloadGetProviderRetType = string
/*
types and functions for scopes
*/
// isNotNullableString
type PatchAuthenticationPayloadGetScopesAttributeType = *string
func getPatchAuthenticationPayloadGetScopesAttributeTypeOk(arg PatchAuthenticationPayloadGetScopesAttributeType) (ret PatchAuthenticationPayloadGetScopesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchAuthenticationPayloadGetScopesAttributeType(arg *PatchAuthenticationPayloadGetScopesAttributeType, val PatchAuthenticationPayloadGetScopesRetType) {
*arg = &val
}
type PatchAuthenticationPayloadGetScopesArgType = string
type PatchAuthenticationPayloadGetScopesRetType = string
// PatchAuthenticationPayload Properties to patch on an authentication. All fields are optional.
type PatchAuthenticationPayload struct {
// The well-known configuration url to use for this authentication definition.
AutoDiscoverUrl PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType `json:"auto_discover_url,omitempty"`
// The IDP client id to use.
ClientId PatchAuthenticationPayloadGetClientIdAttributeType `json:"client_id,omitempty"`
// The IDP client secret to use.
ClientSecret PatchAuthenticationPayloadGetClientSecretAttributeType `json:"client_secret,omitempty"`
// The url of the icon to use for this authentication definition.
IconUrl PatchAuthenticationPayloadGetIconUrlAttributeType `json:"icon_url,omitempty"`
// The Oauth2 provider to use.
Provider PatchAuthenticationPayloadGetProviderAttributeType `json:"provider,omitempty"`
// Scopes defines the OIDC scopes to request.
Scopes PatchAuthenticationPayloadGetScopesAttributeType `json:"scopes,omitempty"`
}
// NewPatchAuthenticationPayload instantiates a new PatchAuthenticationPayload 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 NewPatchAuthenticationPayload() *PatchAuthenticationPayload {
this := PatchAuthenticationPayload{}
return &this
}
// NewPatchAuthenticationPayloadWithDefaults instantiates a new PatchAuthenticationPayload 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 NewPatchAuthenticationPayloadWithDefaults() *PatchAuthenticationPayload {
this := PatchAuthenticationPayload{}
return &this
}
// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value if set, zero value otherwise.
func (o *PatchAuthenticationPayload) GetAutoDiscoverUrl() (res PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) {
res, _ = o.GetAutoDiscoverUrlOk()
return
}
// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchAuthenticationPayload) GetAutoDiscoverUrlOk() (ret PatchAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) {
return getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl)
}
// HasAutoDiscoverUrl returns a boolean if a field has been set.
func (o *PatchAuthenticationPayload) HasAutoDiscoverUrl() bool {
_, ok := o.GetAutoDiscoverUrlOk()
return ok
}
// SetAutoDiscoverUrl gets a reference to the given string and assigns it to the AutoDiscoverUrl field.
func (o *PatchAuthenticationPayload) SetAutoDiscoverUrl(v PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) {
setPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v)
}
// GetClientId returns the ClientId field value if set, zero value otherwise.
func (o *PatchAuthenticationPayload) GetClientId() (res PatchAuthenticationPayloadGetClientIdRetType) {
res, _ = o.GetClientIdOk()
return
}
// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchAuthenticationPayload) GetClientIdOk() (ret PatchAuthenticationPayloadGetClientIdRetType, ok bool) {
return getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId)
}
// HasClientId returns a boolean if a field has been set.
func (o *PatchAuthenticationPayload) HasClientId() bool {
_, ok := o.GetClientIdOk()
return ok
}
// SetClientId gets a reference to the given string and assigns it to the ClientId field.
func (o *PatchAuthenticationPayload) SetClientId(v PatchAuthenticationPayloadGetClientIdRetType) {
setPatchAuthenticationPayloadGetClientIdAttributeType(&o.ClientId, v)
}
// GetClientSecret returns the ClientSecret field value if set, zero value otherwise.
func (o *PatchAuthenticationPayload) GetClientSecret() (res PatchAuthenticationPayloadGetClientSecretRetType) {
res, _ = o.GetClientSecretOk()
return
}
// GetClientSecretOk returns a tuple with the ClientSecret field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchAuthenticationPayload) GetClientSecretOk() (ret PatchAuthenticationPayloadGetClientSecretRetType, ok bool) {
return getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret)
}
// HasClientSecret returns a boolean if a field has been set.
func (o *PatchAuthenticationPayload) HasClientSecret() bool {
_, ok := o.GetClientSecretOk()
return ok
}
// SetClientSecret gets a reference to the given string and assigns it to the ClientSecret field.
func (o *PatchAuthenticationPayload) SetClientSecret(v PatchAuthenticationPayloadGetClientSecretRetType) {
setPatchAuthenticationPayloadGetClientSecretAttributeType(&o.ClientSecret, v)
}
// GetIconUrl returns the IconUrl field value if set, zero value otherwise.
func (o *PatchAuthenticationPayload) GetIconUrl() (res PatchAuthenticationPayloadGetIconUrlRetType) {
res, _ = o.GetIconUrlOk()
return
}
// GetIconUrlOk returns a tuple with the IconUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchAuthenticationPayload) GetIconUrlOk() (ret PatchAuthenticationPayloadGetIconUrlRetType, ok bool) {
return getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl)
}
// HasIconUrl returns a boolean if a field has been set.
func (o *PatchAuthenticationPayload) HasIconUrl() bool {
_, ok := o.GetIconUrlOk()
return ok
}
// SetIconUrl gets a reference to the given string and assigns it to the IconUrl field.
func (o *PatchAuthenticationPayload) SetIconUrl(v PatchAuthenticationPayloadGetIconUrlRetType) {
setPatchAuthenticationPayloadGetIconUrlAttributeType(&o.IconUrl, v)
}
// GetProvider returns the Provider field value if set, zero value otherwise.
func (o *PatchAuthenticationPayload) GetProvider() (res PatchAuthenticationPayloadGetProviderRetType) {
res, _ = o.GetProviderOk()
return
}
// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchAuthenticationPayload) GetProviderOk() (ret PatchAuthenticationPayloadGetProviderRetType, ok bool) {
return getPatchAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider)
}
// HasProvider returns a boolean if a field has been set.
func (o *PatchAuthenticationPayload) HasProvider() bool {
_, ok := o.GetProviderOk()
return ok
}
// SetProvider gets a reference to the given string and assigns it to the Provider field.
func (o *PatchAuthenticationPayload) SetProvider(v PatchAuthenticationPayloadGetProviderRetType) {
setPatchAuthenticationPayloadGetProviderAttributeType(&o.Provider, v)
}
// GetScopes returns the Scopes field value if set, zero value otherwise.
func (o *PatchAuthenticationPayload) GetScopes() (res PatchAuthenticationPayloadGetScopesRetType) {
res, _ = o.GetScopesOk()
return
}
// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchAuthenticationPayload) GetScopesOk() (ret PatchAuthenticationPayloadGetScopesRetType, ok bool) {
return getPatchAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes)
}
// HasScopes returns a boolean if a field has been set.
func (o *PatchAuthenticationPayload) HasScopes() bool {
_, ok := o.GetScopesOk()
return ok
}
// SetScopes gets a reference to the given string and assigns it to the Scopes field.
func (o *PatchAuthenticationPayload) SetScopes(v PatchAuthenticationPayloadGetScopesRetType) {
setPatchAuthenticationPayloadGetScopesAttributeType(&o.Scopes, v)
}
func (o PatchAuthenticationPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok {
toSerialize["AutoDiscoverUrl"] = val
}
if val, ok := getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId); ok {
toSerialize["ClientId"] = val
}
if val, ok := getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret); ok {
toSerialize["ClientSecret"] = val
}
if val, ok := getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl); ok {
toSerialize["IconUrl"] = val
}
if val, ok := getPatchAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider); ok {
toSerialize["Provider"] = val
}
if val, ok := getPatchAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes); ok {
toSerialize["Scopes"] = val
}
return toSerialize, nil
}
type NullablePatchAuthenticationPayload struct {
value *PatchAuthenticationPayload
isSet bool
}
func (v NullablePatchAuthenticationPayload) Get() *PatchAuthenticationPayload {
return v.value
}
func (v *NullablePatchAuthenticationPayload) Set(val *PatchAuthenticationPayload) {
v.value = val
v.isSet = true
}
func (v NullablePatchAuthenticationPayload) IsSet() bool {
return v.isSet
}
func (v *NullablePatchAuthenticationPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePatchAuthenticationPayload(val *PatchAuthenticationPayload) *NullablePatchAuthenticationPayload {
return &NullablePatchAuthenticationPayload{value: val, isSet: true}
}
func (v NullablePatchAuthenticationPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePatchAuthenticationPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,176 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the PatchInstancePayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &PatchInstancePayload{}
/*
types and functions for acl
*/
// isArray
type PatchInstancePayloadGetAclAttributeType = *[]string
type PatchInstancePayloadGetAclArgType = *[]string
type PatchInstancePayloadGetAclRetType = *[]string
func getPatchInstancePayloadGetAclAttributeTypeOk(arg PatchInstancePayloadGetAclAttributeType) (ret PatchInstancePayloadGetAclRetType, ok bool) {
if arg == nil {
return nil, false
}
return arg, true
}
func setPatchInstancePayloadGetAclAttributeType(arg *PatchInstancePayloadGetAclAttributeType, val PatchInstancePayloadGetAclRetType) {
*arg = val
}
/*
types and functions for feature_toggle
*/
// isModel
type PatchInstancePayloadGetFeatureToggleAttributeType = *FeatureToggle
type PatchInstancePayloadGetFeatureToggleArgType = FeatureToggle
type PatchInstancePayloadGetFeatureToggleRetType = FeatureToggle
func getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(arg PatchInstancePayloadGetFeatureToggleAttributeType) (ret PatchInstancePayloadGetFeatureToggleRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchInstancePayloadGetFeatureToggleAttributeType(arg *PatchInstancePayloadGetFeatureToggleAttributeType, val PatchInstancePayloadGetFeatureToggleRetType) {
*arg = &val
}
// PatchInstancePayload Properties to patch on an instance. All fields are optional.
type PatchInstancePayload struct {
// A list of CIDR network addresses that are allowed to access the instance.
Acl PatchInstancePayloadGetAclAttributeType `json:"acl,omitempty"`
FeatureToggle PatchInstancePayloadGetFeatureToggleAttributeType `json:"feature_toggle,omitempty"`
}
// NewPatchInstancePayload instantiates a new PatchInstancePayload 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 NewPatchInstancePayload() *PatchInstancePayload {
this := PatchInstancePayload{}
return &this
}
// NewPatchInstancePayloadWithDefaults instantiates a new PatchInstancePayload 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 NewPatchInstancePayloadWithDefaults() *PatchInstancePayload {
this := PatchInstancePayload{}
return &this
}
// GetAcl returns the Acl field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *PatchInstancePayload) GetAcl() (res PatchInstancePayloadGetAclRetType) {
res, _ = o.GetAclOk()
return
}
// GetAclOk returns a tuple with the Acl field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *PatchInstancePayload) GetAclOk() (ret PatchInstancePayloadGetAclRetType, ok bool) {
return getPatchInstancePayloadGetAclAttributeTypeOk(o.Acl)
}
// HasAcl returns a boolean if a field has been set.
func (o *PatchInstancePayload) HasAcl() bool {
_, ok := o.GetAclOk()
return ok
}
// SetAcl gets a reference to the given []string and assigns it to the Acl field.
func (o *PatchInstancePayload) SetAcl(v PatchInstancePayloadGetAclRetType) {
setPatchInstancePayloadGetAclAttributeType(&o.Acl, v)
}
// GetFeatureToggle returns the FeatureToggle field value if set, zero value otherwise.
func (o *PatchInstancePayload) GetFeatureToggle() (res PatchInstancePayloadGetFeatureToggleRetType) {
res, _ = o.GetFeatureToggleOk()
return
}
// GetFeatureToggleOk returns a tuple with the FeatureToggle field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchInstancePayload) GetFeatureToggleOk() (ret PatchInstancePayloadGetFeatureToggleRetType, ok bool) {
return getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(o.FeatureToggle)
}
// HasFeatureToggle returns a boolean if a field has been set.
func (o *PatchInstancePayload) HasFeatureToggle() bool {
_, ok := o.GetFeatureToggleOk()
return ok
}
// SetFeatureToggle gets a reference to the given FeatureToggle and assigns it to the FeatureToggle field.
func (o *PatchInstancePayload) SetFeatureToggle(v PatchInstancePayloadGetFeatureToggleRetType) {
setPatchInstancePayloadGetFeatureToggleAttributeType(&o.FeatureToggle, v)
}
func (o PatchInstancePayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getPatchInstancePayloadGetAclAttributeTypeOk(o.Acl); ok {
toSerialize["Acl"] = val
}
if val, ok := getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(o.FeatureToggle); ok {
toSerialize["FeatureToggle"] = val
}
return toSerialize, nil
}
type NullablePatchInstancePayload struct {
value *PatchInstancePayload
isSet bool
}
func (v NullablePatchInstancePayload) Get() *PatchInstancePayload {
return v.value
}
func (v *NullablePatchInstancePayload) Set(val *PatchInstancePayload) {
v.value = val
v.isSet = true
}
func (v NullablePatchInstancePayload) IsSet() bool {
return v.isSet
}
func (v *NullablePatchInstancePayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePatchInstancePayload(val *PatchInstancePayload) *NullablePatchInstancePayload {
return &NullablePatchInstancePayload{value: val, isSet: true}
}
func (v NullablePatchInstancePayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePatchInstancePayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,325 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
"fmt"
)
// checks if the PatchOperation type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &PatchOperation{}
/*
types and functions for op
*/
// isEnum
// PatchOperationOp The patch operation to perform.
// value type for enums
type PatchOperationOp string
// List of Op
const (
PATCHOPERATIONOP_ADD PatchOperationOp = "add"
PATCHOPERATIONOP_REMOVE PatchOperationOp = "remove"
)
// All allowed values of PatchOperation enum
var AllowedPatchOperationOpEnumValues = []PatchOperationOp{
"add",
"remove",
}
func (v *PatchOperationOp) UnmarshalJSON(src []byte) error {
// use a type alias to prevent infinite recursion during unmarshal,
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
type TmpJson PatchOperationOp
var value TmpJson
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue TmpJson
if value == zeroValue {
return nil
}
enumTypeValue := PatchOperationOp(value)
for _, existing := range AllowedPatchOperationOpEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid PatchOperation", value)
}
// NewPatchOperationOpFromValue returns a pointer to a valid PatchOperationOp
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewPatchOperationOpFromValue(v PatchOperationOp) (*PatchOperationOp, error) {
ev := PatchOperationOp(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for PatchOperationOp: valid values are %v", v, AllowedPatchOperationOpEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v PatchOperationOp) IsValid() bool {
for _, existing := range AllowedPatchOperationOpEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to OpOp value
func (v PatchOperationOp) Ptr() *PatchOperationOp {
return &v
}
type NullablePatchOperationOp struct {
value *PatchOperationOp
isSet bool
}
func (v NullablePatchOperationOp) Get() *PatchOperationOp {
return v.value
}
func (v *NullablePatchOperationOp) Set(val *PatchOperationOp) {
v.value = val
v.isSet = true
}
func (v NullablePatchOperationOp) IsSet() bool {
return v.isSet
}
func (v *NullablePatchOperationOp) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePatchOperationOp(val *PatchOperationOp) *NullablePatchOperationOp {
return &NullablePatchOperationOp{value: val, isSet: true}
}
func (v NullablePatchOperationOp) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePatchOperationOp) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type PatchOperationGetOpAttributeType = *PatchOperationOp
type PatchOperationGetOpArgType = PatchOperationOp
type PatchOperationGetOpRetType = PatchOperationOp
func getPatchOperationGetOpAttributeTypeOk(arg PatchOperationGetOpAttributeType) (ret PatchOperationGetOpRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchOperationGetOpAttributeType(arg *PatchOperationGetOpAttributeType, val PatchOperationGetOpRetType) {
*arg = &val
}
/*
types and functions for path
*/
// isNotNullableString
type PatchOperationGetPathAttributeType = *string
func getPatchOperationGetPathAttributeTypeOk(arg PatchOperationGetPathAttributeType) (ret PatchOperationGetPathRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchOperationGetPathAttributeType(arg *PatchOperationGetPathAttributeType, val PatchOperationGetPathRetType) {
*arg = &val
}
type PatchOperationGetPathArgType = string
type PatchOperationGetPathRetType = string
/*
types and functions for value
*/
// isNotNullableString
type PatchOperationGetValueAttributeType = *string
func getPatchOperationGetValueAttributeTypeOk(arg PatchOperationGetValueAttributeType) (ret PatchOperationGetValueRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setPatchOperationGetValueAttributeType(arg *PatchOperationGetValueAttributeType, val PatchOperationGetValueRetType) {
*arg = &val
}
type PatchOperationGetValueArgType = string
type PatchOperationGetValueRetType = string
// PatchOperation Request a STACKIT Git instance to be patch with these properties.
type PatchOperation struct {
// The patch operation to perform.
// REQUIRED
Op PatchOperationGetOpAttributeType `json:"op" required:"true"`
// An RFC6901 JSON Pointer to the target location.
// REQUIRED
Path PatchOperationGetPathAttributeType `json:"path" required:"true"`
// The value to be used for 'add' and 'remove' operations.
Value PatchOperationGetValueAttributeType `json:"value,omitempty"`
}
type _PatchOperation PatchOperation
// NewPatchOperation instantiates a new PatchOperation 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 NewPatchOperation(op PatchOperationGetOpArgType, path PatchOperationGetPathArgType) *PatchOperation {
this := PatchOperation{}
setPatchOperationGetOpAttributeType(&this.Op, op)
setPatchOperationGetPathAttributeType(&this.Path, path)
return &this
}
// NewPatchOperationWithDefaults instantiates a new PatchOperation 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 NewPatchOperationWithDefaults() *PatchOperation {
this := PatchOperation{}
return &this
}
// GetOp returns the Op field value
func (o *PatchOperation) GetOp() (ret PatchOperationGetOpRetType) {
ret, _ = o.GetOpOk()
return ret
}
// GetOpOk returns a tuple with the Op field value
// and a boolean to check if the value has been set.
func (o *PatchOperation) GetOpOk() (ret PatchOperationGetOpRetType, ok bool) {
return getPatchOperationGetOpAttributeTypeOk(o.Op)
}
// SetOp sets field value
func (o *PatchOperation) SetOp(v PatchOperationGetOpRetType) {
setPatchOperationGetOpAttributeType(&o.Op, v)
}
// GetPath returns the Path field value
func (o *PatchOperation) GetPath() (ret PatchOperationGetPathRetType) {
ret, _ = o.GetPathOk()
return ret
}
// GetPathOk returns a tuple with the Path field value
// and a boolean to check if the value has been set.
func (o *PatchOperation) GetPathOk() (ret PatchOperationGetPathRetType, ok bool) {
return getPatchOperationGetPathAttributeTypeOk(o.Path)
}
// SetPath sets field value
func (o *PatchOperation) SetPath(v PatchOperationGetPathRetType) {
setPatchOperationGetPathAttributeType(&o.Path, v)
}
// GetValue returns the Value field value if set, zero value otherwise.
func (o *PatchOperation) GetValue() (res PatchOperationGetValueRetType) {
res, _ = o.GetValueOk()
return
}
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchOperation) GetValueOk() (ret PatchOperationGetValueRetType, ok bool) {
return getPatchOperationGetValueAttributeTypeOk(o.Value)
}
// HasValue returns a boolean if a field has been set.
func (o *PatchOperation) HasValue() bool {
_, ok := o.GetValueOk()
return ok
}
// SetValue gets a reference to the given string and assigns it to the Value field.
func (o *PatchOperation) SetValue(v PatchOperationGetValueRetType) {
setPatchOperationGetValueAttributeType(&o.Value, v)
}
func (o PatchOperation) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getPatchOperationGetOpAttributeTypeOk(o.Op); ok {
toSerialize["Op"] = val
}
if val, ok := getPatchOperationGetPathAttributeTypeOk(o.Path); ok {
toSerialize["Path"] = val
}
if val, ok := getPatchOperationGetValueAttributeTypeOk(o.Value); ok {
toSerialize["Value"] = val
}
return toSerialize, nil
}
type NullablePatchOperation struct {
value *PatchOperation
isSet bool
}
func (v NullablePatchOperation) Get() *PatchOperation {
return v.value
}
func (v *NullablePatchOperation) Set(val *PatchOperation) {
v.value = val
v.isSet = true
}
func (v NullablePatchOperation) IsSet() bool {
return v.isSet
}
func (v *NullablePatchOperation) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePatchOperation(val *PatchOperation) *NullablePatchOperation {
return &NullablePatchOperation{value: val, isSet: true}
}
func (v NullablePatchOperation) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePatchOperation) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

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

258
pkg/gitbeta/model_runner.go Normal file
View file

@ -0,0 +1,258 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
"time"
)
// checks if the Runner type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Runner{}
/*
types and functions for created_at
*/
// isDateTime
type RunnerGetCreatedAtAttributeType = *time.Time
type RunnerGetCreatedAtArgType = time.Time
type RunnerGetCreatedAtRetType = time.Time
func getRunnerGetCreatedAtAttributeTypeOk(arg RunnerGetCreatedAtAttributeType) (ret RunnerGetCreatedAtRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerGetCreatedAtAttributeType(arg *RunnerGetCreatedAtAttributeType, val RunnerGetCreatedAtRetType) {
*arg = &val
}
/*
types and functions for id
*/
// isNotNullableString
type RunnerGetIdAttributeType = *string
func getRunnerGetIdAttributeTypeOk(arg RunnerGetIdAttributeType) (ret RunnerGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerGetIdAttributeType(arg *RunnerGetIdAttributeType, val RunnerGetIdRetType) {
*arg = &val
}
type RunnerGetIdArgType = string
type RunnerGetIdRetType = string
/*
types and functions for labels
*/
// isArray
type RunnerGetLabelsAttributeType = *[]string
type RunnerGetLabelsArgType = []string
type RunnerGetLabelsRetType = []string
func getRunnerGetLabelsAttributeTypeOk(arg RunnerGetLabelsAttributeType) (ret RunnerGetLabelsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerGetLabelsAttributeType(arg *RunnerGetLabelsAttributeType, val RunnerGetLabelsRetType) {
*arg = &val
}
/*
types and functions for status
*/
// isNotNullableString
type RunnerGetStatusAttributeType = *string
func getRunnerGetStatusAttributeTypeOk(arg RunnerGetStatusAttributeType) (ret RunnerGetStatusRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerGetStatusAttributeType(arg *RunnerGetStatusAttributeType, val RunnerGetStatusRetType) {
*arg = &val
}
type RunnerGetStatusArgType = string
type RunnerGetStatusRetType = string
// Runner Describes a runner associated to a STACKIT Git instance.
type Runner struct {
// REQUIRED
CreatedAt RunnerGetCreatedAtAttributeType `json:"created_at" required:"true"`
// REQUIRED
Id RunnerGetIdAttributeType `json:"id" required:"true"`
// REQUIRED
Labels RunnerGetLabelsAttributeType `json:"labels" required:"true"`
// The current status of the runner.
// REQUIRED
Status RunnerGetStatusAttributeType `json:"status" required:"true"`
}
type _Runner Runner
// NewRunner instantiates a new Runner 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 NewRunner(createdAt RunnerGetCreatedAtArgType, id RunnerGetIdArgType, labels RunnerGetLabelsArgType, status RunnerGetStatusArgType) *Runner {
this := Runner{}
setRunnerGetCreatedAtAttributeType(&this.CreatedAt, createdAt)
setRunnerGetIdAttributeType(&this.Id, id)
setRunnerGetLabelsAttributeType(&this.Labels, labels)
setRunnerGetStatusAttributeType(&this.Status, status)
return &this
}
// NewRunnerWithDefaults instantiates a new Runner 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 NewRunnerWithDefaults() *Runner {
this := Runner{}
return &this
}
// GetCreatedAt returns the CreatedAt field value
func (o *Runner) GetCreatedAt() (ret RunnerGetCreatedAtRetType) {
ret, _ = o.GetCreatedAtOk()
return ret
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value
// and a boolean to check if the value has been set.
func (o *Runner) GetCreatedAtOk() (ret RunnerGetCreatedAtRetType, ok bool) {
return getRunnerGetCreatedAtAttributeTypeOk(o.CreatedAt)
}
// SetCreatedAt sets field value
func (o *Runner) SetCreatedAt(v RunnerGetCreatedAtRetType) {
setRunnerGetCreatedAtAttributeType(&o.CreatedAt, v)
}
// GetId returns the Id field value
func (o *Runner) GetId() (ret RunnerGetIdRetType) {
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 *Runner) GetIdOk() (ret RunnerGetIdRetType, ok bool) {
return getRunnerGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *Runner) SetId(v RunnerGetIdRetType) {
setRunnerGetIdAttributeType(&o.Id, v)
}
// GetLabels returns the Labels field value
func (o *Runner) GetLabels() (ret RunnerGetLabelsRetType) {
ret, _ = o.GetLabelsOk()
return ret
}
// GetLabelsOk returns a tuple with the Labels field value
// and a boolean to check if the value has been set.
func (o *Runner) GetLabelsOk() (ret RunnerGetLabelsRetType, ok bool) {
return getRunnerGetLabelsAttributeTypeOk(o.Labels)
}
// SetLabels sets field value
func (o *Runner) SetLabels(v RunnerGetLabelsRetType) {
setRunnerGetLabelsAttributeType(&o.Labels, v)
}
// GetStatus returns the Status field value
func (o *Runner) GetStatus() (ret RunnerGetStatusRetType) {
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 *Runner) GetStatusOk() (ret RunnerGetStatusRetType, ok bool) {
return getRunnerGetStatusAttributeTypeOk(o.Status)
}
// SetStatus sets field value
func (o *Runner) SetStatus(v RunnerGetStatusRetType) {
setRunnerGetStatusAttributeType(&o.Status, v)
}
func (o Runner) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getRunnerGetCreatedAtAttributeTypeOk(o.CreatedAt); ok {
toSerialize["CreatedAt"] = val
}
if val, ok := getRunnerGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getRunnerGetLabelsAttributeTypeOk(o.Labels); ok {
toSerialize["Labels"] = val
}
if val, ok := getRunnerGetStatusAttributeTypeOk(o.Status); ok {
toSerialize["Status"] = val
}
return toSerialize, nil
}
type NullableRunner struct {
value *Runner
isSet bool
}
func (v NullableRunner) Get() *Runner {
return v.value
}
func (v *NullableRunner) Set(val *Runner) {
v.value = val
v.isSet = true
}
func (v NullableRunner) IsSet() bool {
return v.isSet
}
func (v *NullableRunner) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRunner(val *Runner) *NullableRunner {
return &NullableRunner{value: val, isSet: true}
}
func (v NullableRunner) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRunner) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,307 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the RunnerRuntime type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RunnerRuntime{}
/*
types and functions for availability
*/
// isNotNullableString
type RunnerRuntimeGetAvailabilityAttributeType = *string
func getRunnerRuntimeGetAvailabilityAttributeTypeOk(arg RunnerRuntimeGetAvailabilityAttributeType) (ret RunnerRuntimeGetAvailabilityRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerRuntimeGetAvailabilityAttributeType(arg *RunnerRuntimeGetAvailabilityAttributeType, val RunnerRuntimeGetAvailabilityRetType) {
*arg = &val
}
type RunnerRuntimeGetAvailabilityArgType = string
type RunnerRuntimeGetAvailabilityRetType = string
/*
types and functions for description
*/
// isNotNullableString
type RunnerRuntimeGetDescriptionAttributeType = *string
func getRunnerRuntimeGetDescriptionAttributeTypeOk(arg RunnerRuntimeGetDescriptionAttributeType) (ret RunnerRuntimeGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerRuntimeGetDescriptionAttributeType(arg *RunnerRuntimeGetDescriptionAttributeType, val RunnerRuntimeGetDescriptionRetType) {
*arg = &val
}
type RunnerRuntimeGetDescriptionArgType = string
type RunnerRuntimeGetDescriptionRetType = string
/*
types and functions for display_name
*/
// isNotNullableString
type RunnerRuntimeGetDisplayNameAttributeType = *string
func getRunnerRuntimeGetDisplayNameAttributeTypeOk(arg RunnerRuntimeGetDisplayNameAttributeType) (ret RunnerRuntimeGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerRuntimeGetDisplayNameAttributeType(arg *RunnerRuntimeGetDisplayNameAttributeType, val RunnerRuntimeGetDisplayNameRetType) {
*arg = &val
}
type RunnerRuntimeGetDisplayNameArgType = string
type RunnerRuntimeGetDisplayNameRetType = string
/*
types and functions for id
*/
// isNotNullableString
type RunnerRuntimeGetIdAttributeType = *string
func getRunnerRuntimeGetIdAttributeTypeOk(arg RunnerRuntimeGetIdAttributeType) (ret RunnerRuntimeGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerRuntimeGetIdAttributeType(arg *RunnerRuntimeGetIdAttributeType, val RunnerRuntimeGetIdRetType) {
*arg = &val
}
type RunnerRuntimeGetIdArgType = string
type RunnerRuntimeGetIdRetType = string
/*
types and functions for label
*/
// isNotNullableString
type RunnerRuntimeGetLabelAttributeType = *string
func getRunnerRuntimeGetLabelAttributeTypeOk(arg RunnerRuntimeGetLabelAttributeType) (ret RunnerRuntimeGetLabelRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerRuntimeGetLabelAttributeType(arg *RunnerRuntimeGetLabelAttributeType, val RunnerRuntimeGetLabelRetType) {
*arg = &val
}
type RunnerRuntimeGetLabelArgType = string
type RunnerRuntimeGetLabelRetType = string
// RunnerRuntime Describes a STACKIT Git Runner runtime.
type RunnerRuntime struct {
// Indicates the availability of the runner label
// REQUIRED
Availability RunnerRuntimeGetAvailabilityAttributeType `json:"availability" required:"true"`
// Human-friendly description of the runtime and it's capabilities.
// REQUIRED
Description RunnerRuntimeGetDescriptionAttributeType `json:"description" required:"true"`
// Human-friendly name of the runtime.
// REQUIRED
DisplayName RunnerRuntimeGetDisplayNameAttributeType `json:"display_name" required:"true"`
// Runtime identifier.
// REQUIRED
Id RunnerRuntimeGetIdAttributeType `json:"id" required:"true"`
// Runtime label.
// REQUIRED
Label RunnerRuntimeGetLabelAttributeType `json:"label" required:"true"`
}
type _RunnerRuntime RunnerRuntime
// NewRunnerRuntime instantiates a new RunnerRuntime 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 NewRunnerRuntime(availability RunnerRuntimeGetAvailabilityArgType, description RunnerRuntimeGetDescriptionArgType, displayName RunnerRuntimeGetDisplayNameArgType, id RunnerRuntimeGetIdArgType, label RunnerRuntimeGetLabelArgType) *RunnerRuntime {
this := RunnerRuntime{}
setRunnerRuntimeGetAvailabilityAttributeType(&this.Availability, availability)
setRunnerRuntimeGetDescriptionAttributeType(&this.Description, description)
setRunnerRuntimeGetDisplayNameAttributeType(&this.DisplayName, displayName)
setRunnerRuntimeGetIdAttributeType(&this.Id, id)
setRunnerRuntimeGetLabelAttributeType(&this.Label, label)
return &this
}
// NewRunnerRuntimeWithDefaults instantiates a new RunnerRuntime 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 NewRunnerRuntimeWithDefaults() *RunnerRuntime {
this := RunnerRuntime{}
return &this
}
// GetAvailability returns the Availability field value
func (o *RunnerRuntime) GetAvailability() (ret RunnerRuntimeGetAvailabilityRetType) {
ret, _ = o.GetAvailabilityOk()
return ret
}
// GetAvailabilityOk returns a tuple with the Availability field value
// and a boolean to check if the value has been set.
func (o *RunnerRuntime) GetAvailabilityOk() (ret RunnerRuntimeGetAvailabilityRetType, ok bool) {
return getRunnerRuntimeGetAvailabilityAttributeTypeOk(o.Availability)
}
// SetAvailability sets field value
func (o *RunnerRuntime) SetAvailability(v RunnerRuntimeGetAvailabilityRetType) {
setRunnerRuntimeGetAvailabilityAttributeType(&o.Availability, v)
}
// GetDescription returns the Description field value
func (o *RunnerRuntime) GetDescription() (ret RunnerRuntimeGetDescriptionRetType) {
ret, _ = o.GetDescriptionOk()
return ret
}
// GetDescriptionOk returns a tuple with the Description field value
// and a boolean to check if the value has been set.
func (o *RunnerRuntime) GetDescriptionOk() (ret RunnerRuntimeGetDescriptionRetType, ok bool) {
return getRunnerRuntimeGetDescriptionAttributeTypeOk(o.Description)
}
// SetDescription sets field value
func (o *RunnerRuntime) SetDescription(v RunnerRuntimeGetDescriptionRetType) {
setRunnerRuntimeGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value
func (o *RunnerRuntime) GetDisplayName() (ret RunnerRuntimeGetDisplayNameRetType) {
ret, _ = o.GetDisplayNameOk()
return ret
}
// GetDisplayNameOk returns a tuple with the DisplayName field value
// and a boolean to check if the value has been set.
func (o *RunnerRuntime) GetDisplayNameOk() (ret RunnerRuntimeGetDisplayNameRetType, ok bool) {
return getRunnerRuntimeGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// SetDisplayName sets field value
func (o *RunnerRuntime) SetDisplayName(v RunnerRuntimeGetDisplayNameRetType) {
setRunnerRuntimeGetDisplayNameAttributeType(&o.DisplayName, v)
}
// GetId returns the Id field value
func (o *RunnerRuntime) GetId() (ret RunnerRuntimeGetIdRetType) {
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 *RunnerRuntime) GetIdOk() (ret RunnerRuntimeGetIdRetType, ok bool) {
return getRunnerRuntimeGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *RunnerRuntime) SetId(v RunnerRuntimeGetIdRetType) {
setRunnerRuntimeGetIdAttributeType(&o.Id, v)
}
// GetLabel returns the Label field value
func (o *RunnerRuntime) GetLabel() (ret RunnerRuntimeGetLabelRetType) {
ret, _ = o.GetLabelOk()
return ret
}
// GetLabelOk returns a tuple with the Label field value
// and a boolean to check if the value has been set.
func (o *RunnerRuntime) GetLabelOk() (ret RunnerRuntimeGetLabelRetType, ok bool) {
return getRunnerRuntimeGetLabelAttributeTypeOk(o.Label)
}
// SetLabel sets field value
func (o *RunnerRuntime) SetLabel(v RunnerRuntimeGetLabelRetType) {
setRunnerRuntimeGetLabelAttributeType(&o.Label, v)
}
func (o RunnerRuntime) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getRunnerRuntimeGetAvailabilityAttributeTypeOk(o.Availability); ok {
toSerialize["Availability"] = val
}
if val, ok := getRunnerRuntimeGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getRunnerRuntimeGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
if val, ok := getRunnerRuntimeGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getRunnerRuntimeGetLabelAttributeTypeOk(o.Label); ok {
toSerialize["Label"] = val
}
return toSerialize, nil
}
type NullableRunnerRuntime struct {
value *RunnerRuntime
isSet bool
}
func (v NullableRunnerRuntime) Get() *RunnerRuntime {
return v.value
}
func (v *NullableRunnerRuntime) Set(val *RunnerRuntime) {
v.value = val
v.isSet = true
}
func (v NullableRunnerRuntime) IsSet() bool {
return v.isSet
}
func (v *NullableRunnerRuntime) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRunnerRuntime(val *RunnerRuntime) *NullableRunnerRuntime {
return &NullableRunnerRuntime{value: val, isSet: true}
}
func (v NullableRunnerRuntime) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRunnerRuntime) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,125 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
import (
"encoding/json"
)
// checks if the RunnerRuntimeList type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RunnerRuntimeList{}
/*
types and functions for items
*/
// isArray
type RunnerRuntimeListGetItemsAttributeType = *[]RunnerRuntime
type RunnerRuntimeListGetItemsArgType = []RunnerRuntime
type RunnerRuntimeListGetItemsRetType = []RunnerRuntime
func getRunnerRuntimeListGetItemsAttributeTypeOk(arg RunnerRuntimeListGetItemsAttributeType) (ret RunnerRuntimeListGetItemsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setRunnerRuntimeListGetItemsAttributeType(arg *RunnerRuntimeListGetItemsAttributeType, val RunnerRuntimeListGetItemsRetType) {
*arg = &val
}
// RunnerRuntimeList A list of STACKIT Git RunnerLabels.
type RunnerRuntimeList struct {
// REQUIRED
Items RunnerRuntimeListGetItemsAttributeType `json:"items" required:"true"`
}
type _RunnerRuntimeList RunnerRuntimeList
// NewRunnerRuntimeList instantiates a new RunnerRuntimeList 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 NewRunnerRuntimeList(items RunnerRuntimeListGetItemsArgType) *RunnerRuntimeList {
this := RunnerRuntimeList{}
setRunnerRuntimeListGetItemsAttributeType(&this.Items, items)
return &this
}
// NewRunnerRuntimeListWithDefaults instantiates a new RunnerRuntimeList 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 NewRunnerRuntimeListWithDefaults() *RunnerRuntimeList {
this := RunnerRuntimeList{}
return &this
}
// GetItems returns the Items field value
func (o *RunnerRuntimeList) GetItems() (ret RunnerRuntimeListGetItemsRetType) {
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 *RunnerRuntimeList) GetItemsOk() (ret RunnerRuntimeListGetItemsRetType, ok bool) {
return getRunnerRuntimeListGetItemsAttributeTypeOk(o.Items)
}
// SetItems sets field value
func (o *RunnerRuntimeList) SetItems(v RunnerRuntimeListGetItemsRetType) {
setRunnerRuntimeListGetItemsAttributeType(&o.Items, v)
}
func (o RunnerRuntimeList) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getRunnerRuntimeListGetItemsAttributeTypeOk(o.Items); ok {
toSerialize["Items"] = val
}
return toSerialize, nil
}
type NullableRunnerRuntimeList struct {
value *RunnerRuntimeList
isSet bool
}
func (v NullableRunnerRuntimeList) Get() *RunnerRuntimeList {
return v.value
}
func (v *NullableRunnerRuntimeList) Set(val *RunnerRuntimeList) {
v.value = val
v.isSet = true
}
func (v NullableRunnerRuntimeList) IsSet() bool {
return v.isSet
}
func (v *NullableRunnerRuntimeList) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRunnerRuntimeList(val *RunnerRuntimeList) *NullableRunnerRuntimeList {
return &NullableRunnerRuntimeList{value: val, isSet: true}
}
func (v NullableRunnerRuntimeList) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRunnerRuntimeList) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

View file

@ -0,0 +1,11 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta

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

@ -0,0 +1,385 @@
/*
STACKIT Git API
STACKIT Git management API.
API version: 1beta.0.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package gitbeta
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)
}