Skip to content

Commit

Permalink
Updated VMC service to v0.11.0
Browse files Browse the repository at this point in the history
Signed-off-by: Ankit Agrawal <[email protected]>
  • Loading branch information
aagrawal3 committed Apr 3, 2023
1 parent 4304205 commit 8ed3235
Show file tree
Hide file tree
Showing 86 changed files with 5,383 additions and 5,402 deletions.
17 changes: 0 additions & 17 deletions services/vmc/LICENSE.txt

This file was deleted.

65 changes: 33 additions & 32 deletions services/vmc/LocaleClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,78 +9,79 @@
package vmc

import (
"github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors"
"github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
"github.com/vmware/vsphere-automation-sdk-go/runtime/core"
"github.com/vmware/vsphere-automation-sdk-go/runtime/lib"
"github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client"
"github.com/vmware/vsphere-automation-sdk-go/services/vmc/model"
vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors"
vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core"
vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client"
vmcModel "github.com/vmware/vsphere-automation-sdk-go/services/vmc/model"
)

const _ = core.SupportedByRuntimeVersion1
const _ = vapiCore_.SupportedByRuntimeVersion2

type LocaleClient interface {

// Sets the locale for the session which is used for translating responses.
//
// @param vmcLocaleParam The locale to be set. (required)
// @return com.vmware.vmc.model.VmcLocale
//
// @throws Unauthenticated Unauthorized
// @throws Unauthorized Forbidden
Set(vmcLocaleParam model.VmcLocale) (model.VmcLocale, error)
Set(vmcLocaleParam vmcModel.VmcLocale) (vmcModel.VmcLocale, error)
}

type localeClient struct {
connector client.Connector
interfaceDefinition core.InterfaceDefinition
errorsBindingMap map[string]bindings.BindingType
connector vapiProtocolClient_.Connector
interfaceDefinition vapiCore_.InterfaceDefinition
errorsBindingMap map[string]vapiBindings_.BindingType
}

func NewLocaleClient(connector client.Connector) *localeClient {
interfaceIdentifier := core.NewInterfaceIdentifier("com.vmware.vmc.locale")
methodIdentifiers := map[string]core.MethodIdentifier{
"set": core.NewMethodIdentifier(interfaceIdentifier, "set"),
func NewLocaleClient(connector vapiProtocolClient_.Connector) *localeClient {
interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.vmc.locale")
methodIdentifiers := map[string]vapiCore_.MethodIdentifier{
"set": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "set"),
}
interfaceDefinition := core.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers)
errorsBindingMap := make(map[string]bindings.BindingType)
interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers)
errorsBindingMap := make(map[string]vapiBindings_.BindingType)

lIface := localeClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector}
return &lIface
}

func (lIface *localeClient) GetErrorBindingType(errorName string) bindings.BindingType {
func (lIface *localeClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType {
if entry, ok := lIface.errorsBindingMap[errorName]; ok {
return entry
}
return errors.ERROR_BINDINGS_MAP[errorName]
return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName]
}

func (lIface *localeClient) Set(vmcLocaleParam model.VmcLocale) (model.VmcLocale, error) {
func (lIface *localeClient) Set(vmcLocaleParam vmcModel.VmcLocale) (vmcModel.VmcLocale, error) {
typeConverter := lIface.connector.TypeConverter()
executionContext := lIface.connector.NewExecutionContext()
sv := bindings.NewStructValueBuilder(localeSetInputType(), typeConverter)
operationRestMetaData := localeSetRestMetadata()
executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData)
executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false))

sv := vapiBindings_.NewStructValueBuilder(localeSetInputType(), typeConverter)
sv.AddStructField("VmcLocale", vmcLocaleParam)
inputDataValue, inputError := sv.GetStructValue()
if inputError != nil {
var emptyOutput model.VmcLocale
return emptyOutput, bindings.VAPIerrorsToError(inputError)
var emptyOutput vmcModel.VmcLocale
return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError)
}
operationRestMetaData := localeSetRestMetadata()
connectionMetadata := map[string]interface{}{lib.REST_METADATA: operationRestMetaData}
connectionMetadata["isStreamingResponse"] = false
lIface.connector.SetConnectionMetadata(connectionMetadata)

methodResult := lIface.connector.GetApiProvider().Invoke("com.vmware.vmc.locale", "set", inputDataValue, executionContext)
var emptyOutput model.VmcLocale
var emptyOutput vmcModel.VmcLocale
if methodResult.IsSuccess() {
output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), localeSetOutputType())
output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), LocaleSetOutputType())
if errorInOutput != nil {
return emptyOutput, bindings.VAPIerrorsToError(errorInOutput)
return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput)
}
return output.(model.VmcLocale), nil
return output.(vmcModel.VmcLocale), nil
} else {
methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), lIface.GetErrorBindingType(methodResult.Error().Name()))
if errorInError != nil {
return emptyOutput, bindings.VAPIerrorsToError(errorInError)
return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError)
}
return emptyOutput, methodError.(error)
}
Expand Down
34 changes: 17 additions & 17 deletions services/vmc/LocaleTypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,43 @@
package vmc

