Skip to content

Commit e536e8f

Browse files
authored
Merge pull request #3986 from sally5c/namespace-network-spec
api: Support NetworkSpec in Namespaces
2 parents 57d3dfb + 6579127 commit e536e8f

File tree

2 files changed

+70
-9
lines changed

2 files changed

+70
-9
lines changed

vapi/namespace/namespace.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,8 +1130,25 @@ type StorageSpec struct {
11301130

11311131
// NamespacesInstanceUpdateSpec https://developer.vmware.com/apis/vsphere-automation/v7.0U3/vcenter/data-structures/Namespaces/Instances/UpdateSpec/
11321132
type NamespacesInstanceUpdateSpec struct {
1133-
VmServiceSpec VmServiceSpec `json:"vm_service_spec,omitempty"`
1134-
StorageSpecs []StorageSpec `json:"storage_specs,omitempty"`
1133+
VmServiceSpec VmServiceSpec `json:"vm_service_spec,omitempty"`
1134+
StorageSpecs []StorageSpec `json:"storage_specs,omitempty"`
1135+
NetworkSpec *NetworkConfigUpdateSpec `json:"network_spec,omitempty"`
1136+
}
1137+
1138+
// NetworkConfigUpdateSpec
1139+
// https://developer.broadcom.com/xapis/vsphere-automation-api/latest/data-structures/Vcenter%20Namespaces%20Instances%20NetworkConfigUpdateSpec/
1140+
// Since 9.0.0.0
1141+
type NetworkConfigUpdateSpec struct {
1142+
NetworkProvider string `json:"network_provider"`
1143+
VpcConfig *VpcNetworkUpdateSpec `json:"vpc_config,omitempty"`
1144+
}
1145+
1146+
// VpcNetworkUpdateSpec
1147+
// https://developer.broadcom.com/xapis/vsphere-automation-api/latest/data-structures/Vcenter%20Namespaces%20Instances%20VpcNetworkUpdateSpec/
1148+
// Since 9.0.0.0
1149+
type VpcNetworkUpdateSpec struct {
1150+
DefaultSubnetSize *int64 `json:"default_subnet_size,omitempty"`
1151+
PrivateCidrs []Ipv4Cidr `json:"private_cidrs,omitempty"`
11351152
}
11361153

11371154
// ListNamespaces https://developer.vmware.com/apis/vsphere-automation/v7.0U3/vcenter/api/vcenter/namespaces/instances/get/

vapi/namespace/namespace_v2.go

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@ type NamespaceInstanceInfoV2 struct {
3535
VmServiceSpec VmServiceSpec `json:"vm_service_spec"`
3636
ContentLibraries []ContentLibraryV2 `json:"content_libraries"`
3737
SelfServiceNamespace bool `json:"self_service_namespace"`
38+
NetworkSpec *NetworkConfigInfo `json:"network_spec,omitempty"`
3839
}
3940

4041
// NamespaceInstanceCreateSpecV2
4142
// https://developer.broadcom.com/xapis/vsphere-automation-api/9.0/data-structures/Vcenter%20Namespaces%20Instances%20CreateSpecV2
4243
// Since 8.0.0.1
4344
type NamespaceInstanceCreateSpecV2 struct {
44-
Namespace string `json:"namespace"`
45-
Supervisor string `json:"supervisor"`
46-
Description *string `json:"description,omitempty"`
47-
StorageSpecs *[]StorageSpec `json:"storage_specs,omitempty"`
48-
VmServiceSpec *VmServiceSpec `json:"vm_service_spec,omitempty"`
49-
ContentLibraries *[]ContentLibraryV2 `json:"content_libraries,omitempty"`
50-
SelfServiceNamespace *bool `json:"self_service_namespace,omitempty"`
45+
Namespace string `json:"namespace"`
46+
Supervisor string `json:"supervisor"`
47+
Description *string `json:"description,omitempty"`
48+
StorageSpecs *[]StorageSpec `json:"storage_specs,omitempty"`
49+
VmServiceSpec *VmServiceSpec `json:"vm_service_spec,omitempty"`
50+
ContentLibraries *[]ContentLibraryV2 `json:"content_libraries,omitempty"`
51+
SelfServiceNamespace *bool `json:"self_service_namespace,omitempty"`
52+
NetworkSpec *NetworkConfigCreateSpec `json:"network_spec,omitempty"`
5153
}
5254

5355
type Stats struct {
@@ -63,6 +65,48 @@ type ContentLibraryV2 struct {
6365
ResourceNamingStrategy string `json:"resource_naming_strategy"`
6466
}
6567

68+
// NetworkConfigInfo
69+
// https://developer.broadcom.com/xapis/vsphere-automation-api/9.0/data-structures/Vcenter%20Namespaces%20Instances%20NetworkConfigInfo/
70+
// Since 9.0.0.0
71+
type NetworkConfigInfo struct {
72+
NetworkProvider string `json:"network_provider"`
73+
VpcNetwork *VpcNetworkInfo `json:"vpc_network,omitempty"`
74+
}
75+
76+
// VpcNetworkInfo
77+
// https://developer.broadcom.com/xapis/vsphere-automation-api/9.0/data-structures/Vcenter%20Namespaces%20Instances%20VpcNetworkInfo/
78+
// Since 9.0.0.0
79+
type VpcNetworkInfo struct {
80+
VpcConfig VpcConfig `json:"vpc_config"`
81+
Vpc string `json:"vpc"`
82+
AutoCreated bool `json:"auto_created"`
83+
DefaultSubnetSize int64 `json:"default_subnet_size"`
84+
}
85+
86+
// VpcConfig
87+
// https://developer.broadcom.com/xapis/vsphere-automation-api/9.0/data-structures/Vcenter%20Namespaces%20Instances%20VpcConfig/
88+
// Since 9.0.0.0
89+
type VpcConfig struct {
90+
PrivateCidrs []Ipv4Cidr `json:"private_cidrs,omitempty"`
91+
}
92+
93+
// NetworkConfigCreateSpec
94+
// https://developer.broadcom.com/xapis/vsphere-automation-api/9.0/data-structures/Vcenter%20Namespaces%20Instances%20NetworkConfigCreateSpec/
95+
// Since 9.0.0.0
96+
type NetworkConfigCreateSpec struct {
97+
NetworkProvider string `json:"network_provider"`
98+
VpcNetwork *VpcNetworkCreateSpec `json:"vpc_network,omitempty"`
99+
}
100+
101+
// VpcNetworkCreateSpec
102+
// https://developer.broadcom.com/xapis/vsphere-automation-api/9.0/data-structures/Vcenter%20Namespaces%20Instances%20VpcNetworkCreateSpec/
103+
// Since 9.0.0.0
104+
type VpcNetworkCreateSpec struct {
105+
VpcConfig *VpcConfig `json:"vpc_config,omitempty"`
106+
Vpc *string `json:"vpc,omitempty"`
107+
DefaultSubnetSize *int64 `json:"default_subnet_size,omitempty"`
108+
}
109+
66110
// ListNamespacesV2 https://developer.broadcom.com/xapis/vsphere-automation-api/9.0/api/vcenter/namespaces/instances/v2/get/
67111
func (c *Manager) ListNamespacesV2(ctx context.Context) ([]NamespaceInstanceSummaryV2, error) {
68112
resource := c.Resource(internal.NamespacesPathV2)

0 commit comments

Comments
 (0)