get_networking

package
v0.0.4-beta Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGrandeNetworks

func BuildGrandeNetworks(a SwitchData) ([]string, error)

BuildGrandeNetworks builds a 16 oz virtual network

func BuildVentiNetworks

func BuildVentiNetworks(a SwitchData) ([]string, error)

BuildVentiNetworks builds a 20oz virtual network

func CreateJson

func CreateJson(data SwitchData, t TokenBuilder) (string, error)

func Entry

func Entry(data SwitchData, t TokenBuilder) (string, error)

func EvaluateAvailableNetworks

func EvaluateAvailableNetworks(data SwitchData, a AzureNetData) ([]string, error)

func JsonReturn

func JsonReturn(data SwitchData, t TokenBuilder) (struct {
	Region       string
	ClientId     string
	TenantId     string
	AddressSpace string
}, error)

func MakeTheSwitch

func MakeTheSwitch(s SwitchData) ([]string, error)

func ParseHubConnections

func ParseHubConnections(hubId string, t TokenBuilder) ([]string, error)

func ParseVnetConnections

func ParseVnetConnections(hubId string, t TokenBuilder) ([]string, error)

func ReturnConnectable

func ReturnConnectable(c Confirmed) (string, error)

func ReturnNetworks

func ReturnNetworks(s SwitchData) ([]string, error)

func RunAll

func RunAll(data SwitchData, t TokenBuilder, n Subscription) (string, error)

Types

type AzureNetData

type AzureNetData []struct {
	Name     string `json:"name"`
	ID       string `json:"id"`
	Etag     string `json:"etag"`
	Type     string `json:"type"`
	Location string `json:"location"`
	Tags     struct {
	} `json:"tags"`
	Properties struct {
		ProvisioningState string `json:"provisioningState"`
		ResourceGUID      string `json:"resourceGuid"`
		AddressSpace      struct {
			AddressPrefixes []string `json:"addressPrefixes"`
		} `json:"addressSpace"`
		Subnets []struct {
			Name       string `json:"name"`
			ID         string `json:"id"`
			Etag       string `json:"etag"`
			Properties struct {
				ProvisioningState string `json:"provisioningState"`
				AddressPrefix     string `json:"addressPrefix"`
				IPConfigurations  []struct {
					ID string `json:"id"`
				} `json:"ipConfigurations"`
				Delegations                       []interface{} `json:"delegations"`
				PrivateEndpointNetworkPolicies    string        `json:"privateEndpointNetworkPolicies"`
				PrivateLinkServiceNetworkPolicies string        `json:"privateLinkServiceNetworkPolicies"`
			} `json:"properties"`
			Type string `json:"type"`
		} `json:"subnets"`
		VirtualNetworkPeerings []interface{} `json:"virtualNetworkPeerings"`
		EnableDdosProtection   bool          `json:"enableDdosProtection"`
	} `json:"properties"`
}

func BuildCompositeNetworkData

func BuildCompositeNetworkData(t TokenBuilder, s Subscription) (AzureNetData, error)

type AzureNetworks

type AzureNetworks struct {
	SubscriptionId string
	Value          []struct {
		Name     string `json:"name"`
		ID       string `json:"id"`
		Etag     string `json:"etag"`
		Type     string `json:"type"`
		Location string `json:"location"`
		Tags     struct {
		} `json:"tags"`
		Properties struct {
			ProvisioningState string `json:"provisioningState"`
			ResourceGUID      string `json:"resourceGuid"`
			AddressSpace      struct {
				AddressPrefixes []string `json:"addressPrefixes"`
			} `json:"addressSpace"`
			Subnets []struct {
				Name       string `json:"name"`
				ID         string `json:"id"`
				Etag       string `json:"etag"`
				Properties struct {
					ProvisioningState string `json:"provisioningState"`
					AddressPrefix     string `json:"addressPrefix"`
					IPConfigurations  []struct {
						ID string `json:"id"`
					} `json:"ipConfigurations"`
					Delegations                       []interface{} `json:"delegations"`
					PrivateEndpointNetworkPolicies    string        `json:"privateEndpointNetworkPolicies"`
					PrivateLinkServiceNetworkPolicies string        `json:"privateLinkServiceNetworkPolicies"`
				} `json:"properties"`
				Type string `json:"type"`
			} `json:"subnets"`
			VirtualNetworkPeerings []interface{} `json:"virtualNetworkPeerings"`
			EnableDdosProtection   bool          `json:"enableDdosProtection"`
		} `json:"properties"`
	} `json:"value"`
}

