This is a Go Client Library used for accessing Cisco Container Platform (CCP).
It is currently a Proof of Concept and has been developed and tested against Cisco Container Platform 6.0 with Go version 1.15.2
Created by gh-md-toc
Download CCP Client Library
go get -u "github.com/CiscoSE/ccp-client-library/ccp"
package main
import "github.com/CiscoSE/ccp-client-library/ccp”
/*
Define new CCP client
*/
client := ccp.NewClient("admin", ”password", "https://my-ccp-address.com")
/*
Retrieve login
*/
err := client.Login(client)
if err != nil {
fmt.Println(err)
}
/*
Print Users
*/
users, err := client.GetUsers()
if err != nil {
fmt.Println(err)
} else {
for _, user := range users {
fmt.Printf("%+v\n", *user.Username)
}
}
For some situations it may be easier to have the configuration represented as JSON rather than conifguring individually as per the examples below (e.g. AddCluster). In this scenario you can either build the JSON file yourself or monitor the API POST call for the JSON data sent to CCP. This can be achieved using the browsers built in developer tools. See the following document for screenshots of how to find the POST call in the Chrome Developer Tools.
Example JSON File - newCluster.json
{
"name": "myContainerPlatformCluster",
"kubernetes_version": "1.10.1",
"ssh_key": "ssh-rsa aaabbbmysshkey me@localhost",
"description": "My first CCP Cluster",
"datacenter": "innovation-lab",
"cluster": "hx-cluster",
"resource_pool": "hx-cluster/Resources",
"datastore": "CCP",
"ssh_user": "ccp",
"template": "ccp-tenant-image-1.10.1-1.1.0.ova",
"masters": 1,
"workers": 2,
"vcpus": 2,
"memory": 16384,
"type": 1,
"ingress_vip_pool_id": "12345abcd-abcd1234-1234543221",
"network_plugin": {
"name": "contiv-vpp",
"status": "",
"details": "{\"pod_cidr\":\"192.168.0.0/16\"}"
},
"provider_client_config_uuid": "1234abcd-abcd1234-abcdabcd",
"networks": ["ccp-network/ccp-network-port-group"],
"deployer": {
"provider_type": "vsphere",
"provider": {
"vsphere_datacenter": "innovation-lab",
"vsphere_datastore": "CCP",
"vsphere_client_config_uuid": "1234abcd-abcd1234-abcdabcd",
"vsphere_working_dir": "/innovation-lab/vm"
}
}
}
package main
import (
"fmt"
"github.com/CiscoSE/ccp-client-library/ccp"
)
/*
Define new ccp client
*/
client := ccp.NewClient("admin", ”password", "https://my-ccp-address.com")
/*
Retrieve login
*/
err := client.Login(client)
if err != nil {
fmt.Println(err)
}
/*
Create cluster
*/
clusterJSONFile, err := os.Open("newCluster.json")
if err != nil {
fmt.Println(err)
}
bytes, _ := ioutil.ReadAll(clusterJSONFile)
var cluster *ccp.Cluster
json.Unmarshal(bytes, &cluster)
cluster, err = client.AddCluster(cluster)
if err != nil {
fmt.Println(err)
} else {
fmt.Println("Cluster UUID: " + *cluster.UUID)
}
defer clusterJSONFile.Close()
As per the following link, using the Marshal function from the encoding/json library treats false booleans as if they were nil values, and thus it omits them from the JSON response. To make a distinction between a non-existent boolean and false boolean we need to use a *bool
in the struct.
type User struct {
FirstName *string `json:"firstName,omitempty"`
LastName *string `json:"lastName,omitempty"`
Password *string `json:"password,omitempty"`
}
Therefore in order to have a consistent experience all struct fields within this client library use pointers. This provides a way to differentiate between unset values, nil, and an intentional zero value, such as "", false, or 0.
Helper functions have been created to simplify the creation of pointer types.
firstName := "client"
lastName := "library"
password := "myPassword"
newUser := ccp.User {
FirstName: &firstName,
LastName: &lastName,
Password: &password,
}
newUser := ccp.User {
FirstName: ccp.String("client"),
LastName: ccp.String("library"),
Password: ccp.String("myPassword"),
}
Reference: https://willnorris.com/2014/05/go-rest-apis-and-pointers
- ccp.Bool()
- ccp.Int()
- ccp.Int64()
- ccp.String()
- ccp.Float32()
- ccp.Float64()
type LivenessHealth struct {
CXVersion *string
TimeOnMgmtHost *string
}
type Health struct {
TotalSystemHealth *string
CurrentNodes *int64
ExpectedNodes *int64
NodesStatus *[]NodeStatus
PodStatusList *[]PodStatusList
}
type NodeStatus struct {
NodeName *string
NodeCondition *string
NodeStatus *string
LastTransitionTime *string
}
type PodStatusList struct {
PodName *string
PodCondition *string
PodStatus *string
LastTransitionTime *string
}
func (s *Client) Login(client *Client) error
client := ccp.NewClient("admin", ”password", "https://my-ccp-address.com")
err := client.Login(client)
if err != nil {
fmt.Println(err)
}
func (s *Client) GetLivenessHealth() (*LivenessHealth, error)
func (s *Client) GetHealth() (*Health, error)
type User struct {
Username *string
Disable *bool
Role *string
FirstName *string
LastName *string
Password *string
}
Field | Description |
---|---|
Role | Role of the user - either Administrator or Devops |
Disable | Whether or not the user account is enabled or disabled |
func (s *Client) GetUsers() ([]User, error)
users, err := client.GetUsers()
if err != nil {
fmt.Println(err)
} else {
for _, user := range users {
fmt.Printf("%+v\n", *user.Username)
}
}
func (s *Client) GetUser(username string) (*User, error)
user, err := client.GetUser("myUsername")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *user.Username)
fmt.Printf("%+v\n", *user.Role)
}
func (s *Client) AddUser(user *User) (*User, error) {
- Username
- Role
newUser := ccp.User{
FirstName: ccp.String("ccp"),
LastName: ccp.String("sdk"),
Username: ccp.String("ccp_sdk"),
Password: ccp.String("password123"),
Disable: ccp.Bool(false),
Role: ccp.String("SysAdmin"),
}
user, err := client.AddUser(&newUser)
if err != nil {
fmt.Println(err)
} else {
username := *user.Username
token := *user.Token
fmt.Println("Username: " + username + ", Token: " + token)
}
func (s *Client) PatchUser(user *User) (*User, error)
- Username
- Firstname
- LastName
- Password
- Disable
- Role
newUser := ccp.User{
Username: ccp.String("ccp_sdk"),
Role: ccp.String("Devops"),
}
user, err := client.PatchUser(&newUser)
if err != nil {
fmt.Println(err)
} else {
username := *user.Username
role := *user.Role
fmt.Println("Username: " + username + ", Role: " + role)
}
func (s *Client) DeleteUser(username string) error
err := client.DeleteUser("ccp_sdk")
if err != nil {
fmt.Println(err)
}
- GetClusters
- GetCluster
- GetClusterHealth
- GetClusterAuthz
- GetClusterDashboard
- GetClusterEnv
- GetClusterHelmCharts
- AddCluster
- AddClusterBasic
- PatchCluster
- DeleteCluster
type Cluster struct {
UUID *string
ProviderClientConfigUUID *string
ACIProfileUUID *string
Name *string
Description *string
Workers *int64
Masters *int64
ResourcePool *string
Networks *[]string
Type *int64
Datacenter *string
Cluster *string
Datastore *string
State *string
Template *string
SSHUser *string
SSHPassword *string
SSHKey *string
Labels *[]Label
Nodes *[]Node
Deployer *KubeADM
KubernetesVersion *string
ClusterEnvURL *string
ClusterDashboardURL *string
NetworkPlugin *NetworkPlugin
CCPPrivateSSHKey *string
CCPPublicSSHKey *string
NTPPools *[]string
NTPServers *[]string
IsControlCluster *bool
IsAdopt *bool
RegistriesSelfSigned *[]string
RegistriesInsecure *[]string
RegistriesRootCA *[]string
IngressVIPPoolID *string
IngressVIPAddrID *string
IngressVIPs *[]string
KeepalivedVRID *int64
HelmCharts *[]HelmChart
MasterVIPAddrID *string
MasterVIP *string
MasterMACAddresses *[]string
AuthList *[]string
IsHarborEnabled *bool
HarborAdminServerPassword *string
HarborRegistrySize *string
LoadBalancerIPNum *int64
IsIstioEnabled *bool
WorkerNodePool *WorkerNodePool
MasterNodePool *MasterNodePool
Infra *Infra
}
type Infra struct {
Datacenter *string
Datastore *string
Cluster *string
Networks *[]string
ResourcePool *string
}
type Label struct {
Key *string
Value *string
}
type Node struct {
UUID *string
Name *string
PublicIP *string
PrivateIP *string
IsMaster *bool
State *string
CloudInitData *string
KubernetesVersion *string
ErrorLog *string
Template *string
MacAddresses *[]string
}
type Deployer struct {
ProxyCMD *string
ProviderType *string
Provider *Provider
type NetworkPlugin struct {
Name *string
Status *string
Details *string
}
type HelmChart struct {
HelmChartUUID *string
ClusterUUID *string
ChartURL *string
Name *string
Options *string
}
type Provider struct {
VsphereDataCenter *string
VsphereDatastore *string
VsphereSCSIControllerType *string
VsphereWorkingDir *string
VsphereClientConfigUUID *string
ClientConfig *VsphereClientConfig
}
type VsphereClientConfig struct {
IP *string
Port *int64
Username *string
Password *string
}
type WorkerNodePool struct {
VCPUs *int64
Memory *int64
Template *string
}
type MasterNodePool struct {
VCPUs *int64
Memory *int64
Template *string
}
Type | Field | Description |
---|---|---|
Cluster | UUID | UUID of the cluster |
Cluster | ProviderClientConfigUUID | UUID of the provider for the cluster (e.g. vsphere provider) which can be found using the GetProviderClientConfigs() function |
Cluster | ACIProfileUUID | UUID of the ACI profile used with the cluster which can be found using the GetACIProfiles() function |
Cluster | Name | Name of the new cluster |
Cluster | Description | Description for the new cluster |
Cluster | Workers | Number of worker nodes. Must be greater than 0 |
Cluster | Masters | Number of master nodes. As of release 1.5 this value should be 1 |
Cluster | ResourcePool | The Vsphere resource pool in which the nodes will be running. If no reources have been created this is typically [cluster-name]/Resources |
Cluster | Networks | Networks that the nodes will use, in the case of Vsphere these will be the names of the port groups that will attach to the K8s nodes. If using Hyperflex remember to include the k8-priv-iscsivm-network |
Cluster | Type | As of CCP 1.5 this should be set to 1 |
Cluster | Datacenter | Vsphere datacenter in which the nodes will be deployed |
Cluster | Cluster | Vsphere cluster on which the nodes will be deployed |
Cluster | Datastore | Vsphere datastore on which the nodes will be deployed |
Cluster | Template | The Vsphere template from which the nodes will be deployed. This should have been deployed at the initial installation e.g. ccp-tenant-image-1.10.1-ubuntu16-1.5.0 |
Cluster | SSHUser | Username of a user to setup on each of the nodes as part of the cluster deployment. The nodes will then be accessible using this username and SSH key below. Use case includes troubleshooting |
Cluster | SSHPassword | Password for the SSH user specified above |
Cluster | SSHKey | Key for the SSH user specified above |
Cluster | Labels | Labels configuration - See below |
Cluster | Nodes | Node configuration - See below |
Cluster | Deployer | Deployer configuration - See below |
Cluster | Kubernetes Version | Version of Kubeternes to use |
Cluster | ClusterEnvURL | |
Cluster | ClusterDashboardURL | URL for the K8s dashboard of this cluster |
Cluster | NetworkPlugin | Network plugin configuration - See below |
Cluster | CCPPrivateSSHKey | |
Cluster | CCPPublicSSHKey | |
Cluster | NTPPools | NTP pools configrued for the cluster |
Cluster | NTPServers | NTP servers configured within the pools mentioned above |
Cluster | IsControlCluster | Whether or not this cluster is the CCP control cluster. For tenant clusters this should be false |
Cluster | IsAdopt | |
Cluster | RegistriesSelfSigned | |
Cluster | RegistriesInsecure | |
Cluster | RegistriesRootCA | |
Cluster | IngressVIPPoolID | UUID of the Ingress VIP Pool used for the cluster. Required if using Load Balancer IP |
Cluster | IngressVIPAddressID | UUID of the Ingress VIP address |
Cluster | IngressVIPs | Individual VIP addresses assigned to the cluster |
Cluster | KeepaliveVRID | |
Cluster | HelmCharts | List of helm charts - See below |
Cluster | MasterVIPAddressID | UUID of the Master VIP address |
Cluster | MasterVIP | VIP address assigned to the master tenant cluster node |
Cluster | MasterMACAddresses | MAC addresses of the interfaces on the master tenant cluster node |
Cluster | AuthList | |
Cluster | IsHarborEnabled | Whether or not Harbor is enabled- True or False |
Cluster | HarborAdminServerPassword | |
Cluster | HarborRegistrySize | |
Cluster | LoadBalancerIPNum | Number of IP addresses to use from the VIP pool. If Istio is enabled this should be 3 or greater |
Cluster | IsIstioEnabled | Whether or not Istio is enabled - True or False |
Cluster | WorkerNodePool | Worker Node configuration - See below |
Cluster | MasterNodePool | Master Node configuration - See below |
Infra | Datacenter | Vsphere datacenter in which the nodes will be deployed |
Infra | Datastore | Vsphere cluster on which the nodes will be deployed |
Infra | Cluster | Vsphere datastore on which the nodes will be deployed |
Infra | Networks | Networks that the nodes will use, in the case of Vsphere these will be the names of the port groups that will attach to the K8s nodes. If using Hyperflex remember to include the k8-priv-iscsivm-network |
Infra | ResourcePool | The Vsphere resource pool in which the nodes will be running. If no resources have been created this is typically [cluster-name]/Resources |
Label | Key | |
Label | Value | |
Node | UUID | UUID of the tenant cluster node |
Node | Name | Name of the tenant cluster node |
Node | PublicIP | Public IP of the tenant cluster node |
Node | PrivateIP | Private IP of the tenant cluster node |
Node | IsMaster | Whether or not the tenant cluster node is the K8s master |
Node | State | The state of the node - when everything is working correctly this should be "READY" |
Node | CloudInitData | |
Node | KubernetesVersion | Version of Kubeternes running |
Node | ErrorLog | |
Node | Template | The Vsphere template from which the node was deployed. This should have been deployed at the initial installation e.g. ccp-tenant-image-1.10.1-ubuntu16-1.5.0 |
Node | MacAddresses | MAC addresses of the interfaces on the tenant cluster node |
Deployer | ProxyCMD | |
Deployer | ProviderType | The type of provider supported - as of CCP 1.5 this will be vsphere |
Deployer | Provider | Provider configuration - See below |
NetworkPlugin | Name | Name of the network plugin - e.g. calico, contiv-vpp |
NetworkPlugin | Status | Status of the plugin - when everything is working correctly this should be "ready" |
NetworkPlugin | Details | "Includes details of the plugin e.g. |
HelmChart | HelmChartUUID | UUID of the Helm chart |
HelmChart | ClusterUUID | |
HelmChart | ChartURL | |
HelmChart | Name | Name of the Helm chart |
HelmChart | Options | |
Provider | VsphereDataCenter | Vsphere datacenter in which the nodes will be deployed |
Provider | VsphereDatastore | Vsphere datastore on which the nodes will be deployed |
Provider | VsphereSCSIControllerType | |
Provider | VsphereWorkingDir | |
Provider | VsphereClientConfigUUID | UUID of the provider for the cluster (e.g. vsphere provider) which can be found using the GetProviderClientConfigs() function |
Provider | ClientConfig | |
VsphereClientConfig | IP | |
VsphereClientConfig | Port | |
VsphereClientConfig | Username | |
VsphereClientConfig | Password | |
WorkerNodePool | VCPUs | Amount of vCPUs each K8s worker node will use |
WorkerNodePool | Memory | Amount of memory each K8s worker node will use |
WorkerNodePool | Template | The Vsphere template from which the nodes will be deployed. This should have been deployed at the initial installation e.g. ccp-tenant-image-1.10.1-ubuntu16-1.5.0 |
MasterNodePool | VCPUs | Amount of vCPUs each K8s master node will use |
MasterNodePool | Memory | Amount of memory each K8s master node will use |
MasterNodePool | Template | The Vsphere template from which the nodes will be deployed. This should have been deployed at the initial installation e.g. ccp-tenant-image-1.10.1-ubuntu16-1.5.0 |
func (s *Client) GetClusters() ([]Cluster, error)
cluster, err := client.GetClusters()
if err != nil {
fmt.Println(err)
} else {
for _, cluster := range clusters {
fmt.Printf("%+v\n", *cluster.Name)
}
}
func (s *Client) GetCluster(clusterName string) (*Cluster, error)
cluster, err := client.GetCluster("myCluster")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *cluster.UUID)
}
func (s *Client) GetClusterHealth(clusterUUID string) (*Cluster, error)
func (s *Client) GetClusterAuthz(clusterUUID string) (*Cluster, error)
clusterAuthz, err := client.GetClusterAuthz("AAAA-BBBB-CCCC-UUID")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *clusterAuthz.AuthList)
}
func (s *Client) GetClusterDashboard(clusterUUID string) (*string, error)
clusterDashboardAddress, err := client.GetClusterDashboard("AAAA-BBBB-CCCC-UUID")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *clusterDashboardAddress)
}
func (s *Client) GetClusterEnv(clusterUUID string) (*string, error)
clusterEnvironment, err := client.GetClusterEnv("AAAA-BBBB-CCCC-UUID")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *clusterEnvironment)
}
func (s *Client) GetClusterHelmCharts(clusterUUID string) (*HelmChart, error)
clusterHelmCharts, err := client.GetClusterHelmCharts("AAAA-BBBB-CCCC-UUID")
if err != nil {
fmt.Println(err)
} else {
for _, clusterHelmChart := range clusterHelmCharts {
fmt.Printf("%+v\n", *clusterHelmChart.Name)
}
}
func (s *Client) AddCluster(cluster *Cluster) (*Cluster, error)
- ProviderClientConfigUUID
- Name
- KubernetesVersion
- ResourcePool
- Networks
- SSHKey
- Datacenter
- Cluster
- Datastore
- Workers
- SSHUser
- Type
- Masters
- Deployer
- ProviderType
- Provider
- VsphereDataCenter
- VsphereClientConfigUUID
- VsphereDatastore
- VsphereWorkingDir
- NetworkPlugin
- Name
- Status
- Details
- IsHarborEnabled
- LoadBalancerIPNum
- IsIstioEnabled
- WorkerNodePool
- VCPUs
- Memory
- Template
- MasterNodePool
- VCPUs
- Memory
- Template
workerNodePool := ccp.WorkerNodePool{
VCPUs: ccp.Int64(2),
Memory: ccp.Int64(16384),
Template: ccp.String("ccp-tenant-image-1.10.1-1.4.0"),
}
masterNodePool := ccp.MasterNodePool{
VCPUs: ccp.Int64(2),
Memory: ccp.Int64(16384),
Template: ccp.String("ccp-tenant-image-1.10.1-1.4.0"),
}
networkPlugin := ccp.NetworkPlugin{
Name: ccp.String("contiv-vpp"),
Status: ccp.String(""),
Details: ccp.String("{\"pod_cidr\":\"192.168.0.0/16\"}"),
}
provider := ccp.Provider{
VsphereDataCenter: ccp.String("ccp-lab"),
VsphereDatastore: ccp.String("ccpDatastore"),
VsphereClientConfigUUID: ccp.String("example-uuid-aaa-bbb-ccc"),
VsphereWorkingDir: ccp.String("/ccp-lab/vm"),
}
deployer := ccp.Deployer{
ProviderType: ccp.String("vsphere"),
Provider: &provider,
}
var networks []string
networks = append(networks, "ccp-network/ccp-network-portgroup")
newCluster := ccp.Cluster{
ProviderClientConfigUUID: ccp.String("1234abcd-1234-0000-aaaa-abcdef12345"),
Name: ccp.String("ccp-api-cluster"),
KubernetesVersion: ccp.String("1.10.1"),
SSHKey: ccp.String("ssh-rsa sshkey123abc me@locahost"),
Datacenter: ccp.String("ccp-lab"),
Cluster: ccp.String("hx-cluster"),
ResourcePool: ccp.String("hx-cluster/Resources"),
Networks: &networks,
Datastore: ccp.String("ccpDatastore"),
Template: ccp.String("ccp-tenant-image-1.10.1-1.1.0.ova"),
Masters: ccp.Int64(1),
Workers: ccp.Int64(2),
SSHUser: ccp.String("ccpuser"),
Type: ccp.Int64(1),
Deployer: &deployer,
NetworkPlugin: &networkPlugin,
IsHarborEnabled: ccp.Bool(false),
LoadBalanderIPNum: ccp.Int64(1),
IsIstioEnabled: ccp.Bool(false),
WorkerNodePool: &workerNodePool,
MasterNodePool: &masterNodePool,
}
cluster, err := client.AddCluster(&newCluster)
if err != nil {
fmt.Println(err)
} else {
fmt.Println("Cluster UUID: " + *cluster.UUID)
}
This function was added in order to provide users a simpler way of creating clusters. The list of required fields has been shortend with defaults and computed values such as UUIDs to be automatically configured on behalf of the user.
The following fields and values will be configured automatically with the remainder to be specified by the user as shown in the example below.
- ProviderClientConfigUUID - retrived automatically from the provider config
- KubernetesVersion - default will be set to 1.10.1
- Type - default will be set to 1
- Deployer
- ProviderType will be set to "vsphere"
- Provider
- VsphereDataCenter - already specified as part of Cluster struct so will use this same value
- VsphereClientConfigUUID - retrived automatically from the provider config
- VsphereDatastore - already specified as part of Cluster struct so will use this same value
- VsphereWorkingDir - default will be set to /VsphereDataCenter/vm
- NetworkPlugin
- Name - default will be set to contiv-vpp
- Status - default will be set to ""
- Details - default will be set to "{"pod_cidr":"192.168.0.0/16"}"
- WorkerNodePool
- VCPUs - default will be set to 2
- Memory - default will be set to 16384
- MasterNodePool
- VCPUs - default will be set to 2
- Memory - default will be set to 8192
Any fields outside of the required fields are optional
func (s *Client) AddClusterBasic(cluster *Cluster) (*Cluster, error)
- Name
- Datacenter
- Cluster
- Datastore
- ResourcePool
- Template
- Networks
- SSHUser
- SSHKey
- Masters
- Workers
- IsHarborEnabled
- IsIstioEnabled
var networks []string
networks = append(networks, "ccp-network/ccp-network-portgroup")
newCluster := ccp.Cluster{
Name: ccp.String("ccp-api-cluster"),
Datacenter: ccp.String("ccp-lab"),
Cluster: ccp.String("hx-cluster"),
Datastore: ccp.String("ccpDatastore"),
ResourcePool: ccp.String("hx-cluster/Resources"),
SSHUser: ccp.String("ccpuser"),
SSHKey: ccp.String("ssh-rsa sshkey123abc me@locahost"),
Template: ccp.String("ccp-tenant-image-1.10.1-1.1.0.ova"),
Masters: ccp.Int64(1),
Workers: ccp.Int64(2),
IsHarborEnabled: ccp.Bool(false),
IsIstioEnabled: ccp.Bool(false),
Networks: &networks,
}
cluster, err := client.AddClusterBasic(&newCluster)
if err != nil {
fmt.Println(err)
} else {
fmt.Println("Cluster UUID: " + *cluster.UUID)
}
func (s *Client) PatchCluster(cluster *Cluster) (*Cluster, error)
- UUID
- Workers
- Workers
- LoadBalanderIPNum
newCluster := ccp.Cluster{
UUID: ccp.String("aaaa-bbbb-cccc-dddd-eeee"),
Workers: ccp.Int64(3),
LoadBalanderIPNum: ccp.Int64(3),
}
cluster, err := client.PatchCluster(&newCluster)
if err != nil {
fmt.Println(err)
} else {
fmt.Println("Cluster UUID: " + *cluster.UUID)
}
func (s *Client) DeleteCluster(uuid string) error
err = client.DeleteCluster("aaaa-bbbb-cccc-dddd-eeee")
if err != nil {
fmt.Println(err)
}
- GetProviderClientConfigs
- GetProviderClientConfig
- GetProviderClientConfigClusters
- GetProviderClientConfigVsphereDatacenter
- GetProviderClientConfigVsphereDatacenterClusters
- GetProviderClientConfigVsphereDatacenterVMs
- GetProviderClientConfigVsphereDatacenterNetworks
- GetProviderClientConfigVsphereDatacenterDatastores
- GetProviderClientConfigVsphereDatacenterClusterPools
type ProviderClientConfig struct {
UUID *string
Name *string
Type *int64
Config *Config
}
type Config struct {
IP *string
Port *int64
Username *string
}
type Vsphere struct {
Datacenters *[]string
Clusters *[]string
VMs *[]string
Networks *[]string
Datastores *[]string
Pools *[]string
}
func (s *Client) GetProviderClientConfigs() ([]ProviderClientConfig, error)
providerClientConfigs, err := client.GetProviderClientConfigs()
if err != nil {
fmt.Println(err)
} else {
for _, providerClientConfig := range providerClientConfigs {
fmt.Printf("%+v\n", *providerClientConfig.Name)
}
}
func (s *Client) GetProviderClientConfig(clientUUID string) (*ProviderClientConfig, error)
providerClientConfig, err := client.GetProviderClientConfig("AAAA-BBBB-CCCC-UUID")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *providerClientConfig.Name)
}
func (s *Client) GetProviderClientConfigClusters(clientUUID string) ([]Cluster, error)
providerClientConfigClusters, err := client.GetProviderClientConfigClusters("AAAA-BBBB-CCCC-UUID")
if err != nil {
fmt.Println(err)
} else {
for _, providerClientConfigCluster := range providerClientConfigClusters {
fmt.Printf("%+v\n", *providerClientConfigCluster.Name)
}
}
func (s *Client) GetProviderClientConfigVsphereDatacenter(clientUUID string) (*Vsphere, error)
providerClientConfigVsphereDatacenter, err := client.GetProviderClientConfigVsphereDatacenter("AAAA-BBBB-CCCC-UUID")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *providerClientConfigVsphereDatacenter.Datacenters)
}
func (s *Client) GetProviderClientConfigVsphereDatacenterClusters(clientUUID string, datacenter string) (*Vsphere, error)
providerClientConfigVsphereDatacenterClusters, err := client.GetProviderClientConfigVsphereDatacenterClusters("AAAA-BBBB-CCCC-UUID", "myDatacenter")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *providerClientConfigVsphereDatacenterClusters.Clusters)
}
func (s *Client) GetProviderClientConfigVsphereDatacenterVMs(clientUUID string, datacenter string) (*Vsphere, error)
providerClientConfigVsphereDatacenterVMs, err := client.GetProviderClientConfigVsphereDatacenterVMs("AAAA-BBBB-CCCC-UUID", "myDatacenter")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *providerClientConfigVsphereDatacenterVMs.VMs)
}
func (s *Client) GetProviderClientConfigVsphereDatacenterNetworks(clientUUID string, datacenter string) (*Vsphere, error)
providerClientConfigVsphereDatacenterNetworks, err := client.GetProviderClientConfigVsphereDatacenterNetworks("AAAA-BBBB-CCCC-UUID", "myDatacenter")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *providerClientConfigVsphereDatacenterNetworks.Networks)
}
func (s *Client) GetProviderClientConfigVsphereDatacenterDatastores(clientUUID string, datacenter string) (*Vsphere, error)
providerClientConfigVsphereDatacenterDatastores, err := client.GetProviderClientConfigVsphereDatacenterDatastores("AAAA-BBBB-CCCC-UUID", "myDatacenter")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *providerClientConfigVsphereDatacenterDatastores.Datastores)
}
func (s *Client) GetProviderClientConfigVsphereDatacenterClusterPools(clientUUID string, datacenter string, cluster string) (*Vsphere, error)
providerClientConfigVsphereDatacenterPools, err := client.GetProviderClientConfigVsphereDatacenterClusterPools("AAAA-BBBB-CCCC-UUID", "myDatacenter", "myCluster")
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *providerClientConfigVsphereDatacenterPools.Pools)
}
type ACIProfile struct {
UUID *string
Name *string
APICHosts *string
APICUsername *int64
APICPassword *int64
ACIVMMDomainName *string
ACIInfraVLANID *string
VRFName *string
L3OutsidePolicyName *string
L3OutsideNetworkName *string
AAEPName *string
Nameservers *[]string
ACIAllocator *ACIProfileAllocatorConfig
ControlPlaneContractName *string
}
type ACIProfileAllocatorConfig struct {
NodeVLANStart *int64
NodeVLANEnd *int64
MulticastRange *string
ServiceSubnetStart *string
PodSubnetStart *string
}
func (s *Client) GetACIProfiles() ([]ACIProfile, error)
aciProfiles, err := client.GetACIProfiles()
if err != nil {
fmt.Println(err)
} else {
for _, aciProfile := range aciProfiles {
fmt.Printf("%+v\n", *aciProfile.Name)
}
}
type LDAPSetup struct {
Server *string
Port *int64
BaseDN *string
ServiceAccountDN *string
ServiceAccountPassword *string
StartTLS *bool
InsecureSkipVerify *bool
}
func (s *Client) GetLDAPSetup() (*LDAPSetup, error)
ldapSetup, err := client.GetLDAPSetup()
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *ldapSetup.Server)
}
type Role struct {
Role *string
}
func (s *Client) GetRole() (*Role, error)
role, err := client.GetRole()
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%+v\n", *role.Role)
}
This project is licensed to you under the terms of the Cisco Sample Code License.