gcp

package
v0.0.0-...-f99fb5f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, logger *logrus.Logger) (*Client, error)

func (*Client) AddInboundAllowRuleByInstanceIPMatch

func (c *Client) AddInboundAllowRuleByInstanceIPMatch(ctx context.Context,
	project, _ string,
	vpcID string, ruleName string,
	instancesIPs []string,
	cidrsToAllow []string,
	protocolsAndPorts types.ProtocolsAndPorts,
) (ruleId string, instances []types.Instance, err error)

AddInboundAllowRuleByInstanceIPMatch allows cidrsToAllow with protocolsAndPorts to all instances which have IP within instancesIPs

func (*Client) AddInboundAllowRuleByLabelsMatch

func (c *Client) AddInboundAllowRuleByLabelsMatch(ctx context.Context,
	project, _ string,
	vpcID string,
	ruleName string,
	labels map[string]string,
	cidrsToAllow []string,
	protocolsAndPorts types.ProtocolsAndPorts,
) (ruleId string, instances []types.Instance, err error)

AddInboundAllowRuleByLabelsMatch allows cidrsToAllow with protocolsAndPorts to all instances which match to labels

func (*Client) AddInboundAllowRuleBySubnetMatch

func (c *Client) AddInboundAllowRuleBySubnetMatch(ctx context.Context,
	project, _ string,
	vpcID string,
	ruleName string,
	subnetCidrs []string,
	cidrsToAllow []string,
	protocolsAndPorts types.ProtocolsAndPorts) (
	ruleId string, instances []types.Instance, subnets []types.Subnet, err error)

AddInboundAllowRuleBySubnetMatch allows cidrsToAllow with protocolsAndPorts to all instances which are within subnets which have subnetCidrs

func (*Client) AddInboundAllowRuleForLoadBalancerByDNS

func (c *Client) AddInboundAllowRuleForLoadBalancerByDNS(ctx context.Context,
	project, region string,
	loadBalancerDNS string,
	vpcID string,
	ruleName string,
	cidrsToAllow []string,
	protocolsAndPorts types.ProtocolsAndPorts) (loadBalancerId, ruleId string, err error)

func (*Client) AddInboundAllowRuleInVPC

func (c *Client) AddInboundAllowRuleInVPC(ctx context.Context, project, _ string, destinationVpcID string, cidrsToAllow []string,
	ruleName string, _ map[string]string) error

AddInboundAllowRuleInVPC allows specified CIDRs in VPC (network) supported VPC IDs format: 1. URL of the network resource for this firewall rule with project name information. For example: - https://www.googleapis.com/compute/v1/projects/myproject/global/networks/my-network - projects/myproject/global/networks/my-network - 2. Name or ID, for example: - my-network - 235083625034176684. In this case given network will be looked up in all projects specified in client.projectIDs and firewall rules will be applied in all found networks. Tagging firewall rules is not allowed in GCP.

func (*Client) ConnectVPCs

func (*Client) DisconnectVPCs

func (*Client) GetCIDRsForLabels

func (c *Client) GetCIDRsForLabels(_ context.Context, _ *infrapb.GetCIDRsForLabelsRequest) ([]string, error)

func (*Client) GetIPsForLabels

func (c *Client) GetIPsForLabels(ctx context.Context, params *infrapb.GetIPsForLabelsRequest) ([]string, error)

func (*Client) GetInstancesForLabels

func (c *Client) GetInstancesForLabels(ctx context.Context, params *infrapb.GetInstancesForLabelsRequest) ([]types.Instance, error)

func (*Client) GetName

func (c *Client) GetName() string

func (*Client) GetSubnet

func (c *Client) GetSubnet(ctx context.Context, params *infrapb.GetSubnetRequest) (types.Subnet, error)

func (*Client) GetSyncTime

func (c *Client) GetSyncTime(id string) (types.SyncTime, error)

func (*Client) GetVPCIDForCIDR

func (c *Client) GetVPCIDForCIDR(ctx context.Context, request *infrapb.GetVPCIDForCIDRRequest) (string, error)

func (*Client) GetVPCIDWithTag

func (c *Client) GetVPCIDWithTag(_ context.Context, _ *infrapb.GetVPCIDWithTagRequest) (string, error)

func (*Client) ListACLs

func (c *Client) ListACLs(ctx context.Context, params *infrapb.ListACLsRequest) ([]types.ACL, error)

func (*Client) ListAccounts

func (c *Client) ListAccounts() []types.Account

func (*Client) ListClusters

func (c *Client) ListClusters(ctx context.Context, params *infrapb.ListCloudClustersRequest) ([]types.Cluster, error)

func (*Client) ListInstances

func (c *Client) ListInstances(ctx context.Context, params *infrapb.ListInstancesRequest) ([]types.Instance, error)

ListInstances returns instances matching to provided vpc ID or label or zone.

func (*Client) ListInternetGateways

func (c *Client) ListInternetGateways(ctx context.Context, params *infrapb.ListInternetGatewaysRequest) ([]types.IGW, error)

func (*Client) ListNATGateways

func (c *Client) ListNATGateways(ctx context.Context, params *infrapb.ListNATGatewaysRequest) ([]types.NATGateway, error)

func (*Client) ListRouteTables

func (c *Client) ListRouteTables(ctx context.Context, params *infrapb.ListRouteTablesRequest) ([]types.RouteTable, error)

func (*Client) ListRouters

func (c *Client) ListRouters(ctx context.Context, params *infrapb.ListRoutersRequest) ([]types.Router, error)

func (*Client) ListSecurityGroups

func (c *Client) ListSecurityGroups(ctx context.Context, input *infrapb.ListSecurityGroupsRequest) ([]types.SecurityGroup, error)

func (*Client) ListSubnets

func (c *Client) ListSubnets(ctx context.Context, request *infrapb.ListSubnetsRequest) ([]types.Subnet, error)

func (*Client) ListVPC

func (c *Client) ListVPC(ctx context.Context, params *infrapb.ListVPCRequest) ([]types.VPC, error)

func (*Client) RefreshInboundAllowRule

func (c *Client) RefreshInboundAllowRule(ctx context.Context,
	project, _ string,
	ruleId string,
	cidrsToAdd []string,
	cidrsToRemove []string,
	destinationLabels map[string]string,
	destinationPrefixes []string,
	destinationVPCId string,
	protocolsAndPorts types.ProtocolsAndPorts) (instances []types.Instance, subnets []types.Subnet, err error)

func (*Client) RemoveInboundAllowRuleFromVPCByName

func (c *Client) RemoveInboundAllowRuleFromVPCByName(ctx context.Context, project, _ string, vpcID string, ruleName string) error

func (*Client) RemoveInboundAllowRuleRulesByTags

func (c *Client) RemoveInboundAllowRuleRulesByTags(ctx context.Context, project, region string, vpcID string, ruleName string, tags map[string]string) error

RemoveInboundAllowRuleRulesByTags removes firewall rule with name ruleName, tagging firewall rules is not supported in GCP, so tags are ignored

func (*Client) RemoveInboundAllowRulesFromVPCById

func (c *Client) RemoveInboundAllowRulesFromVPCById(ctx context.Context,
	project, _ string,
	vpcID string,
	instanceIDs []string,
	_ []string,
	ruleId string) error

func (*Client) RetrieveClustersData

func (c *Client) RetrieveClustersData(ctx context.Context) ([]cluster.DiscoveredCluster, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL