Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alxschwarz/6f04d99e7bc41a97a9cc3a12930b676c to your computer and use it in GitHub Desktop.
Save alxschwarz/6f04d99e7bc41a97a9cc3a12930b676c to your computer and use it in GitHub Desktop.
func setNetworkInterface(prefix, network, subnet string) *compute.NetworkInterface {
var netif = new(compute.NetworkInterface)
netif.AccessConfigs = []*compute.AccessConfig{
&compute.AccessConfig{
Type: "ONE_TO_ONE_NAT",
Name: "External NAT",
},
}
netif.Network = prefix + "/global/networks/" + network
if subnet != "" {
netif.Subnetwork = "regions/us-east1/subnetworks/" + subnet
}
return netif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment