Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions languages/golang/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
README.md
git_push.sh
.travis.yml
.gitignore
api/openapi.yaml
3 changes: 1 addition & 2 deletions languages/golang/compat-layer/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
git_push.sh
.travis.yml
.gitignore
#utils.go
README.md
response.go
api/openapi.yaml
Expand All @@ -12,4 +11,4 @@ setup.py
test-requirements.txt
requirements.txt
tox.ini
*/.github/*
*/.github/*
36 changes: 36 additions & 0 deletions languages/golang/compat-layer/allow-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Transitional file to enable compatibility layer generation for selected services.
# Note: It shouldn't be needed to add any services here!
alb
auditlog
authorization
cdn
certificates
dns
edge
git
iaas
intake
kms
loadbalancer
logme
logs
mariadb
modelserving
mongodbflex
objectstorage
observability
opensearch
postgresflex
rabbitmq
redis
resourcemanager
runcommand
scf
secretsmanager
serverbackup
serverupdate
serviceaccount
serviceenablement
sfs
ske
sqlserverflex
27 changes: 11 additions & 16 deletions languages/golang/compat-layer/templates/api.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{>partial_header}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
package {{packageName}}

{{#operations}}
Expand All @@ -16,6 +17,7 @@ import (

{{#generateInterfaces}}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{classname}} interface {
{{#operation}}
/*
Expand All @@ -36,24 +38,21 @@ type {{classname}} interface {
@param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}}
@return {{{.}}}{{/returnType}}

{{#isDeprecated}}
Deprecated: {{{unescapedNotes}}}
{{/isDeprecated}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
*/
{{nickname}}Execute(ctx context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) ({{#returnType}}{{^isArray}}{{^returnTypeIsPrimitive}}{{^isResponseFile}}*{{/isResponseFile}}{{/returnTypeIsPrimitive}}{{/isArray}}{{{.}}}, {{/returnType}} error)
{{/operation}}
}

{{#operation}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request interface {
{{#allParams}}
{{^isPathParam}}
{{#description}}
// {{.}}
{{/description}}
{{#isDeprecated}}
// Deprecated
{{/isDeprecated}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
{{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request
{{/isPathParam}}
{{/allParams}}
Expand All @@ -64,9 +63,11 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/stru
{{/generateInterfaces}}

// {{classname}}Service {{classname}} service
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{classname}}Service service
{{#operation}}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{operationId}}Request struct {
ctx context.Context
apiService *{{classname}}Service
Expand All @@ -80,10 +81,7 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}{{operationId}}Request stru
{{#description}}
// {{.}}
{{/description}}
{{#isDeprecated}}
// Deprecated
{{/isDeprecated}}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{{dataType}}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/structPrefix}}{{operationId}}Request {
r.{{paramName}} = {{^isFile}}&{{/isFile}}{{paramName}}
return r
Expand All @@ -92,6 +90,7 @@ func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{operationId}}Request)
{{/isPathParam}}
{{/allParams}}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{operationId}}Request) Execute() ({{#returnType}}{{^isArray}}{{^returnTypeIsPrimitive}}{{^isResponseFile}}*{{/isResponseFile}}{{/returnTypeIsPrimitive}}{{/isArray}}{{{.}}}, {{/returnType}} error) {
var (
localVarHTTPMethod = http.Method{{httpMethod}}
Expand Down Expand Up @@ -412,8 +411,8 @@ func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{operationId}}Request)
{{operationId}}: {{{summary}}}{{^summary}}Method for {{operationId}}{{/summary}}
{{#notes}}

{{#isDeprecated}}Deprecated: {{/isDeprecated}}{{{unescapedNotes}}}
{{/notes}}
Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().{{#pathParams}}
@param {{paramName}}{{#description}} {{{.}}}{{/description}}{{/pathParams}}
Expand All @@ -429,11 +428,7 @@ func (a *APIClient) {{{nickname}}}(ctx context.Context{{#pathParams}}, {{paramNa
}
}

{{#isDeprecated}}
/*
Deprecated: {{{unescapedNotes}}}
*/
{{/isDeprecated}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (a *APIClient) {{{nickname}}}Execute(ctx context.Context{{#pathParams}}, {{paramName}} {{{dataType}}}{{/pathParams}}) ({{#returnType}}{{^isArray}}{{^returnTypeIsPrimitive}}{{^isResponseFile}}*{{/isResponseFile}}{{/returnTypeIsPrimitive}}{{/isArray}}{{{.}}}, {{/returnType}} error){
r := {{#structPrefix}}{{&classname}}{{/structPrefix}}{{operationId}}Request{
apiService: a.defaultApi,
Expand Down
9 changes: 8 additions & 1 deletion languages/golang/compat-layer/templates/client.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{>partial_header}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
package {{packageName}}

import (
Expand Down Expand Up @@ -38,18 +39,21 @@ var (

// APIClient manages communication with the {{appName}} API v{{version}}
// In most cases there should be only one, shared, APIClient.
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type APIClient struct {
cfg *config.Configuration
common service // Reuse a single struct instead of allocating one for each service on the heap.
defaultApi *DefaultApiService
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type service struct {
client DefaultApi
}

// NewAPIClient creates a new API client.
// Optionally receives configuration options
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) {
cfg := NewConfiguration()

Expand Down Expand Up @@ -146,6 +150,7 @@ func typeCheckParameter(obj interface{}, expected string, name string) error {
return nil
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func ParameterValueToString( obj interface{}, key string ) string {
if reflect.TypeOf(obj).Kind() != reflect.Ptr {
return fmt.Sprintf("%v", obj)
Expand Down Expand Up @@ -284,6 +289,7 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {

// Allow modification of underlying config for alternate implementations and testing
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (c *APIClient) GetConfig() *config.Configuration {
return c.cfg
}
Expand Down Expand Up @@ -640,6 +646,7 @@ func parseCacheControl(headers http.Header) cacheControl {
}

// CacheExpires helper function to determine remaining time before repeating a request.
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func CacheExpires(r *http.Response) time.Time {
// Figure out when the cache expires.
var expires time.Time
Expand Down Expand Up @@ -670,4 +677,4 @@ func CacheExpires(r *http.Response) time.Time {

func strlen(s string) int {
return utf8.RuneCountInString(s)
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{{>partial_header}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
package {{packageName}}

import (
"github.com/stackitcloud/stackit-sdk-go/core/config"
)

// NewConfiguration returns a new Configuration object
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func NewConfiguration() *config.Configuration {
cfg := &config.Configuration{
DefaultHeader: make(map[string]string),
Expand Down Expand Up @@ -89,4 +91,4 @@ func NewConfiguration() *config.Configuration {
{{/apiInfo}}
}
return cfg
}
}
1 change: 1 addition & 0 deletions languages/golang/compat-layer/templates/model.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{>partial_header}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
package {{packageName}}

{{#models}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// {{classname}} {{{description}}}{{^description}}struct for {{{classname}}}{{/description}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{classname}} struct {
{{#anyOf}}
{{{.}}} *{{{.}}}
{{/anyOf}}
}

// Unmarshal JSON data into any of the pointers in the struct
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (dst *{{classname}}) UnmarshalJSON(data []byte) error {
var err error
{{#isNullable}}
Expand Down Expand Up @@ -63,6 +65,7 @@ func (dst *{{classname}}) UnmarshalJSON(data []byte) error {
}

// Marshal data from the first non-nil pointers in the struct to JSON
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (src *{{classname}}) MarshalJSON() ([]byte, error) {
{{#anyOf}}
if src.{{{.}}} != nil {
Expand Down
15 changes: 15 additions & 0 deletions languages/golang/compat-layer/templates/model_enum.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// {{{classname}}} {{{description}}}{{^description}}the model '{{{classname}}}'{{/description}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{{classname}}} {{dataType}}

// List of {{{name}}}
Expand All @@ -7,12 +8,14 @@ const (
{{#enumVars}}
{{^-first}}
{{/-first}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
{{{classname.toUpperCase}}}_{{name}} {{{classname}}} = {{{value}}}
{{/enumVars}}
{{/allowableValues}}
)

// All allowed values of {{{classname}}} enum
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
var Allowed{{{classname}}}EnumValues = []{{{classname}}}{
{{#allowableValues}}
{{#enumVars}}
Expand All @@ -21,6 +24,7 @@ var Allowed{{{classname}}}EnumValues = []{{{classname}}}{
{{/allowableValues}}
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v *{{{classname}}}) UnmarshalJSON(src []byte) error {
var value {{dataType}}
err := json.Unmarshal(src, &value)
Expand All @@ -45,6 +49,7 @@ func (v *{{{classname}}}) UnmarshalJSON(src []byte) error {

// New{{{classname}}}FromValue returns a pointer to a valid {{{classname}}}
// for the value passed as argument, or an error if the value passed is not allowed by the enum
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func New{{{classname}}}FromValue(v {{dataType}}) (*{{{classname}}}, error) {
ev := {{{classname}}}(v)
if ev.IsValid() {
Expand All @@ -55,6 +60,7 @@ func New{{{classname}}}FromValue(v {{dataType}}) (*{{{classname}}}, error) {
}

// IsValid return true if the value is valid for the enum, false otherwise
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v {{{classname}}}) IsValid() bool {
for _, existing := range Allowed{{{classname}}}EnumValues {
if existing == v {
Expand All @@ -65,41 +71,50 @@ func (v {{{classname}}}) IsValid() bool {
}

// Ptr returns reference to {{{name}}} value
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v {{{classname}}}) Ptr() *{{{classname}}} {
return &v
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type Nullable{{{classname}}} struct {
value *{{{classname}}}
isSet bool
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v Nullable{{classname}}) Get() *{{classname}} {
return v.value
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v *Nullable{{classname}}) Set(val *{{classname}}) {
v.value = val
v.isSet = true
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v Nullable{{classname}}) IsSet() bool {
return v.isSet
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v *Nullable{{classname}}) Unset() {
v.value = nil
v.isSet = false
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func NewNullable{{classname}}(val *{{classname}}) *Nullable{{classname}} {
return &Nullable{{classname}}{value: val, isSet: true}
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v Nullable{{{classname}}}) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}

// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (v *Nullable{{{classname}}}) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// {{classname}} - {{{description}}}{{^description}}struct for {{{classname}}}{{/description}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
type {{classname}} struct {
{{#oneOf}}
{{#lambda.type-to-name}}{{{.}}}{{/lambda.type-to-name}} *{{{.}}}
Expand All @@ -7,6 +8,7 @@ type {{classname}} struct {

{{#oneOf}}
// {{{.}}}As{{classname}} is a convenience function that returns {{{.}}} wrapped in {{classname}}
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func {{#lambda.type-to-name}}{{{.}}}{{/lambda.type-to-name}}As{{classname}}(v *{{{.}}}) {{classname}} {
return {{classname}}{
{{#lambda.type-to-name}}{{{.}}}{{/lambda.type-to-name}}: v,
Expand All @@ -16,6 +18,7 @@ func {{#lambda.type-to-name}}{{{.}}}{{/lambda.type-to-name}}As{{classname}}(v *{
{{/oneOf}}

// Unmarshal JSON data into one of the pointers in the struct
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (dst *{{classname}}) UnmarshalJSON(data []byte) error {
var err error
{{#isNullable}}
Expand Down Expand Up @@ -130,6 +133,7 @@ func (dst *{{classname}}) UnmarshalJSON(data []byte) error {

// Marshal data from the first non-nil pointers in the struct to JSON
func (src {{classname}}) MarshalJSON() ([]byte, error) {
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
{{#oneOf}}
if src.{{#lambda.type-to-name}}{{{.}}}{{/lambda.type-to-name}} != nil {
return json.Marshal(&src.{{#lambda.type-to-name}}{{{.}}}{{/lambda.type-to-name}})
Expand All @@ -140,6 +144,7 @@ func (src {{classname}}) MarshalJSON() ([]byte, error) {
}

// Get the actual instance
// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead
func (obj *{{classname}}) GetActualInstance() (interface{}) {
if obj == nil {
return nil
Expand Down
Loading
Loading