AzureNetworks contains data about the virtual networks per subscription in Azure

func GetNetworks

func GetNetworks(s string, t TokenBuilder) (AzureNetworks, error)

GetNetworks reads all the virtual networks in a given subscription for Azure

type Confirmed

type Confirmed struct {
	Region             string
	ClientId           string
	TenantId           string
	AddressSpace       string
	RemoteConnectionId string
}

func MakeConnectionSwitches

func MakeConnectionSwitches(j string, c Connect, t TokenBuilder) (Confirmed, error)

type Connect

type Connect struct {
	HubId   string
	HubType string
}

func (Connect) Address

func (c Connect) Address(sw SwitchData, t TokenBuilder) (string, error)

func (Connect) CheckLength

func (c Connect) CheckLength() error

func (Connect) Gen

func (c Connect) Gen(sw SwitchData, t TokenBuilder) (string, error)

func (Connect) Generate

func (c Connect) Generate(j string, con Connect) (string, error)

type HubConnections

type HubConnections struct {
	Value []struct {
		Name       string `json:"name"`
		Id         string `json:"id"`
		Etag       string `json:"etag"`
		Type       string `json:"type"`
		Properties struct {
			ProvisioningState    string `json:"provisioningState"`
			ResourceGuid         string `json:"resourceGuid"`
			RoutingConfiguration struct {
				AssociatedRouteTable struct {
					Id string `json:"id"`
				} `json:"associatedRouteTable"`
				PropagatedRouteTables struct {
					Labels []string `json:"labels"`
					Ids    []struct {
						Id string `json:"id"`
					} `json:"ids"`
				} `json:"propagatedRouteTables"`
				VnetRoutes struct {
					StaticRoutes []interface{} `json:"staticRoutes"`
				} `json:"vnetRoutes"`
			} `json:"routingConfiguration"`
			RemoteVirtualNetwork struct {
				Id string `json:"id"`
			} `json:"remoteVirtualNetwork"`
			AllowHubToRemoteVnetTransit         bool   `json:"allowHubToRemoteVnetTransit"`
			AllowRemoteVnetToUseHubVnetGateways bool   `json:"allowRemoteVnetToUseHubVnetGateways"`
			EnableInternetSecurity              bool   `json:"enableInternetSecurity"`
			ConnectivityStatus                  string `json:"connectivityStatus"`
		} `json:"properties"`
	} `json:"value"`
}

func GetVirtualHubConnections

func GetVirtualHubConnections(hubId string, t TokenBuilder) (HubConnections, error)

type NetData

type NetData struct {
	VnetIds      []string
	VnetSpaces   []string
	NetworkStuff struct {
		Name       string `json:"name"`
		ID         string `json:"id"`
		Type       string `json:"type"`
		Location   string `json:"location"`
		Properties struct {
			ProvisioningState string `json:"provisioningState"`
			AddressSpace      struct {
				AddressPrefixes []string `json:"addressPrefixes"`
			} `json:"addressSpace"`
			Subnets []struct {
				Name       string `json:"name"`
				ID         string `json:"id"`
				Properties struct {
					ProvisioningState string `json:"provisioningState"`
					AddressPrefix     string `json:"addressPrefix"`
					IPConfigurations  []struct {
						ID string `json:"id"`
					} `json:"ipConfigurations"`
				} `json:"properties"`
			} `json:"subnets"`
			VirtualNetworkPeerings []interface{} `json:"virtualNetworkPeerings"`
		} `json:"properties"`
	}
}

type Subscription

type Subscription struct {
	Value []struct {
		Id             string `json:"id"`
		SubscriptionId string `json:"subscriptionId"`
		TenantId       string `json:"tenantId"`
		DisplayName    string `json:"displayName"`
		State          string `json:"state"`
	} `json:"value"`
}

func GetSubscriptions

func GetSubscriptions(t TokenBuilder) (Subscription, error)

GetSubscriptions reads all the subscriptions available for the tenant

type SwitchData

type SwitchData struct {
	Size   string
	Space  string
	Cidr   string
	Region string
}

type TokenBuilder

