-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from DataDog/ianferguson/updated_Demo
Update demo to use GCP SDK as well
- Loading branch information
Showing
8 changed files
with
101 additions
and
20 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 |
---|---|---|
|
@@ -21,4 +21,6 @@ | |
go.work | ||
go.work.sum | ||
|
||
attache | ||
/attache | ||
/demo-runner | ||
bin/ |
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
File renamed without changes.
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,34 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"io" | ||
"os" | ||
|
||
"cloud.google.com/go/storage" | ||
) | ||
|
||
func main() { | ||
ctx := context.Background() | ||
client, err := storage.NewClient(ctx) | ||
if err != nil { | ||
fmt.Printf("new client: %v", err) | ||
os.Exit(1) | ||
} | ||
|
||
// Read the object1 from bucket. | ||
rc, err := client.Bucket("emissary").Object("sherman.txt").NewReader(ctx) | ||
if err != nil { | ||
fmt.Printf("get object: %v\n", err) | ||
os.Exit(1) | ||
} | ||
defer rc.Close() | ||
body, err := io.ReadAll(rc) | ||
if err != nil { | ||
fmt.Printf("read object: %v\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
fmt.Println(string(body)) | ||
} |
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
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
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
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