api

package
v0.0.0-...-f1610be Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package api Copyright 2020-2021 Author.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Mustafa mbayramo@vmware.com

Package api Copyright 2020-2021 Author.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Mustafa mbayramo@vmware.com

Package api Copyright 2020-2021 Author.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Mustafa mbayramo@vmware.com

Package api Copyright 2020-2021 Author.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Mustafa mbayramo@vmware.com

Package api Copyright 2020-2021 Author.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Mustafa mbayramo@vmware.com

Package api Copyright 2020-2021 Author.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Mustafa mbayramo@vmware.com

Index

Constants

View Source
const (

	//VmwareTemplateK8s default filter for k8s  templates
	VmwareTemplateK8s VmTemplateFilterType = "k8svm"

	// DefaultNamespace - default name space used for placement
	DefaultNamespace = "default"

	// DefaultFlavor default vdu flavor
	DefaultFlavor = "default"
)
View Source
const (

	// BlockMaxRetryTimer - default retry timer
	BlockMaxRetryTimer = 32

	// TaskPoolSeconds  default pool timer.
	TaskPoolSeconds = 10

	StateInstantiate  = "INSTANTIATE"
	StateCompleted    = "COMPLETED"
	StateStarting     = "STARTING"
	StateInstantiated = "INSTANTIATED"
	StateTerminated   = "TERMINATED"
	StateTerminate    = "TERMINATE"
	StateFailedTemp   = "FAILED_TEMP"

	StateNotInstantiated = "NOT_INSTANTIATED"

	DefaultMaxRetry = 32

	// TaskStateSuccess task state successes
	TaskStateSuccess = "SUCCESS"

	// TaskStateQueued task state queued by tca
	TaskStateQueued = "QUEUED"

	// TaskStateFailed task state failed
	TaskStateFailed = "FAILED"

	TaskTypeNodePoolCreation = "Node Pool Creation"
	TaskTypeInventoryUpdate  = "Inventory Update"
	TaskTypeUpdateNodePool   = "Update Node Pool"

	CLusterCsiNfs     = "nfs_client"
	ClusterCsiVsphere = "vsphere-csi"
)

Variables

This section is empty.

Functions

func ClusterFields

func ClusterFields() []string

func GetTestAssetsDir

func GetTestAssetsDir() string

GetTestAssetsDir return dir where test assets are it call RunOnRootFolder that change dir

func IsInState

func IsInState(currentState string, predicate string) bool

IsInState - abstract state change, late if I move code to state as different representation we swap code here.

func IsValidUUID

func IsValidUUID(u string) bool

IsValidUUID check value in UUID format

func NewInstanceRequestSpec

func NewInstanceRequestSpec(cloudName string, clusterName string, vimType string, nfdName string,
	repo *Repo, instanceName string, nodePoolName string) (*specs.InstanceRequestSpec, error)

NewInstanceRequestSpec return new instance request spec

func SetLoggingFlags

func SetLoggingFlags()

SetLoggingFlags Sets logging flag for logging tracer

func TemplateFields

func TemplateFields() []string

func TenantFields

func TenantFields() []string

TenantFields method return all struct fields name

Types

type CloudProviderNotFound

type CloudProviderNotFound struct {
	// contains filtered or unexported fields
}

CloudProviderNotFound error raised if tenant cloud not found

func (*CloudProviderNotFound) Error

func (m *CloudProviderNotFound) Error() string

Error - return if cloud provider not found

type ClusterCreateApiReq

type ClusterCreateApiReq struct {

	// Spec hold a pointer to specs.SpecCluster and must not be nil
	Spec *specs.SpecCluster

	//
	IsDryRun bool

	//
	IsBlocking bool

	//
	IsVerbose bool

	// isFixConflict if true , api create method will try to resolve cluster IP conflict.
	IsFixConflict bool
}

ClusterCreateApiReq api request issued to create new cluster

type ClusterDeleteApiReq

type ClusterDeleteApiReq struct {
	// cluster name or id
	Cluster string
	//
	IsBlocking bool
	//
	IsVerbose bool
}

ClusterDeleteApiReq api request issued to delete cluster

