Merge pull request #6743 from svanharmelen/b-network-acl
provider/cloudstack: list network ACLs with VPC IDs
This commit is contained in:
commit
cd5ada186c
|
@ -1389,8 +1389,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/xanzy/go-cloudstack/cloudstack",
|
"ImportPath": "github.com/xanzy/go-cloudstack/cloudstack",
|
||||||
"Comment": "2.0.0-2-gcfbfb48",
|
"Comment": "2.0.0-6-g5686bcd",
|
||||||
"Rev": "cfbfb481e04c131cb89df1c6141b082f2714bc29"
|
"Rev": "5686bcde5af20565d8c7a3f66b5441430ac54186"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/xanzy/ssh-agent",
|
"ImportPath": "github.com/xanzy/ssh-agent",
|
||||||
|
|
|
@ -90,8 +90,22 @@ func resourceCloudStackNetworkACLCreate(d *schema.ResourceData, meta interface{}
|
||||||
func resourceCloudStackNetworkACLRead(d *schema.ResourceData, meta interface{}) error {
|
func resourceCloudStackNetworkACLRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
cs := meta.(*cloudstack.CloudStackClient)
|
cs := meta.(*cloudstack.CloudStackClient)
|
||||||
|
|
||||||
|
vpc, ok := d.GetOk("vpc_id")
|
||||||
|
if !ok {
|
||||||
|
vpc, ok = d.GetOk("vpc")
|
||||||
|
}
|
||||||
|
if !ok {
|
||||||
|
return errors.New("Either `vpc_id` or [deprecated] `vpc` must be provided.")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the vpc ID
|
||||||
|
vpcid, e := retrieveID(cs, "vpc", vpc.(string))
|
||||||
|
if e != nil {
|
||||||
|
return e.Error()
|
||||||
|
}
|
||||||
|
|
||||||
// Get the network ACL list details
|
// Get the network ACL list details
|
||||||
f, count, err := cs.NetworkACL.GetNetworkACLListByID(d.Id())
|
f, count, err := cs.NetworkACL.GetNetworkACLListByID(d.Id(), cloudstack.WithVPCID(vpcid))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
log.Printf(
|
log.Printf(
|
||||||
|
|
|
@ -2008,12 +2008,12 @@ func (s *LoadBalancerService) ListLoadBalancerRuleInstances(p *ListLoadBalancerR
|
||||||
|
|
||||||
type ListLoadBalancerRuleInstancesResponse struct {
|
type ListLoadBalancerRuleInstancesResponse struct {
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
LoadBalancerRuleInstances []*LoadBalancerRuleInstance `json:"loadbalancerruleinstance"`
|
LoadBalancerRuleInstances []*LoadBalancerRuleInstance `json:"lbrulevmidip"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LoadBalancerRuleInstance struct {
|
type LoadBalancerRuleInstance struct {
|
||||||
Lbvmipaddresses []string `json:"lbvmipaddresses,omitempty"`
|
Lbvmipaddresses []string `json:"lbvmipaddresses,omitempty"`
|
||||||
Loadbalancerruleinstance string `json:"loadbalancerruleinstance,omitempty"`
|
Loadbalancerruleinstance *VirtualMachine `json:"loadbalancerruleinstance,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateLoadBalancerRuleParams struct {
|
type UpdateLoadBalancerRuleParams struct {
|
||||||
|
|
|
@ -411,6 +411,26 @@ func WithProject(project string) OptionFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VPCIDSetter is an interface that every type that can set a vpc ID must implement
|
||||||
|
type VPCIDSetter interface {
|
||||||
|
SetVpcid(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithVPCID takes a vpc ID and sets the `vpcid` parameter
|
||||||
|
func WithVPCID(id string) OptionFunc {
|
||||||
|
return func(cs *CloudStackClient, p interface{}) error {
|
||||||
|
vs, ok := p.(VPCIDSetter)
|
||||||
|
|
||||||
|
if !ok || id == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
vs.SetVpcid(id)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type APIDiscoveryService struct {
|
type APIDiscoveryService struct {
|
||||||
cs *CloudStackClient
|
cs *CloudStackClient
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue