diff --git a/nsxt/provider.go b/nsxt/provider.go index c3c3ac65e..bad876f8f 100644 --- a/nsxt/provider.go +++ b/nsxt/provider.go @@ -413,6 +413,7 @@ func Provider() *schema.Provider { "nsxt_manager_cluster": resourceNsxtManagerCluster(), "nsxt_uplink_host_switch_profile": resourceNsxtUplinkHostSwitchProfile(), "nsxt_transport_node": resourceNsxtTransportNode(), + "nsxt_cluster_virtual_ip": resourceNsxtClusterVirualIP(), }, ConfigureFunc: providerConfigure, diff --git a/nsxt/resource_nsxt_cluster_virtual_ip.go b/nsxt/resource_nsxt_cluster_virtual_ip.go new file mode 100644 index 000000000..c20e47fac --- /dev/null +++ b/nsxt/resource_nsxt_cluster_virtual_ip.go @@ -0,0 +1,114 @@ +/* Copyright © 2023 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: MPL-2.0 */ + +package nsxt + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" +) + +var ClusterVirtualIPForceType = []string{ + nsxModel.ClusterVirtualIpProperties_FORCE_TRUE, + nsxModel.ClusterVirtualIpProperties_FORCE_FALSE, +} + +var DefaultIPv4VirtualAddress = "0.0.0.0" + +var DefaultIPv6VirtualAddress = "::" + +func resourceNsxtClusterVirualIP() *schema.Resource { + return &schema.Resource{ + Create: resourceNsxtClusterVirualIPCreate, + Read: resourceNsxtClusterVirualIPRead, + Update: resourceNsxtClusterVirualIPUpdate, + Delete: resourceNsxtClusterVirualIPDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "force": { + Type: schema.TypeString, + Description: "On enable it ignores duplicate address detection and DNS lookup validation check", + Optional: true, + ValidateFunc: validation.StringInSlice(ClusterVirtualIPForceType, false), + Default: nsxModel.ClusterVirtualIpProperties_FORCE_FALSE, + }, + "ip_address": { + Type: schema.TypeString, + Description: "Virtual IPv4 address", + Optional: true, + ValidateFunc: validation.IsIPv4Address, + Default: DefaultIPv4VirtualAddress, + }, + "ipv6_address": { + Type: schema.TypeString, + Description: "IP address of the cluster node that will join the cluster of the host node", + Optional: true, + ValidateFunc: validation.IsIPv6Address, + Default: DefaultIPv6VirtualAddress, + }, + }, + } +} + +func resourceNsxtClusterVirualIPCreate(d *schema.ResourceData, m interface{}) error { + // Virtual IP is a property of the cluster and does not have its NSX ID + // For create and update we can use the same client function setvirtual IP + return resourceNsxtClusterVirualIPUpdate(d, m) +} + +func resourceNsxtClusterVirualIPRead(d *schema.ResourceData, m interface{}) error { + connector := getPolicyConnector(m) + client := cluster.NewApiVirtualIpClient(connector) + + obj, err := client.Get() + if err != nil { + return err + } + + // For some reason the Get() function of ApiVirtulIPClient will only return ip address information + // so skip setting force here + d.Set("ip_address", obj.IpAddress) + d.Set("ipv6_address", obj.Ip6Address) + + return nil +} + +func resourceNsxtClusterVirualIPUpdate(d *schema.ResourceData, m interface{}) error { + + id := d.Id() + if id == "" { + id = newUUID() + } + connector := getPolicyConnector(m) + client := cluster.NewApiVirtualIpClient(connector) + force := d.Get("force").(string) + ipAddress := d.Get("ip_address").(string) + ipv6Address := d.Get("ipv6_address").(string) + _, err := client.Setvirtualip(&force, &ipv6Address, &ipAddress) + if err != nil { + return fmt.Errorf("Failed to set cluster virtual ip: %s", err) + } + d.SetId(id) + return resourceNsxtClusterVirualIPRead(d, m) +} + +func resourceNsxtClusterVirualIPDelete(d *schema.ResourceData, m interface{}) error { + connector := getPolicyConnector(m) + client := cluster.NewApiVirtualIpClient(connector) + _, err := client.Clearvirtualip() + if err != nil { + return fmt.Errorf("Failed to clear cluster virtual IPv4 address: %s", err) + } + _, err = client.Clearvirtualip6() + if err != nil { + return fmt.Errorf("Failed to clear cluster virtual IPv6 address: %s", err) + } + return nil +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiCertificateClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiCertificateClient.go new file mode 100644 index 000000000..fb17e0677 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiCertificateClient.go @@ -0,0 +1,182 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ApiCertificate +// Used by client-side stubs. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ApiCertificateClient interface { + + // Clears the certificate used for the MP cluster. This does not affect the certificate itself. This API is deprecated. Instead use the /api/v1/cluster/api-certificate?action=set_cluster_certificate API to set the cluster certificate to a different one. It just means that from now on, individual certificates will be used on each MP node. This affects all nodes in the cluster. + // + // Deprecated: This API element is deprecated. + // + // @param certificateIdParam Certificate ID (required) + // @return com.vmware.nsx.model.ClusterCertificateId + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Clearclustercertificate(certificateIdParam string) (nsxModel.ClusterCertificateId, error) + + // Returns the ID of the certificate that is used as the cluster certificate for MP + // @return com.vmware.nsx.model.ClusterCertificateId + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get() (nsxModel.ClusterCertificateId, error) + + // + // + // Deprecated: This API element is deprecated. + // + // @param certificateIdParam Certificate ID (required) + // @return com.vmware.nsx.model.ClusterCertificateId + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Setclustercertificate(certificateIdParam string) (nsxModel.ClusterCertificateId, error) +} + +type apiCertificateClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewApiCertificateClient(connector vapiProtocolClient_.Connector) *apiCertificateClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx.cluster.api_certificate") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "clearclustercertificate": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "clearclustercertificate"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "setclustercertificate": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "setclustercertificate"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + aIface := apiCertificateClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &aIface +} + +func (aIface *apiCertificateClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := aIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (aIface *apiCertificateClient) Clearclustercertificate(certificateIdParam string) (nsxModel.ClusterCertificateId, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiCertificateClearclustercertificateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiCertificateClearclustercertificateInputType(), typeConverter) + sv.AddStructField("CertificateId", certificateIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterCertificateId + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_certificate", "clearclustercertificate", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterCertificateId + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiCertificateClearclustercertificateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterCertificateId), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (aIface *apiCertificateClient) Get() (nsxModel.ClusterCertificateId, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiCertificateGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiCertificateGetInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterCertificateId + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_certificate", "get", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterCertificateId + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiCertificateGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterCertificateId), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (aIface *apiCertificateClient) Setclustercertificate(certificateIdParam string) (nsxModel.ClusterCertificateId, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiCertificateSetclustercertificateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiCertificateSetclustercertificateInputType(), typeConverter) + sv.AddStructField("CertificateId", certificateIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterCertificateId + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_certificate", "setclustercertificate", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterCertificateId + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiCertificateSetclustercertificateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterCertificateId), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiCertificateTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiCertificateTypes.go new file mode 100644 index 000000000..edf41eb9a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiCertificateTypes.go @@ -0,0 +1,160 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ApiCertificate. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" + "reflect" +) + +func apiCertificateClearclustercertificateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["certificate_id"] = vapiBindings_.NewStringType() + fieldNameMap["certificate_id"] = "CertificateId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiCertificateClearclustercertificateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterCertificateIdBindingType) +} + +func apiCertificateClearclustercertificateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["certificate_id"] = vapiBindings_.NewStringType() + fieldNameMap["certificate_id"] = "CertificateId" + paramsTypeMap["certificate_id"] = vapiBindings_.NewStringType() + queryParams["certificate_id"] = "certificate_id" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=clear_cluster_certificate", + "", + "POST", + "/api/v1/cluster/api-certificate", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func apiCertificateGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiCertificateGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterCertificateIdBindingType) +} + +func apiCertificateGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/api/v1/cluster/api-certificate", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func apiCertificateSetclustercertificateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["certificate_id"] = vapiBindings_.NewStringType() + fieldNameMap["certificate_id"] = "CertificateId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiCertificateSetclustercertificateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterCertificateIdBindingType) +} + +func apiCertificateSetclustercertificateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["certificate_id"] = vapiBindings_.NewStringType() + fieldNameMap["certificate_id"] = "CertificateId" + paramsTypeMap["certificate_id"] = vapiBindings_.NewStringType() + queryParams["certificate_id"] = "certificate_id" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=set_cluster_certificate", + "", + "POST", + "/api/v1/cluster/api-certificate", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiServiceClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiServiceClient.go new file mode 100644 index 000000000..e821d7737 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiServiceClient.go @@ -0,0 +1,133 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ApiService +// Used by client-side stubs. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ApiServiceClient interface { + + // Read the configuration of the NSX API service. + // @return com.vmware.nsx.model.ApiServiceConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get() (nsxModel.ApiServiceConfig, error) + + // Read the configuration of the NSX API service. Changes are applied to all nodes in the cluster. The API service on each node will restart after it is updated using this API. There may be a delay of up to a minute or so between the time this API call completes and when the new configuration goes into effect. + // + // @param apiServiceConfigParam (required) + // @return com.vmware.nsx.model.ApiServiceConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Update(apiServiceConfigParam nsxModel.ApiServiceConfig) (nsxModel.ApiServiceConfig, error) +} + +type apiServiceClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewApiServiceClient(connector vapiProtocolClient_.Connector) *apiServiceClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx.cluster.api_service") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "update": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "update"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + aIface := apiServiceClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &aIface +} + +func (aIface *apiServiceClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := aIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (aIface *apiServiceClient) Get() (nsxModel.ApiServiceConfig, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiServiceGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiServiceGetInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ApiServiceConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_service", "get", inputDataValue, executionContext) + var emptyOutput nsxModel.ApiServiceConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiServiceGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ApiServiceConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (aIface *apiServiceClient) Update(apiServiceConfigParam nsxModel.ApiServiceConfig) (nsxModel.ApiServiceConfig, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiServiceUpdateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiServiceUpdateInputType(), typeConverter) + sv.AddStructField("ApiServiceConfig", apiServiceConfigParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ApiServiceConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_service", "update", inputDataValue, executionContext) + var emptyOutput nsxModel.ApiServiceConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiServiceUpdateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ApiServiceConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiServiceTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiServiceTypes.go new file mode 100644 index 000000000..17aeec94a --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiServiceTypes.go @@ -0,0 +1,110 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ApiService. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" + "reflect" +) + +func apiServiceGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiServiceGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ApiServiceConfigBindingType) +} + +func apiServiceGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/api/v1/cluster/api-service", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func apiServiceUpdateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["api_service_config"] = vapiBindings_.NewReferenceType(nsxModel.ApiServiceConfigBindingType) + fieldNameMap["api_service_config"] = "ApiServiceConfig" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiServiceUpdateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ApiServiceConfigBindingType) +} + +func apiServiceUpdateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["api_service_config"] = vapiBindings_.NewReferenceType(nsxModel.ApiServiceConfigBindingType) + fieldNameMap["api_service_config"] = "ApiServiceConfig" + paramsTypeMap["api_service_config"] = vapiBindings_.NewReferenceType(nsxModel.ApiServiceConfigBindingType) + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "api_service_config", + "PUT", + "/api/v1/cluster/api-service", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiVirtualIpClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiVirtualIpClient.go new file mode 100644 index 000000000..528497f78 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiVirtualIpClient.go @@ -0,0 +1,226 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: ApiVirtualIp +// Used by client-side stubs. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type ApiVirtualIpClient interface { + + // Clears the cluster virtual IPv4 or IPv6 address. + // Note, query parameter **?action=clear_virtual_ip** clears virtual IPv4 address and **?action=clear_virtual_ip6** clears virtual IPv6 address. + // @return com.vmware.nsx.model.ClusterVirtualIpProperties + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Clearvirtualip() (nsxModel.ClusterVirtualIpProperties, error) + + // Clears the cluster virtual IPv4 or IPv6 address. + // Note, query parameter **?action=clear_virtual_ip** clears virtual IPv4 address and **?action=clear_virtual_ip6** clears virtual IPv6 address. + // @return com.vmware.nsx.model.ClusterVirtualIpProperties + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Clearvirtualip6() (nsxModel.ClusterVirtualIpProperties, error) + + // Returns the configured cluster virtual IPv4 and IPv6 address or null if not configured. + // @return com.vmware.nsx.model.ClusterVirtualIpProperties + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get() (nsxModel.ClusterVirtualIpProperties, error) + + // Sets the cluster virtual IPv4 and IPv6 address. Note, all nodes in the management cluster must be in the same subnet. If not, a 409 CONFLICT status is returned. + // Query parameter **ip_address** sets virtual IPv4 address and **ip6_address** sets virtual IPv6 address; either or both of the parameters can be specified to set virtual IP address(es). + // When updating either of any one parameter value this does not changes the value of other unspecified parameter. + // + // @param forceParam On enable it ignores duplicate address detection and DNS lookup validation check (optional, default to false) + // @param ip6AddressParam Virtual IPv6 address, :: if not configured (optional) + // @param ipAddressParam Virtual IP address, 0.0.0.0 if not configured (optional) + // @return com.vmware.nsx.model.ClusterVirtualIpProperties + // + // @throws ConcurrentChange Conflict + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Setvirtualip(forceParam *string, ip6AddressParam *string, ipAddressParam *string) (nsxModel.ClusterVirtualIpProperties, error) +} + +type apiVirtualIpClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewApiVirtualIpClient(connector vapiProtocolClient_.Connector) *apiVirtualIpClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx.cluster.api_virtual_ip") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "clearvirtualip": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "clearvirtualip"), + "clearvirtualip6": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "clearvirtualip6"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "setvirtualip": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "setvirtualip"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + aIface := apiVirtualIpClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &aIface +} + +func (aIface *apiVirtualIpClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := aIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (aIface *apiVirtualIpClient) Clearvirtualip() (nsxModel.ClusterVirtualIpProperties, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiVirtualIpClearvirtualipRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiVirtualIpClearvirtualipInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterVirtualIpProperties + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_virtual_ip", "clearvirtualip", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterVirtualIpProperties + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiVirtualIpClearvirtualipOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterVirtualIpProperties), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (aIface *apiVirtualIpClient) Clearvirtualip6() (nsxModel.ClusterVirtualIpProperties, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiVirtualIpClearvirtualip6RestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiVirtualIpClearvirtualip6InputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterVirtualIpProperties + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_virtual_ip", "clearvirtualip6", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterVirtualIpProperties + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiVirtualIpClearvirtualip6OutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterVirtualIpProperties), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (aIface *apiVirtualIpClient) Get() (nsxModel.ClusterVirtualIpProperties, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiVirtualIpGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiVirtualIpGetInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterVirtualIpProperties + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_virtual_ip", "get", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterVirtualIpProperties + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiVirtualIpGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterVirtualIpProperties), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (aIface *apiVirtualIpClient) Setvirtualip(forceParam *string, ip6AddressParam *string, ipAddressParam *string) (nsxModel.ClusterVirtualIpProperties, error) { + typeConverter := aIface.connector.TypeConverter() + executionContext := aIface.connector.NewExecutionContext() + operationRestMetaData := apiVirtualIpSetvirtualipRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(apiVirtualIpSetvirtualipInputType(), typeConverter) + sv.AddStructField("Force", forceParam) + sv.AddStructField("Ip6Address", ip6AddressParam) + sv.AddStructField("IpAddress", ipAddressParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterVirtualIpProperties + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := aIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.api_virtual_ip", "setvirtualip", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterVirtualIpProperties + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), ApiVirtualIpSetvirtualipOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterVirtualIpProperties), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), aIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiVirtualIpTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiVirtualIpTypes.go new file mode 100644 index 000000000..b21436c0f --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ApiVirtualIpTypes.go @@ -0,0 +1,215 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: ApiVirtualIp. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" + "reflect" +) + +// Possible value for ``force`` of method ApiVirtualIp#setvirtualip. +const ApiVirtualIp_SETVIRTUALIP_FORCE_TRUE = "true" + +// Possible value for ``force`` of method ApiVirtualIp#setvirtualip. +const ApiVirtualIp_SETVIRTUALIP_FORCE_FALSE = "false" + +func apiVirtualIpClearvirtualipInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiVirtualIpClearvirtualipOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterVirtualIpPropertiesBindingType) +} + +func apiVirtualIpClearvirtualipRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=clear_virtual_ip", + "", + "POST", + "/api/v1/cluster/api-virtual-ip", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func apiVirtualIpClearvirtualip6InputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiVirtualIpClearvirtualip6OutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterVirtualIpPropertiesBindingType) +} + +func apiVirtualIpClearvirtualip6RestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=clear_virtual_ip6", + "", + "POST", + "/api/v1/cluster/api-virtual-ip", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func apiVirtualIpGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiVirtualIpGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterVirtualIpPropertiesBindingType) +} + +func apiVirtualIpGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/api/v1/cluster/api-virtual-ip", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func apiVirtualIpSetvirtualipInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["ip6_address"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["ip_address"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["force"] = "Force" + fieldNameMap["ip6_address"] = "Ip6Address" + fieldNameMap["ip_address"] = "IpAddress" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func ApiVirtualIpSetvirtualipOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterVirtualIpPropertiesBindingType) +} + +func apiVirtualIpSetvirtualipRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["ip6_address"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["ip_address"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["force"] = "Force" + fieldNameMap["ip6_address"] = "Ip6Address" + fieldNameMap["ip_address"] = "IpAddress" + paramsTypeMap["ip6_address"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["force"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["ip_address"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + queryParams["ip6_address"] = "ip6_address" + queryParams["force"] = "force" + queryParams["ip_address"] = "ip_address" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=set_virtual_ip", + "", + "POST", + "/api/v1/cluster/api-virtual-ip", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.concurrent_change": 409, "com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/BackupsClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/BackupsClient.go new file mode 100644 index 000000000..23f573597 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/BackupsClient.go @@ -0,0 +1,91 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Backups +// Used by client-side stubs. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type BackupsClient interface { + + // Get SHA256 fingerprint of ECDSA key of remote server. The caller should independently verify that the key is trusted. + // + // @param remoteServerFingerprintRequestParam (required) + // @return com.vmware.nsx.model.RemoteServerFingerprint + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Retrievesshfingerprint(remoteServerFingerprintRequestParam nsxModel.RemoteServerFingerprintRequest) (nsxModel.RemoteServerFingerprint, error) +} + +type backupsClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewBackupsClient(connector vapiProtocolClient_.Connector) *backupsClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx.cluster.backups") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "retrievesshfingerprint": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "retrievesshfingerprint"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + bIface := backupsClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &bIface +} + +func (bIface *backupsClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := bIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (bIface *backupsClient) Retrievesshfingerprint(remoteServerFingerprintRequestParam nsxModel.RemoteServerFingerprintRequest) (nsxModel.RemoteServerFingerprint, error) { + typeConverter := bIface.connector.TypeConverter() + executionContext := bIface.connector.NewExecutionContext() + operationRestMetaData := backupsRetrievesshfingerprintRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(backupsRetrievesshfingerprintInputType(), typeConverter) + sv.AddStructField("RemoteServerFingerprintRequest", remoteServerFingerprintRequestParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.RemoteServerFingerprint + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := bIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.backups", "retrievesshfingerprint", inputDataValue, executionContext) + var emptyOutput nsxModel.RemoteServerFingerprint + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), BackupsRetrievesshfingerprintOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.RemoteServerFingerprint), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), bIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/BackupsTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/BackupsTypes.go new file mode 100644 index 000000000..26d51243c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/BackupsTypes.go @@ -0,0 +1,67 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Backups. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" + "reflect" +) + +func backupsRetrievesshfingerprintInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["remote_server_fingerprint_request"] = vapiBindings_.NewReferenceType(nsxModel.RemoteServerFingerprintRequestBindingType) + fieldNameMap["remote_server_fingerprint_request"] = "RemoteServerFingerprintRequest" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func BackupsRetrievesshfingerprintOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.RemoteServerFingerprintBindingType) +} + +func backupsRetrievesshfingerprintRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["remote_server_fingerprint_request"] = vapiBindings_.NewReferenceType(nsxModel.RemoteServerFingerprintRequestBindingType) + fieldNameMap["remote_server_fingerprint_request"] = "RemoteServerFingerprintRequest" + paramsTypeMap["remote_server_fingerprint_request"] = vapiBindings_.NewReferenceType(nsxModel.RemoteServerFingerprintRequestBindingType) + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=retrieve_ssh_fingerprint", + "remote_server_fingerprint_request", + "POST", + "/api/v1/cluster/backups", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ClusterPackageTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ClusterPackageTypes.go new file mode 100644 index 000000000..7f6cdca4b --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/ClusterPackageTypes.go @@ -0,0 +1,11 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for package: com.vmware.nsx.cluster. +// Includes binding types of a top level structures and enumerations. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodeClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodeClient.go new file mode 100644 index 000000000..1733cdbc1 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodeClient.go @@ -0,0 +1,80 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Node +// Used by client-side stubs. + +package cluster + +import ( + 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" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type NodeClient interface { + + // Attempts to synchronize the repository partition on nsx manager. Repository partition contains packages required for the install and upgrade of nsx components.Normally there is no need to call this API explicitely by the user. + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Reposync() error +} + +type nodeClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewNodeClient(connector vapiProtocolClient_.Connector) *nodeClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx.cluster.node") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "reposync": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "reposync"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + nIface := nodeClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &nIface +} + +func (nIface *nodeClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := nIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (nIface *nodeClient) Reposync() error { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := nodeReposyncRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(nodeReposyncInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.node", "reposync", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodeTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodeTypes.go new file mode 100644 index 000000000..ec3be9ab2 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodeTypes.go @@ -0,0 +1,61 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Node. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster + +import ( + 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" + "reflect" +) + +func nodeReposyncInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NodeReposyncOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func nodeReposyncRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=repo_sync", + "", + "POST", + "/api/v1/cluster/node", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodesClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodesClient.go new file mode 100644 index 000000000..76019d5ea --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodesClient.go @@ -0,0 +1,238 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Nodes +// Used by client-side stubs. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type NodesClient interface { + + // Add a new controller to the NSX cluster. The controller comes with the new node. + // Deprecated. Use POST /cluster?action=join_cluster to join a node to cluster. + // + // Deprecated: This API element is deprecated. + // + // @param addClusterNodeSpecParam (required) + // @param actionParam (required) + // @return com.vmware.nsx.model.ClusterNodeConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Create(addClusterNodeSpecParam nsxModel.AddClusterNodeSpec, actionParam string) (nsxModel.ClusterNodeConfig, error) + + // Removes the specified controller from the NSX cluster. Before you can remove a controller from the cluster, you must shut down the controller service with the \"stop service controller\" command. + // Use POST /cluster/?action=remove_node to detach a node from cluster. The controller is removed with the node. + // + // Deprecated: This API element is deprecated. + // + // @param nodeIdParam (required) + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Delete(nodeIdParam string) error + + // Returns information about the specified NSX cluster node. + // Deprecated. Use GET /cluster/ to get cluster node configuration. + // + // Deprecated: This API element is deprecated. + // + // @param nodeIdParam (required) + // @return com.vmware.nsx.model.ClusterNodeConfig + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get(nodeIdParam string) (nsxModel.ClusterNodeConfig, error) + + // Returns information about all NSX cluster nodes. + // + // @param cursorParam Opaque cursor to be used for getting next page of records (supplied by current result page) (optional) + // @param includedFieldsParam Comma separated list of fields that should be included in query result (optional) + // @param pageSizeParam Maximum number of results to return in this page (server may return fewer) (optional, default to 1000) + // @param sortAscendingParam (optional) + // @param sortByParam Field by which records are sorted (optional) + // @return com.vmware.nsx.model.ClusterNodeConfigListResult + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + List(cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsxModel.ClusterNodeConfigListResult, error) +} + +type nodesClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewNodesClient(connector vapiProtocolClient_.Connector) *nodesClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx.cluster.nodes") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "create": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "create"), + "delete": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "delete"), + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + "list": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "list"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + nIface := nodesClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &nIface +} + +func (nIface *nodesClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := nIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (nIface *nodesClient) Create(addClusterNodeSpecParam nsxModel.AddClusterNodeSpec, actionParam string) (nsxModel.ClusterNodeConfig, error) { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := nodesCreateRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(nodesCreateInputType(), typeConverter) + sv.AddStructField("AddClusterNodeSpec", addClusterNodeSpecParam) + sv.AddStructField("Action", actionParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterNodeConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.nodes", "create", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterNodeConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), NodesCreateOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterNodeConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (nIface *nodesClient) Delete(nodeIdParam string) error { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := nodesDeleteRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(nodesDeleteInputType(), typeConverter) + sv.AddStructField("NodeId", nodeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + return vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.nodes", "delete", inputDataValue, executionContext) + if methodResult.IsSuccess() { + return nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return vapiBindings_.VAPIerrorsToError(errorInError) + } + return methodError.(error) + } +} + +func (nIface *nodesClient) Get(nodeIdParam string) (nsxModel.ClusterNodeConfig, error) { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := nodesGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(nodesGetInputType(), typeConverter) + sv.AddStructField("NodeId", nodeIdParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterNodeConfig + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.nodes", "get", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterNodeConfig + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), NodesGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterNodeConfig), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (nIface *nodesClient) List(cursorParam *string, includedFieldsParam *string, pageSizeParam *int64, sortAscendingParam *bool, sortByParam *string) (nsxModel.ClusterNodeConfigListResult, error) { + typeConverter := nIface.connector.TypeConverter() + executionContext := nIface.connector.NewExecutionContext() + operationRestMetaData := nodesListRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(nodesListInputType(), typeConverter) + sv.AddStructField("Cursor", cursorParam) + sv.AddStructField("IncludedFields", includedFieldsParam) + sv.AddStructField("PageSize", pageSizeParam) + sv.AddStructField("SortAscending", sortAscendingParam) + sv.AddStructField("SortBy", sortByParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterNodeConfigListResult + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := nIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.nodes", "list", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterNodeConfigListResult + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), NodesListOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterNodeConfigListResult), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), nIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodesTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodesTypes.go new file mode 100644 index 000000000..e3c2fd648 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/NodesTypes.go @@ -0,0 +1,249 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Nodes. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" + "reflect" +) + +// Possible value for ``action`` of method Nodes#create. +const Nodes_CREATE_ACTION_NODE = "add_cluster_node" + +func nodesCreateInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["add_cluster_node_spec"] = vapiBindings_.NewReferenceType(nsxModel.AddClusterNodeSpecBindingType) + fields["action"] = vapiBindings_.NewStringType() + fieldNameMap["add_cluster_node_spec"] = "AddClusterNodeSpec" + fieldNameMap["action"] = "Action" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NodesCreateOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterNodeConfigBindingType) +} + +func nodesCreateRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["add_cluster_node_spec"] = vapiBindings_.NewReferenceType(nsxModel.AddClusterNodeSpecBindingType) + fields["action"] = vapiBindings_.NewStringType() + fieldNameMap["add_cluster_node_spec"] = "AddClusterNodeSpec" + fieldNameMap["action"] = "Action" + paramsTypeMap["add_cluster_node_spec"] = vapiBindings_.NewReferenceType(nsxModel.AddClusterNodeSpecBindingType) + paramsTypeMap["action"] = vapiBindings_.NewStringType() + queryParams["action"] = "action" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "add_cluster_node_spec", + "POST", + "/api/v1/cluster/nodes", + "", + resultHeaders, + 201, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func nodesDeleteInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["node_id"] = vapiBindings_.NewStringType() + fieldNameMap["node_id"] = "NodeId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NodesDeleteOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewVoidType() +} + +func nodesDeleteRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["node_id"] = vapiBindings_.NewStringType() + fieldNameMap["node_id"] = "NodeId" + paramsTypeMap["node_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nodeId"] = vapiBindings_.NewStringType() + pathParams["node_id"] = "nodeId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "DELETE", + "/api/v1/cluster/nodes/{nodeId}", + "", + resultHeaders, + 204, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func nodesGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["node_id"] = vapiBindings_.NewStringType() + fieldNameMap["node_id"] = "NodeId" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NodesGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterNodeConfigBindingType) +} + +func nodesGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["node_id"] = vapiBindings_.NewStringType() + fieldNameMap["node_id"] = "NodeId" + paramsTypeMap["node_id"] = vapiBindings_.NewStringType() + paramsTypeMap["nodeId"] = vapiBindings_.NewStringType() + pathParams["node_id"] = "nodeId" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/api/v1/cluster/nodes/{nodeId}", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func nodesListInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func NodesListOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterNodeConfigListResultBindingType) +} + +func nodesListRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fields["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + fields["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + fields["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + fieldNameMap["cursor"] = "Cursor" + fieldNameMap["included_fields"] = "IncludedFields" + fieldNameMap["page_size"] = "PageSize" + fieldNameMap["sort_ascending"] = "SortAscending" + fieldNameMap["sort_by"] = "SortBy" + paramsTypeMap["cursor"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_ascending"] = vapiBindings_.NewOptionalType(vapiBindings_.NewBooleanType()) + paramsTypeMap["included_fields"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["sort_by"] = vapiBindings_.NewOptionalType(vapiBindings_.NewStringType()) + paramsTypeMap["page_size"] = vapiBindings_.NewOptionalType(vapiBindings_.NewIntegerType()) + queryParams["cursor"] = "cursor" + queryParams["sort_ascending"] = "sort_ascending" + queryParams["included_fields"] = "included_fields" + queryParams["sort_by"] = "sort_by" + queryParams["page_size"] = "page_size" + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/api/v1/cluster/nodes", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/RestoreClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/RestoreClient.go new file mode 100644 index 000000000..27325257c --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/RestoreClient.go @@ -0,0 +1,267 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Restore +// Used by client-side stubs. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type RestoreClient interface { + + // Advance any currently suspended restore operation. The operation might have been suspended because (1) the user had suspended it previously, or (2) the operation is waiting for user input, to be provided as a part of the POST request body. This operation is only valid when a GET cluster/restore/status returns a status with value SUSPENDED. Otherwise, a 409 response is returned. + // + // @param advanceClusterRestoreRequestParam (required) + // @return com.vmware.nsx.model.ClusterRestoreStatus + // + // @throws ConcurrentChange Conflict + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Advance(advanceClusterRestoreRequestParam nsxModel.AdvanceClusterRestoreRequest) (nsxModel.ClusterRestoreStatus, error) + + // This operation is only valid when a restore is in suspended state. The UI user can cancel any restore operation when the restore is suspended either due to an error, or for a user input. The API user would need to monitor the progression of a restore by calling periodically \"/api/v1/cluster/restore/status\" API. The response object (ClusterRestoreStatus), contains a field \"endpoints\". The API user can cancel the restore process if 'cancel' action is shown in the endpoint field. This operation is only valid when a GET cluster/restore/status returns a status with value SUSPENDED. + // @return com.vmware.nsx.model.ClusterRestoreStatus + // + // @throws ConcurrentChange Conflict + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Cancel() (nsxModel.ClusterRestoreStatus, error) + + // Retry any currently in-progress, failed restore operation. Only the last step of the multi-step restore operation would have failed,and only that step is retried. This operation is only valid when a GET cluster/restore/status returns a status with value FAILED. Otherwise, a 409 response is returned. + // @return com.vmware.nsx.model.ClusterRestoreStatus + // + // @throws ConcurrentChange Conflict + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Retry() (nsxModel.ClusterRestoreStatus, error) + + // Start the restore of an NSX cluster, from some previously backed-up configuration. This operation is only valid when a GET cluster/restore/status returns a status with value NOT_STARTED. Otherwise, a 409 response is returned. + // + // @param initiateClusterRestoreRequestParam (required) + // @return com.vmware.nsx.model.ClusterRestoreStatus + // + // @throws ConcurrentChange Conflict + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Start(initiateClusterRestoreRequestParam nsxModel.InitiateClusterRestoreRequest) (nsxModel.ClusterRestoreStatus, error) + + // Suspend any currently running restore operation. The restore operation is made up of a number of steps. When this call is issued, any currently running step is allowed to finish (successfully or with errors), and the next step (and therefore the entire restore operation) is suspended until a subsequent resume or cancel call is issued. This operation is only valid when a GET cluster/restore/status returns a status with value RUNNING. Otherwise, a 409 response is returned. + // @return com.vmware.nsx.model.ClusterRestoreStatus + // + // @throws ConcurrentChange Conflict + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Suspend() (nsxModel.ClusterRestoreStatus, error) +} + +type restoreClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewRestoreClient(connector vapiProtocolClient_.Connector) *restoreClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx.cluster.restore") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "advance": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "advance"), + "cancel": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "cancel"), + "retry": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "retry"), + "start": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "start"), + "suspend": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "suspend"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + rIface := restoreClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &rIface +} + +func (rIface *restoreClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := rIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (rIface *restoreClient) Advance(advanceClusterRestoreRequestParam nsxModel.AdvanceClusterRestoreRequest) (nsxModel.ClusterRestoreStatus, error) { + typeConverter := rIface.connector.TypeConverter() + executionContext := rIface.connector.NewExecutionContext() + operationRestMetaData := restoreAdvanceRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(restoreAdvanceInputType(), typeConverter) + sv.AddStructField("AdvanceClusterRestoreRequest", advanceClusterRestoreRequestParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterRestoreStatus + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := rIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.restore", "advance", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterRestoreStatus + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), RestoreAdvanceOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterRestoreStatus), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), rIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (rIface *restoreClient) Cancel() (nsxModel.ClusterRestoreStatus, error) { + typeConverter := rIface.connector.TypeConverter() + executionContext := rIface.connector.NewExecutionContext() + operationRestMetaData := restoreCancelRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(restoreCancelInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterRestoreStatus + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := rIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.restore", "cancel", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterRestoreStatus + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), RestoreCancelOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterRestoreStatus), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), rIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (rIface *restoreClient) Retry() (nsxModel.ClusterRestoreStatus, error) { + typeConverter := rIface.connector.TypeConverter() + executionContext := rIface.connector.NewExecutionContext() + operationRestMetaData := restoreRetryRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(restoreRetryInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterRestoreStatus + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := rIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.restore", "retry", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterRestoreStatus + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), RestoreRetryOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterRestoreStatus), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), rIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (rIface *restoreClient) Start(initiateClusterRestoreRequestParam nsxModel.InitiateClusterRestoreRequest) (nsxModel.ClusterRestoreStatus, error) { + typeConverter := rIface.connector.TypeConverter() + executionContext := rIface.connector.NewExecutionContext() + operationRestMetaData := restoreStartRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(restoreStartInputType(), typeConverter) + sv.AddStructField("InitiateClusterRestoreRequest", initiateClusterRestoreRequestParam) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterRestoreStatus + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := rIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.restore", "start", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterRestoreStatus + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), RestoreStartOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterRestoreStatus), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), rIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} + +func (rIface *restoreClient) Suspend() (nsxModel.ClusterRestoreStatus, error) { + typeConverter := rIface.connector.TypeConverter() + executionContext := rIface.connector.NewExecutionContext() + operationRestMetaData := restoreSuspendRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(restoreSuspendInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterRestoreStatus + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := rIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.restore", "suspend", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterRestoreStatus + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), RestoreSuspendOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterRestoreStatus), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), rIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/RestoreTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/RestoreTypes.go new file mode 100644 index 000000000..777429b40 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/RestoreTypes.go @@ -0,0 +1,244 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Restore. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" + "reflect" +) + +func restoreAdvanceInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["advance_cluster_restore_request"] = vapiBindings_.NewReferenceType(nsxModel.AdvanceClusterRestoreRequestBindingType) + fieldNameMap["advance_cluster_restore_request"] = "AdvanceClusterRestoreRequest" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func RestoreAdvanceOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterRestoreStatusBindingType) +} + +func restoreAdvanceRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["advance_cluster_restore_request"] = vapiBindings_.NewReferenceType(nsxModel.AdvanceClusterRestoreRequestBindingType) + fieldNameMap["advance_cluster_restore_request"] = "AdvanceClusterRestoreRequest" + paramsTypeMap["advance_cluster_restore_request"] = vapiBindings_.NewReferenceType(nsxModel.AdvanceClusterRestoreRequestBindingType) + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=advance", + "advance_cluster_restore_request", + "POST", + "/api/v1/cluster/restore", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.concurrent_change": 409, "com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func restoreCancelInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func RestoreCancelOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterRestoreStatusBindingType) +} + +func restoreCancelRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=cancel", + "", + "POST", + "/api/v1/cluster/restore", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.concurrent_change": 409, "com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func restoreRetryInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func RestoreRetryOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterRestoreStatusBindingType) +} + +func restoreRetryRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=retry", + "", + "POST", + "/api/v1/cluster/restore", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.concurrent_change": 409, "com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func restoreStartInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + fields["initiate_cluster_restore_request"] = vapiBindings_.NewReferenceType(nsxModel.InitiateClusterRestoreRequestBindingType) + fieldNameMap["initiate_cluster_restore_request"] = "InitiateClusterRestoreRequest" + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func RestoreStartOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterRestoreStatusBindingType) +} + +func restoreStartRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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["initiate_cluster_restore_request"] = vapiBindings_.NewReferenceType(nsxModel.InitiateClusterRestoreRequestBindingType) + fieldNameMap["initiate_cluster_restore_request"] = "InitiateClusterRestoreRequest" + paramsTypeMap["initiate_cluster_restore_request"] = vapiBindings_.NewReferenceType(nsxModel.InitiateClusterRestoreRequestBindingType) + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=start", + "initiate_cluster_restore_request", + "POST", + "/api/v1/cluster/restore", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.concurrent_change": 409, "com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} + +func restoreSuspendInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func RestoreSuspendOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterRestoreStatusBindingType) +} + +func restoreSuspendRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "action=suspend", + "", + "POST", + "/api/v1/cluster/restore", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.concurrent_change": 409, "com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/StatusClient.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/StatusClient.go new file mode 100644 index 000000000..70c5913c2 --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/StatusClient.go @@ -0,0 +1,88 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Interface file for service: Status +// Used by client-side stubs. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" +) + +const _ = vapiCore_.SupportedByRuntimeVersion2 + +type StatusClient interface { + + // Returns status information for the NSX cluster control role and management role. + // @return com.vmware.nsx.model.ClusterStatus + // + // @throws InvalidRequest Bad Request, Precondition Failed + // @throws Unauthorized Forbidden + // @throws ServiceUnavailable Service Unavailable + // @throws InternalServerError Internal Server Error + // @throws NotFound Not Found + Get() (nsxModel.ClusterStatus, error) +} + +type statusClient struct { + connector vapiProtocolClient_.Connector + interfaceDefinition vapiCore_.InterfaceDefinition + errorsBindingMap map[string]vapiBindings_.BindingType +} + +func NewStatusClient(connector vapiProtocolClient_.Connector) *statusClient { + interfaceIdentifier := vapiCore_.NewInterfaceIdentifier("com.vmware.nsx.cluster.status") + methodIdentifiers := map[string]vapiCore_.MethodIdentifier{ + "get": vapiCore_.NewMethodIdentifier(interfaceIdentifier, "get"), + } + interfaceDefinition := vapiCore_.NewInterfaceDefinition(interfaceIdentifier, methodIdentifiers) + errorsBindingMap := make(map[string]vapiBindings_.BindingType) + + sIface := statusClient{interfaceDefinition: interfaceDefinition, errorsBindingMap: errorsBindingMap, connector: connector} + return &sIface +} + +func (sIface *statusClient) GetErrorBindingType(errorName string) vapiBindings_.BindingType { + if entry, ok := sIface.errorsBindingMap[errorName]; ok { + return entry + } + return vapiStdErrors_.ERROR_BINDINGS_MAP[errorName] +} + +func (sIface *statusClient) Get() (nsxModel.ClusterStatus, error) { + typeConverter := sIface.connector.TypeConverter() + executionContext := sIface.connector.NewExecutionContext() + operationRestMetaData := statusGetRestMetadata() + executionContext.SetConnectionMetadata(vapiCore_.RESTMetadataKey, operationRestMetaData) + executionContext.SetConnectionMetadata(vapiCore_.ResponseTypeKey, vapiCore_.NewResponseType(true, false)) + + sv := vapiBindings_.NewStructValueBuilder(statusGetInputType(), typeConverter) + inputDataValue, inputError := sv.GetStructValue() + if inputError != nil { + var emptyOutput nsxModel.ClusterStatus + return emptyOutput, vapiBindings_.VAPIerrorsToError(inputError) + } + + methodResult := sIface.connector.GetApiProvider().Invoke("com.vmware.nsx.cluster.status", "get", inputDataValue, executionContext) + var emptyOutput nsxModel.ClusterStatus + if methodResult.IsSuccess() { + output, errorInOutput := typeConverter.ConvertToGolang(methodResult.Output(), StatusGetOutputType()) + if errorInOutput != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInOutput) + } + return output.(nsxModel.ClusterStatus), nil + } else { + methodError, errorInError := typeConverter.ConvertToGolang(methodResult.Error(), sIface.GetErrorBindingType(methodResult.Error().Name())) + if errorInError != nil { + return emptyOutput, vapiBindings_.VAPIerrorsToError(errorInError) + } + return emptyOutput, methodError.(error) + } +} diff --git a/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/StatusTypes.go b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/StatusTypes.go new file mode 100644 index 000000000..31db031fe --- /dev/null +++ b/vendor/github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster/StatusTypes.go @@ -0,0 +1,62 @@ +// Copyright © 2019-2021 VMware, Inc. All Rights Reserved. +// SPDX-License-Identifier: BSD-2-Clause + +// Auto generated code. DO NOT EDIT. + +// Data type definitions file for service: Status. +// Includes binding types of a structures and enumerations defined in the service. +// Shared by client-side stubs and server-side skeletons to ensure type +// compatibility. + +package cluster + +import ( + 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" + nsxModel "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" + "reflect" +) + +func statusGetInputType() vapiBindings_.StructType { + fields := make(map[string]vapiBindings_.BindingType) + fieldNameMap := make(map[string]string) + var validators = []vapiBindings_.Validator{} + return vapiBindings_.NewStructType("operation-input", fields, reflect.TypeOf(vapiData_.StructValue{}), fieldNameMap, validators) +} + +func StatusGetOutputType() vapiBindings_.BindingType { + return vapiBindings_.NewReferenceType(nsxModel.ClusterStatusBindingType) +} + +func statusGetRestMetadata() vapiProtocol_.OperationRestMetadata { + fields := map[string]vapiBindings_.BindingType{} + fieldNameMap := map[string]string{} + 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{} + resultHeaders := map[string]string{} + errorHeaders := map[string]map[string]string{} + return vapiProtocol_.NewOperationRestMetadata( + fields, + fieldNameMap, + paramsTypeMap, + pathParams, + queryParams, + headerParams, + dispatchHeaderParams, + bodyFieldsMap, + "", + "", + "GET", + "/api/v1/cluster/status", + "", + resultHeaders, + 200, + "", + errorHeaders, + map[string]int{"com.vmware.vapi.std.errors.invalid_request": 400, "com.vmware.vapi.std.errors.unauthorized": 403, "com.vmware.vapi.std.errors.service_unavailable": 503, "com.vmware.vapi.std.errors.internal_server_error": 500, "com.vmware.vapi.std.errors.not_found": 404}) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 28b85e987..6e983b3a2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -313,6 +313,7 @@ github.com/vmware/vsphere-automation-sdk-go/services/nsxt-gm/search # github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp v0.5.0 ## explicit; go 1.17 github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx +github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/cluster github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/fabric github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/logical_routers/nat github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model diff --git a/website/docs/r/cluster_virtual_ip.html.markdown b/website/docs/r/cluster_virtual_ip.html.markdown new file mode 100644 index 000000000..e80a214ae --- /dev/null +++ b/website/docs/r/cluster_virtual_ip.html.markdown @@ -0,0 +1,33 @@ +--- +subcategory: "Fabric" +layout: "nsxt" +page_title: "NSXT: nsxt_cluster_virtual_ip" +description: A resource to configure virtual IP of NSXT cluster. +--- + +# nsxt_manager_cluster + +This resource provides a method for configuring the virtual IP of NSXT cluster. +This resource is supported with NSX 4.1.0 onwards. + +## Example Usage + +```hcl +resource "nsxt_cluster_virtual_ip" "test" { + ip_address = "10.0.0.251" + ipv6_address = "fd01:1:2:2918:250:56ff:fe8b:7e4d" + force = "true" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `force` - (Optional) A flag to determine if need to ignore duplicate address detection and DNS lookup validation check. Value can be `true` or `false`. Default value is `false`. +* `ip_address` - (Optional) Virtual IP Address of the cluster. Must be in the same subnet as the manager nodes. Default value is `0.0.0.0`. +* `ipv6_address` - (Optional) Virtual IPv6 Address of the cluster. To set ipv6 virtual IP address, IPv6 interface needs to be configured on manager nodes. Default value is `::`. + +## Importing + +Importing is not supported for this resource. \ No newline at end of file