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.
 
 
 

237 lines
5.0 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 instance_test
  16. import (
  17. "context"
  18. instance "cloud.google.com/go/spanner/admin/instance/apiv1"
  19. "google.golang.org/api/iterator"
  20. iampb "google.golang.org/genproto/googleapis/iam/v1"
  21. instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1"
  22. )
  23. func ExampleNewInstanceAdminClient() {
  24. ctx := context.Background()
  25. c, err := instance.NewInstanceAdminClient(ctx)
  26. if err != nil {
  27. // TODO: Handle error.
  28. }
  29. // TODO: Use client.
  30. _ = c
  31. }
  32. func ExampleInstanceAdminClient_ListInstanceConfigs() {
  33. ctx := context.Background()
  34. c, err := instance.NewInstanceAdminClient(ctx)
  35. if err != nil {
  36. // TODO: Handle error.
  37. }
  38. req := &instancepb.ListInstanceConfigsRequest{
  39. // TODO: Fill request struct fields.
  40. }
  41. it := c.ListInstanceConfigs(ctx, req)
  42. for {
  43. resp, err := it.Next()
  44. if err == iterator.Done {
  45. break
  46. }
  47. if err != nil {
  48. // TODO: Handle error.
  49. }
  50. // TODO: Use resp.
  51. _ = resp
  52. }
  53. }
  54. func ExampleInstanceAdminClient_GetInstanceConfig() {
  55. ctx := context.Background()
  56. c, err := instance.NewInstanceAdminClient(ctx)
  57. if err != nil {
  58. // TODO: Handle error.
  59. }
  60. req := &instancepb.GetInstanceConfigRequest{
  61. // TODO: Fill request struct fields.
  62. }
  63. resp, err := c.GetInstanceConfig(ctx, req)
  64. if err != nil {
  65. // TODO: Handle error.
  66. }
  67. // TODO: Use resp.
  68. _ = resp
  69. }
  70. func ExampleInstanceAdminClient_ListInstances() {
  71. ctx := context.Background()
  72. c, err := instance.NewInstanceAdminClient(ctx)
  73. if err != nil {
  74. // TODO: Handle error.
  75. }
  76. req := &instancepb.ListInstancesRequest{
  77. // TODO: Fill request struct fields.
  78. }
  79. it := c.ListInstances(ctx, req)
  80. for {
  81. resp, err := it.Next()
  82. if err == iterator.Done {
  83. break
  84. }
  85. if err != nil {
  86. // TODO: Handle error.
  87. }
  88. // TODO: Use resp.
  89. _ = resp
  90. }
  91. }
  92. func ExampleInstanceAdminClient_GetInstance() {
  93. ctx := context.Background()
  94. c, err := instance.NewInstanceAdminClient(ctx)
  95. if err != nil {
  96. // TODO: Handle error.
  97. }
  98. req := &instancepb.GetInstanceRequest{
  99. // TODO: Fill request struct fields.
  100. }
  101. resp, err := c.GetInstance(ctx, req)
  102. if err != nil {
  103. // TODO: Handle error.
  104. }
  105. // TODO: Use resp.
  106. _ = resp
  107. }
  108. func ExampleInstanceAdminClient_CreateInstance() {
  109. ctx := context.Background()
  110. c, err := instance.NewInstanceAdminClient(ctx)
  111. if err != nil {
  112. // TODO: Handle error.
  113. }
  114. req := &instancepb.CreateInstanceRequest{
  115. // TODO: Fill request struct fields.
  116. }
  117. op, err := c.CreateInstance(ctx, req)
  118. if err != nil {
  119. // TODO: Handle error.
  120. }
  121. resp, err := op.Wait(ctx)
  122. if err != nil {
  123. // TODO: Handle error.
  124. }
  125. // TODO: Use resp.
  126. _ = resp
  127. }
  128. func ExampleInstanceAdminClient_UpdateInstance() {
  129. ctx := context.Background()
  130. c, err := instance.NewInstanceAdminClient(ctx)
  131. if err != nil {
  132. // TODO: Handle error.
  133. }
  134. req := &instancepb.UpdateInstanceRequest{
  135. // TODO: Fill request struct fields.
  136. }
  137. op, err := c.UpdateInstance(ctx, req)
  138. if err != nil {
  139. // TODO: Handle error.
  140. }
  141. resp, err := op.Wait(ctx)
  142. if err != nil {
  143. // TODO: Handle error.
  144. }
  145. // TODO: Use resp.
  146. _ = resp
  147. }
  148. func ExampleInstanceAdminClient_DeleteInstance() {
  149. ctx := context.Background()
  150. c, err := instance.NewInstanceAdminClient(ctx)
  151. if err != nil {
  152. // TODO: Handle error.
  153. }
  154. req := &instancepb.DeleteInstanceRequest{
  155. // TODO: Fill request struct fields.
  156. }
  157. err = c.DeleteInstance(ctx, req)
  158. if err != nil {
  159. // TODO: Handle error.
  160. }
  161. }
  162. func ExampleInstanceAdminClient_SetIamPolicy() {
  163. ctx := context.Background()
  164. c, err := instance.NewInstanceAdminClient(ctx)
  165. if err != nil {
  166. // TODO: Handle error.
  167. }
  168. req := &iampb.SetIamPolicyRequest{
  169. // TODO: Fill request struct fields.
  170. }
  171. resp, err := c.SetIamPolicy(ctx, req)
  172. if err != nil {
  173. // TODO: Handle error.
  174. }
  175. // TODO: Use resp.
  176. _ = resp
  177. }
  178. func ExampleInstanceAdminClient_GetIamPolicy() {
  179. ctx := context.Background()
  180. c, err := instance.NewInstanceAdminClient(ctx)
  181. if err != nil {
  182. // TODO: Handle error.
  183. }
  184. req := &iampb.GetIamPolicyRequest{
  185. // TODO: Fill request struct fields.
  186. }
  187. resp, err := c.GetIamPolicy(ctx, req)
  188. if err != nil {
  189. // TODO: Handle error.
  190. }
  191. // TODO: Use resp.
  192. _ = resp
  193. }
  194. func ExampleInstanceAdminClient_TestIamPermissions() {
  195. ctx := context.Background()
  196. c, err := instance.NewInstanceAdminClient(ctx)
  197. if err != nil {
  198. // TODO: Handle error.
  199. }
  200. req := &iampb.TestIamPermissionsRequest{
  201. // TODO: Fill request struct fields.
  202. }
  203. resp, err := c.TestIamPermissions(ctx, req)
  204. if err != nil {
  205. // TODO: Handle error.
  206. }
  207. // TODO: Use resp.
  208. _ = resp
  209. }