type CnfMoveReq

type CnfMoveReq struct {
	NodeSelector HelmNodeSelector `yaml:"nodeSelector"`
}

type CreateInstanceApiReq

type CreateInstanceApiReq struct {

	//InstanceName instance name
	InstanceName string

	//PoolName node pool name
	PoolName string

	//VimName target vim name
	VimName string

	//ClusterName target cluster name
	ClusterName string

	//IsBlocking block or async task
	IsBlocking bool

	// if blocking request require output progress
	IsVerbose bool

	// additional param
	AdditionalParam *specs.AdditionalParams

	//Namespace  overwrite name
	Namespace string

	//RepoUsername overwrites Repo username
	RepoUsername string

	//RepoPassword overwrite Repo password
	RepoPassword string

	// RepoUrl overwrite Repo url
	RepoUrl string
}

CreateInstanceApiReq - api request to create new cnf or vnf instance

type HelmNodeSelector

type HelmNodeSelector struct {
	Label string `yaml:"telco.vmware.com/nodepool"`
}

type NodePoolCreateApiReq

type NodePoolCreateApiReq struct {

	// Spec is a specs.SpecNodePool
	Spec *specs.SpecNodePool

	// Cluster is cluster name or cluster id
	Cluster string

	// dry run or apply change
	IsDryRun bool

	// if node pool creation needs to block
	IsBlocking bool

	// if blocking request require output progress
	IsVerbose bool
}

NodePoolCreateApiReq api request issued to create new node pool

type Repo

type Repo struct {
	RepoUrl  string
	Username string
	Password string
}

type ResetInstanceApiReq

type ResetInstanceApiReq struct {

	//InstanceName instance name or id
	InstanceName string

	//ClusterName target cluster name
	ClusterName string

	//IsBlocking block or async task
	IsBlocking bool

	// if a request is blocking, and caller requires output progress
	IsVerbose bool
}

ResetInstanceApiReq api request to reset existing CNF or VNF instance.

type TaskCanceled

type TaskCanceled struct {
	ErrMsg string
}

func (*TaskCanceled) Error

func (e *TaskCanceled) Error() string

type TaskNotFound

type TaskNotFound struct {
	ErrMsg string
}

func (*TaskNotFound) Error

func (e *TaskNotFound) Error() string

type TcaApi

type TcaApi struct {
	// contains filtered or unexported fields
}

TcaApi - TCA Api interface Called need to use NewTcaApi to get instance before

func NewTcaApi

func NewTcaApi(r *client.RestClient) (*TcaApi, error)

NewTcaApi - return instance for API.

func (*TcaApi) BlockWaitStateChange

func (a *TcaApi) BlockWaitStateChange(ctx context.Context, instanceId string, waitFor string, maxRetry int, verbose bool) error

BlockWaitStateChange - simple block and pull status instanceId is instance that method will pull and check waitFor is target status method waits. maxRetry a limit.

func (*TcaApi) BlockWaitTaskFinish

func (a *TcaApi) BlockWaitTaskFinish(ctx context.Context, task *models.TcaTask, waitFor string, maxRetry int, verbose bool) error

BlockWaitTaskFinish - simple block and pull status instanceId is instance that method will pull and check waitFor is target status method waits. maxRetry a limit.

func (*TcaApi) CnfMove

func (a *TcaApi) CnfMove(ctx context.Context, instanceName string, moveReq *CnfMoveReq, isDry bool) error

CnfMove - reconfigure existing instance

func (*TcaApi) CnfReconfigure

func (a *TcaApi) CnfReconfigure(ctx context.Context, instanceName string, valueFile string,
	vduName string, isDry bool) error

CnfReconfigure - reconfigure existing instance

func (*TcaApi) CreateCatalogEntity

func (a *TcaApi) CreateCatalogEntity(
	fileName string,
	catalogName string,
	substitution map[string]string) (bool, error)

CreateCatalogEntity method create a new package it take file name that must compressed zip file package catalog name and a substitution map. substitution map used to replace CSAR values. a key of map is key in CSAR and value a new value that used to replace value in actual CSAR. i.e existing CSAR used as template and substitution map applied a transformation.

