blob: 040a87c891ee554982d250ac1a5ff903d5267f65 [file] [log] [blame]
// Copyright 2022 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 pubsublite_test
import (
"context"
pubsublite "cloud.google.com/go/pubsublite/apiv1"
"google.golang.org/api/iterator"
pubsublitepb "google.golang.org/genproto/googleapis/cloud/pubsublite/v1"
)
func ExampleNewAdminClient() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func ExampleAdminClient_CreateTopic() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.CreateTopicRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#CreateTopicRequest.
}
resp, err := c.CreateTopic(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_GetTopic() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.GetTopicRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#GetTopicRequest.
}
resp, err := c.GetTopic(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_GetTopicPartitions() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.GetTopicPartitionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#GetTopicPartitionsRequest.
}
resp, err := c.GetTopicPartitions(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_ListTopics() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListTopicsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#ListTopicsRequest.
}
it := c.ListTopics(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAdminClient_UpdateTopic() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.UpdateTopicRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#UpdateTopicRequest.
}
resp, err := c.UpdateTopic(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_DeleteTopic() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.DeleteTopicRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#DeleteTopicRequest.
}
err = c.DeleteTopic(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleAdminClient_ListTopicSubscriptions() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListTopicSubscriptionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#ListTopicSubscriptionsRequest.
}
it := c.ListTopicSubscriptions(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAdminClient_CreateSubscription() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.CreateSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#CreateSubscriptionRequest.
}
resp, err := c.CreateSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_GetSubscription() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.GetSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#GetSubscriptionRequest.
}
resp, err := c.GetSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_ListSubscriptions() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListSubscriptionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#ListSubscriptionsRequest.
}
it := c.ListSubscriptions(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAdminClient_UpdateSubscription() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.UpdateSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#UpdateSubscriptionRequest.
}
resp, err := c.UpdateSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_DeleteSubscription() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.DeleteSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#DeleteSubscriptionRequest.
}
err = c.DeleteSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleAdminClient_SeekSubscription() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.SeekSubscriptionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#SeekSubscriptionRequest.
}
op, err := c.SeekSubscription(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_CreateReservation() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.CreateReservationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#CreateReservationRequest.
}
resp, err := c.CreateReservation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_GetReservation() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.GetReservationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#GetReservationRequest.
}
resp, err := c.GetReservation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_ListReservations() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListReservationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#ListReservationsRequest.
}
it := c.ListReservations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func ExampleAdminClient_UpdateReservation() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.UpdateReservationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#UpdateReservationRequest.
}
resp, err := c.UpdateReservation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func ExampleAdminClient_DeleteReservation() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.DeleteReservationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#DeleteReservationRequest.
}
err = c.DeleteReservation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func ExampleAdminClient_ListReservationTopics() {
ctx := context.Background()
c, err := pubsublite.NewAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &pubsublitepb.ListReservationTopicsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#ListReservationTopicsRequest.
}
it := c.ListReservationTopics(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}