github.com/vmware/go-vcloud-director/v2@v2.24.0/types/v56/openapi.go (about)

     1  package types
     2  
     3  import (
     4  	"encoding/json"
     5  	"fmt"
     6  )
     7  
     8  // OpenApiPages unwraps pagination for "Get All" endpoints in OpenAPI. Values kept in json.RawMessage helps to decouple
     9  // marshalling paging related information from exact type related information. Paging can be handled dynamically this
    10  // way while values can be marshaled into exact types.
    11  type OpenApiPages struct {
    12  	// ResultTotal reports total results available
    13  	ResultTotal int `json:"resultTotal,omitempty"`
    14  	// PageCount reports total result pages available
    15  	PageCount int `json:"pageCount,omitempty"`
    16  	// Page reports current page of result
    17  	Page int `json:"page,omitempty"`
    18  	// PageSize reports page size
    19  	PageSize int `json:"pageSize,omitempty"`
    20  	// Associations ...
    21  	Associations interface{} `json:"associations,omitempty"`
    22  	// Values holds types depending on the endpoint therefore `json.RawMessage` is used to dynamically unmarshal into
    23  	// specific type as required
    24  	Values json.RawMessage `json:"values,omitempty"`
    25  }
    26  
    27  // OpenApiError helps to marshal and provider meaningful `Error` for
    28  type OpenApiError struct {
    29  	MinorErrorCode string `json:"minorErrorCode"`
    30  	Message        string `json:"message"`
    31  	StackTrace     string `json:"stackTrace"`
    32  }
    33  
    34  // Error method implements Go's default `error` interface for CloudAPI errors formats them for human readable output.
    35  func (openApiError OpenApiError) Error() string {
    36  	return fmt.Sprintf("%s - %s", openApiError.MinorErrorCode, openApiError.Message)
    37  }
    38  
    39  // ErrorWithStack is the same as `Error()`, but also includes stack trace returned by API which is usually lengthy.
    40  func (openApiError OpenApiError) ErrorWithStack() string {
    41  	return fmt.Sprintf("%s - %s. Stack: %s", openApiError.MinorErrorCode, openApiError.Message,
    42  		openApiError.StackTrace)
    43  }
    44  
    45  // Role defines access roles in VCD
    46  type Role struct {
    47  	ID          string `json:"id,omitempty"`
    48  	Name        string `json:"name,omitempty"`
    49  	Description string `json:"description,omitempty"`
    50  	BundleKey   string `json:"bundleKey,omitempty"`
    51  	ReadOnly    bool   `json:"readOnly,omitempty"`
    52  }
    53  
    54  // NsxtTier0Router defines NSX-T Tier 0 router
    55  type NsxtTier0Router struct {
    56  	ID          string `json:"id,omitempty"`
    57  	Description string `json:"description"`
    58  	DisplayName string `json:"displayName"`
    59  }
    60  
    61  // NsxtEdgeCluster is a struct to represent logical grouping of NSX-T Edge virtual machines.
    62  type NsxtEdgeCluster struct {
    63  	// ID contains edge cluster ID (UUID format)
    64  	ID          string `json:"id"`
    65  	Name        string `json:"name"`
    66  	Description string `json:"description"`
    67  	// NodeCount shows number of nodes in the edge cluster
    68  	NodeCount int `json:"nodeCount"`
    69  	// NodeType usually holds "EDGE_NODE"
    70  	NodeType string `json:"nodeType"`
    71  	// DeploymentType (e.g. "VIRTUAL_MACHINE")
    72  	DeploymentType string `json:"deploymentType"`
    73  }
    74  
    75  // ExternalNetworkV2 defines a struct for OpenAPI endpoint which is capable of creating NSX-V or
    76  // NSX-T external network based on provided NetworkBackings.
    77  type ExternalNetworkV2 struct {
    78  	// ID is unique for the network. This field is read-only.
    79  	ID string `json:"id,omitempty"`
    80  	// Name of the network.
    81  	Name string `json:"name"`
    82  	// Description of the network
    83  	Description string `json:"description"`
    84  	// Subnets define one or more subnets and IP allocation pools in edge gateway
    85  	Subnets ExternalNetworkV2Subnets `json:"subnets,omitempty"`
    86  	// NetworkBackings for this external network. Describes if this external network is backed by
    87  	// port groups, vCenter standard switch or an NSX-T Tier-0 router.
    88  	NetworkBackings ExternalNetworkV2Backings `json:"networkBackings"`
    89  
    90  	// UsingIpSpace indicates whether the external network is using IP Spaces or not. This field is
    91  	// applicable only to the external networks backed by NSX-T Tier-0 router.
    92  	// This field is only available in VCD 10.4.1+
    93  	UsingIpSpace *bool `json:"usingIpSpace,omitempty"`
    94  
    95  	// DedicatedEdgeGateway contains reference to the Edge Gateway that this external network is
    96  	// dedicated to. This is null if this is not a dedicated external network. This field is unset
    97  	// if external network is using IP Spaces.
    98  	DedicatedEdgeGateway *OpenApiReference `json:"dedicatedEdgeGateway,omitempty"`
    99  
   100  	// DedicatedOrg specifies the Organization that this external network belongs to. This is unset
   101  	// for the external networks which are available to more than one organization.
   102  	//
   103  	// If this external network is dedicated to an Edge Gateway, this field is read-only and will be
   104  	// set to the Organization of the Edge Gateway.
   105  	//
   106  	// If this external network is using IP Spaces, this field can
   107  	// be used to dedicate this external network to the specified Organization.
   108  	DedicatedOrg *OpenApiReference `json:"dedicatedOrg,omitempty"`
   109  
   110  	// TotalIpCount contains the number of IP addresses defined by the static ip pools. If the
   111  	// network contains any IPv6 subnets, the total ip count will be null.
   112  	TotalIpCount *int `json:"totalIpCount,omitempty"`
   113  
   114  	// UsedIpCount holds the number of IP address used from the static ip pools.
   115  	UsedIpCount *int `json:"usedIpCount,omitempty"`
   116  }
   117  
   118  // OpenApiIPRangeValues defines allocated IP pools for a subnet in external network
   119  type OpenApiIPRangeValues struct {
   120  	// StartAddress holds starting IP address in the range
   121  	StartAddress string `json:"startAddress"`
   122  	// EndAddress holds ending IP address in the range
   123  	EndAddress string `json:"endAddress"`
   124  }
   125  
   126  // ExternalNetworkV2IPRanges contains slice of ExternalNetworkV2IPRange
   127  type OpenApiIPRanges struct {
   128  	Values []OpenApiIPRangeValues `json:"values"`
   129  }
   130  
   131  // ExternalNetworkV2Subnets contains slice of ExternalNetworkV2Subnet
   132  type ExternalNetworkV2Subnets struct {
   133  	Values []ExternalNetworkV2Subnet `json:"values"`
   134  }
   135  
   136  // ExternalNetworkV2Subnet defines one subnet for external network with assigned static IP ranges
   137  type ExternalNetworkV2Subnet struct {
   138  	// Gateway for the subnet
   139  	Gateway string `json:"gateway"`
   140  	// PrefixLength holds prefix length of the subnet
   141  	PrefixLength int `json:"prefixLength"`
   142  	// DNSSuffix is the DNS suffix that VMs attached to this network will use (NSX-V only)
   143  	DNSSuffix string `json:"dnsSuffix"`
   144  	// DNSServer1 - first DNS server that VMs attached to this network will use (NSX-V only)
   145  	DNSServer1 string `json:"dnsServer1"`
   146  	// DNSServer2 - second DNS server that VMs attached to this network will use (NSX-V only)
   147  	DNSServer2 string `json:"dnsServer2"`
   148  	// Enabled indicates whether the external network subnet is currently enabled
   149  	Enabled bool `json:"enabled"`
   150  	// UsedIPCount shows number of IP addresses defined by the static IP ranges
   151  	UsedIPCount int `json:"usedIpCount,omitempty"`
   152  	// TotalIPCount shows number of IP address used from the static IP ranges
   153  	TotalIPCount int `json:"totalIpCount,omitempty"`
   154  	// IPRanges define allocated static IP pools allocated from a defined subnet
   155  	IPRanges ExternalNetworkV2IPRanges `json:"ipRanges"`
   156  }
   157  
   158  type ExternalNetworkV2Backings struct {
   159  	Values []ExternalNetworkV2Backing `json:"values"`
   160  }
   161  
   162  // ExternalNetworkV2Backing defines which networking subsystem is used for external network (NSX-T or NSX-V)
   163  type ExternalNetworkV2Backing struct {
   164  	// BackingID must contain either Tier-0 router ID for NSX-T or PortGroup ID for NSX-V
   165  	BackingID string `json:"backingId"`
   166  	Name      string `json:"name,omitempty"`
   167  	// BackingType can be either ExternalNetworkBackingTypeNsxtTier0Router in case of NSX-T or one
   168  	// of ExternalNetworkBackingTypeNetwork or ExternalNetworkBackingDvPortgroup in case of NSX-V
   169  	// Deprecated in favor of BackingTypeValue in API V35.0
   170  	BackingType string `json:"backingType,omitempty"`
   171  
   172  	// BackingTypeValue replaces BackingType in API V35.0 and adds support for additional network backing type
   173  	// ExternalNetworkBackingTypeNsxtSegment
   174  	BackingTypeValue string `json:"backingTypeValue,omitempty"`
   175  	// NetworkProvider defines backing network manager
   176  	NetworkProvider NetworkProvider `json:"networkProvider"`
   177  }
   178  
   179  // NetworkProvider can be NSX-T manager or vCenter. ID is sufficient for creation purpose.
   180  type NetworkProvider struct {
   181  	Name string `json:"name,omitempty"`
   182  	ID   string `json:"id"`
   183  }
   184  
   185  // VdcComputePolicy contains VDC specific configuration for workloads. (version 1.0.0)
   186  // Deprecated: Use VdcComputePolicyV2 instead (version 2.0.0)
   187  type VdcComputePolicy struct {
   188  	ID                         string   `json:"id,omitempty"`
   189  	Description                *string  `json:"description"` // It's a not-omitempty pointer to be able to send "null" values for empty descriptions.
   190  	Name                       string   `json:"name"`
   191  	CPUSpeed                   *int     `json:"cpuSpeed,omitempty"`
   192  	Memory                     *int     `json:"memory,omitempty"`
   193  	CPUCount                   *int     `json:"cpuCount,omitempty"`
   194  	CoresPerSocket             *int     `json:"coresPerSocket,omitempty"`
   195  	MemoryReservationGuarantee *float64 `json:"memoryReservationGuarantee,omitempty"`
   196  	CPUReservationGuarantee    *float64 `json:"cpuReservationGuarantee,omitempty"`
   197  	CPULimit                   *int     `json:"cpuLimit,omitempty"`
   198  	MemoryLimit                *int     `json:"memoryLimit,omitempty"`
   199  	CPUShares                  *int     `json:"cpuShares,omitempty"`
   200  	MemoryShares               *int     `json:"memoryShares,omitempty"`
   201  	ExtraConfigs               *struct {
   202  		AdditionalProp1 string `json:"additionalProp1,omitempty"`
   203  		AdditionalProp2 string `json:"additionalProp2,omitempty"`
   204  		AdditionalProp3 string `json:"additionalProp3,omitempty"`
   205  	} `json:"extraConfigs,omitempty"`
   206  	PvdcComputePolicyRef     *OpenApiReference   `json:"pvdcComputePolicyRef,omitempty"`
   207  	PvdcComputePolicy        *OpenApiReference   `json:"pvdcComputePolicy,omitempty"`
   208  	CompatibleVdcTypes       []string            `json:"compatibleVdcTypes,omitempty"`
   209  	IsSizingOnly             bool                `json:"isSizingOnly,omitempty"`
   210  	PvdcID                   string              `json:"pvdcId,omitempty"`
   211  	NamedVMGroups            []OpenApiReferences `json:"namedVmGroups,omitempty"`
   212  	LogicalVMGroupReferences OpenApiReferences   `json:"logicalVmGroupReferences,omitempty"`
   213  	IsAutoGenerated          bool                `json:"isAutoGenerated,omitempty"`
   214  }
   215  
   216  // VdcComputePolicyV2 contains VDC specific configuration for workloads (version 2.0.0)
   217  // https://developer.vmware.com/apis/vmware-cloud-director/latest/data-structures/VdcComputePolicy2/
   218  type VdcComputePolicyV2 struct {
   219  	VdcComputePolicy
   220  	PolicyType             string                   `json:"policyType"` // Required. Can be "VdcVmPolicy" or "VdcKubernetesPolicy"
   221  	IsVgpuPolicy           bool                     `json:"isVgpuPolicy,omitempty"`
   222  	PvdcNamedVmGroupsMap   []PvdcNamedVmGroupsMap   `json:"pvdcNamedVmGroupsMap,omitempty"`
   223  	PvdcLogicalVmGroupsMap []PvdcLogicalVmGroupsMap `json:"pvdcLogicalVmGroupsMap,omitempty"`
   224  	PvdcVgpuClustersMap    []PvdcVgpuClustersMap    `json:"pvdcVgpuClustersMap,omitempty"`
   225  	VgpuProfiles           []VgpuProfile            `json:"vgpuProfiles,omitempty"`
   226  }
   227  
   228  // PvdcNamedVmGroupsMap is a combination of a reference to a Provider VDC and a list of references to Named VM Groups.
   229  // This is used for VM Placement Policies (see VdcComputePolicyV2)
   230  type PvdcNamedVmGroupsMap struct {
   231  	NamedVmGroups []OpenApiReferences `json:"namedVmGroups,omitempty"`
   232  	Pvdc          OpenApiReference    `json:"pvdc,omitempty"`
   233  }
   234  
   235  // PvdcLogicalVmGroupsMap is a combination of a reference to a Provider VDC and a list of references to Logical VM Groups.
   236  // This is used for VM Placement Policies (see VdcComputePolicyV2)
   237  type PvdcLogicalVmGroupsMap struct {
   238  	LogicalVmGroups OpenApiReferences `json:"logicalVmGroups,omitempty"`
   239  	Pvdc            OpenApiReference  `json:"pvdc,omitempty"`
   240  }
   241  
   242  type PvdcVgpuClustersMap struct {
   243  	Clusters []string         `json:"clusters,omitempty"`
   244  	Pvdc     OpenApiReference `json:"pvdc,omitempty"`
   245  }
   246  
   247  // OpenApiReference is a generic reference type commonly used throughout OpenAPI endpoints
   248  type OpenApiReference struct {
   249  	Name string `json:"name,omitempty"`
   250  	ID   string `json:"id,omitempty"`
   251  }
   252  
   253  type OpenApiReferences []OpenApiReference
   254  
   255  // VdcCapability can be used to determine VDC capabilities, including such:
   256  // * Is it backed by NSX-T or NSX-V pVdc
   257  // * Does it support BGP routing
   258  type VdcCapability struct {
   259  	// Name of capability
   260  	Name string `json:"name"`
   261  	// Description of capability
   262  	Description string `json:"description"`
   263  	// Value can be any value. Sometimes it is a JSON bool (true, false), sometimes it is a JSON array (["custom", "default"])
   264  	// and sometimes just a string ("NSX_V"). It is up for the consumer to handle values as per the Type field.
   265  	Value interface{} `json:"value"`
   266  	// Type of field (e.g. "Boolean", "String", "List")
   267  	Type string `json:"type"`
   268  	// Category of capability (e.g. "Security", "EdgeGateway", "OrgVdcNetwork")
   269  	Category string `json:"category"`
   270  }
   271  
   272  // A Right is a component of a role, a global role, or a rights bundle.
   273  // In this view, roles, global roles, and rights bundles are collections of rights.
   274  // Note that the rights are not stored in the above collection structures, but retrieved separately
   275  type Right struct {
   276  	Name             string             `json:"name"`
   277  	ID               string             `json:"id"`
   278  	Description      string             `json:"description,omitempty"`
   279  	BundleKey        string             `json:"bundleKey,omitempty"`        // key used for internationalization
   280  	Category         string             `json:"category,omitempty"`         // Category ID
   281  	ServiceNamespace string             `json:"serviceNamespace,omitempty"` // Not used
   282  	RightType        string             `json:"rightType,omitempty"`        // VIEW or MODIFY
   283  	ImpliedRights    []OpenApiReference `json:"impliedRights,omitempty"`
   284  }
   285  
   286  // RightsCategory defines the category to which the Right belongs
   287  type RightsCategory struct {
   288  	Name        string `json:"name"`
   289  	Id          string `json:"id"`
   290  	BundleKey   string `json:"bundleKey"` // key used for internationalization
   291  	Parent      string `json:"parent"`
   292  	RightsCount struct {
   293  		View   int `json:"view"`
   294  		Modify int `json:"modify"`
   295  	} `json:"rightsCount"`
   296  	SubCategories []string `json:"subCategories"`
   297  }
   298  
   299  // RightsBundle is a collection of Rights to be assigned to a tenant(= organization).
   300  // Changing a rights bundle and publishing it for a given tenant will limit
   301  // the rights that the global roles implement in such tenant.
   302  type RightsBundle struct {
   303  	Name        string `json:"name"`
   304  	Id          string `json:"id"`
   305  	Description string `json:"description,omitempty"`
   306  	BundleKey   string `json:"bundleKey,omitempty"` // key used for internationalization
   307  	ReadOnly    bool   `json:"readOnly"`
   308  	PublishAll  *bool  `json:"publishAll"`
   309  }
   310  
   311  // GlobalRole is a Role definition implemented in the provider that is passed on to tenants (=organizations)
   312  // Modifying an existing global role has immediate effect on the corresponding roles in the tenants (no need
   313  // to re-publish) while creating a new GlobalRole is only passed to the tenants if it is published.
   314  type GlobalRole struct {
   315  	Name        string `json:"name"`
   316  	Id          string `json:"id"`
   317  	Description string `json:"description,omitempty"`
   318  	BundleKey   string `json:"bundleKey,omitempty"` // key used for internationalization
   319  	ReadOnly    bool   `json:"readOnly"`
   320  	PublishAll  *bool  `json:"publishAll"`
   321  }
   322  
   323  // OpenApiItems defines the input when multiple items need to be passed to a POST or PUT operation
   324  // All the fields are optional, except Values
   325  // This structure is the same as OpenApiPages, except for the type of Values, which is explicitly
   326  // defined as a collection of name+ID structures
   327  type OpenApiItems struct {
   328  	ResultTotal  int                `json:"resultTotal,omitempty"`
   329  	PageCount    int                `json:"pageCount,omitempty"`
   330  	Page         int                `json:"page,omitempty"`
   331  	PageSize     int                `json:"pageSize,omitempty"`
   332  	Associations interface{}        `json:"associations,omitempty"`
   333  	Values       []OpenApiReference `json:"values"` // a collection of items defined by an ID + a name
   334  }
   335  
   336  // CertificateLibraryItem is a Certificate Library definition of stored Certificate details
   337  type CertificateLibraryItem struct {
   338  	Alias                string `json:"alias"`
   339  	Id                   string `json:"id,omitempty"`
   340  	Certificate          string `json:"certificate"` // PEM encoded certificate
   341  	Description          string `json:"description,omitempty"`
   342  	PrivateKey           string `json:"privateKey,omitempty"`           // PEM encoded private key. Required if providing a certificate chain
   343  	PrivateKeyPassphrase string `json:"privateKeyPassphrase,omitempty"` // passphrase for the private key. Required if the private key is encrypted
   344  }
   345  
   346  // CurrentSessionInfo gives information about the current session
   347  type CurrentSessionInfo struct {
   348  	ID                        string            `json:"id"`                        // Session ID
   349  	User                      OpenApiReference  `json:"user"`                      // Name of the user associated with this session
   350  	Org                       OpenApiReference  `json:"org"`                       // Organization for this connection
   351  	Location                  string            `json:"location"`                  // Location ID: unknown usage
   352  	Roles                     []string          `json:"roles"`                     // Roles associated with the session user
   353  	RoleRefs                  OpenApiReferences `json:"roleRefs"`                  // Roles references for the session user
   354  	SessionIdleTimeoutMinutes int               `json:"sessionIdleTimeoutMinutes"` // session idle timeout
   355  }
   356  
   357  // VdcGroup is a VDC group definition
   358  type VdcGroup struct {
   359  	Description                string                 `json:"description,omitempty"`                // The description of this group.
   360  	DfwEnabled                 bool                   `json:"dfwEnabled,omitempty"`                 // Whether Distributed Firewall is enabled for this vDC Group. Only applicable for NSX_T vDC Groups.
   361  	ErrorMessage               string                 `json:"errorMessage,omitempty"`               // If the group has an error status, a more detailed error message is set here.
   362  	Id                         string                 `json:"id,omitempty"`                         // The unique ID for the vDC Group (read-only).
   363  	LocalEgress                bool                   `json:"localEgress,omitempty"`                // Determines whether local egress is enabled for a universal router belonging to a universal vDC group. This value is used on create if universalNetworkingEnabled is set to true. This cannot be updated. This value is always false for local vDC groups.
   364  	Name                       string                 `json:"name"`                                 // The name of this group. The name must be unique.
   365  	NetworkPoolId              string                 `json:"networkPoolId,omitempty"`              // ID of network pool to use if creating a local vDC group router. Must be set if creating a local group. Ignored if creating a universal group.
   366  	NetworkPoolUniversalId     string                 `json:"networkPoolUniversalId,omitempty"`     // The network provider’s universal id that is backing the universal network pool. This field is read-only and is derived from the list of participating vDCs if a universal vDC group is created. For universal vDC groups, each participating vDC should have a universal network pool that is backed by this same id.
   367  	NetworkProviderType        string                 `json:"networkProviderType,omitempty"`        // The values currently supported are NSX_V and NSX_T. Defines the networking provider backing the vDC Group. This is used on create. If not specified, NSX_V value will be used. NSX_V is used for existing vDC Groups and vDC Groups where Cross-VC NSX is used for the underlying technology. NSX_T is used when the networking provider type for the Organization vDCs in the group is NSX-T. NSX_T only supports groups of type LOCAL (single site).
   368  	OrgId                      string                 `json:"orgId"`                                // The organization that this group belongs to.
   369  	ParticipatingOrgVdcs       []ParticipatingOrgVdcs `json:"participatingOrgVdcs"`                 // The list of organization vDCs that are participating in this group.
   370  	Status                     string                 `json:"status,omitempty"`                     // The status that the group can be in. Possible values are: SAVING, SAVED, CONFIGURING, REALIZED, REALIZATION_FAILED, DELETING, DELETE_FAILED, OBJECT_NOT_FOUND, UNCONFIGURED
   371  	Type                       string                 `json:"type,omitempty"`                       // Defines the group as LOCAL or UNIVERSAL. This cannot be changed. Local vDC Groups can have networks stretched across multiple vDCs in a single Cloud Director instance. Local vDC Groups share the same broadcast domain/transport zone and network provider scope. Universal vDC groups can have networks stretched across multiple vDCs in a single or multiple Cloud Director instance(s). Universal vDC groups are backed by a broadcast domain/transport zone that strectches across a single or multiple Cloud Director instance(s). Local vDC groups are supported for both NSX-V and NSX-T Network Provider Types. Universal vDC Groups are supported for only NSX_V Network Provider Type. Possible values are: LOCAL , UNIVERSAL
   372  	UniversalNetworkingEnabled bool                   `json:"universalNetworkingEnabled,omitempty"` // True means that a vDC group router has been created. If set to true for vdc group creation, a universal router will also be created.
   373  }
   374  
   375  // ParticipatingOrgVdcs is a participating Org VDCs definition
   376  type ParticipatingOrgVdcs struct {
   377  	FaultDomainTag       string           `json:"faultDomainTag,omitempty"`       // Represents the fault domain of a given organization vDC. For NSX_V backed organization vDCs, this is the network provider scope. For NSX_T backed organization vDCs, this can vary (for example name of the provider vDC or compute provider scope).
   378  	NetworkProviderScope string           `json:"networkProviderScope,omitempty"` // Read-only field that specifies the network provider scope of the vDC.
   379  	OrgRef               OpenApiReference `json:"orgRef,omitempty"`               // Read-only field that specifies what organization this vDC is in.
   380  	RemoteOrg            bool             `json:"remoteOrg,omitempty"`            // Read-only field that specifies whether the vDC is local to this VCD site.
   381  	SiteRef              OpenApiReference `json:"siteRef,omitempty"`              // The site ID that this vDC belongs to. Required for universal vDC groups.
   382  	Status               string           `json:"status,omitempty"`               // The status that the vDC can be in. An example is if the vDC has been deleted from the system but is still part of the group. Possible values are: SAVING, SAVED, CONFIGURING, REALIZED, REALIZATION_FAILED, DELETING, DELETE_FAILED, OBJECT_NOT_FOUND, UNCONFIGURED
   383  	VdcRef               OpenApiReference `json:"vdcRef"`                         // The reference to the vDC that is part of this a vDC group.
   384  }
   385  
   386  // CandidateVdc defines possible candidate VDCs for VDC group
   387  type CandidateVdc struct {
   388  	FaultDomainTag       string           `json:"faultDomainTag"`
   389  	Id                   string           `json:"id"`
   390  	Name                 string           `json:"name"`
   391  	NetworkProviderScope string           `json:"networkProviderScope"`
   392  	OrgRef               OpenApiReference `json:"orgRef"`
   393  	SiteRef              OpenApiReference `json:"siteRef"`
   394  }
   395  
   396  // DfwPolicies defines Distributed firewall policies
   397  type DfwPolicies struct {
   398  	Enabled       bool           `json:"enabled"`
   399  	DefaultPolicy *DefaultPolicy `json:"defaultPolicy,omitempty"`
   400  }
   401  
   402  // DefaultPolicy defines Default policy for Distributed firewall
   403  type DefaultPolicy struct {
   404  	Description string        `json:"description,omitempty"` // Description for the security policy.
   405  	Enabled     *bool         `json:"enabled,omitempty"`     // Whether this security policy is enabled.
   406  	Id          string        `json:"id,omitempty"`          // The unique id of this security policy. On updates, the id is required for the policy, while for create a new id will be generated. This id is not a VCD URN.
   407  	Name        string        `json:"name"`                  // Name for the security policy.
   408  	Version     *VersionField `json:"version,omitempty"`     // This property describes the current version of the entity. To prevent clients from overwriting each other’s changes, update operations must include the version which can be obtained by issuing a GET operation. If the version number on an update call is missing, the operation will be rejected. This is only needed on update calls.
   409  }
   410  
   411  // VersionField defines Version
   412  type VersionField struct {
   413  	Version int `json:"version"`
   414  }
   415  
   416  // TestConnection defines the parameters used when testing a connection, including SSL handshake and hostname verification.
   417  type TestConnection struct {
   418  	Host                          string               `json:"host"`                                    // The host (or IP address) to connect to.
   419  	Port                          int                  `json:"port"`                                    // The port to use when connecting.
   420  	Secure                        *bool                `json:"secure,omitempty"`                        // If the connection should use https.
   421  	Timeout                       int                  `json:"timeout,omitempty"`                       // Maximum time (in seconds) any step in the test should wait for a response.
   422  	HostnameVerificationAlgorithm string               `json:"hostnameVerificationAlgorithm,omitempty"` // Endpoint/Hostname verification algorithm to be used during SSL/TLS/DTLS handshake.
   423  	AdditionalCAIssuers           []string             `json:"additionalCAIssuers,omitempty"`           // A list of URLs being authorized by the user to retrieve additional CA certificates from, if necessary, to complete the certificate chain to its trust anchor.
   424  	ProxyConnection               *ProxyTestConnection `json:"proxyConnection,omitempty"`               // Proxy connection to use for test. Only one of proxyConnection and preConfiguredProxy can be specified.
   425  	PreConfiguredProxy            string               `json:"preConfiguredProxy,omitempty"`            // The URN of a ProxyConfiguration to use for the test. Only one of proxyConnection or preConfiguredProxy can be specified. If neither is specified then no proxy is used to test the connection.
   426  }
   427  
   428  // ProxyTestConnection defines the proxy connection to use for TestConnection (if any).
   429  type ProxyTestConnection struct {
   430  	ProxyHost     string `json:"proxyHost"`               // The host (or IP address) of the proxy.
   431  	ProxyPort     int    `json:"proxyPort"`               // The port to use when connecting to the proxy.
   432  	ProxyUsername string `json:"proxyUsername,omitempty"` // Username to authenticate to the proxy.
   433  	ProxyPassword string `json:"proxyPassword,omitempty"` // Password to authenticate to the proxy.
   434  	ProxySecure   *bool  `json:"proxySecure,omitempty"`   // If the connection to the proxy should use https.
   435  }
   436  
   437  // TestConnectionResult is the result of a connection test.
   438  type TestConnectionResult struct {
   439  	TargetProbe *ProbeResult `json:"targetProbe,omitempty"` // Results of a connection test to a specific endpoint.
   440  	ProxyProbe  *ProbeResult `json:"proxyProbe,omitempty"`  // Results of a connection test to a specific endpoint.
   441  }
   442  
   443  // ProbeResult results of a connection test to a specific endpoint.
   444  type ProbeResult struct {
   445  	Result              string   `json:"result,omitempty"`              // Localized message describing the connection result stating success or an error message with a brief summary.
   446  	ResolvedIp          string   `json:"resolvedIp,omitempty"`          // The IP address the host was resolved to, if not going through a proxy.
   447  	CanConnect          bool     `json:"canConnect,omitempty"`          // If vCD can establish a connection on the specified port.
   448  	SSLHandshake        bool     `json:"sslHandshake,omitempty"`        // If an SSL Handshake succeeded (secure requests only).
   449  	ConnectionResult    string   `json:"connectionResult,omitempty"`    // A code describing the result of establishing a connection. It can be either SUCCESS, ERROR_CANNOT_RESOLVE_IP or ERROR_CANNOT_CONNECT.
   450  	SSLResult           string   `json:"sslResult,omitempty"`           // A code describing the result of the SSL handshake. It can be either SUCCESS, ERROR_SSL_ERROR, ERROR_UNTRUSTED_CERTIFICATE, ERROR_CANNOT_VERIFY_HOSTNAME or null.
   451  	CertificateChain    string   `json:"certificateChain,omitempty"`    // The SSL certificate chain presented by the server if a secure connection was made.
   452  	AdditionalCAIssuers []string `json:"additionalCAIssuers,omitempty"` // URLs supplied by Certificate Authorities to retrieve signing certificates, when those certificates are not included in the chain.
   453  }
   454  
   455  // LogicalVmGroup is used to create VM Placement Policies in VCD.
   456  type LogicalVmGroup struct {
   457  	Name                   string            `json:"name,omitempty"` // Display name
   458  	Description            string            `json:"description,omitempty"`
   459  	ID                     string            `json:"id,omitempty"`                     // UUID for LogicalVmGroup. This is immutable
   460  	NamedVmGroupReferences OpenApiReferences `json:"namedVmGroupReferences,omitempty"` // List of named VM Groups associated with LogicalVmGroup.
   461  	PvdcID                 string            `json:"pvdcId,omitempty"`                 // URN for Provider VDC
   462  }
   463  
   464  // DefinedInterface defines a interface for a defined entity. The combination of nss+version+vendor should be unique
   465  type DefinedInterface struct {
   466  	ID         string `json:"id,omitempty"`       // The id of the defined interface type in URN format
   467  	Name       string `json:"name,omitempty"`     // The name of the defined interface
   468  	Nss        string `json:"nss,omitempty"`      // A unique namespace associated with the interface
   469  	Version    string `json:"version,omitempty"`  // The interface's version. The version should follow semantic versioning rules
   470  	Vendor     string `json:"vendor,omitempty"`   // The vendor name
   471  	IsReadOnly bool   `json:"readonly,omitempty"` // True if the entity type cannot be modified
   472  }
   473  
   474  // Behavior defines a concept similar to a "procedure" that lives inside Defined Interfaces or Defined Entity Types as overrides.
   475  type Behavior struct {
   476  	ID          string                 `json:"id,omitempty"`          // The Behavior ID is generated and is an output-only property
   477  	Description string                 `json:"description,omitempty"` // A description specifying the contract of the Behavior
   478  	Execution   map[string]interface{} `json:"execution,omitempty"`   // The Behavior execution mechanism. Can be defined both in an Interface and in a Defined Entity Type as an override
   479  	Ref         string                 `json:"ref,omitempty"`         // The Behavior invocation reference to be used for polymorphic behavior invocations. It is generated and is an output-only property
   480  	Name        string                 `json:"name,omitempty"`
   481  }
   482  
   483  // BehaviorAccess defines the access control configuration of a Behavior.
   484  type BehaviorAccess struct {
   485  	AccessLevelId string `json:"accessLevelId,omitempty"` // The ID of an AccessLevel
   486  	BehaviorId    string `json:"behaviorId,omitempty"`    // The ID of the Behavior. It can be both a behavior-interface or an overridden behavior-type ID
   487  }
   488  
   489  // BehaviorInvocation is an invocation of a Behavior on a Defined Entity instance. Currently, the Behavior interfaces are key-value maps specified in the Behavior description.
   490  type BehaviorInvocation struct {
   491  	Arguments interface{} `json:"arguments,omitempty"`
   492  	Metadata  interface{} `json:"metadata,omitempty"`
   493  }
   494  
   495  // DefinedEntityType describes what a Defined Entity Type should look like.
   496  type DefinedEntityType struct {
   497  	ID               string                 `json:"id,omitempty"`               // The id of the defined entity type in URN format
   498  	Name             string                 `json:"name,omitempty"`             // The name of the defined entity type
   499  	Nss              string                 `json:"nss,omitempty"`              // A unique namespace specific string. The combination of nss and version must be unique
   500  	Version          string                 `json:"version,omitempty"`          // The version of the defined entity. The combination of nss and version must be unique. The version string must follow semantic versioning rules
   501  	Description      string                 `json:"description,omitempty"`      // Description of the defined entity
   502  	ExternalId       string                 `json:"externalId,omitempty"`       // An external entity’s id that this definition may apply to
   503  	Hooks            map[string]string      `json:"hooks,omitempty"`            // A mapping defining which behaviors should be invoked upon specific lifecycle events, like PostCreate, PostUpdate, PreDelete. For example: "hooks": { "PostCreate": "urn:vcloud:behavior-interface:postCreateHook:vendorA:containerCluster:1.0.0" }. Added in 36.0
   504  	InheritedVersion string                 `json:"inheritedVersion,omitempty"` // To be used when creating a new version of a defined entity type. Specifies the version of the type that will be the template for the authorization configuration of the new version. The Type ACLs and the access requirements of the Type Behaviors of the new version will be copied from those of the inherited version. If the value of this property is ‘0’, then the new type version will not inherit another version and will have the default authorization settings, just like the first version of a new type. Added in 36.0
   505  	Interfaces       []string               `json:"interfaces,omitempty"`       // List of interface IDs that this defined entity type is referenced by
   506  	MaxImplicitRight string                 `json:"maxImplicitRight,omitempty"` // The maximum Type Right level that will be implied from the user’s Type ACLs if this field is defined. For example, “maxImplicitRight”: “urn:vcloud:accessLevel:ReadWrite” would mean that a user with RO , RW, and FC ACLs to the Type would implicitly get the “Read: ” and “Write: ” rights, but not the “Full Control: ” right. The valid values are “urn:vcloud:accessLevel:ReadOnly”, “urn:vcloud:accessLevel:ReadWrite”, “urn:vcloud:accessLevel:FullControl”
   507  	IsReadOnly       bool                   `json:"readonly,omitempty"`         // `true` if the entity type cannot be modified
   508  	Schema           map[string]interface{} `json:"schema,omitempty"`           // The JSON-Schema valid definition of the defined entity type. If no JSON Schema version is specified, version 4 will be assumed
   509  	Vendor           string                 `json:"vendor,omitempty"`           // The vendor name
   510  }
   511  
   512  // DefinedEntity describes an instance of a defined entity type.
   513  type DefinedEntity struct {
   514  	ID         string                 `json:"id,omitempty"`         // The id of the defined entity in URN format
   515  	EntityType string                 `json:"entityType,omitempty"` // The URN ID of the defined entity type that the entity is an instance of. This is a read-only field
   516  	Name       string                 `json:"name,omitempty"`       // The name of the defined entity
   517  	ExternalId string                 `json:"externalId,omitempty"` // An external entity's id that this entity may have a relation to.
   518  	Entity     map[string]interface{} `json:"entity,omitempty"`     // A JSON value representation. The JSON will be validated against the schema of the DefinedEntityType that the entity is an instance of
   519  	State      *string                `json:"state,omitempty"`      // Every entity is created in the "PRE_CREATED" state. Once an entity is ready to be validated against its schema, it will transition in another state - RESOLVED, if the entity is valid according to the schema, or RESOLUTION_ERROR otherwise. If an entity in an "RESOLUTION_ERROR" state is updated, it will transition to the inital "PRE_CREATED" state without performing any validation. If its in the "RESOLVED" state, then it will be validated against the entity type schema and throw an exception if its invalid
   520  	Owner      *OpenApiReference      `json:"owner,omitempty"`      // The owner of the defined entity
   521  	Org        *OpenApiReference      `json:"org,omitempty"`        // The organization of the defined entity.
   522  }
   523  
   524  type VSphereVirtualCenter struct {
   525  	VcId                      string `json:"vcId"`
   526  	Name                      string `json:"name"`
   527  	Description               string `json:"description"`
   528  	Username                  string `json:"username"`
   529  	Password                  string `json:"password"`
   530  	Url                       string `json:"url"`
   531  	IsEnabled                 bool   `json:"isEnabled"`
   532  	VsphereWebClientServerUrl string `json:"vsphereWebClientServerUrl"`
   533  	HasProxy                  bool   `json:"hasProxy"`
   534  	RootFolder                string `json:"rootFolder"`
   535  	VcNoneNetwork             string `json:"vcNoneNetwork"`
   536  	TenantVisibleName         string `json:"tenantVisibleName"`
   537  	IsConnected               bool   `json:"isConnected"`
   538  	Mode                      string `json:"mode"`
   539  	ListenerState             string `json:"listenerState"`
   540  	ClusterHealthStatus       string `json:"clusterHealthStatus"`
   541  	VcVersion                 string `json:"vcVersion"`
   542  	BuildNumber               string `json:"buildNumber"`
   543  	Uuid                      string `json:"uuid"`
   544  	NsxVManager               struct {
   545  		Username        string `json:"username"`
   546  		Password        string `json:"password"`
   547  		Url             string `json:"url"`
   548  		SoftwareVersion string `json:"softwareVersion"`
   549  	} `json:"nsxVManager"`
   550  	ProxyConfigurationUrn string `json:"proxyConfigurationUrn"`
   551  }
   552  
   553  type ResourcePoolSummary struct {
   554  	Associations []struct {
   555  		EntityId      string `json:"entityId"`
   556  		AssociationId string `json:"associationId"`
   557  	} `json:"associations"`
   558  	Values []ResourcePool `json:"values"`
   559  }
   560  
   561  // ResourcePool defines a vSphere Resource Pool
   562  type ResourcePool struct {
   563  	Moref             string `json:"moref"`
   564  	ClusterMoref      string `json:"clusterMoref"`
   565  	Name              string `json:"name"`
   566  	VcId              string `json:"vcId"`
   567  	Eligible          bool   `json:"eligible"`
   568  	KubernetesEnabled bool   `json:"kubernetesEnabled"`
   569  	VgpuEnabled       bool   `json:"vgpuEnabled"`
   570  }
   571  
   572  // OpenApiSupportedHardwareVersions is the list of versions supported by a given resource
   573  type OpenApiSupportedHardwareVersions struct {
   574  	Versions          []string `json:"versions"`
   575  	SupportedVersions []struct {
   576  		IsDefault bool   `json:"isDefault"`
   577  		Name      string `json:"name"`
   578  	} `json:"supportedVersions"`
   579  }
   580  
   581  // NetworkPool is the full data retrieved for a provider network pool
   582  type NetworkPool struct {
   583  	Status             string             `json:"status,omitempty"`
   584  	Id                 string             `json:"id,omitempty"`
   585  	Name               string             `json:"name"`
   586  	Description        string             `json:"description"`
   587  	PoolType           string             `json:"poolType"`
   588  	PromiscuousMode    bool               `json:"promiscuousMode,omitempty"`
   589  	TotalBackingsCount int                `json:"totalBackingsCount,omitempty"`
   590  	UsedBackingsCount  int                `json:"usedBackingsCount,omitempty"`
   591  	ManagingOwnerRef   OpenApiReference   `json:"managingOwnerRef"`
   592  	Backing            NetworkPoolBacking `json:"backing"`
   593  }
   594  
   595  // NetworkPoolBacking is the definition of the objects supporting the network pool
   596  type NetworkPoolBacking struct {
   597  	VlanIdRanges     VlanIdRanges       `json:"vlanIdRanges,omitempty"`
   598  	VdsRefs          []OpenApiReference `json:"vdsRefs,omitempty"`
   599  	PortGroupRefs    []OpenApiReference `json:"portGroupRefs,omitempty"`
   600  	TransportZoneRef OpenApiReference   `json:"transportZoneRef,omitempty"`
   601  	ProviderRef      OpenApiReference   `json:"providerRef"`
   602  }
   603  
   604  type VlanIdRanges struct {
   605  	Values []VlanIdRange `json:"values"`
   606  }
   607  
   608  // VlanIdRange is a component of a network pool of type VLAN
   609  type VlanIdRange struct {
   610  	StartId int `json:"startId"`
   611  	EndId   int `json:"endId"`
   612  }
   613  
   614  // OpenApiStorageProfile defines a storage profile before it is assigned to a provider VDC
   615  type OpenApiStorageProfile struct {
   616  	Moref string `json:"moref"`
   617  	Name  string `json:"name"`
   618  }
   619  
   620  // UIPluginMetadata gives meta information about a UI Plugin
   621  type UIPluginMetadata struct {
   622  	ID             string `json:"id,omitempty"`
   623  	Vendor         string `json:"vendor,omitempty"`
   624  	License        string `json:"license,omitempty"`
   625  	Link           string `json:"link,omitempty"`
   626  	PluginName     string `json:"pluginName,omitempty"`
   627  	Version        string `json:"version,omitempty"`
   628  	Description    string `json:"description,omitempty"`
   629  	ProviderScoped bool   `json:"provider_scoped,omitempty"`
   630  	TenantScoped   bool   `json:"tenant_scoped,omitempty"`
   631  	Enabled        bool   `json:"enabled,omitempty"`
   632  	PluginStatus   string `json:"plugin_status,omitempty"`
   633  }
   634  
   635  // UploadSpec gives information about an upload
   636  type UploadSpec struct {
   637  	FileName     string `json:"fileName,omitempty"`
   638  	Size         int64  `json:"size,omitempty"`
   639  	Checksum     string `json:"checksum,omitempty"`
   640  	ChecksumAlgo string `json:"checksumAlgo,omitempty"`
   641  }
   642  
   643  type TransportZones struct {
   644  	Values []*TransportZone `json:"values"`
   645  }
   646  
   647  // TransportZone is a backing component of a network pool of type 'GENEVE' (NSX-T backed)
   648  type TransportZone struct {
   649  	Id              string `json:"id"`
   650  	Name            string `json:"name"`
   651  	Type            string `json:"type,omitempty"`
   652  	AlreadyImported bool   `json:"alreadyImported"`
   653  }
   654  
   655  // VcenterDistributedSwitch is a backing component of a network pool of type VLAN
   656  type VcenterDistributedSwitch struct {
   657  	BackingRef    OpenApiReference `json:"backingRef"`
   658  	VirtualCenter OpenApiReference `json:"virtualCenter"`
   659  }
   660  
   661  // OpenApiMetadataEntry represents a metadata entry in VCD.
   662  type OpenApiMetadataEntry struct {
   663  	ID           string                  `json:"id,omitempty"`         // UUID for OpenApiMetadataEntry. This is immutable
   664  	IsPersistent bool                    `json:"persistent,omitempty"` // Persistent entries can be copied over on some entity operation, for example: Creating a copy of an Org VDC, capturing a vApp to a template, instantiating a catalog item as a VM, etc.
   665  	IsReadOnly   bool                    `json:"readOnly,omitempty"`   // The kind of level of access organizations of the entry’s domain have
   666  	KeyValue     OpenApiMetadataKeyValue `json:"keyValue,omitempty"`   // Contains core metadata entry data
   667  }
   668  
   669  // OpenApiMetadataKeyValue contains core metadata entry data.
   670  type OpenApiMetadataKeyValue struct {
   671  	Domain    string                    `json:"domain,omitempty"`    // Only meaningful for providers. Allows them to share entries with their tenants. Currently, accepted values are: `TENANT`, `PROVIDER`, where that is the ascending sort order of the enumeration.
   672  	Key       string                    `json:"key,omitempty"`       // Key of the metadata entry
   673  	Value     OpenApiMetadataTypedValue `json:"value,omitempty"`     // Value of the metadata entry
   674  	Namespace string                    `json:"namespace,omitempty"` // Namespace of the metadata entry
   675  }
   676  
   677  // OpenApiMetadataTypedValue the type and value of the metadata entry.
   678  type OpenApiMetadataTypedValue struct {
   679  	Value interface{} `json:"value,omitempty"` // The Value is anything because it depends on the Type field.
   680  	Type  string      `json:"type,omitempty"`
   681  }
   682  
   683  // VgpuProfile uniquely represents a type of vGPU
   684  // vGPU Profiles are fetched from your NVIDIA GRID GPU enabled Clusters in vCenter.
   685  type VgpuProfile struct {
   686  	Id                 string `json:"id"`
   687  	Name               string `json:"name"`
   688  	TenantFacingName   string `json:"tenantFacingName"`
   689  	Instructions       string `json:"instructions,omitempty"`
   690  	AllowMultiplePerVm bool   `json:"allowMultiplePerVm"`
   691  	Count              int    `json:"count,omitempty"`
   692  }