func (*TcaApi) CreateClusterTemplate

func (a *TcaApi) CreateClusterTemplate(spec *specs.SpecClusterTemplate) (string, error)

CreateClusterTemplate - create cluster template from initialSpec

func (*TcaApi) CreateClusters

func (a *TcaApi) CreateClusters(ctx context.Context, req *ClusterCreateApiReq) (*models.TcaTask, error)

CreateClusters - creates new cluster , in Dry Run method only will do specString validation. isBlocking will indicate if caller expects cluster task to finish. verbose will output status of each task, linked to specific cluster creation.

func (*TcaApi) CreateCnfInstance

func (a *TcaApi) CreateCnfInstance(ctx context.Context, req *CreateInstanceApiReq) error

CreateCnfInstance - create cnf instance that already in running, not instantiated state or termination state. method take req *CreateInstanceApiReq

 where   InstanceName is instance that state must change
		    poolName is target pool
			ClusterName a cluster that will be used to query and search instance.

func (*TcaApi) CreateCnfNewInstance

func (a *TcaApi) CreateCnfNewInstance(ctx context.Context, n *specs.InstanceRequestSpec, isDry bool, isBlocked bool) (*response.LcmInfo, error)

CreateCnfNewInstance create a new instance of VNF or CNF. Dry run will validate request but will not create any CNF.

func (*TcaApi) CreateExtension

func (a *TcaApi) CreateExtension(ctx context.Context, spec *specs.SpecExtension) (string, error)

CreateExtension api call create extension in TCA

func (*TcaApi) CreateNewNodePool

func (a *TcaApi) CreateNewNodePool(ctx context.Context, req *NodePoolCreateApiReq) (*models.TcaTask, error)

CreateNewNodePool api call creates a new node pool for a given cluster name or id. both cluster can be named or ids. API call returns models.TcaTas that monitored. isDry run provide capability only validate specs without creating actual node pool.

func (*TcaApi) CreateSpecExample

func (a *TcaApi) CreateSpecExample(
	name string,
	t string,
	h string,
	vm string,
	ip string,
	p string,
	netpath string,
	dns string,
) *specs.SpecCluster

func (*TcaApi) CreateTenantProvider

func (a *TcaApi) CreateTenantProvider(spec *specs.SpecCloudProvider) (*models.RegistrationRespond, error)

CreateTenantProvider method create, registers new target cloud provider as tenant infrastructure in TCA.

func (*TcaApi) DeleteCatalogEntity

func (a *TcaApi) DeleteCatalogEntity(catalogName string) (bool, error)

DeleteCatalogEntity api method deletes catalog entity

func (*TcaApi) DeleteCloudProvider

func (a *TcaApi) DeleteCloudProvider(ctx context.Context, s string) (*models.TcaTask, error)

DeleteCloudProvider method delete cloud provider note cloud provider must not contain any active clusters

func (*TcaApi) DeleteCluster

func (a *TcaApi) DeleteCluster(ctx context.Context, req *ClusterDeleteApiReq) (*models.TcaTask, error)

DeleteCluster - Method deletes cluster, note in order delete it must not have anything running on it. In order delete management cluster, all tenant cluster must be deleted first.

func (*TcaApi) DeleteCnf

func (a *TcaApi) DeleteCnf(ctx context.Context, instanceName string) error

DeleteCnf delete CNF or VNF instance

func (*TcaApi) DeleteCnfInstance

func (a *TcaApi) DeleteCnfInstance(ctx context.Context, instanceName string, vimName string, isForce bool) error

DeleteCnfInstance - deletes instance

func (*TcaApi) DeleteExtension

func (a *TcaApi) DeleteExtension(ctx context.Context, NameOrId string) (bool, error)

DeleteExtension api call delete extension from tca return true

func (*TcaApi) DeleteNodePool

func (a *TcaApi) DeleteNodePool(ctx context.Context, cluster string, nodePool string) (*models.TcaTask, error)

DeleteNodePool api call deletes node pool from a tenant cluster, cluster argument is cluster name or id. API call returns models.TcaTask that hold operation id that can be used for subsequent monitoring.

