blob: 3296a481c22418cf670a8a957612f6d32da9b3b0 [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 cloudtasks_test
import (
"context"
cloudtasks "cloud.google.com/go/cloudtasks/apiv2"
"google.golang.org/api/iterator"
taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
iampb "google.golang.org/genproto/googleapis/iam/v1"
)
func ExampleNewClient() {
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use client.
_ = c
}
func ExampleClient_ListQueues() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
// import "google.golang.org/api/iterator"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.ListQueuesRequest{
// TODO: Fill request struct fields.
}
it := c.ListQueues(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleClient_GetQueue() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.GetQueueRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetQueue(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateQueue() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.CreateQueueRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateQueue(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_UpdateQueue() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.UpdateQueueRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateQueue(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_DeleteQueue() {
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.DeleteQueueRequest{
// TODO: Fill request struct fields.
}
err = c.DeleteQueue(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_PurgeQueue() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.PurgeQueueRequest{
// TODO: Fill request struct fields.
}
resp, err := c.PurgeQueue(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_PauseQueue() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.PauseQueueRequest{
// TODO: Fill request struct fields.
}
resp, err := c.PauseQueue(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_ResumeQueue() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.ResumeQueueRequest{
// TODO: Fill request struct fields.
}
resp, err := c.ResumeQueue(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 := cloudtasks.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_SetIamPolicy() {
// import iampb "google.golang.org/genproto/googleapis/iam/v1"
ctx := context.Background()
c, err := cloudtasks.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_TestIamPermissions() {
// import iampb "google.golang.org/genproto/googleapis/iam/v1"
ctx := context.Background()
c, err := cloudtasks.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
}
func ExampleClient_ListTasks() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
// import "google.golang.org/api/iterator"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.ListTasksRequest{
// TODO: Fill request struct fields.
}
it := c.ListTasks(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleClient_GetTask() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.GetTaskRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetTask(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_CreateTask() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.CreateTaskRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateTask(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleClient_DeleteTask() {
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.DeleteTaskRequest{
// TODO: Fill request struct fields.
}
err = c.DeleteTask(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleClient_RunTask() {
// import taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
ctx := context.Background()
c, err := cloudtasks.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &taskspb.RunTaskRequest{
// TODO: Fill request struct fields.
}
resp, err := c.RunTask(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}