type TokenBuilder struct {
	ClientId       string
	ClientSecret   string
	TenantId       string
	SubscriptionId string
	BearerToken    struct {
		TokenType    string `json:"token_type"`
		ExpiresIn    string `json:"expires_in"`
		ExtExpiresIn string `json:"ext_expires_in"`
		ExpiresOn    string `json:"expires_on"`
		NotBefore    string `json:"not_before"`
		Resource     string `json:"resource"`
		AccessToken  string `json:"access_token"`
	}
}

TokenBuilder is used to generate and return token needed to query resources in Azure

func DoTokenRequest

func DoTokenRequest(t TokenBuilder) (TokenBuilder, error)

DoTokenRequest creates a token for use later on with pulling data on networking

func ExecToken

func ExecToken() (TokenBuilder, error)

func GenerateToken

func GenerateToken() (TokenBuilder, error)

type VirtualHub

type VirtualHub struct {
	Id         string `json:"id"`
	Etag       string `json:"etag"`
	Location   string `json:"location"`
	Name       string `json:"name"`
	Type       string `json:"type"`
	Properties struct {
		ProvisioningState string `json:"provisioningState"`
		VirtualWan        struct {
			Id string `json:"id"`
		} `json:"virtualWan"`
		VirtualHubRouteTableV2S    []interface{} `json:"virtualHubRouteTableV2s"`
		AddressPrefix              string        `json:"addressPrefix"`
		Sku                        string        `json:"sku"`
		RoutingState               string        `json:"routingState"`
		VirtualRouterAsn           int           `json:"virtualRouterAsn"`
		VirtualRouterIps           []string      `json:"virtualRouterIps"`
		AllowBranchToBranchTraffic bool          `json:"allowBranchToBranchTraffic"`
		PreferredRoutingGateway    string        `json:"preferredRoutingGateway"`
	} `json:"properties"`
}

func GetVirtualHubData

func GetVirtualHubData(hubId string, t TokenBuilder) (VirtualHub, error)

type Vnet

type Vnet struct {
	Name       string `json:"name"`
	Id         string `json:"id"`
	Type       string `json:"type"`
	Location   string `json:"location"`
	Properties struct {
		ProvisioningState string `json:"provisioningState"`
		AddressSpace      struct {
			AddressPrefixes []string `json:"addressPrefixes"`
		} `json:"addressSpace"`
		Subnets []struct {
			Name       string `json:"name"`
			Id         string `json:"id"`
			Properties struct {
				ProvisioningState string `json:"provisioningState"`
				AddressPrefix     string `json:"addressPrefix"`
				IpConfigurations  []struct {
					Id string `json:"id"`
				} `json:"ipConfigurations"`
			} `json:"properties"`
		} `json:"subnets"`
		VirtualNetworkPeerings []interface{} `json:"virtualNetworkPeerings"`
	} `json:"properties"`
}

func GetVirtualNetworkHubData

func GetVirtualNetworkHubData(hubId string, t TokenBuilder) (Vnet, error)

type VnetConnections

type VnetConnections struct {
	Value []struct {
		Id         string `json:"id"`
		Name       string `json:"name"`
		Properties struct {
			AllowVirtualNetworkAccess bool `json:"allowVirtualNetworkAccess"`
			AllowForwardedTraffic     bool `json:"allowForwardedTraffic"`
			AllowGatewayTransit       bool `json:"allowGatewayTransit"`
			UseRemoteGateways         bool `json:"useRemoteGateways"`
			RemoteVirtualNetwork      struct {
				Id string `json:"id"`
			} `json:"remoteVirtualNetwork"`
			RemoteAddressSpace struct {
				AddressPrefixes []string `json:"addressPrefixes"`
			} `json:"remoteAddressSpace"`
			RemoteVirtualNetworkAddressSpace struct {
				AddressPrefixes []string `json:"addressPrefixes"`
			} `json:"remoteVirtualNetworkAddressSpace"`
			RemoteBgpCommunities struct {
				VirtualNetworkCommunity string `json:"virtualNetworkCommunity"`
				RegionalCommunity       string `json:"regionalCommunity"`
			} `json:"remoteBgpCommunities"`
			PeeringState      string `json:"peeringState"`
			PeeringSyncLevel  string `json:"peeringSyncLevel"`
			ProvisioningState string `json:"provisioningState"`
		} `json:"properties"`
	} `json:"value"`
}

func GetVirtualNetworkPeerings

func GetVirtualNetworkPeerings(hubId string, t TokenBuilder) (VnetConnections, error)

Jump to

Keyboard shortcuts

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