Documentation ¶
Index ¶
- func CreateNetworkInterface(ctx context.Context, ...) (nic network.Interface, err error)
- func CreateNetworkSecurityGroup(ctx context.Context, nsgName string) (nsg network.SecurityGroup, err error)
- func CreatePublicIP(ctx context.Context, ipName string) (ip network.PublicIPAddress, err error)
- func CreateVirtualNetworkAndSubnets(ctx context.Context, vnetName, subnetName string) (vnet network.VirtualNetwork, err error)
- func GetNetworkSecurityGroup(ctx context.Context, nsgName string) (network.SecurityGroup, error)
- func GetNic(ctx context.Context, nicName string) (network.Interface, error)
- func GetPublicIP(ctx context.Context, ipName string) (network.PublicIPAddress, error)
- func GetVirtualNetworkSubnet(ctx context.Context, vnetName string, subnetName string) (network.Subnet, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNetworkInterface ¶
func CreateNetworkInterface(ctx context.Context, netInterfaceName, nsgName, vnetName, subnetName, ipName string) (nic network.Interface, err error)
CreateNetworkInterface creates a new network interface
Example ¶
groupName := config.GenerateGroupName("NIC") config.SetGroupName(groupName) // TODO: don't use globals ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second) defer cancel() defer hybridresources.Cleanup(ctx) _, err := hybridresources.CreateGroup(ctx) if err != nil { util.LogAndPanic(err) } _, err = CreateNetworkInterface(ctx, networkInterfaceName, nsgName, virtualNetworkName, subnetName, ipName) if err != nil { util.LogAndPanic(fmt.Errorf("cannot create network interface. Error details: %+v", err)) } fmt.Println("Network interface created")
Output: Network interface created
func CreateNetworkSecurityGroup ¶
func CreateNetworkSecurityGroup(ctx context.Context, nsgName string) (nsg network.SecurityGroup, err error)
CreateNetworkSecurityGroup creates a new network security group
Example ¶
groupName := config.GenerateGroupName("HybridNetworkSecurityGroup") config.SetGroupName(groupName) // TODO: don't use globals ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second) defer cancel() defer hybridresources.Cleanup(ctx) _, err := hybridresources.CreateGroup(ctx) if err != nil { util.LogAndPanic(err) } _, err = CreateNetworkSecurityGroup(ctx, nsgName) if err != nil { util.LogAndPanic(fmt.Errorf("cannot create network security group. Error details: %+v", err)) } fmt.Println("VNET security group created")
Output: VNET security group created
func CreatePublicIP ¶
CreatePublicIP creates a new public IP
Example ¶
groupName := config.GenerateGroupName("CreatePublicIP") config.SetGroupName(groupName) // TODO: don't use globals ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second) defer cancel() defer hybridresources.Cleanup(ctx) _, err := hybridresources.CreateGroup(ctx) if err != nil { util.LogAndPanic(err) } _, err = CreatePublicIP(ctx, ipName) if err != nil { util.LogAndPanic(fmt.Errorf("cannot create public IP. Error details: %+v", err)) } fmt.Println("Public IP created")
Output: Public IP created
func CreateVirtualNetworkAndSubnets ¶
func CreateVirtualNetworkAndSubnets(ctx context.Context, vnetName, subnetName string) (vnet network.VirtualNetwork, err error)
CreateVirtualNetworkAndSubnets creates a virtual network with one subnet
func GetNetworkSecurityGroup ¶
GetNetworkSecurityGroup retrieves a netwrok resource group by its name
func GetPublicIP ¶
GetPublicIP retrieves a public IP by its name
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.