diff --git a/ekms/api/go/rest/etsi/client/.openapi-generator/FILES b/ekms/api/go/rest/etsi/client/.openapi-generator/FILES index a056ae3b3f143aee0e8c6d7970ce1d4a877cf795..2248a762d2ca3bcd1eff43bab52d90e203fa2438 100644 --- a/ekms/api/go/rest/etsi/client/.openapi-generator/FILES +++ b/ekms/api/go/rest/etsi/client/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -25,5 +24,4 @@ model_key_ids_request_key_ids_inner.go model_key_request.go model_status.go response.go -test/api_default_test.go utils.go diff --git a/ekms/api/go/rest/etsi/client/.openapi-generator/VERSION b/ekms/api/go/rest/etsi/client/.openapi-generator/VERSION index 73a86b1970a7911cbe31f05c7fc666d530a9f163..ba7f754d0c33efc277ab296ee7d1cf6b084ba36b 100644 --- a/ekms/api/go/rest/etsi/client/.openapi-generator/VERSION +++ b/ekms/api/go/rest/etsi/client/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.1 \ No newline at end of file +7.4.0 diff --git a/ekms/api/go/rest/etsi/client/README.md b/ekms/api/go/rest/etsi/client/README.md index f2e280c43740f253e2f4776003d69e651daa1b88..6208d2279cf0919c3fc64e3b3ae1012bbfeda398 100644 --- a/ekms/api/go/rest/etsi/client/README.md +++ b/ekms/api/go/rest/etsi/client/README.md @@ -7,26 +7,27 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - API version: 0.0.1 - Package version: 1.0.0 +- Generator version: 7.4.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation Install the following dependencies: -```shell +```sh go get github.com/stretchr/testify/assert go get golang.org/x/net/context ``` Put the package under your project folder and add the following in import: -```golang +```go import etsi14 "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" ``` To use a proxy, set the environment variable `HTTP_PROXY`: -```golang +```go os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` @@ -36,17 +37,17 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `etsi14.ContextServerIndex` of type `int`. -```golang +```go ctx := context.WithValue(context.Background(), etsi14.ContextServerIndex, 1) ``` ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `etsi14.ContextServerVariables` of type `map[string]string`. -```golang +```go ctx := context.WithValue(context.Background(), etsi14.ContextServerVariables, map[string]string{ "basePath": "v2", }) @@ -58,9 +59,9 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `etsi14.ContextOperationServerIndices` and `etsi14.ContextOperationServerVariables` context maps. -```golang +```go ctx := context.WithValue(context.Background(), etsi14.ContextOperationServerIndices, map[string]int{ "{classname}Service.{nickname}": 2, }) diff --git a/ekms/api/go/rest/etsi/client/api/openapi.yaml b/ekms/api/go/rest/etsi/client/api/openapi.yaml index b82abeada16504dd760f17821ab3d900558f2880..e10f0b9fe53e2ae39a3d1857dbd2ebb9db9ac022 100644 --- a/ekms/api/go/rest/etsi/client/api/openapi.yaml +++ b/ekms/api/go/rest/etsi/client/api/openapi.yaml @@ -141,7 +141,8 @@ components: in: path name: slave_SAE_ID required: true - schema: {} + schema: + type: string style: simple master_SAE_ID: description: SAE ID of the calling master SAE @@ -149,7 +150,8 @@ components: in: path name: master_SAE_ID required: true - schema: {} + schema: + type: string style: simple responses: "400BadRequest": diff --git a/ekms/api/go/rest/etsi/client/api_default.go b/ekms/api/go/rest/etsi/client/api_default.go index 048c9fa3c9392c5b73ba119be3269cf292acd21b..6b6f5246380b688888164ebbf9032404180fb0f6 100644 --- a/ekms/api/go/rest/etsi/client/api_default.go +++ b/ekms/api/go/rest/etsi/client/api_default.go @@ -26,7 +26,7 @@ type DefaultAPIService service type ApiGetKeyRequest struct { ctx context.Context ApiService *DefaultAPIService - slaveSAEID interface{} + slaveSAEID string number *int64 size *int64 } @@ -52,7 +52,7 @@ GetKey TBD @param slaveSAEID SAE ID of the specified slave SAE @return ApiGetKeyRequest */ -func (a *DefaultAPIService) GetKey(ctx context.Context, slaveSAEID interface{}) ApiGetKeyRequest { +func (a *DefaultAPIService) GetKey(ctx context.Context, slaveSAEID string) ApiGetKeyRequest { return ApiGetKeyRequest{ ApiService: a, ctx: ctx, @@ -127,6 +127,27 @@ func (a *DefaultAPIService) GetKeyExecute(r ApiGetKeyRequest) (*KeyContainer, *h body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -145,7 +166,7 @@ func (a *DefaultAPIService) GetKeyExecute(r ApiGetKeyRequest) (*KeyContainer, *h type ApiGetKeyPostRequest struct { ctx context.Context ApiService *DefaultAPIService - slaveSAEID interface{} + slaveSAEID string keyRequest *KeyRequest } @@ -166,7 +187,7 @@ GetKeyPost Method for GetKeyPost @param slaveSAEID SAE ID of the specified slave SAE @return ApiGetKeyPostRequest */ -func (a *DefaultAPIService) GetKeyPost(ctx context.Context, slaveSAEID interface{}) ApiGetKeyPostRequest { +func (a *DefaultAPIService) GetKeyPost(ctx context.Context, slaveSAEID string) ApiGetKeyPostRequest { return ApiGetKeyPostRequest{ ApiService: a, ctx: ctx, @@ -237,6 +258,27 @@ func (a *DefaultAPIService) GetKeyPostExecute(r ApiGetKeyPostRequest) (*KeyConta body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -255,7 +297,7 @@ func (a *DefaultAPIService) GetKeyPostExecute(r ApiGetKeyPostRequest) (*KeyConta type ApiGetKeyWithIdsRequest struct { ctx context.Context ApiService *DefaultAPIService - masterSAEID interface{} + masterSAEID string keyID *string } @@ -275,7 +317,7 @@ GetKeyWithIds TBD @param masterSAEID SAE ID of the calling master SAE @return ApiGetKeyWithIdsRequest */ -func (a *DefaultAPIService) GetKeyWithIds(ctx context.Context, masterSAEID interface{}) ApiGetKeyWithIdsRequest { +func (a *DefaultAPIService) GetKeyWithIds(ctx context.Context, masterSAEID string) ApiGetKeyWithIdsRequest { return ApiGetKeyWithIdsRequest{ ApiService: a, ctx: ctx, @@ -347,6 +389,27 @@ func (a *DefaultAPIService) GetKeyWithIdsExecute(r ApiGetKeyWithIdsRequest) (*Ke body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -365,7 +428,7 @@ func (a *DefaultAPIService) GetKeyWithIdsExecute(r ApiGetKeyWithIdsRequest) (*Ke type ApiGetKeyWithIdsPostRequest struct { ctx context.Context ApiService *DefaultAPIService - masterSAEID interface{} + masterSAEID string keyIDsRequest *KeyIDsRequest } @@ -386,7 +449,7 @@ GetKeyWithIdsPost TBD @param masterSAEID SAE ID of the calling master SAE @return ApiGetKeyWithIdsPostRequest */ -func (a *DefaultAPIService) GetKeyWithIdsPost(ctx context.Context, masterSAEID interface{}) ApiGetKeyWithIdsPostRequest { +func (a *DefaultAPIService) GetKeyWithIdsPost(ctx context.Context, masterSAEID string) ApiGetKeyWithIdsPostRequest { return ApiGetKeyWithIdsPostRequest{ ApiService: a, ctx: ctx, @@ -457,6 +520,27 @@ func (a *DefaultAPIService) GetKeyWithIdsPostExecute(r ApiGetKeyWithIdsPostReque body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -475,7 +559,7 @@ func (a *DefaultAPIService) GetKeyWithIdsPostExecute(r ApiGetKeyWithIdsPostReque type ApiGetStatusRequest struct { ctx context.Context ApiService *DefaultAPIService - slaveSAEID interface{} + slaveSAEID string } func (r ApiGetStatusRequest) Execute() (*Status, *http.Response, error) { @@ -489,7 +573,7 @@ GetStatus TBD @param slaveSAEID SAE ID of the specified slave SAE @return ApiGetStatusRequest */ -func (a *DefaultAPIService) GetStatus(ctx context.Context, slaveSAEID interface{}) ApiGetStatusRequest { +func (a *DefaultAPIService) GetStatus(ctx context.Context, slaveSAEID string) ApiGetStatusRequest { return ApiGetStatusRequest{ ApiService: a, ctx: ctx, @@ -558,6 +642,27 @@ func (a *DefaultAPIService) GetStatusExecute(r ApiGetStatusRequest) (*Status, *h body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorFormat + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/ekms/api/go/rest/etsi/client/client.go b/ekms/api/go/rest/etsi/client/client.go index 77edeab8a4c8be4d13d29dc46dee7156ed3205c3..3cb4709f31df148d42e39df08aeacc960bf382e2 100644 --- a/ekms/api/go/rest/etsi/client/client.go +++ b/ekms/api/go/rest/etsi/client/client.go @@ -35,8 +35,8 @@ import ( ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) ) @@ -436,7 +436,6 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err return } _, err = f.Seek(0, io.SeekStart) - err = os.Remove(f.Name()) return } if f, ok := v.(**os.File); ok { @@ -449,16 +448,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err return } _, err = (*f).Seek(0, io.SeekStart) - err = os.Remove((*f).Name()) return } - if xmlCheck.MatchString(contentType) { + if XmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err } return nil } - if jsonCheck.MatchString(contentType) { + 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 { @@ -523,9 +521,9 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e _, err = bodyBuf.WriteString(s) } else if s, ok := body.(*string); ok { _, err = bodyBuf.WriteString(*s) - } else if jsonCheck.MatchString(contentType) { + } else if JsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) - } else if xmlCheck.MatchString(contentType) { + } else if XmlCheck.MatchString(contentType) { var bs []byte bs, err = xml.Marshal(body) if err == nil { diff --git a/ekms/api/go/rest/etsi/client/docs/DefaultAPI.md b/ekms/api/go/rest/etsi/client/docs/DefaultAPI.md index 741643487cf400c34b2c97aaa9e2fcad5fd5e9c8..78e864f38fa6dadcf3e1fc9c3dec079f59663ee2 100644 --- a/ekms/api/go/rest/etsi/client/docs/DefaultAPI.md +++ b/ekms/api/go/rest/etsi/client/docs/DefaultAPI.md @@ -24,26 +24,26 @@ TBD package main import ( - "context" - "fmt" - "os" - openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" + "context" + "fmt" + "os" + openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" ) func main() { - slaveSAEID := TODO // interface{} | SAE ID of the specified slave SAE - number := int64(789) // int64 | (optional) - size := int64(789) // int64 | (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.GetKey(context.Background(), slaveSAEID).Number(number).Size(size).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetKey``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetKey`: KeyContainer - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetKey`: %v\n", resp) + slaveSAEID := "slaveSAEID_example" // string | SAE ID of the specified slave SAE + number := int64(789) // int64 | (optional) + size := int64(789) // int64 | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.GetKey(context.Background(), slaveSAEID).Number(number).Size(size).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetKey`: KeyContainer + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetKey`: %v\n", resp) } ``` @@ -53,7 +53,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**slaveSAEID** | [**interface{}**](.md) | SAE ID of the specified slave SAE | +**slaveSAEID** | **string** | SAE ID of the specified slave SAE | ### Other Parameters @@ -96,25 +96,25 @@ No authorization required package main import ( - "context" - "fmt" - "os" - openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" + "context" + "fmt" + "os" + openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" ) func main() { - slaveSAEID := TODO // interface{} | SAE ID of the specified slave SAE - keyRequest := *openapiclient.NewKeyRequest() // KeyRequest | TBD (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.GetKeyPost(context.Background(), slaveSAEID).KeyRequest(keyRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetKeyPost``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetKeyPost`: KeyContainer - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetKeyPost`: %v\n", resp) + slaveSAEID := "slaveSAEID_example" // string | SAE ID of the specified slave SAE + keyRequest := *openapiclient.NewKeyRequest() // KeyRequest | TBD (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.GetKeyPost(context.Background(), slaveSAEID).KeyRequest(keyRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetKeyPost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetKeyPost`: KeyContainer + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetKeyPost`: %v\n", resp) } ``` @@ -124,7 +124,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**slaveSAEID** | [**interface{}**](.md) | SAE ID of the specified slave SAE | +**slaveSAEID** | **string** | SAE ID of the specified slave SAE | ### Other Parameters @@ -166,25 +166,25 @@ TBD package main import ( - "context" - "fmt" - "os" - openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" + "context" + "fmt" + "os" + openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" ) func main() { - masterSAEID := TODO // interface{} | SAE ID of the calling master SAE - keyID := "keyID_example" // string | (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.GetKeyWithIds(context.Background(), masterSAEID).KeyID(keyID).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetKeyWithIds``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetKeyWithIds`: KeyContainer - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetKeyWithIds`: %v\n", resp) + masterSAEID := "masterSAEID_example" // string | SAE ID of the calling master SAE + keyID := "keyID_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.GetKeyWithIds(context.Background(), masterSAEID).KeyID(keyID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetKeyWithIds``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetKeyWithIds`: KeyContainer + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetKeyWithIds`: %v\n", resp) } ``` @@ -194,7 +194,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**masterSAEID** | [**interface{}**](.md) | SAE ID of the calling master SAE | +**masterSAEID** | **string** | SAE ID of the calling master SAE | ### Other Parameters @@ -236,25 +236,25 @@ TBD package main import ( - "context" - "fmt" - "os" - openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" + "context" + "fmt" + "os" + openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" ) func main() { - masterSAEID := TODO // interface{} | SAE ID of the calling master SAE - keyIDsRequest := *openapiclient.NewKeyIDsRequest() // KeyIDsRequest | TBD (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.GetKeyWithIdsPost(context.Background(), masterSAEID).KeyIDsRequest(keyIDsRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetKeyWithIdsPost``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetKeyWithIdsPost`: KeyContainer - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetKeyWithIdsPost`: %v\n", resp) + masterSAEID := "masterSAEID_example" // string | SAE ID of the calling master SAE + keyIDsRequest := *openapiclient.NewKeyIDsRequest() // KeyIDsRequest | TBD (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.GetKeyWithIdsPost(context.Background(), masterSAEID).KeyIDsRequest(keyIDsRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetKeyWithIdsPost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetKeyWithIdsPost`: KeyContainer + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetKeyWithIdsPost`: %v\n", resp) } ``` @@ -264,7 +264,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**masterSAEID** | [**interface{}**](.md) | SAE ID of the calling master SAE | +**masterSAEID** | **string** | SAE ID of the calling master SAE | ### Other Parameters @@ -306,24 +306,24 @@ TBD package main import ( - "context" - "fmt" - "os" - openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" + "context" + "fmt" + "os" + openapiclient "code.fbi.h-da.de/danet/ekms/api/go/rest/etsi/client" ) func main() { - slaveSAEID := TODO // interface{} | SAE ID of the specified slave SAE - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultAPI.GetStatus(context.Background(), slaveSAEID).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetStatus``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetStatus`: Status - fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetStatus`: %v\n", resp) + slaveSAEID := "slaveSAEID_example" // string | SAE ID of the specified slave SAE + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.GetStatus(context.Background(), slaveSAEID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.GetStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetStatus`: Status + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.GetStatus`: %v\n", resp) } ``` @@ -333,7 +333,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**slaveSAEID** | [**interface{}**](.md) | SAE ID of the specified slave SAE | +**slaveSAEID** | **string** | SAE ID of the specified slave SAE | ### Other Parameters diff --git a/ekms/api/go/rest/etsi/client/model_key_ids_request_key_ids_inner.go b/ekms/api/go/rest/etsi/client/model_key_ids_request_key_ids_inner.go index abeff234d9a69e253e569af8d4cc2a4781acae91..7745ce6f4cc1ffc770bfa3f39c5e3116da10654c 100644 --- a/ekms/api/go/rest/etsi/client/model_key_ids_request_key_ids_inner.go +++ b/ekms/api/go/rest/etsi/client/model_key_ids_request_key_ids_inner.go @@ -12,6 +12,8 @@ package etsi14 import ( "encoding/json" + "bytes" + "fmt" ) // checks if the KeyIDsRequestKeyIDsInner type satisfies the MappedNullable interface at compile time @@ -22,6 +24,8 @@ type KeyIDsRequestKeyIDsInner struct { KeyID string `json:"key_ID"` } +type _KeyIDsRequestKeyIDsInner KeyIDsRequestKeyIDsInner + // NewKeyIDsRequestKeyIDsInner instantiates a new KeyIDsRequestKeyIDsInner 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 @@ -78,6 +82,43 @@ func (o KeyIDsRequestKeyIDsInner) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *KeyIDsRequestKeyIDsInner) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "key_ID", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varKeyIDsRequestKeyIDsInner := _KeyIDsRequestKeyIDsInner{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varKeyIDsRequestKeyIDsInner) + + if err != nil { + return err + } + + *o = KeyIDsRequestKeyIDsInner(varKeyIDsRequestKeyIDsInner) + + return err +} + type NullableKeyIDsRequestKeyIDsInner struct { value *KeyIDsRequestKeyIDsInner isSet bool diff --git a/ekms/api/go/rest/etsi/client/test/api_default_test.go b/ekms/api/go/rest/etsi/client/test/api_default_test.go index ebdf4fe85544ed6772c96360f05f19abcd57ebc2..4d52c6e8ac226678e9067084d08d7585caf52c7e 100644 --- a/ekms/api/go/rest/etsi/client/test/api_default_test.go +++ b/ekms/api/go/rest/etsi/client/test/api_default_test.go @@ -25,7 +25,7 @@ func Test_etsi14_DefaultAPIService(t *testing.T) { t.Run("Test DefaultAPIService GetKey", func(t *testing.T) { t.Skip("skip test") // remove to run test - var slaveSAEID interface{} + var slaveSAEID = "slaveSAEID" resp, httpRes, err := apiClient.DefaultAPI.GetKey(context.Background(), slaveSAEID).Execute() @@ -37,7 +37,7 @@ func Test_etsi14_DefaultAPIService(t *testing.T) { t.Run("Test DefaultAPIService GetKeyPost", func(t *testing.T) { t.Skip("skip test") // remove to run test - var slaveSAEID interface{} + var slaveSAEID = "slaveSAEID" resp, httpRes, err := apiClient.DefaultAPI.GetKeyPost(context.Background(), slaveSAEID).Execute() @@ -49,7 +49,7 @@ func Test_etsi14_DefaultAPIService(t *testing.T) { t.Run("Test DefaultAPIService GetKeyWithIds", func(t *testing.T) { t.Skip("skip test") // remove to run test - var masterSAEID interface{} + var masterSAEID = "masterSAEID" resp, httpRes, err := apiClient.DefaultAPI.GetKeyWithIds(context.Background(), masterSAEID).Execute() @@ -61,7 +61,7 @@ func Test_etsi14_DefaultAPIService(t *testing.T) { t.Run("Test DefaultAPIService GetKeyWithIdsPost", func(t *testing.T) { t.Skip("skip test") // remove to run test - var masterSAEID interface{} + var masterSAEID = "masterSAEID" resp, httpRes, err := apiClient.DefaultAPI.GetKeyWithIdsPost(context.Background(), masterSAEID).Execute() @@ -73,7 +73,7 @@ func Test_etsi14_DefaultAPIService(t *testing.T) { t.Run("Test DefaultAPIService GetStatus", func(t *testing.T) { t.Skip("skip test") // remove to run test - var slaveSAEID interface{} + var slaveSAEID = "slaveSAEID" resp, httpRes, err := apiClient.DefaultAPI.GetStatus(context.Background(), slaveSAEID).Execute() diff --git a/ekms/api/go/rest/etsi/client/utils.go b/ekms/api/go/rest/etsi/client/utils.go index 50301f7397f8d856e56c5ef50eb315e26021a1e8..d0b4f3aa4490c605bf04754210a377f80d9742ea 100644 --- a/ekms/api/go/rest/etsi/client/utils.go +++ b/ekms/api/go/rest/etsi/client/utils.go @@ -320,7 +320,7 @@ func NewNullableTime(val *time.Time) *NullableTime { } func (v NullableTime) MarshalJSON() ([]byte, error) { - return v.value.MarshalJSON() + return json.Marshal(v.value) } func (v *NullableTime) UnmarshalJSON(src []byte) error { diff --git a/ekms/api/go/rest/etsi/server/go/model_key_container.go b/ekms/api/go/rest/etsi/server/go/model_key_container.go index 609f2a505d5ff37256abb678b1739cc0e3844994..ea14f320b33170bd7dafc7947e208cced643b9f8 100644 --- a/ekms/api/go/rest/etsi/server/go/model_key_container.go +++ b/ekms/api/go/rest/etsi/server/go/model_key_container.go @@ -10,7 +10,7 @@ package etsi14 type KeyContainer struct { - Keys []KeyContainerKeysInner `json:"Keys,omitempty"` + Keys []KeyContainerKeysInner `json:"keys,omitempty"` } // AssertKeyContainerRequired checks if the required fields are not zero-ed. diff --git a/ekms/api/proto/etsi/etsi14.proto b/ekms/api/proto/etsi/etsi14.proto index 6214b64749d90f1f398e0a321a57cb2f3e5e70ed..4001fa5b47c1829c14520d85dd9860e6780dd621 100644 --- a/ekms/api/proto/etsi/etsi14.proto +++ b/ekms/api/proto/etsi/etsi14.proto @@ -29,8 +29,8 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { }; service ETSI14Service { - // Returns Status from a KME to the calling SAE. - // Status contains information on keys available to be requested + // Returns Status from a KME to the calling SAE. + // Status contains information on keys available to be requested // by a master SAE for a specified slave SAE. rpc GetStatus(GetStatusRequest) returns (GetStatusResponse) { option (google.api.http) = { @@ -38,10 +38,10 @@ service ETSI14Service { }; } - // Returns Key container data from the KME to the calling master SAE. - // Key container data contains one or more keys. The calling master SAE may supply - // Key request data to specify the requirement on Key container data. The slave SAE - // specified by the slave_SAE_ID parameter may subsequently request matching keys + // Returns Key container data from the KME to the calling master SAE. + // Key container data contains one or more keys. The calling master SAE may supply + // Key request data to specify the requirement on Key container data. The slave SAE + // specified by the slave_SAE_ID parameter may subsequently request matching keys // from a remote KME using key_ID identifiers from the returned Key container. rpc GetKey(GetKeyRequest) returns (GetKeyResponse) { option (google.api.http) = { @@ -50,10 +50,10 @@ service ETSI14Service { }; } - // Returns Key container from the KME to the calling slave SAE. + // Returns Key container from the KME to the calling slave SAE. // Key container contains keys matching those previously delivered to a remote master SAE // based on the Key IDs supplied from the remote master SAE in response to its call to Get key. - // The KME shall reject the request with a 401 HTTP status code if the SAE ID of the requestor + // The KME shall reject the request with a 401 HTTP status code if the SAE ID of the requestor // was not an SAE ID supplied to the "Get key" method each time it was called resulting in the // return of any of the Key IDs being requested. rpc GetKeyWithIDs(GetKeyWithIDsRequest) returns (GetKeyWithIDsResponse) { @@ -103,7 +103,7 @@ message Error { string message = 1; map<string, ListOfDetails> details = 2; // maybe map<string, string> is enough here?! // or also google.protobuf.Any? -} +} // Maybe not neccessary message ListOfDetails { @@ -122,7 +122,7 @@ message Status { string slave_SAE_ID = 4; int64 key_size = 5; int64 stored_key_count = 6; - int64 max_key_count = 7; + int64 max_key_count = 7; int64 max_key_per_request = 8; int64 max_key_size = 9; int64 min_key_size = 10; @@ -137,13 +137,13 @@ message KeyRequest { repeated ExtensionOptional extension_optional = 5; } -// Array of extension parameters specified as name/value pairs that KME shall +// Array of extension parameters specified as name/value pairs that KME shall // handle or return an error. Parameter values may be of any type, including objects. message ExtensionMandatory { map<string, google.protobuf.Any> extension_mandatory = 1; } -// Array of extension parameters specified as name/value pairs that KME may ignore. +// Array of extension parameters specified as name/value pairs that KME may ignore. // Parameter values may be of any type, including objects. message ExtensionOptional { map<string, google.protobuf.Any> extension_optional = 1; @@ -155,7 +155,7 @@ message KeyID { } message KeyContainer { - repeated Key key = 1; + repeated Key key = 1 [json_name = "keys"]; google.protobuf.Any key_container_extension = 2; } @@ -168,4 +168,4 @@ message Key { KeyIDExtension key_ID_extension = 2; string key = 3; google.protobuf.Any key_extension = 4; -} \ No newline at end of file +}