Skip to content

Commit

Permalink
feat(Context-Based Restrictions): add enforcement_modes to operations…
Browse files Browse the repository at this point in the history
… response (#286)


Signed-off-by: Matthew Brandyberry <mbrandy@us.ibm.com>
  • Loading branch information
mtbrandy authored Nov 3, 2023
1 parent fe7c5d2 commit a3ccd19
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
9 changes: 8 additions & 1 deletion contextbasedrestrictionsv1/context_based_restrictions_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 3.79.0-2eb6af3d-20230905-174838
* IBM OpenAPI SDK Code Generator Version: 3.81.0-c73a091c-20231026-215706
*/

// Package contextbasedrestrictionsv1 : Operations and models for the ContextBasedRestrictionsV1 service
Expand Down Expand Up @@ -1123,6 +1123,9 @@ type APIType struct {

// The actions available for the API type.
Actions []Action `json:"actions" validate:"required"`

// The enforcement modes supported by the API type.
EnforcementModes []string `json:"enforcement_modes,omitempty"`
}

// UnmarshalAPIType unmarshals an instance of APIType from the specified map of raw messages.
Expand All @@ -1148,6 +1151,10 @@ func UnmarshalAPIType(m map[string]json.RawMessage, result interface{}) (err err
if err != nil {
return
}
err = core.UnmarshalPrimitive(m, "enforcement_modes", &obj.EnforcementModes)
if err != nil {
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,18 @@ var _ = Describe(`ContextBasedRestrictionsV1 Examples Tests`, func() {
Type: core.StringPtr("ipAddress"),
Value: core.StringPtr("169.23.56.234"),
}
ipAddressV6Model := &contextbasedrestrictionsv1.AddressIPAddress{
Type: core.StringPtr("ipAddress"),
Value: core.StringPtr("3ffe:1900:fe21:4545::"),
}
ipRangeAddressModel := &contextbasedrestrictionsv1.AddressIPAddressRange{
Type: core.StringPtr("ipRange"),
Value: core.StringPtr("169.23.22.0-169.23.22.255"),
}
ipRangeAddressV6Model := &contextbasedrestrictionsv1.AddressIPAddressRange{
Type: core.StringPtr("ipRange"),
Value: core.StringPtr("3ffe:1900:fe21:4545::-3ffe:1900:fe21:6767::"),
}
subnetAddressModel := &contextbasedrestrictionsv1.AddressSubnet{
Type: core.StringPtr("subnet"),
Value: core.StringPtr("192.0.2.0/24"),
Expand All @@ -169,7 +177,7 @@ var _ = Describe(`ContextBasedRestrictionsV1 Examples Tests`, func() {
createZoneOptions.SetName("an example of zone")
createZoneOptions.SetAccountID(accountID)
createZoneOptions.SetDescription("this is an example of zone")
createZoneOptions.SetAddresses([]contextbasedrestrictionsv1.AddressIntf{ipAddressModel, ipRangeAddressModel, subnetAddressModel, vpcAddressModel, serviceRefAddressModel})
createZoneOptions.SetAddresses([]contextbasedrestrictionsv1.AddressIntf{ipAddressModel, ipAddressV6Model, ipRangeAddressModel, ipRangeAddressV6Model, subnetAddressModel, vpcAddressModel, serviceRefAddressModel})
createZoneOptions.SetExcluded([]contextbasedrestrictionsv1.AddressIntf{excludedIPAddressModel})

zone, response, err := contextBasedRestrictionsService.CreateZone(createZoneOptions)
Expand Down
32 changes: 16 additions & 16 deletions contextbasedrestrictionsv1/context_based_restrictions_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the CreateZoneOptions model
createZoneOptionsModel := new(contextbasedrestrictionsv1.CreateZoneOptions)
Expand Down Expand Up @@ -272,7 +272,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the CreateZoneOptions model
createZoneOptionsModel := new(contextbasedrestrictionsv1.CreateZoneOptions)
Expand Down Expand Up @@ -362,7 +362,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the CreateZoneOptions model
createZoneOptionsModel := new(contextbasedrestrictionsv1.CreateZoneOptions)
Expand Down Expand Up @@ -393,7 +393,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the CreateZoneOptions model
createZoneOptionsModel := new(contextbasedrestrictionsv1.CreateZoneOptions)
Expand Down Expand Up @@ -438,7 +438,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the CreateZoneOptions model
createZoneOptionsModel := new(contextbasedrestrictionsv1.CreateZoneOptions)
Expand Down Expand Up @@ -983,7 +983,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the ReplaceZoneOptions model
replaceZoneOptionsModel := new(contextbasedrestrictionsv1.ReplaceZoneOptions)
Expand Down Expand Up @@ -1069,7 +1069,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the ReplaceZoneOptions model
replaceZoneOptionsModel := new(contextbasedrestrictionsv1.ReplaceZoneOptions)
Expand Down Expand Up @@ -1163,7 +1163,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the ReplaceZoneOptions model
replaceZoneOptionsModel := new(contextbasedrestrictionsv1.ReplaceZoneOptions)
Expand Down Expand Up @@ -1196,7 +1196,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the ReplaceZoneOptions model
replaceZoneOptionsModel := new(contextbasedrestrictionsv1.ReplaceZoneOptions)
Expand Down Expand Up @@ -1250,7 +1250,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Construct an instance of the AddressIPAddress model
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")

// Construct an instance of the ReplaceZoneOptions model
replaceZoneOptionsModel := new(contextbasedrestrictionsv1.ReplaceZoneOptions)
Expand Down Expand Up @@ -3446,7 +3446,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Set mock response
res.Header().Set("Content-type", "application/json")
res.WriteHeader(200)
fmt.Fprintf(res, "%s", `{"api_types": [{"api_type_id": "APITypeID", "display_name": "DisplayName", "description": "Description", "type": "Type", "actions": [{"action_id": "ActionID", "description": "Description"}]}]}`)
fmt.Fprintf(res, "%s", `{"api_types": [{"api_type_id": "APITypeID", "display_name": "DisplayName", "description": "Description", "type": "Type", "actions": [{"action_id": "ActionID", "description": "Description"}], "enforcement_modes": ["EnforcementModes"]}]}`)
}))
})
It(`Invoke ListAvailableServiceOperations successfully with retries`, func() {
Expand Down Expand Up @@ -3511,7 +3511,7 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
// Set mock response
res.Header().Set("Content-type", "application/json")
res.WriteHeader(200)
fmt.Fprintf(res, "%s", `{"api_types": [{"api_type_id": "APITypeID", "display_name": "DisplayName", "description": "Description", "type": "Type", "actions": [{"action_id": "ActionID", "description": "Description"}]}]}`)
fmt.Fprintf(res, "%s", `{"api_types": [{"api_type_id": "APITypeID", "display_name": "DisplayName", "description": "Description", "type": "Type", "actions": [{"action_id": "ActionID", "description": "Description"}], "enforcement_modes": ["EnforcementModes"]}]}`)
}))
})
It(`Invoke ListAvailableServiceOperations successfully`, func() {
Expand Down Expand Up @@ -3698,9 +3698,9 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
Expect(addressModel).ToNot(BeNil())
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")
Expect(addressModel.Type).To(Equal(core.StringPtr("ipAddress")))
Expect(addressModel.Value).To(Equal(core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")))
Expect(addressModel.Value).To(Equal(core.StringPtr("169.23.56.234")))

// Construct an instance of the CreateZoneOptions model
createZoneOptionsModel := contextBasedRestrictionsService.NewCreateZoneOptions()
Expand Down Expand Up @@ -3972,9 +3972,9 @@ var _ = Describe(`ContextBasedRestrictionsV1`, func() {
addressModel := new(contextbasedrestrictionsv1.AddressIPAddress)
Expect(addressModel).ToNot(BeNil())
addressModel.Type = core.StringPtr("ipAddress")
addressModel.Value = core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")
addressModel.Value = core.StringPtr("169.23.56.234")
Expect(addressModel.Type).To(Equal(core.StringPtr("ipAddress")))
Expect(addressModel.Value).To(Equal(core.StringPtr("169.23.56.234, 3ffe:1900:fe21:4545::")))
Expect(addressModel.Value).To(Equal(core.StringPtr("169.23.56.234")))

// Construct an instance of the ReplaceZoneOptions model
zoneID := "testString"
Expand Down

0 comments on commit a3ccd19

Please sign in to comment.