You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

110 lines
2.5 KiB

  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. // Code generated by gapic-generator. DO NOT EDIT.
  15. package longrunning_test
  16. import (
  17. "context"
  18. longrunning "cloud.google.com/go/longrunning/autogen"
  19. "google.golang.org/api/iterator"
  20. longrunningpb "google.golang.org/genproto/googleapis/longrunning"
  21. )
  22. func ExampleNewOperationsClient() {
  23. ctx := context.Background()
  24. c, err := longrunning.NewOperationsClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleOperationsClient_GetOperation() {
  32. ctx := context.Background()
  33. c, err := longrunning.NewOperationsClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &longrunningpb.GetOperationRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. resp, err := c.GetOperation(ctx, req)
  41. if err != nil {
  42. // TODO: Handle error.
  43. }
  44. // TODO: Use resp.
  45. _ = resp
  46. }
  47. func ExampleOperationsClient_ListOperations() {
  48. ctx := context.Background()
  49. c, err := longrunning.NewOperationsClient(ctx)
  50. if err != nil {
  51. // TODO: Handle error.
  52. }
  53. req := &longrunningpb.ListOperationsRequest{
  54. // TODO: Fill request struct fields.
  55. }
  56. it := c.ListOperations(ctx, req)
  57. for {
  58. resp, err := it.Next()
  59. if err == iterator.Done {
  60. break
  61. }
  62. if err != nil {
  63. // TODO: Handle error.
  64. }
  65. // TODO: Use resp.
  66. _ = resp
  67. }
  68. }
  69. func ExampleOperationsClient_CancelOperation() {
  70. ctx := context.Background()
  71. c, err := longrunning.NewOperationsClient(ctx)
  72. if err != nil {
  73. // TODO: Handle error.
  74. }
  75. req := &longrunningpb.CancelOperationRequest{
  76. // TODO: Fill request struct fields.
  77. }
  78. err = c.CancelOperation(ctx, req)
  79. if err != nil {
  80. // TODO: Handle error.
  81. }
  82. }
  83. func ExampleOperationsClient_DeleteOperation() {
  84. ctx := context.Background()
  85. c, err := longrunning.NewOperationsClient(ctx)
  86. if err != nil {
  87. // TODO: Handle error.
  88. }
  89. req := &longrunningpb.DeleteOperationRequest{
  90. // TODO: Fill request struct fields.
  91. }
  92. err = c.DeleteOperation(ctx, req)
  93. if err != nil {
  94. // TODO: Handle error.
  95. }
  96. }