func (*TcaApi) DeleteTemplate

func (a *TcaApi) DeleteTemplate(template string) error

DeleteTemplate deletes cluster template from TCA template argument can be name or ID.

func (*TcaApi) DeleteTenantCluster

func (a *TcaApi) DeleteTenantCluster(ctx context.Context, tenantCluster string) (*models.TcaTask, error)

DeleteTenantCluster - deletes tenant cluster it accept just name or id.

func (*TcaApi) DeleteTenantsProvider

func (a *TcaApi) DeleteTenantsProvider(ctx context.Context, tenantCluster string) (*models.TcaTask, error)

DeleteTenantsProvider delete a tenant attached to cloud provide.

func (*TcaApi) ExtensionQuery

func (a *TcaApi) ExtensionQuery(ctx context.Context) (*response.Extensions, error)

ExtensionQuery - query for all extension api

func (*TcaApi) GetAllInstances

func (a *TcaApi) GetAllInstances() (*response.CnfsExtended, error)

GetAllInstances api method returns a list of CNF/VNF instances in response.CnfsExtended that encapsulate in collection

func (*TcaApi) GetAllNodePool

func (a *TcaApi) GetAllNodePool(ctx context.Context) (*response.NodePool, error)

GetAllNodePool return a Node pool for particular cluster It generally useful to get list only if we need to display all in all other cases it efficient to use direct call for cluster.

func (*TcaApi) GetAllNodePools

func (a *TcaApi) GetAllNodePools(ctx context.Context) ([]response.NodesSpecs, error)

GetAllNodePools - return all node pool for clusterId

func (*TcaApi) GetAllPackages

func (a *TcaApi) GetAllPackages() (*response.CnfsExtended, error)

GetAllPackages return all catalog entries as response.CnfsExtended object

func (*TcaApi) GetApiKey

func (a *TcaApi) GetApiKey() string

GetApiKey returns API key used to connect to rest interface

func (*TcaApi) GetAuthorization

func (a *TcaApi) GetAuthorization() (bool, error)

GetAuthorization retrieve API key from TCA and update internal state.

func (*TcaApi) GetBaseUrl

func (a *TcaApi) GetBaseUrl() string

GetBaseUrl set base url for TCA API client interface.

func (*TcaApi) GetCatalogAndVdu

func (a *TcaApi) GetCatalogAndVdu(nfdName string) (*response.VnfPackage, *response.VduPackage, error)

GetCatalogAndVdu API method returns catalog entity and vdu package.

func (*TcaApi) GetCatalogId

func (a *TcaApi) GetCatalogId(catalogId string) (string, string, error)

GetCatalogId return vnf Package ID and VNFD ID

func (*TcaApi) GetCluster

func (a *TcaApi) GetCluster(ctx context.Context, clusterId string) (*response.ClusterSpec, error)

GetCluster - method retrieve cluster information

func (*TcaApi) GetClusterNodePool

func (a *TcaApi) GetClusterNodePool(ctx context.Context, clusterId string, nodePoolId string) (*response.NodesSpecs, error)

GetClusterNodePool - API Method lookup clusters node pool. clusterId is identified either a name or UUID. nodePoolId is identifier either a name or UUID.

func (*TcaApi) GetClusterNodePools

func (a *TcaApi) GetClusterNodePools(Id string) (*response.NodePool, error)

GetClusterNodePools - return node pool for a given id.

func (*TcaApi) GetClusterTask

func (a *TcaApi) GetClusterTask(ctx context.Context, clusterId string, showChildren bool) (*models.ClusterTask, error)

GetClusterTask method return list task models.ClusterTask currently executing on given cluster

func (*TcaApi) GetClusterTemplate

func (a *TcaApi) GetClusterTemplate(templateId string) (*response.ClusterTemplateSpec, error)

GetClusterTemplate return cluster template

func (*TcaApi) GetClusterTemplates

func (a *TcaApi) GetClusterTemplates() (*response.ClusterTemplates, error)

GetClusterTemplates - return list of cluster templates

func (*TcaApi) GetClusters