import (
"github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
"github.com/vmware/vsphere-automation-sdk-go/runtime/data"
"github.com/vmware/vsphere-automation-sdk-go/runtime/protocol"
"github.com/vmware/vsphere-automation-sdk-go/services/vmc/model"
vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
vapiData_ "github.com/vmware/vsphere-automation-sdk-go/runtime/data"
vapiProtocol_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol"
vmcModel "github.com/vmware/vsphere-automation-sdk-go/services/vmc/model"
"reflect"
)

func localeSetInputType() bindings.StructType {
fields := make(map[string]bindings.BindingType)
func localeSetInputType() vapiBindings_.StructType {
fields := make(map[string]vapiBindings_.BindingType)
fieldNameMap := make(map[string]string)
fields["vmc_locale"] = bindings.NewReferenceType(model.VmcLocaleBindingType)
fields["vmc_locale"] = vapiBindings_.NewReferenceType(vmcModel.VmcLocaleBindingType)
fieldNameMap["vmc_locale"] = "VmcLocale"
var validators = []bindings.Validator{}
return bindings.NewStructType("operation-input", fields, reflect.TypeOf(data.StructValue{}), fieldNameMap, validators)
var validators = []vapiBindings_.Validator{}
return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators)
}

func localeSetOutputType() bindings.BindingType {
return bindings.NewReferenceType(model.VmcLocaleBindingType)
func LocaleSetOutputType() vapiBindings_.BindingType {
return vapiBindings_.NewReferenceType(vmcModel.VmcLocaleBindingType)
}

func localeSetRestMetadata() protocol.OperationRestMetadata {
fields := map[string]bindings.BindingType{}
func localeSetRestMetadata() vapiProtocol_.OperationRestMetadata {
fields := map[string]vapiBindings_.BindingType{}
fieldNameMap := map[string]string{}
paramsTypeMap := map[string]bindings.BindingType{}
paramsTypeMap := map[string]vapiBindings_.BindingType{}
pathParams := map[string]string{}
queryParams := map[string]string{}
headerParams := map[string]string{}
dispatchHeaderParams := map[string]string{}
bodyFieldsMap := map[string]string{}
fields["vmc_locale"] = bindings.NewReferenceType(model.VmcLocaleBindingType)
fields["vmc_locale"] = vapiBindings_.NewReferenceType(vmcModel.VmcLocaleBindingType)
fieldNameMap["vmc_locale"] = "VmcLocale"
paramsTypeMap["vmc_locale"] = bindings.NewReferenceType(model.VmcLocaleBindingType)
paramsTypeMap["vmc_locale"] = vapiBindings_.NewReferenceType(vmcModel.VmcLocaleBindingType)
resultHeaders := map[string]string{}
errorHeaders := map[string]map[string]string{}
errorHeaders["com.vmware.vapi.std.errors.unauthenticated"] = make(map[string]string)
errorHeaders["com.vmware.vapi.std.errors.unauthenticated"]["challenge"] = "WWW-Authenticate"
return protocol.NewOperationRestMetadata(
return vapiProtocol_.NewOperationRestMetadata(
fields,
fieldNameMap,
paramsTypeMap,
Expand Down
97 changes: 50 additions & 47 deletions services/vmc/OrgsClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,115 +9,118 @@
package vmc

import (
"github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors"
"github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
"github.com/vmware/vsphere-automation-sdk-go/runtime/core"
"github.com/vmware/vsphere-automation-sdk-go/runtime/lib"
"github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client"
"github.com/vmware/vsphere-automation-sdk-go/services/vmc/model"
vapiStdErrors_ "github.com/vmware/vsphere-automation-sdk-go/lib/vapi/std/errors"
vapiBindings_ "github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
vapiCore_ "github.com/vmware/vsphere-automation-sdk-go/runtime/core"
vapiProtocolClient_ "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client"
vmcModel "github.com/vmware/vsphere-automation-sdk-go/services/vmc/model"
)

const _ = core.SupportedByRuntimeVersion1
const _ = vapiCore_.SupportedByRuntimeVersion2

type OrgsClient interface {

// Get details of organization
//
// @param orgParam Organization identifier (required)
// @return com.vmware.vmc.model.Organization
//
// @throws Unauthenticated Unauthorized
// @throws Unauthorized Forbidden
// @throws NotFound Organization doesn't exist
Get(orgParam string) (model.Organization, error)
Get(orgParam string) (vmcModel.Organization, error)

// Return a list of all organizations the calling user (based on credential) is authorized on.
//
// @throws Unauthenticated Unauthorized
// @throws Unauthorized Forbidden
List() ([]model.Organization, error)
List() ([]vmcModel.Organization, error)
}

type orgsClient struct {
connector client.Connector
interfaceDefinition core.InterfaceDefinition
errorsBindingMap map[string]bindings.BindingType
connector vapiProtocolClient_.Connector
interfaceDefinition vapiCore_.InterfaceDefinition
errorsBindingMap map[string]vapiBindings_.BindingType
}

func NewOrgsClient(connector client.Connector) *orgsClient {
interfaceIdentifier := core.NewInterfaceIdentifier("com.vmware.vmc.orgs")
methodIdentifiers := map[string]core.MethodIdentifier{
"get": core.NewMethodIdentifier(interfaceIdentifier, "get"),
"list": core.NewMethodIdentifier(interfaceIdentifier, "list"),
func NewOrgsClient(connector vapiProtocolClient_.Connector) *orgsClient {
interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.vmc.orgs")
methodIdentifiers := map[string]vapiCore_.MethodIdentifier{
"get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"),
"list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"),
}
interfaceDefinition := core.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers)
errorsBindingMap := make(map[string]bindings.BindingType)
interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers)
errorsBindingMap := make(map[string]vapiBindings_.BindingType)

oIface := orgsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector}
return &oIface
}

func (oIface *orgsClient) GetErrorBindingType(errorName string) bindings.BindingType {
func (oIface *orgsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType {
if entry, ok := oIface.errorsBindingMap[errorName]; ok {
return entry
}
return errors.ERROR_BINDINGS_MAP[errorName]
return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName]
}

func (oIface *orgsClient) Get(orgParam string) (model.Organization, error) {
func (oIface *orgsClient) Get(orgParam string) (vmcModel.Organization, error) {
typeConverter := oIface.connector.TypeConverter()
executionContext := oIface.connector.NewExecutionContext()
sv := bindings.NewStructValueBuilder(orgsGetInputType(), typeConverter)
operationRestMetaData := orgsGetRestMetadata()
executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData)
executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false))

sv := vapiBindings_.NewStructValueBuilder(orgsGetInputType(), typeConverter)
sv.AddStructField("Org", orgParam)
inputDataValue, inputError := sv.GetStructValue()
if inputError != nil {
var emptyOutput model.Organization
return emptyOutput, bindings.VAPIerrorsToError(inputError)
var emptyOutput vmcModel.Organization
return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError)
}
operationRestMetaData := orgsGetRestMetadata()
connectionMetadata := map[string]interface{}{lib.REST_METADATA: operationRestMetaData}
connectionMetadata["isStreamingResponse"] = false
oIface.connector.SetConnectionMetadata(connectionMetadata)

methodResult := oIface.connector.GetApiProvider().Invoke("com.vmware.vmc.orgs", "get", inputDataValue, executionContext)
var emptyOutput model.Organization
var emptyOutput vmcModel.Organization
if methodResult.IsSuccess() {
output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), orgsGetOutputType())
output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), OrgsGetOutputType())
if errorInOutput != nil {
return emptyOutput, bindings.VAPIerrorsToError(errorInOutput)
return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput)
}
return output.(model.Organization), nil
return output.(vmcModel.Organization), nil
} else {
methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), oIface.GetErrorBindingType(methodResult.Error().Name()))
if errorInError != nil {
return emptyOutput, bindings.VAPIerrorsToError(errorInError)
return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError)
}
return emptyOutput, methodError.(error)
}
}

