Skip to content

Commit

Permalink
ODJ-3077 integrate IAAS API (#203)
Browse files Browse the repository at this point in the history
* Introduces Support fo IaaS API of STACKIT to support everything network related and as a basis for the community Terraform provider.
  • Loading branch information
EmilGeorgiev committed Feb 20, 2024
1 parent 8545eec commit 0dac3d4
Show file tree
Hide file tree
Showing 10 changed files with 2,167 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
41 changes: 41 additions & 0 deletions examples/iaas/iaas.go
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)
}
Loading

0 comments on commit 0dac3d4

Please sign in to comment.