Debian Codegraph @

example/file-auth/main.go

raw symbols SCIP
1 package mainscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/
2
3 import (
4 "contextscip-go gomod github.com/golang/go/src go1.13 context/"
5 "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/"
6 "logscip-go gomod github.com/golang/go/src go1.13 log/"
7 "osscip-go gomod github.com/golang/go/src go1.13 os/"
8
9 "github.com/Azure/go-autorest/autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/"
10 "github.com/hashicorp/go-azure-helpers/authenticationscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/"
11 "github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/"
12 )
13
14 func mainscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/main().() {
15 logscip-go gomod github.com/golang/go/src go1.13 log/.Printfscip-go gomod github.com/golang/go/src go1.13 log/Printf().("[DEBUG] Started..")
16
17 // NOTE: fill this in
18 storageAccountName := "example"
19 storageAccountKey := "example"
20
21 logscip-go gomod github.com/golang/go/src go1.13 log/.Printfscip-go gomod github.com/golang/go/src go1.13 log/Printf().("[DEBUG] Building Client..")
22 client, err := buildClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/buildClient().(storageAccountName, storageAccountKey)
23 if err != nil {
24 panic(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error building client: %s", err))
25 }
26
27 ctx := contextscip-go gomod github.com/golang/go/src go1.13 context/.TODOscip-go gomod github.com/golang/go/src go1.13 context/TODO().()
28 containerName := "armauth"
29 input := containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/.CreateInputscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/CreateInput#{
30 AccessLevelscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/CreateInput#AccessLevel.: containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/.Privatescip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/Private.,
31 MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/CreateInput#MetaData.: map[string]string{
32 "hello": "world",
33 },
34 }
35 logscip-go gomod github.com/golang/go/src go1.13 log/.Printfscip-go gomod github.com/golang/go/src go1.13 log/Printf().("[DEBUG] Creating Container..")
36 if _, err := client.ContainersClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/Client#ContainersClient..Createscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/Client#Create().(ctx, storageAccountName, containerName, input); err != nil {
37 panic(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error creating container: %s", err))
38 }
39
40 logscip-go gomod github.com/golang/go/src go1.13 log/.Printfscip-go gomod github.com/golang/go/src go1.13 log/Printf().("[DEBUG] Retrieving Container..")
41 container, err := client.ContainersClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/Client#ContainersClient..GetPropertiesscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/Client#GetProperties().(ctx, storageAccountName, containerName)
42 if err != nil {
43 panic(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("Error reading properties for container: %s", err))
44 }
45
46 logscip-go gomod github.com/golang/go/src go1.13 log/.Printfscip-go gomod github.com/golang/go/src go1.13 log/Printf().("[DEBUG] MetaData: %+v", container.MetaDatascip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/ContainerProperties#MetaData.)
47 }
48
49 type Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/Client# struct {
50 ContainersClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/Client#ContainersClient. containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/Client#
51 }
52
53 func buildClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/buildClient().(accountName, accountKey string) (*Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/Client#, error) {
54 env, err := authenticationscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/.DetermineEnvironmentscip-go gomod github.com/hashicorp/go-azure-helpers v0.12.0 `github.com/hashicorp/go-azure-helpers/authentication`/DetermineEnvironment().(osscip-go gomod github.com/golang/go/src go1.13 os/.Getenvscip-go gomod github.com/golang/go/src go1.13 os/Getenv().("ARM_ENVIRONMENT"))
55 if err != nil {
56 return nil, err
57 }
58
59 storageAuth, err := autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.NewSharedKeyAuthorizerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/NewSharedKeyAuthorizer().(accountName, accountKey, autorestscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/.SharedKeyLitescip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/SharedKeyLite.)
60 if err != nil {
61 return nil, err
62 }
63
64 containersClient := containersscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/.NewWithEnvironmentscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/NewWithEnvironment().(*env)
65 containersClient.Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers`/Client#Client..Authorizerscip-go gomod github.com/Azure/go-autorest/autorest v0.11.19 `github.com/Azure/go-autorest/autorest`/Client#Authorizer. = storageAuth
66
67 result := &Clientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/Client#{
68 ContainersClientscip-go gomod github.com/tombuildsstuff/giovanni . `github.com/tombuildsstuff/giovanni/example/file-auth`/Client#ContainersClient.: containersClient,
69 }
70
71 return result, nil
72 }