func (a *TcaApi) GetClusters(ctx context.Context) (*response.Clusters, error)

GetClusters get cluster

func (*TcaApi) GetConsumption

func (a *TcaApi) GetConsumption(ctx context.Context) (*models.ConsumptionResp, error)

GetConsumption - return lic consumption

func (*TcaApi) GetCurrentClusterTask

func (a *TcaApi) GetCurrentClusterTask(ctx context.Context, clusterId string) (*models.ClusterTask, error)

GetCurrentClusterTask get current cluster task

func (*TcaApi) GetEntireCatalog

func (a *TcaApi) GetEntireCatalog() (*response.VnfPackages, error)

GetEntireCatalog - api call return entire TCA catalog.

func (*TcaApi) GetExtension

func (a *TcaApi) GetExtension(ctx context.Context, NameOrId string) (*response.Extensions, error)

GetExtension api call return extension register in TCA NameOrId is name of extension or id. If name provided method need resolve name to id first.

func (*TcaApi) GetExtensions

func (a *TcaApi) GetExtensions(ctx context.Context) (*response.Extensions, error)

GetExtensions returns all extension registered in TCA This method useful if we need find Harbor or any other extension for example attached to particular VIM

func (*TcaApi) GetFilteredExtension

func (a *TcaApi) GetFilteredExtension(ctx context.Context) (*response.ReposList, error)

GetFilteredExtension retrieve repos by tenant id

func (*TcaApi) GetInstance

func (a *TcaApi) GetInstance(ctx context.Context, NameOrId string) (*response.LcmInfo, error)

func (*TcaApi) GetLcmActions

func (a *TcaApi) GetLcmActions(ctx context.Context, instanceName string) (*models.PolicyLinks, error)

GetLcmActions return list of available actions in current state

func (*TcaApi) GetNamedClusterTemplate

func (a *TcaApi) GetNamedClusterTemplate(name string) (*response.ClusterTemplateSpec, error)

GetNamedClusterTemplate - return template if name is string first resolve template

func (*TcaApi) GetNodePool

func (a *TcaApi) GetNodePool(ctx context.Context, NameOrId string) (*response.NodePool, error)

GetNodePool api method returns a Node pool response.NodePool lookup based on cluster id or cluster name

func (*TcaApi) GetRepos

func (a *TcaApi) GetRepos(ctx context.Context) (*response.ReposList, error)

GetRepos retrieve repos by tenant id

func (*TcaApi) GetTenant

func (a *TcaApi) GetTenant(ctx context.Context, tenant string) (*response.Tenants, error)

GetTenant method return tenant as response.Tenants if tenant is name, method will lookup by name. if tenant is UUID it will lookup by id if it has prefix vmware it will lookup by VIM id.

func (*TcaApi) GetTenantsQuery

func (a *TcaApi) GetTenantsQuery(tenantId string, nfType string) (*response.Tenants, error)

GetTenantsQuery query tenant information based on tenant id and package id

func (*TcaApi) GetVdu

func (a *TcaApi) GetVdu(nfdName string) (*response.VduPackage, error)

GetVdu retrieve Vdu

func (*TcaApi) GetVim

func (a *TcaApi) GetVim(ctx context.Context, NameOrId string) (*response.TenantSpecs, error)

GetVim return cloud provider.

func (*TcaApi) GetVimComputeClusters

func (a *TcaApi) GetVimComputeClusters(ctx context.Context, cloudName string) (*models.VMwareClusters, error)

GetVimComputeClusters - return compute cluster attached to VIM For example VMware VIM is vCenter.

func (*TcaApi) GetVimFolders

func (a *TcaApi) GetVimFolders(ctx context.Context, cloudName string) (*models.Folders, error)

GetVimFolders - return folders in target cloud provider. for VMware VC it list of VM Folders, models.Folders

func (*TcaApi) GetVimNetworks

func (a *TcaApi) GetVimNetworks(ctx context.Context, cloudName string) (*models.CloudNetworks, error)

GetVimNetworks - method return network attached to vim, cloud provider, for a VMware vim it is a full path to object.

func (*TcaApi) GetVimResourcePool