func (oIface *orgsClient) List() ([]model.Organization, error) {
func (oIface *orgsClient) List() ([]vmcModel.Organization, error) {
typeConverter := oIface.connector.TypeConverter()
executionContext := oIface.connector.NewExecutionContext()
sv := bindings.NewStructValueBuilder(orgsListInputType(), typeConverter)
operationRestMetaData := orgsListRestMetadata()
executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData)
executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false))

sv := vapiBindings_.NewStructValueBuilder(orgsListInputType(), typeConverter)
inputDataValue, inputError := sv.GetStructValue()
if inputError != nil {
var emptyOutput []model.Organization
return emptyOutput, bindings.VAPIerrorsToError(inputError)
var emptyOutput []vmcModel.Organization
return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError)
}
operationRestMetaData := orgsListRestMetadata()
connectionMetadata := map[string]interface{}{lib.REST_METADATA: operationRestMetaData}
connectionMetadata["isStreamingResponse"] = false
oIface.connector.SetConnectionMetadata(connectionMetadata)

methodResult := oIface.connector.GetApiProvider().Invoke("com.vmware.vmc.orgs", "list", inputDataValue, executionContext)
var emptyOutput []model.Organization
var emptyOutput []vmcModel.Organization
if methodResult.IsSuccess() {
output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), orgsListOutputType())
output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), OrgsListOutputType())
if errorInOutput != nil {
return emptyOutput, bindings.VAPIerrorsToError(errorInOutput)
return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput)
}
return output.([]model.Organization), nil
return output.([]vmcModel.Organization), nil
} else {
methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), oIface.GetErrorBindingType(methodResult.Error().Name()))
if errorInError != nil {
return emptyOutput, bindings.VAPIerrorsToError(errorInError)
return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError)
}
return emptyOutput, methodError.(error)
}
Expand Down
Loading

0 comments on commit 8ed3235

Please sign in to comment.