Skip to content

Commit

Permalink
feat: VNF-3111 add initial_config to create_vna (#51)
Browse files Browse the repository at this point in the history
* feat: VNF-3111 add initial_config to v4/ecl/vna/

* feat:  VNF-3111 add initial_config to v3/ecl/vna/

* refactor: adjust request indentation in ecl/vna/v1/appliances/testing/fixtures.go
  • Loading branch information
guy555 authored Nov 29, 2024
1 parent 38f1434 commit 3d65930
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 16 deletions.
22 changes: 14 additions & 8 deletions v3/ecl/vna/v1/appliances/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,22 @@ type CreateOptsInterfaces struct {
Interface8 *CreateOptsInterface `json:"interface_8,omitempty"`
}

type CreateOptsInitialConfig struct {
Format string `json:"format" required:"true"`
Data string `json:"data" required:"true"`
}

// CreateOpts represents options used to create a virtual network appliance.
type CreateOpts struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DefaultGateway string `json:"default_gateway,omitempty"`
AvailabilityZone string `json:"availability_zone,omitempty"`
VirtualNetworkAppliancePlanID string `json:"virtual_network_appliance_plan_id" required:"true"`
TenantID string `json:"tenant_id,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Interfaces *CreateOptsInterfaces `json:"interfaces,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DefaultGateway string `json:"default_gateway,omitempty"`
AvailabilityZone string `json:"availability_zone,omitempty"`
VirtualNetworkAppliancePlanID string `json:"virtual_network_appliance_plan_id" required:"true"`
TenantID string `json:"tenant_id,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Interfaces *CreateOptsInterfaces `json:"interfaces,omitempty"`
InitialConfig *CreateOptsInitialConfig `json:"initial_config,omitempty"`
}

// ToApplianceCreateMap builds a request body from CreateOpts.
Expand Down
4 changes: 4 additions & 0 deletions v3/ecl/vna/v1/appliances/testing/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ var createRequest = fmt.Sprintf(`
"network_id": "dummyNetworkID"
}
},
"initial_config": {
"format": "set",
"data": "c2V0IGludGVyZmFjZXMgZ2UtMC8wLzAgZGVzY3JpcHRpb24gc2FtcGxl"
},
"tags": {
"k1": "v1"
},
Expand Down
4 changes: 4 additions & 0 deletions v3/ecl/vna/v1/appliances/testing/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ func TestCreateAppliance(t *testing.T) {
},
},
},
InitialConfig: &appliances.CreateOptsInitialConfig{
Format: "set",
Data: "c2V0IGludGVyZmFjZXMgZ2UtMC8wLzAgZGVzY3JpcHRpb24gc2FtcGxl",
},
}
ap, err := appliances.Create(ServiceClient(), createOpts).Extract()
th.AssertNoErr(t, err)
Expand Down
22 changes: 14 additions & 8 deletions v4/ecl/vna/v1/appliances/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,22 @@ type CreateOptsInterfaces struct {
Interface8 *CreateOptsInterface `json:"interface_8,omitempty"`
}

type CreateOptsInitialConfig struct {
Format string `json:"format" required:"true"`
Data string `json:"data" required:"true"`
}

// CreateOpts represents options used to create a virtual network appliance.
type CreateOpts struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DefaultGateway string `json:"default_gateway,omitempty"`
AvailabilityZone string `json:"availability_zone,omitempty"`
VirtualNetworkAppliancePlanID string `json:"virtual_network_appliance_plan_id" required:"true"`
TenantID string `json:"tenant_id,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Interfaces *CreateOptsInterfaces `json:"interfaces,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DefaultGateway string `json:"default_gateway,omitempty"`
AvailabilityZone string `json:"availability_zone,omitempty"`
VirtualNetworkAppliancePlanID string `json:"virtual_network_appliance_plan_id" required:"true"`
TenantID string `json:"tenant_id,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Interfaces *CreateOptsInterfaces `json:"interfaces,omitempty"`
InitialConfig *CreateOptsInitialConfig `json:"initial_config,omitempty"`
}

// ToApplianceCreateMap builds a request body from CreateOpts.
Expand Down
4 changes: 4 additions & 0 deletions v4/ecl/vna/v1/appliances/testing/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ var createRequest = fmt.Sprintf(`
"network_id": "dummyNetworkID"
}
},
"initial_config": {
"format": "set",
"data": "c2V0IGludGVyZmFjZXMgZ2UtMC8wLzAgZGVzY3JpcHRpb24gc2FtcGxl"
},
"tags": {
"k1": "v1"
},
Expand Down
4 changes: 4 additions & 0 deletions v4/ecl/vna/v1/appliances/testing/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ func TestCreateAppliance(t *testing.T) {
},
},
},
InitialConfig: &appliances.CreateOptsInitialConfig{
Format: "set",
Data: "c2V0IGludGVyZmFjZXMgZ2UtMC8wLzAgZGVzY3JpcHRpb24gc2FtcGxl",
},
}
ap, err := appliances.Create(ServiceClient(), createOpts).Extract()
th.AssertNoErr(t, err)
Expand Down

0 comments on commit 3d65930

Please sign in to comment.