1// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT. 16 17package scheduler_test 18 19import ( 20 "context" 21 22 scheduler "cloud.google.com/go/scheduler/apiv1beta1" 23 "google.golang.org/api/iterator" 24 schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" 25) 26 27func ExampleNewCloudSchedulerClient() { 28 ctx := context.Background() 29 c, err := scheduler.NewCloudSchedulerClient(ctx) 30 if err != nil { 31 // TODO: Handle error. 32 } 33 // TODO: Use client. 34 _ = c 35} 36 37func ExampleCloudSchedulerClient_ListJobs() { 38 // import schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" 39 // import "google.golang.org/api/iterator" 40 41 ctx := context.Background() 42 c, err := scheduler.NewCloudSchedulerClient(ctx) 43 if err != nil { 44 // TODO: Handle error. 45 } 46 47 req := &schedulerpb.ListJobsRequest{ 48 // TODO: Fill request struct fields. 49 } 50 it := c.ListJobs(ctx, req) 51 for { 52 resp, err := it.Next() 53 if err == iterator.Done { 54 break 55 } 56 if err != nil { 57 // TODO: Handle error. 58 } 59 // TODO: Use resp. 60 _ = resp 61 } 62} 63 64func ExampleCloudSchedulerClient_GetJob() { 65 // import schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" 66 67 ctx := context.Background() 68 c, err := scheduler.NewCloudSchedulerClient(ctx) 69 if err != nil { 70 // TODO: Handle error. 71 } 72 73 req := &schedulerpb.GetJobRequest{ 74 // TODO: Fill request struct fields. 75 } 76 resp, err := c.GetJob(ctx, req) 77 if err != nil { 78 // TODO: Handle error. 79 } 80 // TODO: Use resp. 81 _ = resp 82} 83 84func ExampleCloudSchedulerClient_CreateJob() { 85 // import schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" 86 87 ctx := context.Background() 88 c, err := scheduler.NewCloudSchedulerClient(ctx) 89 if err != nil { 90 // TODO: Handle error. 91 } 92 93 req := &schedulerpb.CreateJobRequest{ 94 // TODO: Fill request struct fields. 95 } 96 resp, err := c.CreateJob(ctx, req) 97 if err != nil { 98 // TODO: Handle error. 99 } 100 // TODO: Use resp. 101 _ = resp 102} 103 104func ExampleCloudSchedulerClient_UpdateJob() { 105 // import schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" 106 107 ctx := context.Background() 108 c, err := scheduler.NewCloudSchedulerClient(ctx) 109 if err != nil { 110 // TODO: Handle error. 111 } 112 113 req := &schedulerpb.UpdateJobRequest{ 114 // TODO: Fill request struct fields. 115 } 116 resp, err := c.UpdateJob(ctx, req) 117 if err != nil { 118 // TODO: Handle error. 119 } 120 // TODO: Use resp. 121 _ = resp 122} 123 124func ExampleCloudSchedulerClient_DeleteJob() { 125 ctx := context.Background() 126 c, err := scheduler.NewCloudSchedulerClient(ctx) 127 if err != nil { 128 // TODO: Handle error. 129 } 130 131 req := &schedulerpb.DeleteJobRequest{ 132 // TODO: Fill request struct fields. 133 } 134 err = c.DeleteJob(ctx, req) 135 if err != nil { 136 // TODO: Handle error. 137 } 138} 139 140func ExampleCloudSchedulerClient_PauseJob() { 141 // import schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" 142 143 ctx := context.Background() 144 c, err := scheduler.NewCloudSchedulerClient(ctx) 145 if err != nil { 146 // TODO: Handle error. 147 } 148 149 req := &schedulerpb.PauseJobRequest{ 150 // TODO: Fill request struct fields. 151 } 152 resp, err := c.PauseJob(ctx, req) 153 if err != nil { 154 // TODO: Handle error. 155 } 156 // TODO: Use resp. 157 _ = resp 158} 159 160func ExampleCloudSchedulerClient_ResumeJob() { 161 // import schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" 162 163 ctx := context.Background() 164 c, err := scheduler.NewCloudSchedulerClient(ctx) 165 if err != nil { 166 // TODO: Handle error. 167 } 168 169 req := &schedulerpb.ResumeJobRequest{ 170 // TODO: Fill request struct fields. 171 } 172 resp, err := c.ResumeJob(ctx, req) 173 if err != nil { 174 // TODO: Handle error. 175 } 176 // TODO: Use resp. 177 _ = resp 178} 179 180func ExampleCloudSchedulerClient_RunJob() { 181 // import schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1" 182 183 ctx := context.Background() 184 c, err := scheduler.NewCloudSchedulerClient(ctx) 185 if err != nil { 186 // TODO: Handle error. 187 } 188 189 req := &schedulerpb.RunJobRequest{ 190 // TODO: Fill request struct fields. 191 } 192 resp, err := c.RunJob(ctx, req) 193 if err != nil { 194 // TODO: Handle error. 195 } 196 // TODO: Use resp. 197 _ = resp 198} 199