blob: 2b96e395561119db0666a2adc069e5043ea01cd2 [file] [log] [blame]
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
package secretmanager_test
import (
"context"
secretmanager "cloud.google.com/go/secretmanager/apiv1"
"google.golang.org/api/iterator"
secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
)
func ExampleNewClient() {
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use client.
_ = c
}
func ExampleClient_ListSecrets() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
// import "google.golang.org/api/iterator"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.ListSecretsRequest{
// TODO: Fill request struct fields.
}
it := c.ListSecrets(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleClient_CreateSecret() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.CreateSecretRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateSecret(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_AddSecretVersion() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.AddSecretVersionRequest{
// TODO: Fill request struct fields.
}
resp, err := c.AddSecretVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetSecret() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.GetSecretRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetSecret(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateSecret() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.UpdateSecretRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateSecret(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_DeleteSecret() {
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.DeleteSecretRequest{
// TODO: Fill request struct fields.
}
err = c.DeleteSecret(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_ListSecretVersions() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
// import "google.golang.org/api/iterator"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.ListSecretVersionsRequest{
// TODO: Fill request struct fields.
}
it := c.ListSecretVersions(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleClient_GetSecretVersion() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.GetSecretVersionRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetSecretVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_AccessSecretVersion() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.AccessSecretVersionRequest{
// TODO: Fill request struct fields.
}
resp, err := c.AccessSecretVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_DisableSecretVersion() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.DisableSecretVersionRequest{
// TODO: Fill request struct fields.
}
resp, err := c.DisableSecretVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_EnableSecretVersion() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.EnableSecretVersionRequest{
// TODO: Fill request struct fields.
}
resp, err := c.EnableSecretVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_DestroySecretVersion() {
// import secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &secretmanagerpb.DestroySecretVersionRequest{
// TODO: Fill request struct fields.
}
resp, err := c.DestroySecretVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_SetIamPolicy() {
// import iampb "google.golang.org/genproto/googleapis/iam/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &iampb.SetIamPolicyRequest{
// TODO: Fill request struct fields.
}
resp, err := c.SetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_GetIamPolicy() {
// import iampb "google.golang.org/genproto/googleapis/iam/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &iampb.GetIamPolicyRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_TestIamPermissions() {
// import iampb "google.golang.org/genproto/googleapis/iam/v1"
ctx := context.Background()
c, err := secretmanager.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &iampb.TestIamPermissionsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.TestIamPermissions(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}