Skip to content

Commit

Permalink
Add dns setup for new org
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-soltesz committed Sep 10, 2024
1 parent 242438e commit de04de7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cmd/orgadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import (
"github.com/m-lab/autojoin/internal/adminx"
"github.com/m-lab/autojoin/internal/adminx/crmiface"
"github.com/m-lab/autojoin/internal/adminx/iamiface"
"github.com/m-lab/autojoin/internal/dnsname"
"github.com/m-lab/autojoin/internal/dnsx"
"github.com/m-lab/autojoin/internal/dnsx/dnsiface"
"github.com/m-lab/go/rtx"
"google.golang.org/api/cloudresourcemanager/v1"
"google.golang.org/api/dns/v1"
iam "google.golang.org/api/iam/v1"
)

Expand Down Expand Up @@ -38,13 +42,18 @@ func main() {
defer sc.Close()
ic, err := iam.NewService(ctx)
rtx.Must(err, "failed to create iam service client")
log.Println("Creating SAM & KEYS")
nn := adminx.NewNamer(project)
crm, err := cloudresourcemanager.NewService(ctx)
rtx.Must(err, "failed to allocate new cloud resource manager client")
sa := adminx.NewServiceAccountsManager(iamiface.NewIAM(ic), nn)
rtx.Must(err, "failed to create sam")
sm := adminx.NewSecretManager(sc, nn, sa)
o := adminx.NewOrg(project, crmiface.NewCRM(project, crm), sa, sm)
o.Setup(ctx, org)
ds, err := dns.NewService(ctx)
rtx.Must(err, "failed to create new dns service")
d := dnsx.NewManager(dnsiface.NewCloudDNSService(ds), project, dnsname.ProjectZone(project))

o := adminx.NewOrg(project, crmiface.NewCRM(project, crm), sa, sm, d)
err = o.Setup(ctx, org)
rtx.Must(err, "failed to setup new organization: "+org)
log.Println("okay")
}

0 comments on commit de04de7

Please sign in to comment.