func (a *TcaApi) GetVimResourcePool(ctx context.Context, cloudName string) (*models.ResourcePool, error)

GetVimResourcePool - return resource pool in target VIM. caller need indicate template type and version.

func (*TcaApi) GetVimTenants

func (a *TcaApi) GetVimTenants(ctx context.Context) (*response.Tenants, error)

GetVimTenants method return vim tenants as response.Tenants collection.

func (*TcaApi) GetVimVMTemplates

func (a *TcaApi) GetVimVMTemplates(ctx context.Context, cloudName string,
	templateType VmTemplateFilterType, ver string) (*models.VcInventory, error)

GetVimVMTemplates - return compute cluster attached to cloud provider. caller need indicate template type and version.

func (*TcaApi) GetVims

func (a *TcaApi) GetVims(ctx context.Context) (*response.Tenants, error)

GetVims return all attached tenant vim

func (*TcaApi) GetVnfPkgm

func (a *TcaApi) GetVnfPkgm(filter string, pkgId string) (*response.VnfPackages, error)

GetVnfPkgm - return catalog entity pkgId is id of package in TCA filter

func (*TcaApi) GetVnflcm

func (a *TcaApi) GetVnflcm(f ...string) (interface{}, error)

GetVnflcm return lcm state

func (*TcaApi) NormalizeTemplateId

func (a *TcaApi) NormalizeTemplateId(IdOrName string, templateType string) (string, error)

NormalizeTemplateId - resolve template name to id for a give template type. Both must match in order method return ture

func (*TcaApi) ResetState

func (a *TcaApi) ResetState(ctx context.Context, req *ResetInstanceApiReq) error

ResetState reset instance state.

func (*TcaApi) ResolveClusterName

func (a *TcaApi) ResolveClusterName(ctx context.Context, q string) (string, error)

ResolveClusterName - resolve cluster name to cluster id and return a string version. TCA use UUID format for ID.

func (*TcaApi) ResolveExtensionId

func (a *TcaApi) ResolveExtensionId(ctx context.Context, NameOrId string) (string, error)

ResolveExtensionId method resolve Name or Id to extension if extension already valid id it no op

func (*TcaApi) ResolveInstanceName

func (a *TcaApi) ResolveInstanceName(name string) (string, error)

ResolveInstanceName resolve instance name to id

func (*TcaApi) ResolveManagementCluster

func (a *TcaApi) ResolveManagementCluster(NameOrId string, tenants *response.Clusters) (*response.ClusterSpec, error)

ResolveManagementCluster mgmt cluster

func (*TcaApi) ResolvePoolAndCluster

func (a *TcaApi) ResolvePoolAndCluster(ctx context.Context,
	cluster string, nodePool string) (string, string, error)

ResolvePoolAndCluster - api method resolves cluster and node pool in pair return cluster id and pool id or error

func (*TcaApi) ResolvePoolId

func (a *TcaApi) ResolvePoolId(ctx context.Context, poolName string, clusterScope ...string) (string, error)

ResolvePoolId method resolves pool name to pool id

func (*TcaApi) ResolvePoolName

func (a *TcaApi) ResolvePoolName(ctx context.Context, poolName string, clusterName string) (string, string, error)

ResolvePoolName - method resolves pool name to id for a requested cluster. pool name is named pool and cluster is name or uuid

func (*TcaApi) ResolveTemplateId

func (a *TcaApi) ResolveTemplateId(templateId string) (string, error)

ResolveTemplateId - resolves template name to id

func (*TcaApi) ResolveVim

func (a *TcaApi) ResolveVim(ctx context.Context, name string) (*response.TenantsDetails, error)

ResolveVim resolve vim name to id

func (*TcaApi) ResolveVimId

func (a *TcaApi) ResolveVimId(ctx context.Context, name string) (string, error)

func (*TcaApi) ResolveVimName

func (a *TcaApi) ResolveVimName(ctx context.Context, name string) (string, error)

ResolveVimName resolve name to id

func (*TcaApi) RollbackCnf

func (a *TcaApi) RollbackCnf(ctx context.Context, instanceName string, doBlock bool, verbose bool) error

