mirror of
https://github.com/restic/restic.git
synced 2026-10-25 01:58:54 +00:00
Update dependencies
Among others, this updates minio-go, so that the new "eu-west-3" zone for AWS is supported.
This commit is contained in:
1 parent
b63de7c798
commit
2b39f9f4b2
3435 files changed
+1317989
-315639
No files matched your search
+5
-3
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
// Copyright 2018 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
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// 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,
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
)
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -31,6 +32,7 @@ import (
|
||||
"google.golang.org/api/option"
|
||||
)
|
||||
|
||||
var _ = fmt.Sprintf
|
||||
var _ = iterator.Done
|
||||
var _ = strconv.FormatUint
|
||||
var _ = time.Now
|
||||
@@ -53,7 +55,7 @@ func TestPublisherSmoke(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var formattedProject string = PublisherProjectPath(projectId)
|
||||
var formattedProject string = fmt.Sprintf("projects/%s", projectId)
|
||||
var request = &pubsubpb.ListTopicsRequest{
|
||||
Project: formattedProject,
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
// Copyright 2018 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
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// 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,
|
||||
@@ -17,7 +17,7 @@
|
||||
// Package pubsub is an auto-generated package for the
|
||||
// Google Cloud Pub/Sub API.
|
||||
//
|
||||
// NOTE: This package is in alpha. It is not stable, and is likely to be subject to changes.
|
||||
// NOTE: This package is in alpha. It is not stable, and is likely to change.
|
||||
//
|
||||
// Provides reliable, many-to-many, asynchronous messaging between
|
||||
// applications.
|
||||
|
||||
+89
-54
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
// Copyright 2018 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
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// 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,
|
||||
@@ -18,6 +18,7 @@ package pubsub
|
||||
|
||||
import (
|
||||
emptypb "github.com/golang/protobuf/ptypes/empty"
|
||||
timestamppb "github.com/golang/protobuf/ptypes/timestamp"
|
||||
iampb "google.golang.org/genproto/googleapis/iam/v1"
|
||||
pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1"
|
||||
field_maskpb "google.golang.org/genproto/protobuf/field_mask"
|
||||
@@ -450,7 +451,7 @@ func TestPublisherCreateTopic(t *testing.T) {
|
||||
|
||||
mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse)
|
||||
|
||||
var formattedName string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedName string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.Topic{
|
||||
Name: formattedName,
|
||||
}
|
||||
@@ -479,7 +480,7 @@ func TestPublisherCreateTopicError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockPublisher.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedName string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedName string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.Topic{
|
||||
Name: formattedName,
|
||||
}
|
||||
@@ -573,7 +574,7 @@ func TestPublisherPublish(t *testing.T) {
|
||||
|
||||
mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse)
|
||||
|
||||
var formattedTopic string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var data []byte = []byte("-86")
|
||||
var messagesElement = &pubsubpb.PubsubMessage{
|
||||
Data: data,
|
||||
@@ -608,7 +609,7 @@ func TestPublisherPublishError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockPublisher.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedTopic string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var data []byte = []byte("-86")
|
||||
var messagesElement = &pubsubpb.PubsubMessage{
|
||||
Data: data,
|
||||
@@ -644,7 +645,7 @@ func TestPublisherGetTopic(t *testing.T) {
|
||||
|
||||
mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse)
|
||||
|
||||
var formattedTopic string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.GetTopicRequest{
|
||||
Topic: formattedTopic,
|
||||
}
|
||||
@@ -673,7 +674,7 @@ func TestPublisherGetTopicError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockPublisher.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedTopic string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.GetTopicRequest{
|
||||
Topic: formattedTopic,
|
||||
}
|
||||
@@ -706,7 +707,7 @@ func TestPublisherListTopics(t *testing.T) {
|
||||
|
||||
mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse)
|
||||
|
||||
var formattedProject string = PublisherProjectPath("[PROJECT]")
|
||||
var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var request = &pubsubpb.ListTopicsRequest{
|
||||
Project: formattedProject,
|
||||
}
|
||||
@@ -745,7 +746,7 @@ func TestPublisherListTopicsError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockPublisher.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedProject string = PublisherProjectPath("[PROJECT]")
|
||||
var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var request = &pubsubpb.ListTopicsRequest{
|
||||
Project: formattedProject,
|
||||
}
|
||||
@@ -778,7 +779,7 @@ func TestPublisherListTopicSubscriptions(t *testing.T) {
|
||||
|
||||
mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse)
|
||||
|
||||
var formattedTopic string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.ListTopicSubscriptionsRequest{
|
||||
Topic: formattedTopic,
|
||||
}
|
||||
@@ -817,7 +818,7 @@ func TestPublisherListTopicSubscriptionsError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockPublisher.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedTopic string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.ListTopicSubscriptionsRequest{
|
||||
Topic: formattedTopic,
|
||||
}
|
||||
@@ -844,7 +845,7 @@ func TestPublisherDeleteTopic(t *testing.T) {
|
||||
|
||||
mockPublisher.resps = append(mockPublisher.resps[:0], expectedResponse)
|
||||
|
||||
var formattedTopic string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.DeleteTopicRequest{
|
||||
Topic: formattedTopic,
|
||||
}
|
||||
@@ -870,7 +871,7 @@ func TestPublisherDeleteTopicError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockPublisher.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedTopic string = PublisherTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.DeleteTopicRequest{
|
||||
Topic: formattedTopic,
|
||||
}
|
||||
@@ -905,8 +906,8 @@ func TestSubscriberCreateSubscription(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedName string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedTopic string = SubscriberTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedName string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.Subscription{
|
||||
Name: formattedName,
|
||||
Topic: formattedTopic,
|
||||
@@ -936,8 +937,8 @@ func TestSubscriberCreateSubscriptionError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedName string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedTopic string = SubscriberTopicPath("[PROJECT]", "[TOPIC]")
|
||||
var formattedName string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedTopic string = fmt.Sprintf("projects/%s/topics/%s", "[PROJECT]", "[TOPIC]")
|
||||
var request = &pubsubpb.Subscription{
|
||||
Name: formattedName,
|
||||
Topic: formattedTopic,
|
||||
@@ -974,7 +975,7 @@ func TestSubscriberGetSubscription(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var request = &pubsubpb.GetSubscriptionRequest{
|
||||
Subscription: formattedSubscription,
|
||||
}
|
||||
@@ -1003,7 +1004,7 @@ func TestSubscriberGetSubscriptionError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var request = &pubsubpb.GetSubscriptionRequest{
|
||||
Subscription: formattedSubscription,
|
||||
}
|
||||
@@ -1025,12 +1026,12 @@ func TestSubscriberGetSubscriptionError(t *testing.T) {
|
||||
func TestSubscriberUpdateSubscription(t *testing.T) {
|
||||
var name string = "name3373707"
|
||||
var topic string = "topic110546223"
|
||||
var ackDeadlineSeconds int32 = 2135351438
|
||||
var ackDeadlineSeconds2 int32 = 921632575
|
||||
var retainAckedMessages bool = false
|
||||
var expectedResponse = &pubsubpb.Subscription{
|
||||
Name: name,
|
||||
Topic: topic,
|
||||
AckDeadlineSeconds: ackDeadlineSeconds,
|
||||
AckDeadlineSeconds: ackDeadlineSeconds2,
|
||||
RetainAckedMessages: retainAckedMessages,
|
||||
}
|
||||
|
||||
@@ -1039,8 +1040,15 @@ func TestSubscriberUpdateSubscription(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var subscription *pubsubpb.Subscription = &pubsubpb.Subscription{}
|
||||
var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{}
|
||||
var ackDeadlineSeconds int32 = 42
|
||||
var subscription = &pubsubpb.Subscription{
|
||||
AckDeadlineSeconds: ackDeadlineSeconds,
|
||||
}
|
||||
var pathsElement string = "ack_deadline_seconds"
|
||||
var paths = []string{pathsElement}
|
||||
var updateMask = &field_maskpb.FieldMask{
|
||||
Paths: paths,
|
||||
}
|
||||
var request = &pubsubpb.UpdateSubscriptionRequest{
|
||||
Subscription: subscription,
|
||||
UpdateMask: updateMask,
|
||||
@@ -1070,8 +1078,15 @@ func TestSubscriberUpdateSubscriptionError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var subscription *pubsubpb.Subscription = &pubsubpb.Subscription{}
|
||||
var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{}
|
||||
var ackDeadlineSeconds int32 = 42
|
||||
var subscription = &pubsubpb.Subscription{
|
||||
AckDeadlineSeconds: ackDeadlineSeconds,
|
||||
}
|
||||
var pathsElement string = "ack_deadline_seconds"
|
||||
var paths = []string{pathsElement}
|
||||
var updateMask = &field_maskpb.FieldMask{
|
||||
Paths: paths,
|
||||
}
|
||||
var request = &pubsubpb.UpdateSubscriptionRequest{
|
||||
Subscription: subscription,
|
||||
UpdateMask: updateMask,
|
||||
@@ -1105,7 +1120,7 @@ func TestSubscriberListSubscriptions(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedProject string = SubscriberProjectPath("[PROJECT]")
|
||||
var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var request = &pubsubpb.ListSubscriptionsRequest{
|
||||
Project: formattedProject,
|
||||
}
|
||||
@@ -1144,7 +1159,7 @@ func TestSubscriberListSubscriptionsError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedProject string = SubscriberProjectPath("[PROJECT]")
|
||||
var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var request = &pubsubpb.ListSubscriptionsRequest{
|
||||
Project: formattedProject,
|
||||
}
|
||||
@@ -1171,7 +1186,7 @@ func TestSubscriberDeleteSubscription(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var request = &pubsubpb.DeleteSubscriptionRequest{
|
||||
Subscription: formattedSubscription,
|
||||
}
|
||||
@@ -1197,7 +1212,7 @@ func TestSubscriberDeleteSubscriptionError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var request = &pubsubpb.DeleteSubscriptionRequest{
|
||||
Subscription: formattedSubscription,
|
||||
}
|
||||
@@ -1223,7 +1238,7 @@ func TestSubscriberModifyAckDeadline(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var ackIds []string = nil
|
||||
var ackDeadlineSeconds int32 = 2135351438
|
||||
var request = &pubsubpb.ModifyAckDeadlineRequest{
|
||||
@@ -1253,7 +1268,7 @@ func TestSubscriberModifyAckDeadlineError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var ackIds []string = nil
|
||||
var ackDeadlineSeconds int32 = 2135351438
|
||||
var request = &pubsubpb.ModifyAckDeadlineRequest{
|
||||
@@ -1283,7 +1298,7 @@ func TestSubscriberAcknowledge(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var ackIds []string = nil
|
||||
var request = &pubsubpb.AcknowledgeRequest{
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1311,7 +1326,7 @@ func TestSubscriberAcknowledgeError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var ackIds []string = nil
|
||||
var request = &pubsubpb.AcknowledgeRequest{
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1339,7 +1354,7 @@ func TestSubscriberPull(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var maxMessages int32 = 496131527
|
||||
var request = &pubsubpb.PullRequest{
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1370,7 +1385,7 @@ func TestSubscriberPullError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var maxMessages int32 = 496131527
|
||||
var request = &pubsubpb.PullRequest{
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1403,7 +1418,7 @@ func TestSubscriberStreamingPull(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var streamAckDeadlineSeconds int32 = 1875467245
|
||||
var request = &pubsubpb.StreamingPullRequest{
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1444,7 +1459,7 @@ func TestSubscriberStreamingPullError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var streamAckDeadlineSeconds int32 = 1875467245
|
||||
var request = &pubsubpb.StreamingPullRequest{
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1483,7 +1498,7 @@ func TestSubscriberModifyPushConfig(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var pushConfig *pubsubpb.PushConfig = &pubsubpb.PushConfig{}
|
||||
var request = &pubsubpb.ModifyPushConfigRequest{
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1511,7 +1526,7 @@ func TestSubscriberModifyPushConfigError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var pushConfig *pubsubpb.PushConfig = &pubsubpb.PushConfig{}
|
||||
var request = &pubsubpb.ModifyPushConfigRequest{
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1545,7 +1560,7 @@ func TestSubscriberListSnapshots(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedProject string = SubscriberProjectPath("[PROJECT]")
|
||||
var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var request = &pubsubpb.ListSnapshotsRequest{
|
||||
Project: formattedProject,
|
||||
}
|
||||
@@ -1584,7 +1599,7 @@ func TestSubscriberListSnapshotsError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedProject string = SubscriberProjectPath("[PROJECT]")
|
||||
var formattedProject string = fmt.Sprintf("projects/%s", "[PROJECT]")
|
||||
var request = &pubsubpb.ListSnapshotsRequest{
|
||||
Project: formattedProject,
|
||||
}
|
||||
@@ -1616,8 +1631,8 @@ func TestSubscriberCreateSnapshot(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedName string = SubscriberSnapshotPath("[PROJECT]", "[SNAPSHOT]")
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedName string = fmt.Sprintf("projects/%s/snapshots/%s", "[PROJECT]", "[SNAPSHOT]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var request = &pubsubpb.CreateSnapshotRequest{
|
||||
Name: formattedName,
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1647,8 +1662,8 @@ func TestSubscriberCreateSnapshotError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedName string = SubscriberSnapshotPath("[PROJECT]", "[SNAPSHOT]")
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedName string = fmt.Sprintf("projects/%s/snapshots/%s", "[PROJECT]", "[SNAPSHOT]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var request = &pubsubpb.CreateSnapshotRequest{
|
||||
Name: formattedName,
|
||||
Subscription: formattedSubscription,
|
||||
@@ -1681,8 +1696,18 @@ func TestSubscriberUpdateSnapshot(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var snapshot *pubsubpb.Snapshot = &pubsubpb.Snapshot{}
|
||||
var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{}
|
||||
var seconds int64 = 123456
|
||||
var expireTime = ×tamppb.Timestamp{
|
||||
Seconds: seconds,
|
||||
}
|
||||
var snapshot = &pubsubpb.Snapshot{
|
||||
ExpireTime: expireTime,
|
||||
}
|
||||
var pathsElement string = "expire_time"
|
||||
var paths = []string{pathsElement}
|
||||
var updateMask = &field_maskpb.FieldMask{
|
||||
Paths: paths,
|
||||
}
|
||||
var request = &pubsubpb.UpdateSnapshotRequest{
|
||||
Snapshot: snapshot,
|
||||
UpdateMask: updateMask,
|
||||
@@ -1712,8 +1737,18 @@ func TestSubscriberUpdateSnapshotError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var snapshot *pubsubpb.Snapshot = &pubsubpb.Snapshot{}
|
||||
var updateMask *field_maskpb.FieldMask = &field_maskpb.FieldMask{}
|
||||
var seconds int64 = 123456
|
||||
var expireTime = ×tamppb.Timestamp{
|
||||
Seconds: seconds,
|
||||
}
|
||||
var snapshot = &pubsubpb.Snapshot{
|
||||
ExpireTime: expireTime,
|
||||
}
|
||||
var pathsElement string = "expire_time"
|
||||
var paths = []string{pathsElement}
|
||||
var updateMask = &field_maskpb.FieldMask{
|
||||
Paths: paths,
|
||||
}
|
||||
var request = &pubsubpb.UpdateSnapshotRequest{
|
||||
Snapshot: snapshot,
|
||||
UpdateMask: updateMask,
|
||||
@@ -1741,7 +1776,7 @@ func TestSubscriberDeleteSnapshot(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSnapshot string = SubscriberSnapshotPath("[PROJECT]", "[SNAPSHOT]")
|
||||
var formattedSnapshot string = fmt.Sprintf("projects/%s/snapshots/%s", "[PROJECT]", "[SNAPSHOT]")
|
||||
var request = &pubsubpb.DeleteSnapshotRequest{
|
||||
Snapshot: formattedSnapshot,
|
||||
}
|
||||
@@ -1767,7 +1802,7 @@ func TestSubscriberDeleteSnapshotError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSnapshot string = SubscriberSnapshotPath("[PROJECT]", "[SNAPSHOT]")
|
||||
var formattedSnapshot string = fmt.Sprintf("projects/%s/snapshots/%s", "[PROJECT]", "[SNAPSHOT]")
|
||||
var request = &pubsubpb.DeleteSnapshotRequest{
|
||||
Snapshot: formattedSnapshot,
|
||||
}
|
||||
@@ -1793,7 +1828,7 @@ func TestSubscriberSeek(t *testing.T) {
|
||||
|
||||
mockSubscriber.resps = append(mockSubscriber.resps[:0], expectedResponse)
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var request = &pubsubpb.SeekRequest{
|
||||
Subscription: formattedSubscription,
|
||||
}
|
||||
@@ -1822,7 +1857,7 @@ func TestSubscriberSeekError(t *testing.T) {
|
||||
errCode := codes.PermissionDenied
|
||||
mockSubscriber.err = gstatus.Error(errCode, "test error")
|
||||
|
||||
var formattedSubscription string = SubscriberSubscriptionPath("[PROJECT]", "[SUBSCRIPTION]")
|
||||
var formattedSubscription string = fmt.Sprintf("projects/%s/subscriptions/%s", "[PROJECT]", "[SUBSCRIPTION]")
|
||||
var request = &pubsubpb.SeekRequest{
|
||||
Subscription: formattedSubscription,
|
||||
}
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
// Copyright 2018 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.
|
||||
|
||||
package pubsub
|
||||
|
||||
// PublisherProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
// instead.
|
||||
func PublisherProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// PublisherTopicPath returns the path for the topic resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/topics/%s", project, topic)
|
||||
// instead.
|
||||
func PublisherTopicPath(project, topic string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/topics/" +
|
||||
topic +
|
||||
""
|
||||
}
|
||||
|
||||
// SubscriberProjectPath returns the path for the project resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s", project)
|
||||
// instead.
|
||||
func SubscriberProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// SubscriberSnapshotPath returns the path for the snapshot resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/snapshots/%s", project, snapshot)
|
||||
// instead.
|
||||
func SubscriberSnapshotPath(project, snapshot string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/snapshots/" +
|
||||
snapshot +
|
||||
""
|
||||
}
|
||||
|
||||
// SubscriberSubscriptionPath returns the path for the subscription resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/subscriptions/%s", project, subscription)
|
||||
// instead.
|
||||
func SubscriberSubscriptionPath(project, subscription string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/subscriptions/" +
|
||||
subscription +
|
||||
""
|
||||
}
|
||||
|
||||
// SubscriberTopicPath returns the path for the topic resource.
|
||||
//
|
||||
// Deprecated: Use
|
||||
// fmt.Sprintf("projects/%s/topics/%s", project, topic)
|
||||
// instead.
|
||||
func SubscriberTopicPath(project, topic string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/topics/" +
|
||||
topic +
|
||||
""
|
||||
}
|
||||
+12
-30
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
// Copyright 2018 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
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// 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,
|
||||
@@ -105,8 +105,8 @@ type PublisherClient struct {
|
||||
// The call options for this service.
|
||||
CallOptions *PublisherCallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
Metadata metadata.MD
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewPublisherClient creates a new publisher client.
|
||||
@@ -145,25 +145,7 @@ func (c *PublisherClient) Close() error {
|
||||
func (c *PublisherClient) SetGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.Metadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// PublisherProjectPath returns the path for the project resource.
|
||||
func PublisherProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// PublisherTopicPath returns the path for the topic resource.
|
||||
func PublisherTopicPath(project, topic string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/topics/" +
|
||||
topic +
|
||||
""
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
func (c *PublisherClient) SubscriptionIAM(subscription *pubsubpb.Subscription) *iam.Handle {
|
||||
@@ -176,7 +158,7 @@ func (c *PublisherClient) TopicIAM(topic *pubsubpb.Topic) *iam.Handle {
|
||||
|
||||
// CreateTopic creates the given topic with the given name.
|
||||
func (c *PublisherClient) CreateTopic(ctx context.Context, req *pubsubpb.Topic, opts ...gax.CallOption) (*pubsubpb.Topic, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateTopic[0:len(c.CallOptions.CreateTopic):len(c.CallOptions.CreateTopic)], opts...)
|
||||
var resp *pubsubpb.Topic
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -197,7 +179,7 @@ func (c *PublisherClient) CreateTopic(ctx context.Context, req *pubsubpb.Topic,
|
||||
// corrected in V2. See
|
||||
// https://cloud.google.com/apis/design/standard_methods#update for details.
|
||||
func (c *PublisherClient) UpdateTopic(ctx context.Context, req *pubsubpb.UpdateTopicRequest, opts ...gax.CallOption) (*pubsubpb.Topic, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.UpdateTopic[0:len(c.CallOptions.UpdateTopic):len(c.CallOptions.UpdateTopic)], opts...)
|
||||
var resp *pubsubpb.Topic
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -215,7 +197,7 @@ func (c *PublisherClient) UpdateTopic(ctx context.Context, req *pubsubpb.UpdateT
|
||||
// does not exist. The message payload must not be empty; it must contain
|
||||
// either a non-empty data field, or at least one attribute.
|
||||
func (c *PublisherClient) Publish(ctx context.Context, req *pubsubpb.PublishRequest, opts ...gax.CallOption) (*pubsubpb.PublishResponse, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.Publish[0:len(c.CallOptions.Publish):len(c.CallOptions.Publish)], opts...)
|
||||
var resp *pubsubpb.PublishResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -231,7 +213,7 @@ func (c *PublisherClient) Publish(ctx context.Context, req *pubsubpb.PublishRequ
|
||||
|
||||
// GetTopic gets the configuration of a topic.
|
||||
func (c *PublisherClient) GetTopic(ctx context.Context, req *pubsubpb.GetTopicRequest, opts ...gax.CallOption) (*pubsubpb.Topic, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetTopic[0:len(c.CallOptions.GetTopic):len(c.CallOptions.GetTopic)], opts...)
|
||||
var resp *pubsubpb.Topic
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -247,7 +229,7 @@ func (c *PublisherClient) GetTopic(ctx context.Context, req *pubsubpb.GetTopicRe
|
||||
|
||||
// ListTopics lists matching topics.
|
||||
func (c *PublisherClient) ListTopics(ctx context.Context, req *pubsubpb.ListTopicsRequest, opts ...gax.CallOption) *TopicIterator {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListTopics[0:len(c.CallOptions.ListTopics):len(c.CallOptions.ListTopics)], opts...)
|
||||
it := &TopicIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*pubsubpb.Topic, string, error) {
|
||||
@@ -282,7 +264,7 @@ func (c *PublisherClient) ListTopics(ctx context.Context, req *pubsubpb.ListTopi
|
||||
|
||||
// ListTopicSubscriptions lists the name of the subscriptions for this topic.
|
||||
func (c *PublisherClient) ListTopicSubscriptions(ctx context.Context, req *pubsubpb.ListTopicSubscriptionsRequest, opts ...gax.CallOption) *StringIterator {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListTopicSubscriptions[0:len(c.CallOptions.ListTopicSubscriptions):len(c.CallOptions.ListTopicSubscriptions)], opts...)
|
||||
it := &StringIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]string, string, error) {
|
||||
@@ -321,7 +303,7 @@ func (c *PublisherClient) ListTopicSubscriptions(ctx context.Context, req *pubsu
|
||||
// configuration or subscriptions. Existing subscriptions to this topic are
|
||||
// not deleted, but their topic field is set to _deleted-topic_.
|
||||
func (c *PublisherClient) DeleteTopic(ctx context.Context, req *pubsubpb.DeleteTopicRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteTopic[0:len(c.CallOptions.DeleteTopic):len(c.CallOptions.DeleteTopic)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
|
||||
+9
-9
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
// Copyright 2018 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
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// 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,
|
||||
@@ -75,7 +75,7 @@ func ExamplePublisherClient_CreateTopic() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.Topic{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.CreateTopic(ctx, req)
|
||||
if err != nil {
|
||||
@@ -93,7 +93,7 @@ func ExamplePublisherClient_UpdateTopic() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.UpdateTopicRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.UpdateTopic(ctx, req)
|
||||
if err != nil {
|
||||
@@ -111,7 +111,7 @@ func ExamplePublisherClient_Publish() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.PublishRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.Publish(ctx, req)
|
||||
if err != nil {
|
||||
@@ -129,7 +129,7 @@ func ExamplePublisherClient_GetTopic() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.GetTopicRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.GetTopic(ctx, req)
|
||||
if err != nil {
|
||||
@@ -147,7 +147,7 @@ func ExamplePublisherClient_ListTopics() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.ListTopicsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
it := c.ListTopics(ctx, req)
|
||||
for {
|
||||
@@ -171,7 +171,7 @@ func ExamplePublisherClient_ListTopicSubscriptions() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.ListTopicSubscriptionsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
it := c.ListTopicSubscriptions(ctx, req)
|
||||
for {
|
||||
@@ -195,7 +195,7 @@ func ExamplePublisherClient_DeleteTopic() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.DeleteTopicRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
err = c.DeleteTopic(ctx, req)
|
||||
if err != nil {
|
||||
|
||||
+20
-58
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
// Copyright 2018 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
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// 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,
|
||||
@@ -134,8 +134,8 @@ type SubscriberClient struct {
|
||||
// The call options for this service.
|
||||
CallOptions *SubscriberCallOptions
|
||||
|
||||
// The metadata to be sent with each request.
|
||||
Metadata metadata.MD
|
||||
// The x-goog-* metadata to be sent with each request.
|
||||
xGoogMetadata metadata.MD
|
||||
}
|
||||
|
||||
// NewSubscriberClient creates a new subscriber client.
|
||||
@@ -174,45 +174,7 @@ func (c *SubscriberClient) Close() error {
|
||||
func (c *SubscriberClient) SetGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", version.Go()}, keyval...)
|
||||
kv = append(kv, "gapic", version.Repo, "gax", gax.Version, "grpc", grpc.Version)
|
||||
c.Metadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
// SubscriberProjectPath returns the path for the project resource.
|
||||
func SubscriberProjectPath(project string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
""
|
||||
}
|
||||
|
||||
// SubscriberSnapshotPath returns the path for the snapshot resource.
|
||||
func SubscriberSnapshotPath(project, snapshot string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/snapshots/" +
|
||||
snapshot +
|
||||
""
|
||||
}
|
||||
|
||||
// SubscriberSubscriptionPath returns the path for the subscription resource.
|
||||
func SubscriberSubscriptionPath(project, subscription string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/subscriptions/" +
|
||||
subscription +
|
||||
""
|
||||
}
|
||||
|
||||
// SubscriberTopicPath returns the path for the topic resource.
|
||||
func SubscriberTopicPath(project, topic string) string {
|
||||
return "" +
|
||||
"projects/" +
|
||||
project +
|
||||
"/topics/" +
|
||||
topic +
|
||||
""
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
||||
func (c *SubscriberClient) SubscriptionIAM(subscription *pubsubpb.Subscription) *iam.Handle {
|
||||
@@ -234,7 +196,7 @@ func (c *SubscriberClient) TopicIAM(topic *pubsubpb.Topic) *iam.Handle {
|
||||
// The generated name is populated in the returned Subscription object.
|
||||
// Note that for REST API requests, you must specify a name in the request.
|
||||
func (c *SubscriberClient) CreateSubscription(ctx context.Context, req *pubsubpb.Subscription, opts ...gax.CallOption) (*pubsubpb.Subscription, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateSubscription[0:len(c.CallOptions.CreateSubscription):len(c.CallOptions.CreateSubscription)], opts...)
|
||||
var resp *pubsubpb.Subscription
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -250,7 +212,7 @@ func (c *SubscriberClient) CreateSubscription(ctx context.Context, req *pubsubpb
|
||||
|
||||
// GetSubscription gets the configuration details of a subscription.
|
||||
func (c *SubscriberClient) GetSubscription(ctx context.Context, req *pubsubpb.GetSubscriptionRequest, opts ...gax.CallOption) (*pubsubpb.Subscription, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.GetSubscription[0:len(c.CallOptions.GetSubscription):len(c.CallOptions.GetSubscription)], opts...)
|
||||
var resp *pubsubpb.Subscription
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -271,7 +233,7 @@ func (c *SubscriberClient) GetSubscription(ctx context.Context, req *pubsubpb.Ge
|
||||
// corrected in V2. See
|
||||
// https://cloud.google.com/apis/design/standard_methods#update for details.
|
||||
func (c *SubscriberClient) UpdateSubscription(ctx context.Context, req *pubsubpb.UpdateSubscriptionRequest, opts ...gax.CallOption) (*pubsubpb.Subscription, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.UpdateSubscription[0:len(c.CallOptions.UpdateSubscription):len(c.CallOptions.UpdateSubscription)], opts...)
|
||||
var resp *pubsubpb.Subscription
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -287,7 +249,7 @@ func (c *SubscriberClient) UpdateSubscription(ctx context.Context, req *pubsubpb
|
||||
|
||||
// ListSubscriptions lists matching subscriptions.
|
||||
func (c *SubscriberClient) ListSubscriptions(ctx context.Context, req *pubsubpb.ListSubscriptionsRequest, opts ...gax.CallOption) *SubscriptionIterator {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListSubscriptions[0:len(c.CallOptions.ListSubscriptions):len(c.CallOptions.ListSubscriptions)], opts...)
|
||||
it := &SubscriptionIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*pubsubpb.Subscription, string, error) {
|
||||
@@ -326,7 +288,7 @@ func (c *SubscriberClient) ListSubscriptions(ctx context.Context, req *pubsubpb.
|
||||
// the same name, but the new one has no association with the old
|
||||
// subscription or its topic unless the same topic is specified.
|
||||
func (c *SubscriberClient) DeleteSubscription(ctx context.Context, req *pubsubpb.DeleteSubscriptionRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteSubscription[0:len(c.CallOptions.DeleteSubscription):len(c.CallOptions.DeleteSubscription)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
@@ -342,7 +304,7 @@ func (c *SubscriberClient) DeleteSubscription(ctx context.Context, req *pubsubpb
|
||||
// processing was interrupted. Note that this does not modify the
|
||||
// subscription-level ackDeadlineSeconds used for subsequent messages.
|
||||
func (c *SubscriberClient) ModifyAckDeadline(ctx context.Context, req *pubsubpb.ModifyAckDeadlineRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ModifyAckDeadline[0:len(c.CallOptions.ModifyAckDeadline):len(c.CallOptions.ModifyAckDeadline)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
@@ -360,7 +322,7 @@ func (c *SubscriberClient) ModifyAckDeadline(ctx context.Context, req *pubsubpb.
|
||||
// but such a message may be redelivered later. Acknowledging a message more
|
||||
// than once will not result in an error.
|
||||
func (c *SubscriberClient) Acknowledge(ctx context.Context, req *pubsubpb.AcknowledgeRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.Acknowledge[0:len(c.CallOptions.Acknowledge):len(c.CallOptions.Acknowledge)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
@@ -375,7 +337,7 @@ func (c *SubscriberClient) Acknowledge(ctx context.Context, req *pubsubpb.Acknow
|
||||
// there are too many concurrent pull requests pending for the given
|
||||
// subscription.
|
||||
func (c *SubscriberClient) Pull(ctx context.Context, req *pubsubpb.PullRequest, opts ...gax.CallOption) (*pubsubpb.PullResponse, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.Pull[0:len(c.CallOptions.Pull):len(c.CallOptions.Pull)], opts...)
|
||||
var resp *pubsubpb.PullResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -402,7 +364,7 @@ func (c *SubscriberClient) Pull(ctx context.Context, req *pubsubpb.PullRequest,
|
||||
// (e.g., a server restart). These should also be retried by the client. Flow
|
||||
// control can be achieved by configuring the underlying RPC channel.
|
||||
func (c *SubscriberClient) StreamingPull(ctx context.Context, opts ...gax.CallOption) (pubsubpb.Subscriber_StreamingPullClient, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.StreamingPull[0:len(c.CallOptions.StreamingPull):len(c.CallOptions.StreamingPull)], opts...)
|
||||
var resp pubsubpb.Subscriber_StreamingPullClient
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -423,7 +385,7 @@ func (c *SubscriberClient) StreamingPull(ctx context.Context, opts ...gax.CallOp
|
||||
// attributes of a push subscription. Messages will accumulate for delivery
|
||||
// continuously through the call regardless of changes to the PushConfig.
|
||||
func (c *SubscriberClient) ModifyPushConfig(ctx context.Context, req *pubsubpb.ModifyPushConfigRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ModifyPushConfig[0:len(c.CallOptions.ModifyPushConfig):len(c.CallOptions.ModifyPushConfig)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
@@ -435,7 +397,7 @@ func (c *SubscriberClient) ModifyPushConfig(ctx context.Context, req *pubsubpb.M
|
||||
|
||||
// ListSnapshots lists the existing snapshots.
|
||||
func (c *SubscriberClient) ListSnapshots(ctx context.Context, req *pubsubpb.ListSnapshotsRequest, opts ...gax.CallOption) *SnapshotIterator {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.ListSnapshots[0:len(c.CallOptions.ListSnapshots):len(c.CallOptions.ListSnapshots)], opts...)
|
||||
it := &SnapshotIterator{}
|
||||
it.InternalFetch = func(pageSize int, pageToken string) ([]*pubsubpb.Snapshot, string, error) {
|
||||
@@ -479,7 +441,7 @@ func (c *SubscriberClient) ListSnapshots(ctx context.Context, req *pubsubpb.List
|
||||
// The generated name is populated in the returned Snapshot object.
|
||||
// Note that for REST API requests, you must specify a name in the request.
|
||||
func (c *SubscriberClient) CreateSnapshot(ctx context.Context, req *pubsubpb.CreateSnapshotRequest, opts ...gax.CallOption) (*pubsubpb.Snapshot, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.CreateSnapshot[0:len(c.CallOptions.CreateSnapshot):len(c.CallOptions.CreateSnapshot)], opts...)
|
||||
var resp *pubsubpb.Snapshot
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -500,7 +462,7 @@ func (c *SubscriberClient) CreateSnapshot(ctx context.Context, req *pubsubpb.Cre
|
||||
// corrected in V2. See
|
||||
// https://cloud.google.com/apis/design/standard_methods#update for details.
|
||||
func (c *SubscriberClient) UpdateSnapshot(ctx context.Context, req *pubsubpb.UpdateSnapshotRequest, opts ...gax.CallOption) (*pubsubpb.Snapshot, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.UpdateSnapshot[0:len(c.CallOptions.UpdateSnapshot):len(c.CallOptions.UpdateSnapshot)], opts...)
|
||||
var resp *pubsubpb.Snapshot
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
@@ -519,7 +481,7 @@ func (c *SubscriberClient) UpdateSnapshot(ctx context.Context, req *pubsubpb.Upd
|
||||
// created with the same name, but the new one has no association with the old
|
||||
// snapshot or its subscription, unless the same subscription is specified.
|
||||
func (c *SubscriberClient) DeleteSnapshot(ctx context.Context, req *pubsubpb.DeleteSnapshotRequest, opts ...gax.CallOption) error {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.DeleteSnapshot[0:len(c.CallOptions.DeleteSnapshot):len(c.CallOptions.DeleteSnapshot)], opts...)
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
var err error
|
||||
@@ -532,7 +494,7 @@ func (c *SubscriberClient) DeleteSnapshot(ctx context.Context, req *pubsubpb.Del
|
||||
// Seek seeks an existing subscription to a point in time or to a given snapshot,
|
||||
// whichever is provided in the request.
|
||||
func (c *SubscriberClient) Seek(ctx context.Context, req *pubsubpb.SeekRequest, opts ...gax.CallOption) (*pubsubpb.SeekResponse, error) {
|
||||
ctx = insertMetadata(ctx, c.Metadata)
|
||||
ctx = insertMetadata(ctx, c.xGoogMetadata)
|
||||
opts = append(c.CallOptions.Seek[0:len(c.CallOptions.Seek):len(c.CallOptions.Seek)], opts...)
|
||||
var resp *pubsubpb.SeekResponse
|
||||
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
|
||||
+17
-17
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017, Google Inc. All rights reserved.
|
||||
// Copyright 2018 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
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// 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,
|
||||
@@ -77,7 +77,7 @@ func ExampleSubscriberClient_CreateSubscription() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.Subscription{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.CreateSubscription(ctx, req)
|
||||
if err != nil {
|
||||
@@ -95,7 +95,7 @@ func ExampleSubscriberClient_GetSubscription() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.GetSubscriptionRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.GetSubscription(ctx, req)
|
||||
if err != nil {
|
||||
@@ -113,7 +113,7 @@ func ExampleSubscriberClient_UpdateSubscription() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.UpdateSubscriptionRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.UpdateSubscription(ctx, req)
|
||||
if err != nil {
|
||||
@@ -131,7 +131,7 @@ func ExampleSubscriberClient_ListSubscriptions() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.ListSubscriptionsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
it := c.ListSubscriptions(ctx, req)
|
||||
for {
|
||||
@@ -155,7 +155,7 @@ func ExampleSubscriberClient_DeleteSubscription() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.DeleteSubscriptionRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
err = c.DeleteSubscription(ctx, req)
|
||||
if err != nil {
|
||||
@@ -171,7 +171,7 @@ func ExampleSubscriberClient_ModifyAckDeadline() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.ModifyAckDeadlineRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
err = c.ModifyAckDeadline(ctx, req)
|
||||
if err != nil {
|
||||
@@ -187,7 +187,7 @@ func ExampleSubscriberClient_Acknowledge() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.AcknowledgeRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
err = c.Acknowledge(ctx, req)
|
||||
if err != nil {
|
||||
@@ -203,7 +203,7 @@ func ExampleSubscriberClient_Pull() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.PullRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.Pull(ctx, req)
|
||||
if err != nil {
|
||||
@@ -225,7 +225,7 @@ func ExampleSubscriberClient_StreamingPull() {
|
||||
}
|
||||
go func() {
|
||||
reqs := []*pubsubpb.StreamingPullRequest{
|
||||
// TODO: Create requests.
|
||||
// TODO: Create requests.
|
||||
}
|
||||
for _, req := range reqs {
|
||||
if err := stream.Send(req); err != nil {
|
||||
@@ -255,7 +255,7 @@ func ExampleSubscriberClient_ModifyPushConfig() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.ModifyPushConfigRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
err = c.ModifyPushConfig(ctx, req)
|
||||
if err != nil {
|
||||
@@ -271,7 +271,7 @@ func ExampleSubscriberClient_ListSnapshots() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.ListSnapshotsRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
it := c.ListSnapshots(ctx, req)
|
||||
for {
|
||||
@@ -295,7 +295,7 @@ func ExampleSubscriberClient_CreateSnapshot() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.CreateSnapshotRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.CreateSnapshot(ctx, req)
|
||||
if err != nil {
|
||||
@@ -313,7 +313,7 @@ func ExampleSubscriberClient_UpdateSnapshot() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.UpdateSnapshotRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.UpdateSnapshot(ctx, req)
|
||||
if err != nil {
|
||||
@@ -331,7 +331,7 @@ func ExampleSubscriberClient_DeleteSnapshot() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.DeleteSnapshotRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
err = c.DeleteSnapshot(ctx, req)
|
||||
if err != nil {
|
||||
@@ -347,7 +347,7 @@ func ExampleSubscriberClient_Seek() {
|
||||
}
|
||||
|
||||
req := &pubsubpb.SeekRequest{
|
||||
// TODO: Fill request struct fields.
|
||||
// TODO: Fill request struct fields.
|
||||
}
|
||||
resp, err := c.Seek(ctx, req)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user