Skip to content

Commit 6f9b443

Browse files
author
Miguel Sama
authored
Publish to external VCD ORG and subscribe attributes on OrgGeneralSettings struct (#444)
Add `CanPublishExternally` and `CanSubscribe` attributes to `OrgGeneralSettings` struct. Signed-off-by: Miguel Sama <msama@vmware.com>
1 parent 7827b70 commit 6f9b443

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

.changes/v2.15.0/444-improvements.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Add `CanPublishExternally` and `CanSubscribe` attributes to `OrgGeneralSettings` struct. [GH-444]

govcd/org_test.go

+24-9
Original file line numberDiff line numberDiff line change
@@ -105,32 +105,42 @@ func (vcd *TestVCD) Test_UpdateOrg(check *C) {
105105
check.Skip(fmt.Sprintf(TestRequiresSysAdminPrivileges, check.TestName()))
106106
}
107107
type updateSet struct {
108-
orgName string
109-
enabled bool
110-
canPublishCatalogs bool
108+
orgName string
109+
enabled bool
110+
canPublishCatalogs bool
111+
canPublishExternally bool
112+
canSubscribe bool
111113
}
112114

113115
// Tests a combination of enabled and canPublishCatalogs to see
114116
// whether they are updated correctly
115117
var updateOrgs = []updateSet{
116-
{TestUpdateOrg + "1", true, false},
117-
{TestUpdateOrg + "2", false, false},
118-
{TestUpdateOrg + "3", true, true},
119-
{TestUpdateOrg + "4", false, true},
118+
{TestUpdateOrg + "1", true, false, false, false},
119+
{TestUpdateOrg + "2", false, false, false, false},
120+
{TestUpdateOrg + "3", true, true, true, false},
121+
{TestUpdateOrg + "4", false, true, false, true},
120122
}
121123

122124
for _, uo := range updateOrgs {
123125

124126
fmt.Printf("Org %s - enabled %v - catalogs %v\n", uo.orgName, uo.enabled, uo.canPublishCatalogs)
125127
task, err := CreateOrg(vcd.client, uo.orgName, uo.orgName, uo.orgName, &types.OrgSettings{
126-
OrgGeneralSettings: &types.OrgGeneralSettings{CanPublishCatalogs: uo.canPublishCatalogs},
127-
OrgLdapSettings: &types.OrgLdapSettingsType{OrgLdapMode: "NONE"},
128+
OrgGeneralSettings: &types.OrgGeneralSettings{
129+
CanPublishCatalogs: uo.canPublishCatalogs,
130+
CanPublishExternally: uo.canPublishExternally,
131+
CanSubscribe: uo.canSubscribe,
132+
},
133+
OrgLdapSettings: &types.OrgLdapSettingsType{OrgLdapMode: "NONE"},
128134
}, uo.enabled)
135+
129136
check.Assert(err, IsNil)
130137
check.Assert(task, Not(Equals), Task{})
138+
131139
err = task.WaitTaskCompletion()
132140
check.Assert(err, IsNil)
141+
133142
AddToCleanupList(uo.orgName, "org", "", "TestUpdateOrg")
143+
134144
// fetch newly created org
135145
adminOrg, err := vcd.client.GetAdminOrgByName(uo.orgName)
136146
check.Assert(err, IsNil)
@@ -144,6 +154,9 @@ func (vcd *TestVCD) Test_UpdateOrg(check *C) {
144154
adminOrg.AdminOrg.Description = updatedDescription
145155
adminOrg.AdminOrg.FullName = updatedFullName
146156
adminOrg.AdminOrg.OrgSettings.OrgGeneralSettings.CanPublishCatalogs = !uo.canPublishCatalogs
157+
adminOrg.AdminOrg.OrgSettings.OrgGeneralSettings.CanPublishExternally = !uo.canPublishExternally
158+
adminOrg.AdminOrg.OrgSettings.OrgGeneralSettings.CanSubscribe = !uo.canSubscribe
159+
147160
adminOrg.AdminOrg.IsEnabled = !uo.enabled
148161

149162
task, err = adminOrg.Update()
@@ -160,6 +173,8 @@ func (vcd *TestVCD) Test_UpdateOrg(check *C) {
160173

161174
check.Assert(updatedAdminOrg.AdminOrg.IsEnabled, Equals, !uo.enabled)
162175
check.Assert(updatedAdminOrg.AdminOrg.OrgSettings.OrgGeneralSettings.CanPublishCatalogs, Equals, !uo.canPublishCatalogs)
176+
check.Assert(updatedAdminOrg.AdminOrg.OrgSettings.OrgGeneralSettings.CanPublishExternally, Equals, !uo.canPublishExternally)
177+
check.Assert(updatedAdminOrg.AdminOrg.OrgSettings.OrgGeneralSettings.CanSubscribe, Equals, !uo.canSubscribe)
163178
if testVerbose {
164179
fmt.Printf("[updated] Org %s - enabled %v (expected %v) - catalogs %v (expected %v)\n",
165180
updatedAdminOrg.AdminOrg.Name,

types/v56/types.go

+2
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,8 @@ type OrgGeneralSettings struct {
787787
Link LinkList `xml:"Link,omitempty"` // A reference to an entity or operation associated with this object.
788788

789789
CanPublishCatalogs bool `xml:"CanPublishCatalogs,omitempty"`
790+
CanPublishExternally bool `xml:"CanPublishExternally,omitempty"`
791+
CanSubscribe bool `xml:"CanSubscribe,omitempty"`
790792
DeployedVMQuota int `xml:"DeployedVMQuota,omitempty"`
791793
StoredVMQuota int `xml:"StoredVmQuota,omitempty"`
792794
UseServerBootSequence bool `xml:"UseServerBootSequence,omitempty"`

0 commit comments

Comments
 (0)