1// Copyright 2019 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// https://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Code generated by gapic-generator. DO NOT EDIT. 16 17package longrunning_test 18 19import ( 20 "context" 21 22 longrunning "cloud.google.com/go/longrunning/autogen" 23 "google.golang.org/api/iterator" 24 longrunningpb "google.golang.org/genproto/googleapis/longrunning" 25) 26 27func ExampleNewOperationsClient() { 28 ctx := context.Background() 29 c, err := longrunning.NewOperationsClient(ctx) 30 if err != nil { 31 // TODO: Handle error. 32 } 33 // TODO: Use client. 34 _ = c 35} 36 37func ExampleOperationsClient_GetOperation() { 38 ctx := context.Background() 39 c, err := longrunning.NewOperationsClient(ctx) 40 if err != nil { 41 // TODO: Handle error. 42 } 43 44 req := &longrunningpb.GetOperationRequest{ 45 // TODO: Fill request struct fields. 46 } 47 resp, err := c.GetOperation(ctx, req) 48 if err != nil { 49 // TODO: Handle error. 50 } 51 // TODO: Use resp. 52 _ = resp 53} 54 55func ExampleOperationsClient_ListOperations() { 56 ctx := context.Background() 57 c, err := longrunning.NewOperationsClient(ctx) 58 if err != nil { 59 // TODO: Handle error. 60 } 61 62 req := &longrunningpb.ListOperationsRequest{ 63 // TODO: Fill request struct fields. 64 } 65 it := c.ListOperations(ctx, req) 66 for { 67 resp, err := it.Next() 68 if err == iterator.Done { 69 break 70 } 71 if err != nil { 72 // TODO: Handle error. 73 } 74 // TODO: Use resp. 75 _ = resp 76 } 77} 78 79func ExampleOperationsClient_CancelOperation() { 80 ctx := context.Background() 81 c, err := longrunning.NewOperationsClient(ctx) 82 if err != nil { 83 // TODO: Handle error. 84 } 85 86 req := &longrunningpb.CancelOperationRequest{ 87 // TODO: Fill request struct fields. 88 } 89 err = c.CancelOperation(ctx, req) 90 if err != nil { 91 // TODO: Handle error. 92 } 93} 94 95func ExampleOperationsClient_DeleteOperation() { 96 ctx := context.Background() 97 c, err := longrunning.NewOperationsClient(ctx) 98 if err != nil { 99 // TODO: Handle error. 100 } 101 102 req := &longrunningpb.DeleteOperationRequest{ 103 // TODO: Fill request struct fields. 104 } 105 err = c.DeleteOperation(ctx, req) 106 if err != nil { 107 // TODO: Handle error. 108 } 109} 110