-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Introduces Support fo IaaS API of STACKIT to support everything network related and as a basis for the community Terraform provider.
- Loading branch information
1 parent
8545eec
commit 0dac3d4
Showing
10 changed files
with
2,167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/SchwarzIT/community-stackit-go-client/pkg/validate" | ||
"github.com/google/uuid" | ||
|
||
stackit "github.com/SchwarzIT/community-stackit-go-client" | ||
iaas "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1alpha" | ||
) | ||
|
||
func main() { | ||
ctx := context.Background() | ||
c := stackit.MustNewClientWithKeyAuth(ctx) | ||
|
||
l := 25 | ||
|
||
servers := []iaas.V1IP{ | ||
"8.8.8.8", | ||
} | ||
|
||
req := iaas.V1CreateNetworkJSONBody{ | ||
// Name The name for a General Object. Matches Names and also UUIDs. | ||
Name: "Network", | ||
|
||
// Nameservers List of DNS Servers/Nameservers. | ||
Nameservers: &servers, // | ||
PrefixLengthV4: &l, | ||
} | ||
projectID := uuid.New() | ||
|
||
res, err := c.IAAS.V1CreateNetwork(ctx, projectID, iaas.V1CreateNetworkJSONRequestBody(req)) | ||
if err = validate.Response(res, err, "JSON200.AvailabilityZones"); err != nil { | ||
fmt.Println(err) | ||
return | ||
} | ||
|
||
fmt.Println(res.JSON202.RequestID) | ||
} |
Oops, something went wrong.