RollbackCnf rollbacks instance if flag delete provide will also delete.

func (*TcaApi) SetBaseUrl

func (a *TcaApi) SetBaseUrl(url string)

SetBaseUrl set tca base api url

func (*TcaApi) SetPassword

func (a *TcaApi) SetPassword(password string)

SetPassword - set password for TCA API client interface.

func (*TcaApi) SetTrace

func (a *TcaApi) SetTrace(trace bool)

SetTrace set trace that will output to stdout server responds

func (*TcaApi) SetUsername

func (a *TcaApi) SetUsername(username string)

SetUsername - sets username for TCA API client interface.

func (*TcaApi) TenantsCloudProvider

func (a *TcaApi) TenantsCloudProvider(ctx context.Context, query string) (*response.Tenants, error)

TenantsCloudProvider return a tenant attached to cloud provide for lookup query string

func (*TcaApi) TerminateCnfInstance

func (a *TcaApi) TerminateCnfInstance(ctx context.Context, req *TerminateInstanceApiReq) error

TerminateCnfInstance method terminate cnf instance caller need provider either name or uuid and vimName doBlock block and wait task to finish verbose output status on screen after each pool timer.

func (*TcaApi) UpdateClusterTemplate

func (a *TcaApi) UpdateClusterTemplate(spec *specs.SpecClusterTemplate) error

UpdateClusterTemplate - updates cluster template based on input initialSpec

func (*TcaApi) UpdateCnfState

func (a *TcaApi) UpdateCnfState(ctx context.Context, req *UpdateInstanceApiReq) (*response.InstanceUpdate, error)

UpdateCnfState update instance state.

func (*TcaApi) UpdateExtension

func (a *TcaApi) UpdateExtension(ctx context.Context, spec *specs.SpecExtension) (bool, error)

UpdateExtension api call delete extension from TCA

func (*TcaApi) UpdateNodePool

func (a *TcaApi) UpdateNodePool(ctx context.Context, req *NodePoolCreateApiReq) (*models.TcaTask, error)

UpdateNodePool api call updates a node pool for a existing cluster or node pool. Both cluster and node pool can be a pool name or pool ids.

API call returns models.TcaTask that hold operation id. req *NodePoolCreateApiReq field

isDry run provide capability to validate specs without applying any changes.
isBlocking will block and wait when all task finish or fail.
isVerbose flag will output progress message during each pool interval.

type TcaTaskFailed

type TcaTaskFailed struct {
	ErrMsg string
}

func (*TcaTaskFailed) Error

func (e *TcaTaskFailed) Error() string

type TcaTaskStateType

type TcaTaskStateType int
const (
	// Instantiate CNF/VNF instantiated
	Instantiate TcaTaskStateType = 1 << iota
	// Terminated CNF/VNF terminated
	Terminated
	// Completed task competed
	Completed
)

TODO move all state

type TerminateInstanceApiReq

type TerminateInstanceApiReq struct {

	//InstanceName instance name
	InstanceName string

	//ClusterName target cluster name
	ClusterName string

	//IsBlocking block or async task
	IsBlocking bool

	// if blocking request require output progress
	IsVerbose bool
}

TerminateInstanceApiReq - api request to terminate CNF or VNF instance.

type UnsupportedCloudProvider

type UnsupportedCloudProvider struct {
	// contains filtered or unexported fields
}

UnsupportedCloudProvider error raised if tenant cloud not found

func (*UnsupportedCloudProvider) Error

func (m *UnsupportedCloudProvider) Error() string

type UpdateInstanceApiReq

type UpdateInstanceApiReq struct {

	//
	UpdateReq *specs.LcmInstantiateRequest

	//InstanceName instance name
	InstanceName string

	//PoolName node pool name
	PoolName string

	//ClusterName target cluster name
	ClusterName string

	//IsBlocking block or async task
	IsBlocking bool

	// if a request is blocking, and caller requires output progress
	IsVerbose bool
}

UpdateInstanceApiReq api request to update a LCM state of existing CNF or VNF instance.

type VmTemplateFilterType

type VmTemplateFilterType string

type VmwareVim

type VmwareVim struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL