Documentation
¶
Overview ¶
Package gcpvpc provides an in-memory mock implementation of Google Cloud VPC networking.
Index ¶
- Constants
- type Mock
- func (m *Mock) AcceptPeeringConnection(_ context.Context, peeringID string) error
- func (m *Mock) AddEgressRule(_ context.Context, groupID string, rule driver.SecurityRule) error
- func (m *Mock) AddIngressRule(_ context.Context, groupID string, rule driver.SecurityRule) error
- func (m *Mock) AddNetworkACLRule(_ context.Context, aclID string, rule *driver.NetworkACLRule) error
- func (m *Mock) AllocateAddress(_ context.Context, cfg driver.ElasticIPConfig) (*driver.ElasticIP, error)
- func (m *Mock) AssociateAddress(_ context.Context, allocationID, instanceID string) (string, error)
- func (m *Mock) AssociateRouteTable(_ context.Context, routeTableID, subnetID string) (*driver.RouteTableAssociation, error)
- func (m *Mock) AttachInternetGateway(_ context.Context, igwID, vpcID string) error
- func (m *Mock) CreateFlowLog(_ context.Context, cfg driver.FlowLogConfig) (*driver.FlowLog, error)
- func (m *Mock) CreateInternetGateway(_ context.Context, cfg driver.InternetGatewayConfig) (*driver.InternetGateway, error)
- func (m *Mock) CreateNATGateway(_ context.Context, cfg driver.NATGatewayConfig) (*driver.NATGateway, error)
- func (m *Mock) CreateNetworkACL(_ context.Context, vpcID string, tags map[string]string) (*driver.NetworkACL, error)
- func (m *Mock) CreatePeeringConnection(_ context.Context, cfg driver.PeeringConfig) (*driver.PeeringConnection, error)
- func (m *Mock) CreateRoute(_ context.Context, routeTableID, destinationCIDR, targetID, targetType string) error
- func (m *Mock) CreateRouteTable(_ context.Context, cfg driver.RouteTableConfig) (*driver.RouteTable, error)
- func (m *Mock) CreateSecurityGroup(_ context.Context, cfg driver.SecurityGroupConfig) (*driver.SecurityGroupInfo, error)
- func (m *Mock) CreateSubnet(_ context.Context, cfg driver.SubnetConfig) (*driver.SubnetInfo, error)
- func (m *Mock) CreateVPC(_ context.Context, cfg driver.VPCConfig) (*driver.VPCInfo, error)
- func (m *Mock) CreateVPCEndpoint(_ context.Context, cfg driver.VPCEndpointConfig) (*driver.VPCEndpoint, error)
- func (m *Mock) DeleteFlowLog(_ context.Context, id string) error
- func (m *Mock) DeleteInternetGateway(_ context.Context, id string) error
- func (m *Mock) DeleteNATGateway(_ context.Context, id string) error
- func (m *Mock) DeleteNetworkACL(_ context.Context, id string) error
- func (m *Mock) DeletePeeringConnection(_ context.Context, peeringID string) error
- func (m *Mock) DeleteRoute(_ context.Context, routeTableID, destinationCIDR string) error
- func (m *Mock) DeleteRouteTable(_ context.Context, id string) error
- func (m *Mock) DeleteSecurityGroup(_ context.Context, id string) error
- func (m *Mock) DeleteSubnet(_ context.Context, id string) error
- func (m *Mock) DeleteVPC(_ context.Context, id string) error
- func (m *Mock) DeleteVPCEndpoint(_ context.Context, id string) error
- func (m *Mock) DescribeAddresses(_ context.Context, ids []string) ([]driver.ElasticIP, error)
- func (m *Mock) DescribeFlowLogs(_ context.Context, ids []string) ([]driver.FlowLog, error)
- func (m *Mock) DescribeInternetGateways(_ context.Context, ids []string) ([]driver.InternetGateway, error)
- func (m *Mock) DescribeNATGateways(_ context.Context, ids []string) ([]driver.NATGateway, error)
- func (m *Mock) DescribeNetworkACLs(_ context.Context, ids []string) ([]driver.NetworkACL, error)
- func (m *Mock) DescribePeeringConnections(_ context.Context, ids []string) ([]driver.PeeringConnection, error)
- func (m *Mock) DescribeRouteTables(_ context.Context, ids []string) ([]driver.RouteTable, error)
- func (m *Mock) DescribeSecurityGroups(_ context.Context, ids []string) ([]driver.SecurityGroupInfo, error)
- func (m *Mock) DescribeSubnets(_ context.Context, ids []string) ([]driver.SubnetInfo, error)
- func (m *Mock) DescribeVPCEndpoints(_ context.Context, ids []string) ([]driver.VPCEndpoint, error)
- func (m *Mock) DescribeVPCs(_ context.Context, ids []string) ([]driver.VPCInfo, error)
- func (m *Mock) DetachInternetGateway(_ context.Context, igwID, vpcID string) error
- func (m *Mock) DisassociateAddress(_ context.Context, associationID string) error
- func (m *Mock) DisassociateRouteTable(_ context.Context, associationID string) error
- func (m *Mock) GetFlowLogRecords(_ context.Context, flowLogID string, limit int) ([]driver.FlowLogRecord, error)
- func (m *Mock) ModifyVPCEndpoint(_ context.Context, id string, cfg driver.VPCEndpointConfig) (*driver.VPCEndpoint, error)
- func (m *Mock) RejectPeeringConnection(_ context.Context, peeringID string) error
- func (m *Mock) ReleaseAddress(_ context.Context, allocationID string) error
- func (m *Mock) RemoveEgressRule(_ context.Context, groupID string, rule driver.SecurityRule) error
- func (m *Mock) RemoveIngressRule(_ context.Context, groupID string, rule driver.SecurityRule) error
- func (m *Mock) RemoveNetworkACLRule(_ context.Context, aclID string, ruleNumber int, egress bool) error
- func (m *Mock) RemoveSecurityGroupTags(_ context.Context, id string, keys []string) error
- func (m *Mock) RemoveSubnetTags(_ context.Context, id string, keys []string) error
- func (m *Mock) RemoveVPCTags(_ context.Context, id string, keys []string) error
- func (m *Mock) UpdateSecurityGroupTags(_ context.Context, id string, tags map[string]string) error
- func (m *Mock) UpdateSubnetTags(_ context.Context, id string, tags map[string]string) error
- func (m *Mock) UpdateVPCTags(_ context.Context, id string, tags map[string]string) error
Constants ¶
const ( TrafficTypeAll = "ALL" TrafficTypeAccept = "ACCEPT" TrafficTypeReject = "REJECT" )
Flow log traffic type constants.
const ( IGWStateDetached = "detached" IGWStateAttached = "attached" )
Internet gateway state constants.
const ( PeeringStatusPending = "pending-acceptance" PeeringStatusActive = "active" PeeringStatusRejected = "rejected" PeeringStatusDeleted = "deleted" )
Peering status constants.
const (
FlowLogStatusActive = "ACTIVE"
)
Flow log status constants.
const (
NATStateAvailable = "available"
)
NAT gateway state constants.
const (
RouteTargetLocal = "local"
)
Route target type constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock is an in-memory mock implementation of GCP VPC networking.
func (*Mock) AcceptPeeringConnection ¶ added in v1.2.0
AcceptPeeringConnection accepts a pending VPC network peering.
func (*Mock) AddEgressRule ¶
AddEgressRule adds an egress rule to the specified firewall rule group.
func (*Mock) AddIngressRule ¶
AddIngressRule adds an ingress rule to the specified firewall rule group.
func (*Mock) AddNetworkACLRule ¶ added in v1.2.0
func (m *Mock) AddNetworkACLRule(_ context.Context, aclID string, rule *driver.NetworkACLRule) error
AddNetworkACLRule adds a rule to the specified firewall policy, keeping rules sorted.
func (*Mock) AllocateAddress ¶ added in v1.3.2
func (m *Mock) AllocateAddress( _ context.Context, cfg driver.ElasticIPConfig, ) (*driver.ElasticIP, error)
AllocateAddress reserves a new external IP address.
func (*Mock) AssociateAddress ¶ added in v1.3.2
func (m *Mock) AssociateAddress( _ context.Context, allocationID, instanceID string, ) (string, error)
AssociateAddress associates an external IP with an instance.
func (*Mock) AssociateRouteTable ¶ added in v1.3.2
func (m *Mock) AssociateRouteTable( _ context.Context, routeTableID, subnetID string, ) (*driver.RouteTableAssociation, error)
AssociateRouteTable associates a route table with a subnet.
func (*Mock) AttachInternetGateway ¶ added in v1.3.2
AttachInternetGateway attaches an internet gateway to a VPC network.
func (*Mock) CreateFlowLog ¶ added in v1.2.0
CreateFlowLog creates a VPC flow log for a VPC or subnet resource.
func (*Mock) CreateInternetGateway ¶ added in v1.3.2
func (m *Mock) CreateInternetGateway( _ context.Context, cfg driver.InternetGatewayConfig, ) (*driver.InternetGateway, error)
CreateInternetGateway creates a new internet gateway.
func (*Mock) CreateNATGateway ¶ added in v1.2.0
func (m *Mock) CreateNATGateway( _ context.Context, cfg driver.NATGatewayConfig, ) (*driver.NATGateway, error)
CreateNATGateway creates a Cloud NAT gateway in the specified subnet.
func (*Mock) CreateNetworkACL ¶ added in v1.2.0
func (m *Mock) CreateNetworkACL( _ context.Context, vpcID string, tags map[string]string, ) (*driver.NetworkACL, error)
CreateNetworkACL creates a firewall policy for the specified VPC network.
func (*Mock) CreatePeeringConnection ¶ added in v1.2.0
func (m *Mock) CreatePeeringConnection( _ context.Context, cfg driver.PeeringConfig, ) (*driver.PeeringConnection, error)
CreatePeeringConnection creates a VPC network peering between two networks.
func (*Mock) CreateRoute ¶ added in v1.2.0
func (m *Mock) CreateRoute( _ context.Context, routeTableID, destinationCIDR, targetID, targetType string, ) error
CreateRoute adds a route to the specified route table.
func (*Mock) CreateRouteTable ¶ added in v1.2.0
func (m *Mock) CreateRouteTable( _ context.Context, cfg driver.RouteTableConfig, ) (*driver.RouteTable, error)
CreateRouteTable creates a route for the specified VPC network.
func (*Mock) CreateSecurityGroup ¶
func (m *Mock) CreateSecurityGroup(_ context.Context, cfg driver.SecurityGroupConfig) (*driver.SecurityGroupInfo, error)
CreateSecurityGroup creates a new firewall rule group.
func (*Mock) CreateSubnet ¶
func (m *Mock) CreateSubnet(_ context.Context, cfg driver.SubnetConfig) (*driver.SubnetInfo, error)
CreateSubnet creates a new subnetwork.
func (*Mock) CreateVPCEndpoint ¶ added in v1.4.0
func (m *Mock) CreateVPCEndpoint( _ context.Context, cfg driver.VPCEndpointConfig, ) (*driver.VPCEndpoint, error)
CreateVPCEndpoint creates a new VPC service endpoint.
func (*Mock) DeleteFlowLog ¶ added in v1.2.0
DeleteFlowLog deletes the flow log with the given ID.
func (*Mock) DeleteInternetGateway ¶ added in v1.3.2
DeleteInternetGateway deletes the internet gateway.
func (*Mock) DeleteNATGateway ¶ added in v1.2.0
DeleteNATGateway deletes the Cloud NAT gateway with the given ID.
func (*Mock) DeleteNetworkACL ¶ added in v1.2.0
DeleteNetworkACL deletes the firewall policy with the given ID.
func (*Mock) DeletePeeringConnection ¶ added in v1.2.0
DeletePeeringConnection deletes a VPC network peering.
func (*Mock) DeleteRoute ¶ added in v1.2.0
DeleteRoute removes a route from the specified route table.
func (*Mock) DeleteRouteTable ¶ added in v1.2.0
DeleteRouteTable deletes the route table with the given ID.
func (*Mock) DeleteSecurityGroup ¶
DeleteSecurityGroup deletes the firewall rule group with the given ID.
func (*Mock) DeleteSubnet ¶
DeleteSubnet deletes the subnetwork with the given ID.
func (*Mock) DeleteVPCEndpoint ¶ added in v1.4.0
DeleteVPCEndpoint deletes the VPC service endpoint with the given ID.
func (*Mock) DescribeAddresses ¶ added in v1.3.2
DescribeAddresses returns external IPs matching the given allocation IDs, or all if ids is empty.
func (*Mock) DescribeFlowLogs ¶ added in v1.2.0
DescribeFlowLogs returns flow logs matching the given IDs, or all if empty.
func (*Mock) DescribeInternetGateways ¶ added in v1.3.2
func (m *Mock) DescribeInternetGateways( _ context.Context, ids []string, ) ([]driver.InternetGateway, error)
DescribeInternetGateways returns internet gateways matching the given IDs, or all if ids is empty.
func (*Mock) DescribeNATGateways ¶ added in v1.2.0
DescribeNATGateways returns Cloud NAT gateways matching the given IDs, or all if empty.
func (*Mock) DescribeNetworkACLs ¶ added in v1.2.0
DescribeNetworkACLs returns firewall policies matching the given IDs, or all if empty.
func (*Mock) DescribePeeringConnections ¶ added in v1.2.0
func (m *Mock) DescribePeeringConnections( _ context.Context, ids []string, ) ([]driver.PeeringConnection, error)
DescribePeeringConnections returns VPC network peerings matching the given IDs.
func (*Mock) DescribeRouteTables ¶ added in v1.2.0
DescribeRouteTables returns route tables matching the given IDs, or all if empty.
func (*Mock) DescribeSecurityGroups ¶
func (m *Mock) DescribeSecurityGroups(_ context.Context, ids []string) ([]driver.SecurityGroupInfo, error)
DescribeSecurityGroups returns firewall rule groups matching the given IDs, or all if ids is empty.
func (*Mock) DescribeSubnets ¶
DescribeSubnets returns subnets matching the given IDs, or all subnets if ids is empty.
func (*Mock) DescribeVPCEndpoints ¶ added in v1.4.0
func (m *Mock) DescribeVPCEndpoints( _ context.Context, ids []string, ) ([]driver.VPCEndpoint, error)
DescribeVPCEndpoints returns VPC service endpoints matching the given IDs, or all endpoints if ids is empty.
func (*Mock) DescribeVPCs ¶
DescribeVPCs returns VPCs matching the given IDs, or all VPCs if ids is empty.
func (*Mock) DetachInternetGateway ¶ added in v1.3.2
DetachInternetGateway detaches an internet gateway from a VPC network.
func (*Mock) DisassociateAddress ¶ added in v1.3.2
DisassociateAddress removes an external IP association.
func (*Mock) DisassociateRouteTable ¶ added in v1.3.2
DisassociateRouteTable removes a route table association.
func (*Mock) GetFlowLogRecords ¶ added in v1.2.0
func (m *Mock) GetFlowLogRecords( _ context.Context, flowLogID string, limit int, ) ([]driver.FlowLogRecord, error)
GetFlowLogRecords generates mock flow log records for the given flow log.
func (*Mock) ModifyVPCEndpoint ¶ added in v1.4.0
func (m *Mock) ModifyVPCEndpoint( _ context.Context, id string, cfg driver.VPCEndpointConfig, ) (*driver.VPCEndpoint, error)
ModifyVPCEndpoint updates a VPC service endpoint configuration.
func (*Mock) RejectPeeringConnection ¶ added in v1.2.0
RejectPeeringConnection rejects a pending VPC network peering.
func (*Mock) ReleaseAddress ¶ added in v1.3.2
ReleaseAddress releases a reserved external IP address.
func (*Mock) RemoveEgressRule ¶
RemoveEgressRule removes a matching egress rule from the specified firewall rule group.
func (*Mock) RemoveIngressRule ¶
RemoveIngressRule removes a matching ingress rule from the specified firewall rule group.
func (*Mock) RemoveNetworkACLRule ¶ added in v1.2.0
func (m *Mock) RemoveNetworkACLRule( _ context.Context, aclID string, ruleNumber int, egress bool, ) error
RemoveNetworkACLRule removes a rule by rule number and direction.
func (*Mock) RemoveSecurityGroupTags ¶ added in v1.6.4
RemoveSecurityGroupTags removes the given label keys from a firewall rule.
func (*Mock) RemoveSubnetTags ¶ added in v1.6.4
RemoveSubnetTags removes the given label keys from a subnetwork.
func (*Mock) RemoveVPCTags ¶ added in v1.6.4
RemoveVPCTags removes the given label keys from a network.
func (*Mock) UpdateSecurityGroupTags ¶ added in v1.6.4
UpdateSecurityGroupTags merges labels into the firewall rule's label map.
func (*Mock) UpdateSubnetTags ¶ added in v1.6.4
UpdateSubnetTags merges labels into the subnetwork's label map.
func (*Mock) UpdateVPCTags ¶ added in v1.6.4
UpdateVPCTags merges the given labels into the network's label map. GCP calls these labels; the cross-cloud Networking interface uses the term tags. The mutation runs under memstore.Update's lock; a fresh map is swapped in so concurrent readers iterating the old map are unaffected.