Skip to content

Commit

Permalink
Merge branch 'infobloxopen:master' into tags
Browse files Browse the repository at this point in the history
  • Loading branch information
MinJiang00 authored May 1, 2024
2 parents c846d8a + 23db084 commit 2a3a80c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
4 changes: 4 additions & 0 deletions dfp/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ paths:
required: true
schema:
type: string
x-gosdk-type: resource_id
x-gosdk-type: resource_id
requestBody:
content:
application/json:
Expand Down Expand Up @@ -188,6 +190,8 @@ paths:
required: true
schema:
type: string
x-gosdk-type: resource_id
x-gosdk-type: resource_id
- description: The DNS Forwarding Proxy object identifier.
in: query
name: id
Expand Down
4 changes: 2 additions & 2 deletions dfp/api_infra_services.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,24 @@ func typeCheckParameter(obj interface{}, expected string, name string) error {
}

func ParameterValueToString(obj interface{}, key string) string {
if key == "id" {
// "id" is always assumed to be a resource_id
// If "id" is not a resource_id, it should be explicitly set to have a different type using "x-gosdk-type" extension
return ParameterValueToStringForType(obj, key, "resource_id")
}
return ParameterValueToStringForType(obj, key, "")
}

func ParameterValueToStringForType(obj interface{}, key string, objType string) string {
if objType == "resource_id" {
return extractResourceId(parameterValueToString(obj, key))
}
return parameterValueToString(obj, key)
}

func parameterValueToString(obj interface{}, key string) string {
if reflect.TypeOf(obj).Kind() != reflect.Ptr {
s := fmt.Sprintf("%v", obj)
if key == "id" {
s = extractResourceId(s)
}
return s
}
var param, ok = obj.(MappedNullable)
Expand All @@ -148,9 +161,6 @@ func ParameterValueToString(obj interface{}, key string) string {
return ""
}
s := fmt.Sprintf("%v", dataMap[key])
if key == "id" {
s = extractResourceId(s)
}
return s
}

Expand Down

0 comments on commit 2a3a80c

Please sign in to comment.