From 8d6ab4c6049a67f7d376793b1083a46d07ef6f4a Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Tue, 1 Dec 2020 13:30:35 -0800 Subject: [PATCH] Allow certificates to be passed as strings A new set of provider attributes allows client cert, client key and ca cert to be passed as string rather than file name. --- go.mod | 2 +- go.sum | 8 +- nsxt/provider.go | 82 +- test_env | 11 - vendor/github.com/antihax/optional/LICENSE | 8 + vendor/github.com/antihax/optional/bool.go | 36 + vendor/github.com/antihax/optional/byte.go | 36 + .../github.com/antihax/optional/complex128.go | 36 + .../github.com/antihax/optional/complex64.go | 36 + vendor/github.com/antihax/optional/float32.go | 36 + vendor/github.com/antihax/optional/float64.go | 36 + vendor/github.com/antihax/optional/go.mod | 3 + vendor/github.com/antihax/optional/int.go | 36 + vendor/github.com/antihax/optional/int16.go | 36 + vendor/github.com/antihax/optional/int32.go | 36 + vendor/github.com/antihax/optional/int64.go | 36 + vendor/github.com/antihax/optional/int8.go | 36 + .../github.com/antihax/optional/interface.go | 37 + vendor/github.com/antihax/optional/rune.go | 36 + vendor/github.com/antihax/optional/string.go | 36 + vendor/github.com/antihax/optional/time.go | 38 + vendor/github.com/antihax/optional/uint.go | 36 + vendor/github.com/antihax/optional/uint16.go | 36 + vendor/github.com/antihax/optional/uint32.go | 36 + vendor/github.com/antihax/optional/uint64.go | 36 + vendor/github.com/antihax/optional/uint8.go | 36 + vendor/github.com/antihax/optional/uintptr.go | 36 + .../vmware/go-vmware-nsxt/api_client.go | 75 +- .../api_container_applications.go | 446 ++++++++ .../go-vmware-nsxt/api_container_clusters.go | 1008 +++++++++++++++++ .../go-vmware-nsxt/api_container_inventory.go | 107 ++ .../go-vmware-nsxt/api_container_projects.go | 230 ++++ .../go-vmware-nsxt/common/network_error.go | 20 + .../vmware/go-vmware-nsxt/configuration.go | 3 + .../container_application.go | 48 + .../container_application_instance.go | 52 + ...tainer_application_instance_list_result.go | 33 + .../container_application_list_result.go | 33 + .../containerinventory/container_cluster.go | 46 + .../container_cluster_list_result.go | 33 + .../container_cluster_node.go | 46 + .../container_cluster_node_list_result.go | 33 + .../container_infrastructure_info.go | 16 + .../container_ingress_policy.go | 50 + .../container_ingress_policy_list_result.go | 33 + .../container_inventory_data.go | 15 + .../container_inventory_object.go | 17 + .../container_network_policy.go | 50 + .../container_network_policy_list_result.go | 33 + .../containerinventory/container_project.go | 44 + .../container_project_list_result.go | 33 + .../github.com/vmware/go-vmware-nsxt/go.mod | 8 + .../github.com/vmware/go-vmware-nsxt/go.sum | 15 + .../loadbalancer/lb_pool_member_statistics.go | 12 + .../loadbalancer/lb_pool_member_status.go | 20 + .../loadbalancer/lb_pool_statistics.go | 15 + .../loadbalancer/lb_pool_status.go | 16 + .../lb_service_statisitcs_counter.go | 27 + .../loadbalancer/lb_service_statistics.go | 18 + .../loadbalancer/lb_service_status.go | 34 + .../loadbalancer/lb_statistics_counter.go | 48 + .../lb_virtual_server_statistics.go | 12 + .../loadbalancer/lb_virtual_server_status.go | 13 + .../manager/attachment_context.go | 3 + .../go-vmware-nsxt/manager/extra_config.go | 12 + .../go-vmware-nsxt/manager/firewall_stats.go | 6 +- .../go-vmware-nsxt/manager/logical_port.go | 3 + .../manager/unbounded_key_value_pair.go | 15 + .../vmware/go-vmware-nsxt/services_api.go | 530 +++++++++ vendor/modules.txt | 5 +- website/docs/index.html.markdown | 8 +- 71 files changed, 4166 insertions(+), 31 deletions(-) delete mode 100644 test_env create mode 100644 vendor/github.com/antihax/optional/LICENSE create mode 100644 vendor/github.com/antihax/optional/bool.go create mode 100644 vendor/github.com/antihax/optional/byte.go create mode 100644 vendor/github.com/antihax/optional/complex128.go create mode 100644 vendor/github.com/antihax/optional/complex64.go create mode 100644 vendor/github.com/antihax/optional/float32.go create mode 100644 vendor/github.com/antihax/optional/float64.go create mode 100644 vendor/github.com/antihax/optional/go.mod create mode 100644 vendor/github.com/antihax/optional/int.go create mode 100644 vendor/github.com/antihax/optional/int16.go create mode 100644 vendor/github.com/antihax/optional/int32.go create mode 100644 vendor/github.com/antihax/optional/int64.go create mode 100644 vendor/github.com/antihax/optional/int8.go create mode 100644 vendor/github.com/antihax/optional/interface.go create mode 100644 vendor/github.com/antihax/optional/rune.go create mode 100644 vendor/github.com/antihax/optional/string.go create mode 100644 vendor/github.com/antihax/optional/time.go create mode 100644 vendor/github.com/antihax/optional/uint.go create mode 100644 vendor/github.com/antihax/optional/uint16.go create mode 100644 vendor/github.com/antihax/optional/uint32.go create mode 100644 vendor/github.com/antihax/optional/uint64.go create mode 100644 vendor/github.com/antihax/optional/uint8.go create mode 100644 vendor/github.com/antihax/optional/uintptr.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/api_container_applications.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/api_container_clusters.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/api_container_inventory.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/api_container_projects.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/common/network_error.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_instance.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_instance_list_result.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_list_result.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_list_result.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_node.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_node_list_result.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_infrastructure_info.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_ingress_policy.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_ingress_policy_list_result.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_inventory_data.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_inventory_object.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_network_policy.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_network_policy_list_result.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_project.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_project_list_result.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/go.mod create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/go.sum create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_member_statistics.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_member_status.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_statistics.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_status.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_statisitcs_counter.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_statistics.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_status.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_statistics_counter.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_virtual_server_statistics.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_virtual_server_status.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/manager/extra_config.go create mode 100644 vendor/github.com/vmware/go-vmware-nsxt/manager/unbounded_key_value_pair.go diff --git a/go.mod b/go.mod index 0aa4420b8..89addc3d0 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/hashicorp/go-version v1.2.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.2 github.com/stretchr/testify v1.6.1 // indirect - github.com/vmware/go-vmware-nsxt v0.0.0-20191219213550-f4221331f638 + github.com/vmware/go-vmware-nsxt v0.0.0-20201201191552-e8b90e7eb469 github.com/vmware/vsphere-automation-sdk-go/lib v0.3.1 github.com/vmware/vsphere-automation-sdk-go/runtime v0.3.1 github.com/vmware/vsphere-automation-sdk-go/services/nsxt v0.4.0 diff --git a/go.sum b/go.sum index 31d5f497b..5684180c1 100644 --- a/go.sum +++ b/go.sum @@ -43,6 +43,8 @@ github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBb github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-cidr v1.0.1 h1:NmIwLZ/KdsjIUlhf+/Np40atNXm/+lZ5txfTJ/SpF+U= github.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= @@ -278,8 +280,10 @@ github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oW github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU= github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmware/go-vmware-nsxt v0.0.0-20191219213550-f4221331f638 h1:IhIA83a2W1hu+0OqAfAqAuImpQQ4Ot4G/Kn8n04qrxg= -github.com/vmware/go-vmware-nsxt v0.0.0-20191219213550-f4221331f638/go.mod h1:AzmozsuEImWQcg9Cfef9oMNoPQKcNaps6VkyJhzbSf0= +github.com/vmware/go-vmware-nsxt v0.0.0-20201110195518-0d17c798219b h1:BNOXM12mMbmXblf8YtP6zeuaw7avNs4mMyqnidLXPDQ= +github.com/vmware/go-vmware-nsxt v0.0.0-20201110195518-0d17c798219b/go.mod h1:VEqcmf4Sp7gPB7z05QGyKVmn6xWppr7Nz8cVNvyC80o= +github.com/vmware/go-vmware-nsxt v0.0.0-20201201191552-e8b90e7eb469 h1:k5WnSRR2XOEfr23tGKSjljyhJW7SOhI1C8Ct4tZmpIA= +github.com/vmware/go-vmware-nsxt v0.0.0-20201201191552-e8b90e7eb469/go.mod h1:VEqcmf4Sp7gPB7z05QGyKVmn6xWppr7Nz8cVNvyC80o= github.com/vmware/vsphere-automation-sdk-go/lib v0.3.1 h1:YIcvcshkKm/fbXOvheGfAlGlDTitQXUSMPnYON/uzyg= github.com/vmware/vsphere-automation-sdk-go/lib v0.3.1/go.mod h1:lzuoOgc7zhx3bfrKFRDBbaJX3wj4wSstWv4pTpryhJs= github.com/vmware/vsphere-automation-sdk-go/runtime v0.3.1 h1:AhoRilMJ6hZbBDr4J9GSrAVpPBkLlZz8+FS84Pdbhc8= diff --git a/nsxt/provider.go b/nsxt/provider.go index fedce0ee4..9d6675c48 100644 --- a/nsxt/provider.go +++ b/nsxt/provider.go @@ -167,6 +167,24 @@ func Provider() *schema.Provider { "Must be a valid nsx license key matching: ^[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}$"), }, }, + "client_auth_cert": { + Type: schema.TypeString, + Description: "Client certificate passed as string", + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("NSXT_CLIENT_AUTH_CERT", nil), + }, + "client_auth_key": { + Type: schema.TypeString, + Description: "Client certificate key passed as string", + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("NSXT_CLIENT_AUTH_KEY", nil), + }, + "ca": { + Type: schema.TypeString, + Description: "CA certificate passed as string", + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("NSXT_CA", nil), + }, }, DataSourcesMap: map[string]*schema.Resource{ @@ -319,6 +337,8 @@ func Provider() *schema.Provider { func configureNsxtClient(d *schema.ResourceData, clients *nsxtClients) error { clientAuthCertFile := d.Get("client_auth_cert_file").(string) clientAuthKeyFile := d.Get("client_auth_key_file").(string) + clientAuthCert := d.Get("client_auth_cert").(string) + clientAuthKey := d.Get("client_auth_key").(string) vmcToken := d.Get("vmc_token").(string) if len(vmcToken) > 0 { @@ -333,6 +353,14 @@ func configureNsxtClient(d *schema.ResourceData, clients *nsxtClients) error { needCreds = false } + if len(clientAuthCert) > 0 { + if len(clientAuthKey) == 0 { + return fmt.Errorf("Please provide key for client certificate") + } + // only supported for policy resources + needCreds = false + } + insecure := d.Get("allow_unverified_ssl").(bool) username := d.Get("username").(string) password := d.Get("password").(string) @@ -356,6 +384,7 @@ func configureNsxtClient(d *schema.ResourceData, clients *nsxtClients) error { } caFile := d.Get("ca_file").(string) + caString := d.Get("ca").(string) maxRetries := d.Get("max_retries").(int) retryMinDelay := d.Get("retry_min_delay").(int) @@ -391,6 +420,9 @@ func configureNsxtClient(d *schema.ResourceData, clients *nsxtClients) error { ClientAuthCertFile: clientAuthCertFile, ClientAuthKeyFile: clientAuthKeyFile, CAFile: caFile, + ClientAuthCertString: clientAuthCert, + ClientAuthKeyString: clientAuthKey, + CAString: caString, Insecure: insecure, RetriesConfiguration: retriesConfig, } @@ -442,17 +474,43 @@ func getAPIToken(vmcAuthHost string, vmcAccessToken string) (string, error) { return token.AccessToken, nil } -func getConnectorTLSConfig(insecure bool, clientCertFile string, clientKeyFile string, caFile string) (*tls.Config, error) { +func getConnectorTLSConfig(d *schema.ResourceData) (*tls.Config, error) { + insecure := d.Get("allow_unverified_ssl").(bool) + clientAuthCertFile := d.Get("client_auth_cert_file").(string) + clientAuthKeyFile := d.Get("client_auth_key_file").(string) + caFile := d.Get("ca_file").(string) + clientAuthCert := d.Get("client_auth_cert").(string) + clientAuthKey := d.Get("client_auth_key").(string) + caCert := d.Get("ca").(string) tlsConfig := tls.Config{InsecureSkipVerify: insecure} - if len(clientCertFile) > 0 { + if len(clientAuthCertFile) > 0 { - if len(clientKeyFile) == 0 { + // cert and key are passed via filesystem + if len(clientAuthKeyFile) == 0 { return nil, fmt.Errorf("Please provide key file for client certificate") } - cert, err := tls.LoadX509KeyPair(clientCertFile, clientKeyFile) + cert, err := tls.LoadX509KeyPair(clientAuthCertFile, clientAuthKeyFile) + + if err != nil { + return nil, fmt.Errorf("Failed to load client cert/key pair: %v", err) + } + + tlsConfig.GetClientCertificate = func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { + return &cert, nil + } + } + + if len(clientAuthCert) > 0 { + // cert and key are passed as strings + if len(clientAuthKey) == 0 { + return nil, fmt.Errorf("Please provide key for client certificate") + } + + cert, err := tls.X509KeyPair([]byte(clientAuthCert), []byte(clientAuthKey)) + if err != nil { return nil, fmt.Errorf("Failed to load client cert/key pair: %v", err) } @@ -474,6 +532,13 @@ func getConnectorTLSConfig(insecure bool, clientCertFile string, clientKeyFile s tlsConfig.RootCAs = caCertPool } + if len(caCert) > 0 { + caCertPool := x509.NewCertPool() + caCertPool.AppendCertsFromPEM([]byte(caCert)) + + tlsConfig.RootCAs = caCertPool + } + return &tlsConfig, nil } @@ -483,10 +548,9 @@ func configurePolicyConnectorData(d *schema.ResourceData, clients *nsxtClients) password := d.Get("password").(string) vmcAccessToken := d.Get("vmc_token").(string) vmcAuthHost := d.Get("vmc_auth_host").(string) - insecure := d.Get("allow_unverified_ssl").(bool) clientAuthCertFile := d.Get("client_auth_cert_file").(string) - clientAuthKeyFile := d.Get("client_auth_key_file").(string) - caFile := d.Get("ca_file").(string) + clientAuthCert := d.Get("client_auth_cert").(string) + clientAuthDefined := (len(clientAuthCertFile) > 0) || (len(clientAuthCert) > 0) policyEnforcementPoint := d.Get("enforcement_point").(string) policyGlobalManager := d.Get("global_manager").(bool) @@ -500,7 +564,7 @@ func configurePolicyConnectorData(d *schema.ResourceData, clients *nsxtClients) securityCtx := core.NewSecurityContextImpl() securityContextNeeded := true - if len(clientAuthCertFile) > 0 && !clients.CommonConfig.RemoteAuth { + if clientAuthDefined && !clients.CommonConfig.RemoteAuth { securityContextNeeded = false } @@ -532,7 +596,7 @@ func configurePolicyConnectorData(d *schema.ResourceData, clients *nsxtClients) } } - tlsConfig, err := getConnectorTLSConfig(insecure, clientAuthCertFile, clientAuthKeyFile, caFile) + tlsConfig, err := getConnectorTLSConfig(d) if err != nil { return err } diff --git a/test_env b/test_env deleted file mode 100644 index 24ff90d65..000000000 --- a/test_env +++ /dev/null @@ -1,11 +0,0 @@ -export TF_ACC=1 -export NSXT_MANAGER_HOST=10.186.192.214 -#export NSXT_MANAGER_HOST=10.92.210.149 -export NSXT_USERNAME=admin -export NSXT_PASSWORD=Admin!23Admin -#export NSXT_PASSWORD=VMware1!VMware1! -export NSXT_ALLOW_UNVERIFIED_SSL=1 -export NSXT_GLOBAL_MANAGER=false -#export NSXT_GLOBAL_MANAGER=true -export NSXT_TEST_SITE_NAME=Pune -export NSXT_TEST_ANOTHER_SITE_NAME=Bangalore diff --git a/vendor/github.com/antihax/optional/LICENSE b/vendor/github.com/antihax/optional/LICENSE new file mode 100644 index 000000000..19587fe47 --- /dev/null +++ b/vendor/github.com/antihax/optional/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2016 Adam Hintz + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/antihax/optional/bool.go b/vendor/github.com/antihax/optional/bool.go new file mode 100644 index 000000000..4f35ff561 --- /dev/null +++ b/vendor/github.com/antihax/optional/bool.go @@ -0,0 +1,36 @@ +package optional + +type Bool struct { + isSet bool + value bool +} + +func NewBool(value bool) Bool { + return Bool{ + true, + value, + } +} + +// EmptyBool returns a new Bool that does not have a value set. +func EmptyBool() Bool { + return Bool{ + false, + false, + } +} + +func (b Bool) IsSet() bool { + return b.isSet +} + +func (b Bool) Value() bool { + return b.value +} + +func (b Bool) Default(defaultValue bool) bool { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/byte.go b/vendor/github.com/antihax/optional/byte.go new file mode 100644 index 000000000..d22bbe8ff --- /dev/null +++ b/vendor/github.com/antihax/optional/byte.go @@ -0,0 +1,36 @@ +package optional + +type Byte struct { + isSet bool + value byte +} + +func NewByte(value byte) Byte { + return Byte{ + true, + value, + } +} + +// EmptyByte returns a new Byte that does not have a value set. +func EmptyByte() Byte { + return Byte{ + false, + 0, + } +} + +func (b Byte) IsSet() bool { + return b.isSet +} + +func (b Byte) Value() byte { + return b.value +} + +func (b Byte) Default(defaultValue byte) byte { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/complex128.go b/vendor/github.com/antihax/optional/complex128.go new file mode 100644 index 000000000..290b3f37b --- /dev/null +++ b/vendor/github.com/antihax/optional/complex128.go @@ -0,0 +1,36 @@ +package optional + +type Complex128 struct { + isSet bool + value complex128 +} + +func NewComplex128(value complex128) Complex128 { + return Complex128{ + true, + value, + } +} + +// EmptyComplex128 returns a new Complex128 that does not have a value set. +func EmptyComplex128() Complex128 { + return Complex128{ + false, + 0, + } +} + +func (i Complex128) IsSet() bool { + return i.isSet +} + +func (i Complex128) Value() complex128 { + return i.value +} + +func (i Complex128) Default(defaultValue complex128) complex128 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/complex64.go b/vendor/github.com/antihax/optional/complex64.go new file mode 100644 index 000000000..7d372d8c1 --- /dev/null +++ b/vendor/github.com/antihax/optional/complex64.go @@ -0,0 +1,36 @@ +package optional + +type Complex64 struct { + isSet bool + value complex64 +} + +func NewComplex64(value complex64) Complex64 { + return Complex64{ + true, + value, + } +} + +// EmptyComplex64 returns a new Complex64 that does not have a value set. +func EmptyComplex64() Complex64 { + return Complex64{ + false, + 0, + } +} + +func (i Complex64) IsSet() bool { + return i.isSet +} + +func (i Complex64) Value() complex64 { + return i.value +} + +func (i Complex64) Default(defaultValue complex64) complex64 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/float32.go b/vendor/github.com/antihax/optional/float32.go new file mode 100644 index 000000000..519cc5d69 --- /dev/null +++ b/vendor/github.com/antihax/optional/float32.go @@ -0,0 +1,36 @@ +package optional + +type Float32 struct { + isSet bool + value float32 +} + +func NewFloat32(value float32) Float32 { + return Float32{ + true, + value, + } +} + +// EmptyFloat32 returns a new Float32 that does not have a value set. +func EmptyFloat32() Float32 { + return Float32{ + false, + 0, + } +} + +func (i Float32) IsSet() bool { + return i.isSet +} + +func (i Float32) Value() float32 { + return i.value +} + +func (i Float32) Default(defaultValue float32) float32 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/float64.go b/vendor/github.com/antihax/optional/float64.go new file mode 100644 index 000000000..835f7058e --- /dev/null +++ b/vendor/github.com/antihax/optional/float64.go @@ -0,0 +1,36 @@ +package optional + +type Float64 struct { + isSet bool + value float64 +} + +func NewFloat64(value float64) Float64 { + return Float64{ + true, + value, + } +} + +// EmptyFloat64 returns a new Float64 that does not have a value set. +func EmptyFloat64() Float64 { + return Float64{ + false, + 0, + } +} + +func (i Float64) IsSet() bool { + return i.isSet +} + +func (i Float64) Value() float64 { + return i.value +} + +func (i Float64) Default(defaultValue float64) float64 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/go.mod b/vendor/github.com/antihax/optional/go.mod new file mode 100644 index 000000000..27b7e9021 --- /dev/null +++ b/vendor/github.com/antihax/optional/go.mod @@ -0,0 +1,3 @@ +module github.com/antihax/optional + +go 1.13 diff --git a/vendor/github.com/antihax/optional/int.go b/vendor/github.com/antihax/optional/int.go new file mode 100644 index 000000000..6c3e65b92 --- /dev/null +++ b/vendor/github.com/antihax/optional/int.go @@ -0,0 +1,36 @@ +package optional + +type Int struct { + isSet bool + value int +} + +func NewInt(value int) Int { + return Int{ + true, + value, + } +} + +// EmptyInt returns a new Int that does not have a value set. +func EmptyInt() Int { + return Int{ + false, + 0, + } +} + +func (i Int) IsSet() bool { + return i.isSet +} + +func (i Int) Value() int { + return i.value +} + +func (i Int) Default(defaultValue int) int { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int16.go b/vendor/github.com/antihax/optional/int16.go new file mode 100644 index 000000000..49465b8c7 --- /dev/null +++ b/vendor/github.com/antihax/optional/int16.go @@ -0,0 +1,36 @@ +package optional + +type Int16 struct { + isSet bool + value int16 +} + +func NewInt16(value int16) Int16 { + return Int16{ + true, + value, + } +} + +// EmptyInt16 returns a new Int16 that does not have a value set. +func EmptyInt16() Int16 { + return Int16{ + false, + 0, + } +} + +func (i Int16) IsSet() bool { + return i.isSet +} + +func (i Int16) Value() int16 { + return i.value +} + +func (i Int16) Default(defaultValue int16) int16 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int32.go b/vendor/github.com/antihax/optional/int32.go new file mode 100644 index 000000000..f3a33c78d --- /dev/null +++ b/vendor/github.com/antihax/optional/int32.go @@ -0,0 +1,36 @@ +package optional + +type Int32 struct { + isSet bool + value int32 +} + +func NewInt32(value int32) Int32 { + return Int32{ + true, + value, + } +} + +// EmptyInt32 returns a new Int32 that does not have a value set. +func EmptyInt32() Int32 { + return Int32{ + false, + 0, + } +} + +func (i Int32) IsSet() bool { + return i.isSet +} + +func (i Int32) Value() int32 { + return i.value +} + +func (i Int32) Default(defaultValue int32) int32 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int64.go b/vendor/github.com/antihax/optional/int64.go new file mode 100644 index 000000000..d047470b7 --- /dev/null +++ b/vendor/github.com/antihax/optional/int64.go @@ -0,0 +1,36 @@ +package optional + +type Int64 struct { + isSet bool + value int64 +} + +func NewInt64(value int64) Int64 { + return Int64{ + true, + value, + } +} + +// EmptyInt64 returns a new Int64 that does not have a value set. +func EmptyInt64() Int64 { + return Int64{ + false, + 0, + } +} + +func (i Int64) IsSet() bool { + return i.isSet +} + +func (i Int64) Value() int64 { + return i.value +} + +func (i Int64) Default(defaultValue int64) int64 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int8.go b/vendor/github.com/antihax/optional/int8.go new file mode 100644 index 000000000..2bd11bda7 --- /dev/null +++ b/vendor/github.com/antihax/optional/int8.go @@ -0,0 +1,36 @@ +package optional + +type Int8 struct { + isSet bool + value int8 +} + +func NewInt8(value int8) Int8 { + return Int8{ + true, + value, + } +} + +// EmptyInt8 returns a new Int8 that does not have a value set. +func EmptyInt8() Int8 { + return Int8{ + false, + 0, + } +} + +func (i Int8) IsSet() bool { + return i.isSet +} + +func (i Int8) Value() int8 { + return i.value +} + +func (i Int8) Default(defaultValue int8) int8 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/interface.go b/vendor/github.com/antihax/optional/interface.go new file mode 100644 index 000000000..a6f2416dd --- /dev/null +++ b/vendor/github.com/antihax/optional/interface.go @@ -0,0 +1,37 @@ +package optional + +// Optional represents a generic optional type, stored as an interface{}. +type Interface struct { + isSet bool + value interface{} +} + +func NewInterface(value interface{}) Interface { + return Interface{ + true, + value, + } +} + +// EmptyInterface returns a new Interface that does not have a value set. +func EmptyInterface() Interface { + return Interface{ + false, + nil, + } +} + +func (b Interface) IsSet() bool { + return b.isSet +} + +func (b Interface) Value() interface{} { + return b.value +} + +func (b Interface) Default(defaultValue interface{}) interface{} { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/rune.go b/vendor/github.com/antihax/optional/rune.go new file mode 100644 index 000000000..cbac81929 --- /dev/null +++ b/vendor/github.com/antihax/optional/rune.go @@ -0,0 +1,36 @@ +package optional + +type Rune struct { + isSet bool + value rune +} + +func NewRune(value rune) Rune { + return Rune{ + true, + value, + } +} + +// EmptyRune returns a new Rune that does not have a value set. +func EmptyRune() Rune { + return Rune{ + false, + 0, + } +} + +func (b Rune) IsSet() bool { + return b.isSet +} + +func (b Rune) Value() rune { + return b.value +} + +func (b Rune) Default(defaultValue rune) rune { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/string.go b/vendor/github.com/antihax/optional/string.go new file mode 100644 index 000000000..a2e5a2b44 --- /dev/null +++ b/vendor/github.com/antihax/optional/string.go @@ -0,0 +1,36 @@ +package optional + +type String struct { + isSet bool + value string +} + +func NewString(value string) String { + return String{ + true, + value, + } +} + +// EmptyString returns a new String that does not have a value set. +func EmptyString() String { + return String{ + false, + "", + } +} + +func (b String) IsSet() bool { + return b.isSet +} + +func (b String) Value() string { + return b.value +} + +func (b String) Default(defaultValue string) string { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/time.go b/vendor/github.com/antihax/optional/time.go new file mode 100644 index 000000000..a92a55aa4 --- /dev/null +++ b/vendor/github.com/antihax/optional/time.go @@ -0,0 +1,38 @@ +package optional + +import "time" + +type Time struct { + isSet bool + value time.Time +} + +func NewTime(value time.Time) Time { + return Time{ + true, + value, + } +} + +// EmptyTime returns a new Time that does not have a value set. +func EmptyTime() Time { + return Time{ + false, + time.Time{}, + } +} + +func (b Time) IsSet() bool { + return b.isSet +} + +func (b Time) Value() time.Time { + return b.value +} + +func (b Time) Default(defaultValue time.Time) time.Time { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint.go b/vendor/github.com/antihax/optional/uint.go new file mode 100644 index 000000000..f9e53a41b --- /dev/null +++ b/vendor/github.com/antihax/optional/uint.go @@ -0,0 +1,36 @@ +package optional + +type Uint struct { + isSet bool + value uint +} + +func NewUint(value uint) Uint { + return Uint{ + true, + value, + } +} + +// EmptyUint returns a new Uint that does not have a value set. +func EmptyUint() Uint { + return Uint{ + false, + 0, + } +} + +func (i Uint) IsSet() bool { + return i.isSet +} + +func (i Uint) Value() uint { + return i.value +} + +func (i Uint) Default(defaultValue uint) uint { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint16.go b/vendor/github.com/antihax/optional/uint16.go new file mode 100644 index 000000000..487eb673b --- /dev/null +++ b/vendor/github.com/antihax/optional/uint16.go @@ -0,0 +1,36 @@ +package optional + +type Uint16 struct { + isSet bool + value uint16 +} + +func NewUint16(value uint16) Uint16 { + return Uint16{ + true, + value, + } +} + +// EmptyUint16 returns a new Uint16 that does not have a value set. +func EmptyUint16() Uint16 { + return Uint16{ + false, + 0, + } +} + +func (i Uint16) IsSet() bool { + return i.isSet +} + +func (i Uint16) Value() uint16 { + return i.value +} + +func (i Uint16) Default(defaultValue uint16) uint16 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint32.go b/vendor/github.com/antihax/optional/uint32.go new file mode 100644 index 000000000..0e46c8378 --- /dev/null +++ b/vendor/github.com/antihax/optional/uint32.go @@ -0,0 +1,36 @@ +package optional + +type Uint32 struct { + isSet bool + value uint32 +} + +func NewUint32(value uint32) Uint32 { + return Uint32{ + true, + value, + } +} + +// EmptyUint32 returns a new Uint32 that does not have a value set. +func EmptyUint32() Uint32 { + return Uint32{ + false, + 0, + } +} + +func (i Uint32) IsSet() bool { + return i.isSet +} + +func (i Uint32) Value() uint32 { + return i.value +} + +func (i Uint32) Default(defaultValue uint32) uint32 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint64.go b/vendor/github.com/antihax/optional/uint64.go new file mode 100644 index 000000000..16004df34 --- /dev/null +++ b/vendor/github.com/antihax/optional/uint64.go @@ -0,0 +1,36 @@ +package optional + +type Uint64 struct { + isSet bool + value uint64 +} + +func NewUint64(value uint64) Uint64 { + return Uint64{ + true, + value, + } +} + +// EmptyUint64 returns a new Uint64 that does not have a value set. +func EmptyUint64() Uint64 { + return Uint64{ + false, + 0, + } +} + +func (i Uint64) IsSet() bool { + return i.isSet +} + +func (i Uint64) Value() uint64 { + return i.value +} + +func (i Uint64) Default(defaultValue uint64) uint64 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint8.go b/vendor/github.com/antihax/optional/uint8.go new file mode 100644 index 000000000..469ceb53a --- /dev/null +++ b/vendor/github.com/antihax/optional/uint8.go @@ -0,0 +1,36 @@ +package optional + +type Uint8 struct { + isSet bool + value uint8 +} + +func NewUint8(value uint8) Uint8 { + return Uint8{ + true, + value, + } +} + +// EmptyUint8 returns a new Uint8 that does not have a value set. +func EmptyUint8() Uint8 { + return Uint8{ + false, + 0, + } +} + +func (i Uint8) IsSet() bool { + return i.isSet +} + +func (i Uint8) Value() uint8 { + return i.value +} + +func (i Uint8) Default(defaultValue uint8) uint8 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uintptr.go b/vendor/github.com/antihax/optional/uintptr.go new file mode 100644 index 000000000..e7e2cabe0 --- /dev/null +++ b/vendor/github.com/antihax/optional/uintptr.go @@ -0,0 +1,36 @@ +package optional + +type Uintptr struct { + isSet bool + value uintptr +} + +func NewUintptr(value uintptr) Uintptr { + return Uintptr{ + true, + value, + } +} + +// EmptyUintptr returns a new Uintptr that does not have a value set. +func EmptyUintptr() Uintptr { + return Uintptr{ + false, + 0, + } +} + +func (i Uintptr) IsSet() bool { + return i.isSet +} + +func (i Uintptr) Value() uintptr { + return i.value +} + +func (i Uintptr) Default(defaultValue uintptr) uintptr { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/api_client.go b/vendor/github.com/vmware/go-vmware-nsxt/api_client.go index c874ef431..0d5ff35ba 100644 --- a/vendor/github.com/vmware/go-vmware-nsxt/api_client.go +++ b/vendor/github.com/vmware/go-vmware-nsxt/api_client.go @@ -70,6 +70,10 @@ type APIClient struct { TransportEntitiesApi *TransportEntitiesApiService TroubleshootingAndMonitoringApi *TroubleshootingAndMonitoringApiService UpgradeApi *UpgradeApiService + ContainerApplicationsApi *ManagementPlaneApiFabricContainerApplicationsApiService + ContainerClustersApi *ManagementPlaneApiFabricContainerClustersApiService + ContainerInventoryApi *ManagementPlaneApiFabricContainerInventoryApiService + ContainerProjectsApi *ManagementPlaneApiFabricContainerProjectsApiService } type service struct { @@ -77,7 +81,7 @@ type service struct { } func GetContext(cfg *Configuration) context.Context { - if len(cfg.ClientAuthCertFile) == 0 && cfg.RemoteAuth == false { + if len(cfg.ClientAuthCertFile) == 0 && len(cfg.ClientAuthCertString) == 0 && cfg.RemoteAuth == false { auth := BasicAuth{UserName: cfg.UserName, Password: cfg.Password} return context.WithValue(context.Background(), ContextBasicAuth, auth) @@ -181,6 +185,19 @@ func InitHttpClient(cfg *Configuration) error { } + if len(cfg.ClientAuthCertString) > 0 { + cert, err := tls.X509KeyPair([]byte(cfg.ClientAuthCertString), + []byte(cfg.ClientAuthKeyString)) + if err != nil { + return err + } + + tlsConfig.GetClientCertificate = func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { + return &cert, nil + } + + } + if len(cfg.CAFile) > 0 { caCert, err := ioutil.ReadFile(cfg.CAFile) if err != nil { @@ -193,7 +210,13 @@ func InitHttpClient(cfg *Configuration) error { tlsConfig.RootCAs = caCertPool } - tlsConfig.BuildNameToCertificate() + if len(cfg.CAString) > 0 { + + caCertPool := x509.NewCertPool() + caCertPool.AppendCertsFromPEM([]byte(cfg.CAString)) + + tlsConfig.RootCAs = caCertPool + } transport := &http.Transport{Proxy: http.ProxyFromEnvironment, TLSClientConfig: tlsConfig, @@ -249,6 +272,10 @@ func NewAPIClient(cfg *Configuration) (*APIClient, error) { c.TransportEntitiesApi = (*TransportEntitiesApiService)(&c.common) c.TroubleshootingAndMonitoringApi = (*TroubleshootingAndMonitoringApiService)(&c.common) c.UpgradeApi = (*UpgradeApiService)(&c.common) + c.ContainerApplicationsApi = (*ManagementPlaneApiFabricContainerApplicationsApiService)(&c.common) + c.ContainerClustersApi = (*ManagementPlaneApiFabricContainerClustersApiService)(&c.common) + c.ContainerInventoryApi = (*ManagementPlaneApiFabricContainerInventoryApiService)(&c.common) + c.ContainerProjectsApi = (*ManagementPlaneApiFabricContainerProjectsApiService)(&c.common) return c, nil } @@ -362,7 +389,11 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { } log.Printf("[DEBUG] Retrying request %s %s for the %d time because of status %d", request.Method, request.URL, n_try, status) // sleep a random increasing time - float_delay := float64(rand.Intn(config.RetryMinDelay * n_try)) + minDelay := 1 + if config.RetryMinDelay > 0 { + minDelay = config.RetryMinDelay + } + float_delay := float64(rand.Intn(minDelay * n_try)) fixed_delay := time.Duration(math.Min(float64(config.RetryMaxDelay), float_delay)) time.Sleep(fixed_delay * time.Millisecond) // reset Request.Body @@ -666,3 +697,41 @@ func CacheExpires(r *http.Response) time.Time { func strlen(s string) int { return utf8.RuneCountInString(s) } + +// Added for supporting NSX 3.0 Container Inventory API +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/api_container_applications.go b/vendor/github.com/vmware/go-vmware-nsxt/api_container_applications.go new file mode 100644 index 000000000..7a32be7cf --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/api_container_applications.go @@ -0,0 +1,446 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package nsxt + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/antihax/optional" + "github.com/vmware/go-vmware-nsxt/containerinventory" +) + +// Linger please +var ( + _ context.Context +) + +type ManagementPlaneApiFabricContainerApplicationsApiService service + +/* +ManagementPlaneApiFabricContainerApplicationsApiService Return a Container Application within a container project +Returns information about a specific Container Application within a project. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param containerApplicationId + +@return ContainerApplication +*/ +func (a *ManagementPlaneApiFabricContainerApplicationsApiService) GetContainerApplication(ctx context.Context, containerApplicationId string) (containerinventory.ContainerApplication, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerApplication + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-applications/{container-application-id}" + localVarPath = strings.Replace(localVarPath, "{"+"container-application-id"+"}", fmt.Sprintf("%v", containerApplicationId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerApplicationsApiService Return a container application instance +Returns information about a specific container application instance. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param containerApplicationInstanceId + +@return ContainerApplicationInstance +*/ +func (a *ManagementPlaneApiFabricContainerApplicationsApiService) GetContainerApplicationInstance(ctx context.Context, containerApplicationInstanceId string) (containerinventory.ContainerApplicationInstance, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerApplicationInstance + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-application-instances/{container-application-instance-id}" + localVarPath = strings.Replace(localVarPath, "{"+"container-application-instance-id"+"}", fmt.Sprintf("%v", containerApplicationInstanceId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerApplicationsApiService Return the list of container application instance +Returns information about all container application instance. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ListContainerApplicationInstancesOpts - Optional Parameters: + * @param "ContainerApplicationId" (optional.String) - Identifier of the container application + * @param "ContainerClusterId" (optional.String) - Identifier of the container cluster + * @param "ContainerProjectId" (optional.String) - Identifier of the container project + * @param "Cursor" (optional.String) - Opaque cursor to be used for getting next page of records (supplied by current result page)f + * @param "IncludedFields" (optional.String) - Comma separated list of fields that should be included in query result + * @param "PageSize" (optional.Int64) - Maximum number of results to return in this page (server may return fewer) + * @param "SortAscending" (optional.Bool) - + * @param "SortBy" (optional.String) - Field by which records are sorted + +@return ContainerApplicationInstanceListResult +*/ + +type ListContainerApplicationInstancesOpts struct { + ContainerApplicationId optional.String + ContainerClusterId optional.String + ContainerProjectId optional.String + Cursor optional.String + IncludedFields optional.String + PageSize optional.Int64 + SortAscending optional.Bool + SortBy optional.String +} + +func (a *ManagementPlaneApiFabricContainerApplicationsApiService) ListContainerApplicationInstances(ctx context.Context, localVarOptionals *ListContainerApplicationInstancesOpts) (containerinventory.ContainerApplicationInstanceListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerApplicationInstanceListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-application-instances" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ContainerApplicationId.IsSet() { + localVarQueryParams.Add("container_application_id", parameterToString(localVarOptionals.ContainerApplicationId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ContainerClusterId.IsSet() { + localVarQueryParams.Add("container_cluster_id", parameterToString(localVarOptionals.ContainerClusterId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ContainerProjectId.IsSet() { + localVarQueryParams.Add("container_project_id", parameterToString(localVarOptionals.ContainerProjectId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Cursor.IsSet() { + localVarQueryParams.Add("cursor", parameterToString(localVarOptionals.Cursor.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludedFields.IsSet() { + localVarQueryParams.Add("included_fields", parameterToString(localVarOptionals.IncludedFields.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PageSize.IsSet() { + localVarQueryParams.Add("page_size", parameterToString(localVarOptionals.PageSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortAscending.IsSet() { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarOptionals.SortAscending.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() { + localVarQueryParams.Add("sort_by", parameterToString(localVarOptionals.SortBy.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerApplicationsApiService Return the List of Container Applications +Returns information about all Container Applications. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ListContainerApplicationsOpts - Optional Parameters: + * @param "ContainerClusterId" (optional.String) - Identifier of the container cluster + * @param "ContainerProjectId" (optional.String) - Identifier of the container project + * @param "Cursor" (optional.String) - Opaque cursor to be used for getting next page of records (supplied by current result page) + * @param "IncludedFields" (optional.String) - Comma separated list of fields that should be included in query result + * @param "PageSize" (optional.Int64) - Maximum number of results to return in this page (server may return fewer) + * @param "SortAscending" (optional.Bool) - + * @param "SortBy" (optional.String) - Field by which records are sorted + +@return ContainerApplicationListResult +*/ + +type ListContainerApplicationsOpts struct { + ContainerClusterId optional.String + ContainerProjectId optional.String + Cursor optional.String + IncludedFields optional.String + PageSize optional.Int64 + SortAscending optional.Bool + SortBy optional.String +} + +func (a *ManagementPlaneApiFabricContainerApplicationsApiService) ListContainerApplications(ctx context.Context, localVarOptionals *ListContainerApplicationsOpts) (containerinventory.ContainerApplicationListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerApplicationListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-applications" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ContainerClusterId.IsSet() { + localVarQueryParams.Add("container_cluster_id", parameterToString(localVarOptionals.ContainerClusterId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ContainerProjectId.IsSet() { + localVarQueryParams.Add("container_project_id", parameterToString(localVarOptionals.ContainerProjectId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Cursor.IsSet() { + localVarQueryParams.Add("cursor", parameterToString(localVarOptionals.Cursor.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludedFields.IsSet() { + localVarQueryParams.Add("included_fields", parameterToString(localVarOptionals.IncludedFields.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PageSize.IsSet() { + localVarQueryParams.Add("page_size", parameterToString(localVarOptionals.PageSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortAscending.IsSet() { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarOptionals.SortAscending.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() { + localVarQueryParams.Add("sort_by", parameterToString(localVarOptionals.SortBy.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/api_container_clusters.go b/vendor/github.com/vmware/go-vmware-nsxt/api_container_clusters.go new file mode 100644 index 000000000..d26aa268d --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/api_container_clusters.go @@ -0,0 +1,1008 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package nsxt + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/antihax/optional" + "github.com/vmware/go-vmware-nsxt/containerinventory" +) + +// Linger please +var ( + _ context.Context +) + +type ManagementPlaneApiFabricContainerClustersApiService service + +/* +ManagementPlaneApiFabricContainerClustersApiService Add a container cluster +Add a container cluster + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param containerCluster + +@return ContainerCluster +*/ +func (a *ManagementPlaneApiFabricContainerClustersApiService) AddContainerCluster(ctx context.Context, containerCluster containerinventory.ContainerCluster) (containerinventory.ContainerCluster, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerCluster + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &containerCluster + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Delete a container cluster +Delete a container cluster and objects discovered from that cluster + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param containerClusterId + + +*/ +func (a *ManagementPlaneApiFabricContainerClustersApiService) DeleteContainerCluster(ctx context.Context, containerClusterId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-clusters/{container-cluster-id}" + localVarPath = strings.Replace(localVarPath, "{"+"container-cluster-id"+"}", fmt.Sprintf("%v", containerClusterId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Return a container cluster +Returns information about a specific container cluster + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param containerClusterId + +@return ContainerCluster +*/ +func (a *ManagementPlaneApiFabricContainerClustersApiService) GetContainerCluster(ctx context.Context, containerClusterId string) (containerinventory.ContainerCluster, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerCluster + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-clusters/{container-cluster-id}" + localVarPath = strings.Replace(localVarPath, "{"+"container-cluster-id"+"}", fmt.Sprintf("%v", containerClusterId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Return a container cluster node +Returns information about a specific container cluster node. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param containerClusterNodeId + +@return ContainerClusterNode +*/ +func (a *ManagementPlaneApiFabricContainerClustersApiService) GetContainerClusterNode(ctx context.Context, containerClusterNodeId string) (containerinventory.ContainerClusterNode, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerClusterNode + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-cluster-nodes/{container-cluster-node-id}" + localVarPath = strings.Replace(localVarPath, "{"+"container-cluster-node-id"+"}", fmt.Sprintf("%v", containerClusterNodeId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Returns an ingress policy spec +Returns information about a specific ingress policy. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param ingressPolicyId + +@return ContainerIngressPolicy +*/ +func (a *ManagementPlaneApiFabricContainerClustersApiService) GetContainerIngressPolicy(ctx context.Context, ingressPolicyId string) (containerinventory.ContainerIngressPolicy, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerIngressPolicy + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-ingress-policies/{ingress-policy-id}" + localVarPath = strings.Replace(localVarPath, "{"+"ingress-policy-id"+"}", fmt.Sprintf("%v", ingressPolicyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Return a network policy spec +Returns information about a specific network policy. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param networkPolicyId + +@return ContainerNetworkPolicy +*/ +func (a *ManagementPlaneApiFabricContainerClustersApiService) GetContainerNetworkPolicy(ctx context.Context, networkPolicyId string) (containerinventory.ContainerNetworkPolicy, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerNetworkPolicy + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-network-policies/{network-policy-id}" + localVarPath = strings.Replace(localVarPath, "{"+"network-policy-id"+"}", fmt.Sprintf("%v", networkPolicyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Return the list of container cluster nodes +Returns information about all container cluster nodes. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ListContainerClusterNodesOpts - Optional Parameters: + * @param "ContainerClusterId" (optional.String) - Identifier of the container cluster + * @param "Cursor" (optional.String) - Opaque cursor to be used for getting next page of records (supplied by current result page) + * @param "IncludedFields" (optional.String) - Comma separated list of fields that should be included in query result + * @param "PageSize" (optional.Int64) - Maximum number of results to return in this page (server may return fewer) + * @param "SortAscending" (optional.Bool) - + * @param "SortBy" (optional.String) - Field by which records are sorted + +@return ContainerClusterNodeListResult +*/ + +type ListContainerClusterNodesOpts struct { + ContainerClusterId optional.String + Cursor optional.String + IncludedFields optional.String + PageSize optional.Int64 + SortAscending optional.Bool + SortBy optional.String +} + +func (a *ManagementPlaneApiFabricContainerClustersApiService) ListContainerClusterNodes(ctx context.Context, localVarOptionals *ListContainerClusterNodesOpts) (containerinventory.ContainerClusterNodeListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerClusterNodeListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-cluster-nodes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ContainerClusterId.IsSet() { + localVarQueryParams.Add("container_cluster_id", parameterToString(localVarOptionals.ContainerClusterId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Cursor.IsSet() { + localVarQueryParams.Add("cursor", parameterToString(localVarOptionals.Cursor.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludedFields.IsSet() { + localVarQueryParams.Add("included_fields", parameterToString(localVarOptionals.IncludedFields.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PageSize.IsSet() { + localVarQueryParams.Add("page_size", parameterToString(localVarOptionals.PageSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortAscending.IsSet() { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarOptionals.SortAscending.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() { + localVarQueryParams.Add("sort_by", parameterToString(localVarOptionals.SortBy.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Return the List of Container Clusters +Returns information about all Container Clusters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ListContainerClustersOpts - Optional Parameters: + * @param "ClusterType" (optional.String) - Type of container cluster + * @param "Cursor" (optional.String) - Opaque cursor to be used for getting next page of records (supplied by current result page) + * @param "IncludedFields" (optional.String) - Comma separated list of fields that should be included in query result + * @param "InfraType" (optional.String) - Type of infrastructure + * @param "PageSize" (optional.Int64) - Maximum number of results to return in this page (server may return fewer) + * @param "SortAscending" (optional.Bool) - + * @param "SortBy" (optional.String) - Field by which records are sorted + +@return ContainerClusterListResult +*/ + +type ListContainerClustersOpts struct { + ClusterType optional.String + Cursor optional.String + IncludedFields optional.String + InfraType optional.String + PageSize optional.Int64 + SortAscending optional.Bool + SortBy optional.String +} + +func (a *ManagementPlaneApiFabricContainerClustersApiService) ListContainerClusters(ctx context.Context, localVarOptionals *ListContainerClustersOpts) (containerinventory.ContainerClusterListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerClusterListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ClusterType.IsSet() { + localVarQueryParams.Add("cluster_type", parameterToString(localVarOptionals.ClusterType.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Cursor.IsSet() { + localVarQueryParams.Add("cursor", parameterToString(localVarOptionals.Cursor.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludedFields.IsSet() { + localVarQueryParams.Add("included_fields", parameterToString(localVarOptionals.IncludedFields.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.InfraType.IsSet() { + localVarQueryParams.Add("infra_type", parameterToString(localVarOptionals.InfraType.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PageSize.IsSet() { + localVarQueryParams.Add("page_size", parameterToString(localVarOptionals.PageSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortAscending.IsSet() { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarOptionals.SortAscending.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() { + localVarQueryParams.Add("sort_by", parameterToString(localVarOptionals.SortBy.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Return the List of Container Ingress Policies +Returns information about all ingress policies. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ListContainerIngressPoliciesOpts - Optional Parameters: + * @param "ContainerClusterId" (optional.String) - Identifier of the container cluster + * @param "ContainerProjectId" (optional.String) - Identifier of the container project + * @param "Cursor" (optional.String) - Opaque cursor to be used for getting next page of records (supplied by current result page) + * @param "IncludedFields" (optional.String) - Comma separated list of fields that should be included in query result + * @param "PageSize" (optional.Int64) - Maximum number of results to return in this page (server may return fewer) + * @param "SortAscending" (optional.Bool) - + * @param "SortBy" (optional.String) - Field by which records are sorted + +@return ContainerIngressPolicyListResult +*/ + +type ListContainerIngressPoliciesOpts struct { + ContainerClusterId optional.String + ContainerProjectId optional.String + Cursor optional.String + IncludedFields optional.String + PageSize optional.Int64 + SortAscending optional.Bool + SortBy optional.String +} + +func (a *ManagementPlaneApiFabricContainerClustersApiService) ListContainerIngressPolicies(ctx context.Context, localVarOptionals *ListContainerIngressPoliciesOpts) (containerinventory.ContainerIngressPolicyListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerIngressPolicyListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-ingress-policies" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ContainerClusterId.IsSet() { + localVarQueryParams.Add("container_cluster_id", parameterToString(localVarOptionals.ContainerClusterId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ContainerProjectId.IsSet() { + localVarQueryParams.Add("container_project_id", parameterToString(localVarOptionals.ContainerProjectId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Cursor.IsSet() { + localVarQueryParams.Add("cursor", parameterToString(localVarOptionals.Cursor.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludedFields.IsSet() { + localVarQueryParams.Add("included_fields", parameterToString(localVarOptionals.IncludedFields.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PageSize.IsSet() { + localVarQueryParams.Add("page_size", parameterToString(localVarOptionals.PageSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortAscending.IsSet() { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarOptionals.SortAscending.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() { + localVarQueryParams.Add("sort_by", parameterToString(localVarOptionals.SortBy.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerClustersApiService Return the List of Container Network Policies +Returns information about all network policies. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ListContainerNetworkPoliciesOpts - Optional Parameters: + * @param "ContainerClusterId" (optional.String) - Identifier of the container cluster + * @param "ContainerProjectId" (optional.String) - Identifier of the container project + * @param "Cursor" (optional.String) - Opaque cursor to be used for getting next page of records (supplied by current result page) + * @param "IncludedFields" (optional.String) - Comma separated list of fields that should be included in query result + * @param "PageSize" (optional.Int64) - Maximum number of results to return in this page (server may return fewer) + * @param "SortAscending" (optional.Bool) - + * @param "SortBy" (optional.String) - Field by which records are sorted + +@return ContainerNetworkPolicyListResult +*/ + +type ListContainerNetworkPoliciesOpts struct { + ContainerClusterId optional.String + ContainerProjectId optional.String + Cursor optional.String + IncludedFields optional.String + PageSize optional.Int64 + SortAscending optional.Bool + SortBy optional.String +} + +func (a *ManagementPlaneApiFabricContainerClustersApiService) ListContainerNetworkPolicies(ctx context.Context, localVarOptionals *ListContainerNetworkPoliciesOpts) (containerinventory.ContainerNetworkPolicyListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerNetworkPolicyListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-network-policies" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ContainerClusterId.IsSet() { + localVarQueryParams.Add("container_cluster_id", parameterToString(localVarOptionals.ContainerClusterId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ContainerProjectId.IsSet() { + localVarQueryParams.Add("container_project_id", parameterToString(localVarOptionals.ContainerProjectId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Cursor.IsSet() { + localVarQueryParams.Add("cursor", parameterToString(localVarOptionals.Cursor.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludedFields.IsSet() { + localVarQueryParams.Add("included_fields", parameterToString(localVarOptionals.IncludedFields.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PageSize.IsSet() { + localVarQueryParams.Add("page_size", parameterToString(localVarOptionals.PageSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortAscending.IsSet() { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarOptionals.SortAscending.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() { + localVarQueryParams.Add("sort_by", parameterToString(localVarOptionals.SortBy.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/api_container_inventory.go b/vendor/github.com/vmware/go-vmware-nsxt/api_container_inventory.go new file mode 100644 index 000000000..e513f33b7 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/api_container_inventory.go @@ -0,0 +1,107 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package nsxt + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/vmware/go-vmware-nsxt/containerinventory" +) + +// Linger please +var ( + _ context.Context +) + +type ManagementPlaneApiFabricContainerInventoryApiService service + +/* +ManagementPlaneApiFabricContainerInventoryApiService Send container inventory update to MP-Inventory +Send container inventory update like container project, application, application instance etc to MP-Inventory. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param clusterId + * @param containerInventoryData + + +*/ +func (a *ManagementPlaneApiFabricContainerInventoryApiService) AddContainerInventoryUpdateUpdates(ctx context.Context, clusterId string, containerInventoryData containerinventory.ContainerInventoryData) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/inventory/container/{cluster-id}?action=updates" + localVarPath = strings.Replace(localVarPath, "{"+"cluster-id"+"}", fmt.Sprintf("%v", clusterId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &containerInventoryData + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + + } + + return localVarHttpResponse, nil +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/api_container_projects.go b/vendor/github.com/vmware/go-vmware-nsxt/api_container_projects.go new file mode 100644 index 000000000..3ba3d0056 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/api_container_projects.go @@ -0,0 +1,230 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package nsxt + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/antihax/optional" + "github.com/vmware/go-vmware-nsxt/containerinventory" +) + +// Linger please +var ( + _ context.Context +) + +type ManagementPlaneApiFabricContainerProjectsApiService service + +/* +ManagementPlaneApiFabricContainerProjectsApiService Return a container project +Returns information about a specific project + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param containerProjectId + +@return ContainerProject +*/ +func (a *ManagementPlaneApiFabricContainerProjectsApiService) GetContainerProject(ctx context.Context, containerProjectId string) (containerinventory.ContainerProject, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerProject + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-projects/{container-project-id}" + localVarPath = strings.Replace(localVarPath, "{"+"container-project-id"+"}", fmt.Sprintf("%v", containerProjectId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ManagementPlaneApiFabricContainerProjectsApiService Return the list of container projects +Returns information about all container projects + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ListContainerProjectsOpts - Optional Parameters: + * @param "ContainerClusterId" (optional.String) - Identifier of the container cluster + * @param "Cursor" (optional.String) - Opaque cursor to be used for getting next page of records (supplied by current result page) + * @param "IncludedFields" (optional.String) - Comma separated list of fields that should be included in query result + * @param "PageSize" (optional.Int64) - Maximum number of results to return in this page (server may return fewer) + * @param "SortAscending" (optional.Bool) - + * @param "SortBy" (optional.String) - Field by which records are sorted + +@return ContainerProjectListResult +*/ + +type ListContainerProjectsOpts struct { + ContainerClusterId optional.String + Cursor optional.String + IncludedFields optional.String + PageSize optional.Int64 + SortAscending optional.Bool + SortBy optional.String +} + +func (a *ManagementPlaneApiFabricContainerProjectsApiService) ListContainerProjects(ctx context.Context, localVarOptionals *ListContainerProjectsOpts) (containerinventory.ContainerProjectListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue containerinventory.ContainerProjectListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fabric/container-projects" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ContainerClusterId.IsSet() { + localVarQueryParams.Add("container_cluster_id", parameterToString(localVarOptionals.ContainerClusterId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Cursor.IsSet() { + localVarQueryParams.Add("cursor", parameterToString(localVarOptionals.Cursor.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludedFields.IsSet() { + localVarQueryParams.Add("included_fields", parameterToString(localVarOptionals.IncludedFields.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PageSize.IsSet() { + localVarQueryParams.Add("page_size", parameterToString(localVarOptionals.PageSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortAscending.IsSet() { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarOptionals.SortAscending.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() { + localVarQueryParams.Add("sort_by", parameterToString(localVarOptionals.SortBy.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + var v ApiError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/common/network_error.go b/vendor/github.com/vmware/go-vmware-nsxt/common/network_error.go new file mode 100644 index 000000000..05d992853 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/common/network_error.go @@ -0,0 +1,20 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package common + +// Network error related to container objects. +type NetworkError struct { + // Error code of network related error. + ErrorCode string `json:"error_code,omitempty"` + // Detailed message of network related error. + ErrorMessage string `json:"error_message,omitempty"` + // Additional error information in json format. + Spec string `json:"spec,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/configuration.go b/vendor/github.com/vmware/go-vmware-nsxt/configuration.go index 315cc15ea..ab5aa66f8 100644 --- a/vendor/github.com/vmware/go-vmware-nsxt/configuration.go +++ b/vendor/github.com/vmware/go-vmware-nsxt/configuration.go @@ -43,6 +43,9 @@ type Configuration struct { ClientAuthCertFile string ClientAuthKeyFile string CAFile string + ClientAuthCertString string + ClientAuthKeyString string + CAString string Insecure bool RetriesConfiguration ClientRetriesConfiguration HTTPClient *http.Client diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application.go new file mode 100644 index 000000000..c4d206df5 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application.go @@ -0,0 +1,48 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +// Container application within a project. +type ContainerApplication struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Timestamp of last modification + LastSyncTime int64 `json:"_last_sync_time,omitempty"` + // Description of this resource + Description string `json:"description,omitempty"` + // Defaults to ID if not set + DisplayName string `json:"display_name,omitempty"` + // The type of this resource. + ResourceType string `json:"resource_type"` + // Opaque identifiers meaningful to the API user + Tags []common.Tag `json:"tags,omitempty"` + // Identifier of the container cluster this container application belongs to. + ContainerClusterId string `json:"container_cluster_id,omitempty"` + // Identifier of the project which this container application belongs to. + ContainerProjectId string `json:"container_project_id,omitempty"` + // Identifier of the container application on container cluster e.g. PCF app id, k8s service id. + ExternalId string `json:"external_id"` + // List of network errors related to container application. + NetworkErrors []common.NetworkError `json:"network_errors,omitempty"` + // Network status of container application. + NetworkStatus string `json:"network_status,omitempty"` + // Array of additional specific properties of container application in key-value format. + OriginProperties []common.KeyValuePair `json:"origin_properties,omitempty"` + // Status of the container application. + Status string `json:"status,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_instance.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_instance.go new file mode 100644 index 000000000..ebcf516bb --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_instance.go @@ -0,0 +1,52 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +// Container application instance within a project. +type ContainerApplicationInstance struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Timestamp of last modification + LastSyncTime int64 `json:"_last_sync_time,omitempty"` + // Description of this resource + Description string `json:"description,omitempty"` + // Defaults to ID if not set + DisplayName string `json:"display_name,omitempty"` + // The type of this resource. + ResourceType string `json:"resource_type"` + // Opaque identifiers meaningful to the API user + Tags []common.Tag `json:"tags,omitempty"` + // Cluster node id where application instance is running. + ClusterNodeId string `json:"cluster_node_id,omitempty"` + // List of identifiers of the container application. + ContainerApplicationIds []string `json:"container_application_ids,omitempty"` + // Identifier of the container cluster this application instance belongs to. + ContainerClusterId string `json:"container_cluster_id,omitempty"` + // Identifier of the container project which this container application instance belongs to. + ContainerProjectId string `json:"container_project_id,omitempty"` + // Identifier of the container application instance on container cluster. + ExternalId string `json:"external_id"` + // List of network errors related to container application instance. + NetworkErrors []common.NetworkError `json:"network_errors,omitempty"` + // Network status of container application instance. + NetworkStatus string `json:"network_status,omitempty"` + // Array of additional specific properties of container application instance in key-value format. + OriginProperties []common.KeyValuePair `json:"origin_properties,omitempty"` + // Status of the container application instance. + Status string `json:"status,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_instance_list_result.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_instance_list_result.go new file mode 100644 index 000000000..024084b41 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_instance_list_result.go @@ -0,0 +1,33 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +type ContainerApplicationInstanceListResult struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Opaque cursor to be used for getting next page of records (supplied by current result page) + Cursor string `json:"cursor,omitempty"` + // Count of results found (across all pages), set only on first page + ResultCount int64 `json:"result_count,omitempty"` + // If true, results are sorted in ascending order + SortAscending bool `json:"sort_ascending,omitempty"` + // Field by which records are sorted + SortBy string `json:"sort_by,omitempty"` + // List of Container Applications + Results []ContainerApplicationInstance `json:"results"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_list_result.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_list_result.go new file mode 100644 index 000000000..d900730d7 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_application_list_result.go @@ -0,0 +1,33 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +type ContainerApplicationListResult struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Opaque cursor to be used for getting next page of records (supplied by current result page) + Cursor string `json:"cursor,omitempty"` + // Count of results found (across all pages), set only on first page + ResultCount int64 `json:"result_count,omitempty"` + // If true, results are sorted in ascending order + SortAscending bool `json:"sort_ascending,omitempty"` + // Field by which records are sorted + SortBy string `json:"sort_by,omitempty"` + // List of Container Applications + Results []ContainerApplication `json:"results"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster.go new file mode 100644 index 000000000..ced820eda --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster.go @@ -0,0 +1,46 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +// Details of container cluster. +type ContainerCluster struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Timestamp of last modification + LastSyncTime int64 `json:"_last_sync_time,omitempty"` + // Description of this resource + Description string `json:"description,omitempty"` + // Defaults to ID if not set + DisplayName string `json:"display_name,omitempty"` + // The type of this resource. + ResourceType string `json:"resource_type"` + // Opaque identifiers meaningful to the API user + Tags []common.Tag `json:"tags,omitempty"` + // Type of the container cluster. In case of creating container cluster first time, it is expected to pass the valid cluster-type. In case of update, if there is no change in cluster-type, then this field can be omitted in the request. + ClusterType string `json:"cluster_type,omitempty"` + // External identifier of the container cluster. + ExternalId string `json:"external_id,omitempty"` + // Details of underlying infrastructure that hosts the container cluster. In case of creating container cluster first time, it is expected to pass the valid infrastructure. In case of update, if there is no change in cluster-type, then this field can be omitted in the request. + Infrastructure *ContainerInfrastructureInfo `json:"infrastructure,omitempty"` + // List of network errors related to container cluster. + NetworkErrors []common.NetworkError `json:"network_errors,omitempty"` + // Network status of container cluster. + NetworkStatus string `json:"network_status,omitempty"` + // Array of additional specific properties of container cluster in key-value format. + OriginProperties []common.KeyValuePair `json:"origin_properties,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_list_result.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_list_result.go new file mode 100644 index 000000000..e800c107c --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_list_result.go @@ -0,0 +1,33 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +type ContainerClusterListResult struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Opaque cursor to be used for getting next page of records (supplied by current result page) + Cursor string `json:"cursor,omitempty"` + // Count of results found (across all pages), set only on first page + ResultCount int64 `json:"result_count,omitempty"` + // If true, results are sorted in ascending order + SortAscending bool `json:"sort_ascending,omitempty"` + // Field by which records are sorted + SortBy string `json:"sort_by,omitempty"` + // List of Container Clusters + Results []ContainerCluster `json:"results"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_node.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_node.go new file mode 100644 index 000000000..969e686f6 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_node.go @@ -0,0 +1,46 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +// Details of container cluster node i.e. container host. +type ContainerClusterNode struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Timestamp of last modification + LastSyncTime int64 `json:"_last_sync_time,omitempty"` + // Description of this resource + Description string `json:"description,omitempty"` + // Defaults to ID if not set + DisplayName string `json:"display_name,omitempty"` + // The type of this resource. + ResourceType string `json:"resource_type"` + // Opaque identifiers meaningful to the API user + Tags []common.Tag `json:"tags,omitempty"` + // External identifier of the container cluster. + ContainerClusterId string `json:"container_cluster_id,omitempty"` + // External identifier of the container cluster node in K8S/PAS. + ExternalId string `json:"external_id"` + // List of IP addresses of container cluster node. + IpAddresses []string `json:"ip_addresses,omitempty"` + // List of network errors related to container cluster node. + NetworkErrors []common.NetworkError `json:"network_errors,omitempty"` + // Network status of container cluster node. + NetworkStatus string `json:"network_status,omitempty"` + // Array of additional specific properties of container cluster node in key-value format. + OriginProperties []common.KeyValuePair `json:"origin_properties,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_node_list_result.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_node_list_result.go new file mode 100644 index 000000000..856138d27 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_cluster_node_list_result.go @@ -0,0 +1,33 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +type ContainerClusterNodeListResult struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Opaque cursor to be used for getting next page of records (supplied by current result page) + Cursor string `json:"cursor,omitempty"` + // Count of results found (across all pages), set only on first page + ResultCount int64 `json:"result_count,omitempty"` + // If true, results are sorted in ascending order + SortAscending bool `json:"sort_ascending,omitempty"` + // Field by which records are sorted + SortBy string `json:"sort_by,omitempty"` + // List of container cluster nodes + Results []ContainerClusterNode `json:"results"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_infrastructure_info.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_infrastructure_info.go new file mode 100644 index 000000000..17c3ebb51 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_infrastructure_info.go @@ -0,0 +1,16 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +// Details of infrastructure hosting the container cluster e.g. vSphere, AWS, VMC etc.. +type ContainerInfrastructureInfo struct { + // Type of the infrastructure. + InfraType string `json:"infra_type"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_ingress_policy.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_ingress_policy.go new file mode 100644 index 000000000..6a0044e82 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_ingress_policy.go @@ -0,0 +1,50 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +// Details of Container Ingress Policy. +type ContainerIngressPolicy struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Timestamp of last modification + LastSyncTime int64 `json:"_last_sync_time,omitempty"` + // Description of this resource + Description string `json:"description,omitempty"` + // Defaults to ID if not set + DisplayName string `json:"display_name,omitempty"` + // The type of this resource. + ResourceType string `json:"resource_type"` + // Opaque identifiers meaningful to the API user + Tags []common.Tag `json:"tags,omitempty"` + // List of identifiers of the container application , on which ingress policy is applied. e.g. IDs of all services on which the ingress is applied in kubernetes. + ContainerApplicationIds []string `json:"container_application_ids,omitempty"` + // Identifier of the container cluster this ingress policy belongs to. + ContainerClusterId string `json:"container_cluster_id,omitempty"` + // Identifier of the project which this container ingress belongs to. + ContainerProjectId string `json:"container_project_id,omitempty"` + // Identifier of the container ingress policy. + ExternalId string `json:"external_id"` + // List of network errors related to container ingress. + NetworkErrors []common.NetworkError `json:"network_errors,omitempty"` + // Network status of container ingress. + NetworkStatus string `json:"network_status,omitempty"` + // Array of additional specific properties of container ingress in key-value format. + OriginProperties []common.KeyValuePair `json:"origin_properties,omitempty"` + // Container ingress policy specification. + Spec string `json:"spec,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_ingress_policy_list_result.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_ingress_policy_list_result.go new file mode 100644 index 000000000..745b5d5e6 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_ingress_policy_list_result.go @@ -0,0 +1,33 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +type ContainerIngressPolicyListResult struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Opaque cursor to be used for getting next page of records (supplied by current result page) + Cursor string `json:"cursor,omitempty"` + // Count of results found (across all pages), set only on first page + ResultCount int64 `json:"result_count,omitempty"` + // If true, results are sorted in ascending order + SortAscending bool `json:"sort_ascending,omitempty"` + // Field by which records are sorted + SortBy string `json:"sort_by,omitempty"` + // List of Container Ingress Policy specs + Results []ContainerIngressPolicy `json:"results"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_inventory_data.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_inventory_data.go new file mode 100644 index 000000000..ba87efdb0 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_inventory_data.go @@ -0,0 +1,15 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +type ContainerInventoryData struct { + // List of container inventory objects + ContainerInventoryObjects []ContainerInventoryObject `json:"container_inventory_objects,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_inventory_object.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_inventory_object.go new file mode 100644 index 000000000..555c680f4 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_inventory_object.go @@ -0,0 +1,17 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +type ContainerInventoryObject struct { + // Container object + ContainerObject map[string]interface{} `json:"container_object"` + // Object update type, one of CREATE, UPDATE, DELETE + ObjectUpdateType string `json:"object_update_type"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_network_policy.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_network_policy.go new file mode 100644 index 000000000..ff70691fc --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_network_policy.go @@ -0,0 +1,50 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +// Network policy applied to container. +type ContainerNetworkPolicy struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Timestamp of last modification + LastSyncTime int64 `json:"_last_sync_time,omitempty"` + // Description of this resource + Description string `json:"description,omitempty"` + // Defaults to ID if not set + DisplayName string `json:"display_name,omitempty"` + // The type of this resource. + ResourceType string `json:"resource_type"` + // Opaque identifiers meaningful to the API user + Tags []common.Tag `json:"tags,omitempty"` + // Identifier of the container cluster this network policy belongs to. + ContainerClusterId string `json:"container_cluster_id,omitempty"` + // Identifier of the project which this network policy belongs to. + ContainerProjectId string `json:"container_project_id,omitempty"` + // Identifier of the container network policy. + ExternalId string `json:"external_id"` + // List of network errors related to container network policy. + NetworkErrors []common.NetworkError `json:"network_errors,omitempty"` + // Network status of container network policy. + NetworkStatus string `json:"network_status,omitempty"` + // Array of additional specific properties of container network policy in key-value format. + OriginProperties []common.KeyValuePair `json:"origin_properties,omitempty"` + // Type e.g. Network Policy, ASG. + PolicyType string `json:"policy_type,omitempty"` + // Container network policy specification. + Spec string `json:"spec,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_network_policy_list_result.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_network_policy_list_result.go new file mode 100644 index 000000000..f954d5c01 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_network_policy_list_result.go @@ -0,0 +1,33 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +type ContainerNetworkPolicyListResult struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Opaque cursor to be used for getting next page of records (supplied by current result page) + Cursor string `json:"cursor,omitempty"` + // Count of results found (across all pages), set only on first page + ResultCount int64 `json:"result_count,omitempty"` + // If true, results are sorted in ascending order + SortAscending bool `json:"sort_ascending,omitempty"` + // Field by which records are sorted + SortBy string `json:"sort_by,omitempty"` + // List of Container Network Policy specs + Results []ContainerNetworkPolicy `json:"results"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_project.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_project.go new file mode 100644 index 000000000..a83e919a9 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_project.go @@ -0,0 +1,44 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +// Details of org/namespace within a container cluster. +type ContainerProject struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Timestamp of last modification + LastSyncTime int64 `json:"_last_sync_time,omitempty"` + // Description of this resource + Description string `json:"description,omitempty"` + // Defaults to ID if not set + DisplayName string `json:"display_name,omitempty"` + // The type of this resource. + ResourceType string `json:"resource_type"` + // Opaque identifiers meaningful to the API user + Tags []common.Tag `json:"tags,omitempty"` + // Identifier of the container cluster to which this project/namespace belongs. + ContainerClusterId string `json:"container_cluster_id,omitempty"` + // External identifier of the container project. + ExternalId string `json:"external_id"` + // List of network errors related to container project. + NetworkErrors []common.NetworkError `json:"network_errors,omitempty"` + // Network status of container project. + NetworkStatus string `json:"network_status,omitempty"` + // Array of additional specific properties of container project in key-value format. + OriginProperties []common.KeyValuePair `json:"origin_properties,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_project_list_result.go b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_project_list_result.go new file mode 100644 index 000000000..7e4b0e216 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/containerinventory/container_project_list_result.go @@ -0,0 +1,33 @@ +/* + * NSX-T Manager API + * + * VMware NSX-T Manager REST API + * + * API version: 3.0.0.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package containerinventory + +import ( + "github.com/vmware/go-vmware-nsxt/common" +) + +type ContainerProjectListResult struct { + // The server will populate this field when returing the resource. Ignored on PUT and POST. + Links []common.ResourceLink `json:"_links,omitempty"` + // Schema for this resource + Schema string `json:"_schema,omitempty"` + // Link to this resource + Self *common.SelfResourceLink `json:"_self,omitempty"` + // Opaque cursor to be used for getting next page of records (supplied by current result page) + Cursor string `json:"cursor,omitempty"` + // Count of results found (across all pages), set only on first page + ResultCount int64 `json:"result_count,omitempty"` + // If true, results are sorted in ascending order + SortAscending bool `json:"sort_ascending,omitempty"` + // Field by which records are sorted + SortBy string `json:"sort_by,omitempty"` + // List of projects + Results []ContainerProject `json:"results"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/go.mod b/vendor/github.com/vmware/go-vmware-nsxt/go.mod new file mode 100644 index 000000000..08a57be2f --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/go.mod @@ -0,0 +1,8 @@ +module github.com/vmware/go-vmware-nsxt + +go 1.13 + +require ( + github.com/antihax/optional v1.0.0 + golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 +) diff --git a/vendor/github.com/vmware/go-vmware-nsxt/go.sum b/vendor/github.com/vmware/go-vmware-nsxt/go.sum new file mode 100644 index 000000000..ce55b3c6a --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/go.sum @@ -0,0 +1,15 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_member_statistics.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_member_statistics.go new file mode 100644 index 000000000..dac2ca4e9 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_member_statistics.go @@ -0,0 +1,12 @@ +package loadbalancer + +type LbPoolMemberStatistics struct { + // Pool member IP Address + IPAddress string `json:"ip_address"` + + // Pool member port + Port string `json:"port,omitempty"` + + // Pool member statistics counter + Statistics LbStatisticsCounter `json:"statistics"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_member_status.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_member_status.go new file mode 100644 index 000000000..9cb624ca4 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_member_status.go @@ -0,0 +1,20 @@ +package loadbalancer + +type LbPoolMemberStatus struct { + + // The healthcheck failure cause when status is DOWN + FailureCause string `json:"failure_cause,omitempty"` + + // Pool member status + IPAddress string `json:"ip_address"` + + LastCheckTime int64 `json:"last_check_time,omitempty"` + + LastStateChangeTime int64 `json:"last_state_change_time,omitempty"` + + // Pool member port + Port string `json:"port,omitempty"` + + // Pool member status + Status string `json:"status"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_statistics.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_statistics.go new file mode 100644 index 000000000..c86a0d96f --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_statistics.go @@ -0,0 +1,15 @@ +package loadbalancer + +type LbPoolStatistics struct { + // Timestamp when the data was last updated + LastUpdateTimestamp int64 `json:"last_update_timestamp,omitempty"` + + // Statistics of load balancer pool members + Members []LbPoolMemberStatistics `json:"members,omitempty"` + + // Load balancer pool identifier + PoolId string `json:"pool_id"` + + // Load balancer statistics counter + Statistics LbStatisticsCounter `json:"statistics"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_status.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_status.go new file mode 100644 index 000000000..959808f07 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_pool_status.go @@ -0,0 +1,16 @@ +package loadbalancer + +type LbPoolStatus struct { + + // Timestamp when the data was last updated + LastUpdateTimestamp int64 `json:"last_update_timestamp,omitempty"` + + // Status of load balancer pool members + Members []LbPoolMemberStatus `json:"members,omitempty"` + + // Load balancer pool identifier + PoolId string `json:"pool_id"` + + // Virtual server status + Status string `json:"status"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_statisitcs_counter.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_statisitcs_counter.go new file mode 100644 index 000000000..33f3f1815 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_statisitcs_counter.go @@ -0,0 +1,27 @@ +package loadbalancer + +type LbServiceStatisticsCounter struct { + // Number of l4 current sessions + L4CurrentSessions int64 `json:"l4_current_sessions,omitempty"` + + // The average number of l4 current sessions per second, the number is averaged over the last 5 one-second intervals. + L4CurrentSessionRate float64 `json:"l4_current_session_rate,omitempty"` + + // Number of l4 maximum sessions + L4MaxSessions int64 `json:"l4_max_sessions,omitempty"` + + // Number of l4 total sessions + L4TotalSessions int64 `json:"l4_total_sessions,omitempty"` + + // Number of l7 current sessions + L7CurrentSessions int64 `json:"l7_current_sessions,omitempty"` + + // The average number of l7 current sessions per second, the number is averaged over the last 5 one-second intervals. + L7CurrentSessionRate float64 `json:"l7_current_session_rate,omitempty"` + + // Number of l7 maximum sessions + L7MaxSessions int64 `json:"l7_max_sessions,omitempty"` + + // Number of l7 total sessions + L7TotalSessions int64 `json:"l7_total_sessions,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_statistics.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_statistics.go new file mode 100644 index 000000000..7f60f1887 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_statistics.go @@ -0,0 +1,18 @@ +package loadbalancer + +type LbServiceStatistics struct { + // Timestamp when the data was last updated + LastUpdateTimestamp int64 `json:"last_update_timestamp,omitempty"` + + // Statistics of load balancer pools + Pools []LbPoolStatistics `json:"pools,omitempty"` + + // Load balancer service identifier + ServiceId string `json:"service_id"` + + // Load balancer service statistics counter + Statistics LbServiceStatisticsCounter `json:"statistics,omitempty"` + + // Statistics of load balancer virtual servers + VirtualServes []LbVirtualServerStatistics `json:"virtual_servers,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_status.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_status.go new file mode 100644 index 000000000..d08417292 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_service_status.go @@ -0,0 +1,34 @@ +package loadbalancer + +type LbServiceStatus struct { + + // Ids of load balancer service related active transport nodes + ActiveTransportNodes []string `json:"active_transport_nodes,omitempty"` + + // Cpu usage in percentage + CPUUsage int64 `json:"cpu_usage"` + + // Cpu usage in percentage + ErrorMessage string `json:"error_message,omitempty"` + + // Timestamp when the data was last updated + LastUpdateTimestamp int64 `json:"last_update_timestamp,omitempty"` + + // Memory usage in percentage + MemoryUsage int64 `json:"memory_usage"` + + // status of load balancer pools + Pools []LbPoolStatus `json:"pools,omitempty"` + + // Load balancer service identifier + ServiceId string `json:"service_id"` + + // Status of load balancer service + ServiceStatus string `json:"service_status"` + + // Ids of load balancer service related standby transport nodes + StandbyTransportNodes []string `json:"standby_transport_nodes,omitempty"` + + // status of load balancer virtual servers + VirtualServers []LbVirtualServerStatus `json:"virtual_servers,omitempty"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_statistics_counter.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_statistics_counter.go new file mode 100644 index 000000000..20196f54a --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_statistics_counter.go @@ -0,0 +1,48 @@ +package loadbalancer + +type LbStatisticsCounter struct { + // Number of bytes in + BytesIn int64 `json:"bytes_in"` + + // The average number of inbound bytes per second, the number is averaged over the last 5 one-second intervals. + BytesInRate float64 `json:"bytes_in_rate,omitempty"` + + // Number of bytes out + BytesOut int64 `json:"bytes_out"` + + // The average number of outbound bytes per second, the number is averaged over the last 5 one-second intervals. + BytesOutRate float64 `json:"bytes_out_rate,omitempty"` + + // Number of current sessions + CurrentSessions int64 `json:"current_sessions"` + + // The average number of current sessions per second, the number is averaged over the last 5 one-second intervals. + CurrentSessionRate float64 `json:"current_session_rate,omitempty"` + + // Number of http requests + HttpRequests int64 `json:"http_requests"` + + // The average number of http requests per second, the number is averaged over the last 5 one-second intervals. + HttpRequestRate float64 `json:"http_request_rate,omitempty"` + + // Number of maximum sessions + MaxSessions int64 `json:"max_sessions"` + + // Number of packets in + PacketsIn int64 `json:"packets_in,omitempty"` + + // The average number of inbound packets per second, the number is averaged over the last 5 one-second intervals. + PacketsInRate float64 `json:"packets_in_rate,omitempty"` + + // Number of packets out + PacketsOut int64 `json:"packets_out,omitempty"` + + // The average number of outbound packets per second, the number is averaged over the last 5 one-second intervals. + PacketsOutRate float64 `json:"packets_out_rate,omitempty"` + + // Number of source IP persistence entries + SourceIPPersistenceEntrySize int64 `json:"source_ip_persistence_entry_size,omitempty"` + + // Number of total sessions + TotalSessions int64 `json:"total_sessions"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_virtual_server_statistics.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_virtual_server_statistics.go new file mode 100644 index 000000000..3e0b12c55 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_virtual_server_statistics.go @@ -0,0 +1,12 @@ +package loadbalancer + +type LbVirtualServerStatistics struct { + // Timestamp when the data was last updated + LastUpdateTimestamp int64 `json:"last_update_timestamp,omitempty"` + + // Load balancer virtual server identifier + VirtualServerId string `json:"virtual_server_id"` + + // Virtual server statistics counter + Statistics LbStatisticsCounter `json:"statistics"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_virtual_server_status.go b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_virtual_server_status.go new file mode 100644 index 000000000..b31af5a73 --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/loadbalancer/lb_virtual_server_status.go @@ -0,0 +1,13 @@ +package loadbalancer + +type LbVirtualServerStatus struct { + + // Timestamp when the data was last updated. + LastUpdateTimestamp int64 `json:"last_update_timestamp,omitempty"` + + // Virtual server status + Status string `json:"status"` + + // load balancer virtual server identifier + VirtualServerId string `json:"virtual_server_id"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/manager/attachment_context.go b/vendor/github.com/vmware/go-vmware-nsxt/manager/attachment_context.go index f5cc64069..234fec05b 100644 --- a/vendor/github.com/vmware/go-vmware-nsxt/manager/attachment_context.go +++ b/vendor/github.com/vmware/go-vmware-nsxt/manager/attachment_context.go @@ -12,4 +12,7 @@ type AttachmentContext struct { // Used to identify which concrete class it is ResourceType string `json:"resource_type"` + + // Used to indicate what the port is created for + VifType string `json:"vif_type,omitempty"` } diff --git a/vendor/github.com/vmware/go-vmware-nsxt/manager/extra_config.go b/vendor/github.com/vmware/go-vmware-nsxt/manager/extra_config.go new file mode 100644 index 000000000..c7c76ae0f --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/manager/extra_config.go @@ -0,0 +1,12 @@ +/* Copyright © 2017 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: BSD-2-Clause + + Generated by: https://github.com/swagger-api/swagger-codegen.git */ + +package manager + +// Extra config is intended for supporting vendor specific configuration on the data path, it can be set as key value string pairs on either logical switch or logical port. If it was set on logical switch, it will be inherited automatically by logical ports in it. Also logical port setting will override logical switch setting if specific key was dual set on both logical switch and logical port. +type ExtraConfig struct { + // Key value pair in string for the configuration + ConfigPair *UnboundedKeyValuePair `json:"config_pair"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/manager/firewall_stats.go b/vendor/github.com/vmware/go-vmware-nsxt/manager/firewall_stats.go index 3fc4dc2f8..572b515b7 100644 --- a/vendor/github.com/vmware/go-vmware-nsxt/manager/firewall_stats.go +++ b/vendor/github.com/vmware/go-vmware-nsxt/manager/firewall_stats.go @@ -19,14 +19,14 @@ type FirewallStats struct { Self *common.SelfResourceLink `json:"_self,omitempty"` // Aggregated number of bytes processed by the rule. - ByteCount string `json:"byte_count,omitempty"` + ByteCount int64 `json:"byte_count,omitempty"` // Aggregated number of packets processed by the rule. - PacketCount string `json:"packet_count,omitempty"` + PacketCount int64 `json:"packet_count,omitempty"` // Rule Identifier of the Firewall rule. This is a globally unique number. RuleId string `json:"rule_id,omitempty"` // Aggregated number of sessions processed by the rule - SessionCount string `json:"session_count,omitempty"` + SessionCount int64 `json:"session_count,omitempty"` } diff --git a/vendor/github.com/vmware/go-vmware-nsxt/manager/logical_port.go b/vendor/github.com/vmware/go-vmware-nsxt/manager/logical_port.go index a116883ea..fe7965084 100644 --- a/vendor/github.com/vmware/go-vmware-nsxt/manager/logical_port.go +++ b/vendor/github.com/vmware/go-vmware-nsxt/manager/logical_port.go @@ -60,6 +60,9 @@ type LogicalPort struct { // Logical port attachment Attachment *LogicalPortAttachment `json:"attachment,omitempty"` + // This property could be used for vendor specific configuration in key value string pairs. Logical port setting will override logical switch setting if the same key was set on both logical switch and logical port. + ExtraConfigs []ExtraConfig `json:"extra_configs,omitempty"` + // Id of the Logical switch that this port belongs to. LogicalSwitchId string `json:"logical_switch_id"` diff --git a/vendor/github.com/vmware/go-vmware-nsxt/manager/unbounded_key_value_pair.go b/vendor/github.com/vmware/go-vmware-nsxt/manager/unbounded_key_value_pair.go new file mode 100644 index 000000000..e3680d7ed --- /dev/null +++ b/vendor/github.com/vmware/go-vmware-nsxt/manager/unbounded_key_value_pair.go @@ -0,0 +1,15 @@ +/* Copyright © 2017 VMware, Inc. All Rights Reserved. + SPDX-License-Identifier: BSD-2-Clause + + Generated by: https://github.com/swagger-api/swagger-codegen.git */ + +package manager + +// A key-value pair with no limitations on size +type UnboundedKeyValuePair struct { + // Key + Key string `json:"key"` + + // Value + Value string `json:"value"` +} diff --git a/vendor/github.com/vmware/go-vmware-nsxt/services_api.go b/vendor/github.com/vmware/go-vmware-nsxt/services_api.go index 99f09536a..3a5baa1da 100644 --- a/vendor/github.com/vmware/go-vmware-nsxt/services_api.go +++ b/vendor/github.com/vmware/go-vmware-nsxt/services_api.go @@ -8329,6 +8329,152 @@ func (a *ServicesApiService) ReadLoadBalancerService(ctx context.Context, servic return successPayload, localVarHttpResponse, err } +/* ServicesApiService Retrieve a status of load balancer service. +Retrieve a status of load balancer service. +* @param ctx context.Context for authentication, logging, tracing, etc. +@param serviceId +@param optional (nil or map[string]interface{}) with one or more of: + @param "source" (string) Data source type. +@return loadbalancer.LbServiceStatus*/ +func (a *ServicesApiService) ReadLoadBalancerServiceStatus(ctx context.Context, serviceId string, localVarOptionals map[string]interface{}) (loadbalancer.LbServiceStatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload loadbalancer.LbServiceStatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loadbalancer/services/{service-id}/status" + localVarPath = strings.Replace(localVarPath, "{"+"service-id"+"}", fmt.Sprintf("%v", serviceId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["source"], "string", "source"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["source"].(string); localVarOk { + localVarQueryParams.Add("source", parameterToString(localVarTempParam, "")) + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + return successPayload, localVarHttpResponse, err +} + +/* ServicesApiService Retrieve a statistics of load balancer service. +Retrieve the statistics of load balancer service. +* @param ctx context.Context for authentication, logging, tracing, etc. +@param serviceId +@param optional (nil or map[string]interface{}) with one or more of: + @param "source" (string) Data source type. +@return loadbalancer.LbServiceStatistics*/ +func (a *ServicesApiService) ReadLoadBalancerServiceStatistics(ctx context.Context, serviceId string, localVarOptionals map[string]interface{}) (loadbalancer.LbServiceStatistics, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload loadbalancer.LbServiceStatistics + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loadbalancer/services/{service-id}/statistics" + localVarPath = strings.Replace(localVarPath, "{"+"service-id"+"}", fmt.Sprintf("%v", serviceId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["source"], "string", "source"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["source"].(string); localVarOk { + localVarQueryParams.Add("source", parameterToString(localVarTempParam, "")) + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + return successPayload, localVarHttpResponse, err +} + /* ServicesApiService Read the debug information of the load balancer service API to download below information which will be used for debugging and troubleshooting. 1) Load balancer service 2) Load balancer associated virtual servers 3) Load balancer associated pools 4) Load balancer associated profiles such as persistence, SSL, application. 5) Load balancer associated monitors 6) Load balancer associated rules * @param ctx context.Context for authentication, logging, tracing, etc. @@ -11820,3 +11966,387 @@ func (a *ServicesApiService) UpdateSectionWithRulesUpdateWithRules(ctx context.C return successPayload, localVarHttpResponse, err } + +/* ServicesApiService Get a paginated list of Lb services + @param ctx context.Context Authentication Context +@param optional (nil or map[string]interface{}) with one or more of: + @param "cursor" (string) Opaque cursor to be used for getting next page of records (supplied by current result page) + @param "includedFields" (string) Comma separated list of fields that should be included to result of query + @param "pageSize" (int64) Maximum number of results to return in this page (server may return fewer) + @param "sortAscending" (bool) + @param "sortBy" (string) Field by which records are sorted +@return l.LbServiceListResult*/ +func (a *ServicesApiService) ListLoadBalancerServices(ctx context.Context, localVarOptionals map[string]interface{}) (loadbalancer.LbServiceListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload loadbalancer.LbServiceListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loadbalancer/services" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["cursor"], "string", "cursor"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["includedFields"], "string", "includedFields"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["pageSize"], "int64", "pageSize"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sortAscending"], "bool", "sortAscending"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sortBy"], "string", "sortBy"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["cursor"].(string); localVarOk { + localVarQueryParams.Add("cursor", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["includedFields"].(string); localVarOk { + localVarQueryParams.Add("included_fields", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["pageSize"].(int64); localVarOk { + localVarQueryParams.Add("page_size", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sortAscending"].(bool); localVarOk { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sortBy"].(string); localVarOk { + localVarQueryParams.Add("sort_by", parameterToString(localVarTempParam, "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + return successPayload, localVarHttpResponse, err +} + +/* ServicesApiService Get a paginated list of Lb virtual servers + @param ctx context.Context Authentication Context +@param optional (nil or map[string]interface{}) with one or more of: + @param "cursor" (string) Opaque cursor to be used for getting next page of records (supplied by current result page) + @param "includedFields" (string) Comma separated list of fields that should be included to result of query + @param "pageSize" (int64) Maximum number of results to return in this page (server may return fewer) + @param "sortAscending" (bool) + @param "sortBy" (string) Field by which records are sorted +@return l.LbVirtualServerListResult*/ +func (a *ServicesApiService) ListLoadBalancerVirtualServers(ctx context.Context, localVarOptionals map[string]interface{}) (loadbalancer.LbVirtualServerListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload loadbalancer.LbVirtualServerListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loadbalancer/virtual-servers" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["cursor"], "string", "cursor"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["includedFields"], "string", "includedFields"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["pageSize"], "int64", "pageSize"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sortAscending"], "bool", "sortAscending"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sortBy"], "string", "sortBy"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["cursor"].(string); localVarOk { + localVarQueryParams.Add("cursor", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["includedFields"].(string); localVarOk { + localVarQueryParams.Add("included_fields", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["pageSize"].(int64); localVarOk { + localVarQueryParams.Add("page_size", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sortAscending"].(bool); localVarOk { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sortBy"].(string); localVarOk { + localVarQueryParams.Add("sort_by", parameterToString(localVarTempParam, "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + return successPayload, localVarHttpResponse, err +} + +/* ServicesApiService Get a paginated list of Lb pools + @param ctx context.Context Authentication Context +@param optional (nil or map[string]interface{}) with one or more of: + @param "cursor" (string) Opaque cursor to be used for getting next page of records (supplied by current result page) + @param "includedFields" (string) Comma separated list of fields that should be included to result of query + @param "pageSize" (int64) Maximum number of results to return in this page (server may return fewer) + @param "sortAscending" (bool) + @param "sortBy" (string) Field by which records are sorted +@return l.LbPoolListResult*/ +func (a *ServicesApiService) ListLoadBalancerPools(ctx context.Context, localVarOptionals map[string]interface{}) (loadbalancer.LbPoolListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload loadbalancer.LbPoolListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loadbalancer/pools" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["cursor"], "string", "cursor"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["includedFields"], "string", "includedFields"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["pageSize"], "int64", "pageSize"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sortAscending"], "bool", "sortAscending"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sortBy"], "string", "sortBy"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["cursor"].(string); localVarOk { + localVarQueryParams.Add("cursor", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["includedFields"].(string); localVarOk { + localVarQueryParams.Add("included_fields", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["pageSize"].(int64); localVarOk { + localVarQueryParams.Add("page_size", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sortAscending"].(bool); localVarOk { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sortBy"].(string); localVarOk { + localVarQueryParams.Add("sort_by", parameterToString(localVarTempParam, "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + return successPayload, localVarHttpResponse, err +} + +/* ServicesApiService Get a paginated list of Lb monitors + @param ctx context.Context Authentication Context +@param optional (nil or map[string]interface{}) with one or more of: + @param "cursor" (string) Opaque cursor to be used for getting next page of records (supplied by current result page) + @param "includedFields" (string) Comma separated list of fields that should be included to result of query + @param "pageSize" (int64) Maximum number of results to return in this page (server may return fewer) + @param "sortAscending" (bool) + @param "sortBy" (string) Field by which records are sorted +@return l.LbMonitorListResult*/ +func (a *ServicesApiService) ListLoadBalancerMonitors(ctx context.Context, localVarOptionals map[string]interface{}) (loadbalancer.LbMonitorListResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload loadbalancer.LbMonitorListResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/loadbalancer/monitors" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["cursor"], "string", "cursor"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["includedFields"], "string", "includedFields"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["pageSize"], "int64", "pageSize"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sortAscending"], "bool", "sortAscending"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sortBy"], "string", "sortBy"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["cursor"].(string); localVarOk { + localVarQueryParams.Add("cursor", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["includedFields"].(string); localVarOk { + localVarQueryParams.Add("included_fields", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["pageSize"].(int64); localVarOk { + localVarQueryParams.Add("page_size", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sortAscending"].(bool); localVarOk { + localVarQueryParams.Add("sort_ascending", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sortBy"].(string); localVarOk { + localVarQueryParams.Add("sort_by", parameterToString(localVarTempParam, "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + return successPayload, localVarHttpResponse, err +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 548217286..3ee714c9b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -10,6 +10,8 @@ cloud.google.com/go/internal/version cloud.google.com/go/storage # github.com/agext/levenshtein v1.2.2 github.com/agext/levenshtein +# github.com/antihax/optional v1.0.0 +github.com/antihax/optional # github.com/apparentlymart/go-textseg v1.0.0 github.com/apparentlymart/go-textseg/textseg # github.com/aws/aws-sdk-go v1.25.3 @@ -243,7 +245,7 @@ github.com/ulikunitz/xz/lzma # github.com/vmihailenco/msgpack v4.0.1+incompatible github.com/vmihailenco/msgpack github.com/vmihailenco/msgpack/codes -# github.com/vmware/go-vmware-nsxt v0.0.0-20191219213550-f4221331f638 +# github.com/vmware/go-vmware-nsxt v0.0.0-20201201191552-e8b90e7eb469 ## explicit github.com/vmware/go-vmware-nsxt github.com/vmware/go-vmware-nsxt/aaa @@ -253,6 +255,7 @@ github.com/vmware/go-vmware-nsxt/apiservice github.com/vmware/go-vmware-nsxt/appdiscovery github.com/vmware/go-vmware-nsxt/association github.com/vmware/go-vmware-nsxt/common +github.com/vmware/go-vmware-nsxt/containerinventory github.com/vmware/go-vmware-nsxt/errorresolver github.com/vmware/go-vmware-nsxt/licensing github.com/vmware/go-vmware-nsxt/loadbalancer diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index 9c7ccccfa..1cea9c3a5 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -146,12 +146,16 @@ The following arguments are used to configure the VMware NSX-T Provider: also be specified with the `NSXT_USERNAME` environment variable. * `password` - (Required) The password for the NSX-T manager user. Can also be specified with the `NSXT_PASSWORD` environment variable. -* `client_auth_cert_file` - (Optional) The path to a certificate file for +* `client_auth_cert_file` - (Optional) The path to a certificate file for client certificate authorization. Can also be specified with the `NSXT_CLIENT_AUTH_CERT_FILE` environment variable. * `client_auth_key_file` - (Optional) The path to a private key file for the certificate supplied to `client_auth_cert_file`. Can also be specified with the `NSXT_CLIENT_AUTH_KEY_FILE` environment variable. +* `client_auth_cert` - (Optional) Client certificate string. + Can also be specified with the `NSXT_CLIENT_AUTH_CERT` environment variable. +* `client_auth_key` - (Optional) Client certificate private key string. + Can also be specified with the `NSXT_CLIENT_AUTH_KEY` environment variable. * `allow_unverified_ssl` - (Optional) Boolean that can be set to true to disable SSL certificate verification. This should be used with care as it could allow an attacker to intercept your auth token. If omitted, default value is @@ -160,6 +164,8 @@ The following arguments are used to configure the VMware NSX-T Provider: * `ca_file` - (Optional) The path to an optional CA certificate file for SSL validation. Can also be specified with the `NSXT_CA_FILE` environment variable. +* `ca` - (Optional) CA certificate string for SSL validation. + Can also be specified with the `NSXT_CA` environment variable. * `max_retries` - (Optional) The maximum number of retires before failing an API request. Default: `10` Can also be specified with the `NSXT_MAX_RETRIES` environment variable. Not supported yet for policy resources.