...

Source file src/google.golang.org/api/pubsub/v1beta2/pubsub-gen.go

Documentation: google.golang.org/api/pubsub/v1beta2

     1  // Copyright 2024 Google LLC.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package pubsub provides access to the Cloud Pub/Sub API.
     8  //
     9  // This package is DEPRECATED. Use package cloud.google.com/go/pubsub instead.
    10  //
    11  // For product documentation, see: https://cloud.google.com/pubsub/docs
    12  //
    13  // # Library status
    14  //
    15  // These client libraries are officially supported by Google. However, this
    16  // library is considered complete and is in maintenance mode. This means
    17  // that we will address critical bugs and security issues but will not add
    18  // any new features.
    19  //
    20  // When possible, we recommend using our newer
    21  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    22  // that are still actively being worked and iterated on.
    23  //
    24  // # Creating a client
    25  //
    26  // Usage example:
    27  //
    28  //	import "google.golang.org/api/pubsub/v1beta2"
    29  //	...
    30  //	ctx := context.Background()
    31  //	pubsubService, err := pubsub.NewService(ctx)
    32  //
    33  // In this example, Google Application Default Credentials are used for
    34  // authentication. For information on how to create and obtain Application
    35  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    36  //
    37  // # Other authentication options
    38  //
    39  // By default, all available scopes (see "Constants") are used to authenticate.
    40  // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
    41  //
    42  //	pubsubService, err := pubsub.NewService(ctx, option.WithScopes(pubsub.PubsubScope))
    43  //
    44  // To use an API key for authentication (note: some APIs do not support API
    45  // keys), use [google.golang.org/api/option.WithAPIKey]:
    46  //
    47  //	pubsubService, err := pubsub.NewService(ctx, option.WithAPIKey("AIza..."))
    48  //
    49  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    50  // flow, use [google.golang.org/api/option.WithTokenSource]:
    51  //
    52  //	config := &oauth2.Config{...}
    53  //	// ...
    54  //	token, err := config.Exchange(ctx, ...)
    55  //	pubsubService, err := pubsub.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    56  //
    57  // See [google.golang.org/api/option.ClientOption] for details on options.
    58  package pubsub // import "google.golang.org/api/pubsub/v1beta2"
    59  
    60  import (
    61  	"bytes"
    62  	"context"
    63  	"encoding/json"
    64  	"errors"
    65  	"fmt"
    66  	"io"
    67  	"net/http"
    68  	"net/url"
    69  	"strconv"
    70  	"strings"
    71  
    72  	googleapi "google.golang.org/api/googleapi"
    73  	internal "google.golang.org/api/internal"
    74  	gensupport "google.golang.org/api/internal/gensupport"
    75  	option "google.golang.org/api/option"
    76  	internaloption "google.golang.org/api/option/internaloption"
    77  	htransport "google.golang.org/api/transport/http"
    78  )
    79  
    80  // Always reference these packages, just in case the auto-generated code
    81  // below doesn't.
    82  var _ = bytes.NewBuffer
    83  var _ = strconv.Itoa
    84  var _ = fmt.Sprintf
    85  var _ = json.NewDecoder
    86  var _ = io.Copy
    87  var _ = url.Parse
    88  var _ = gensupport.MarshalJSON
    89  var _ = googleapi.Version
    90  var _ = errors.New
    91  var _ = strings.Replace
    92  var _ = context.Canceled
    93  var _ = internaloption.WithDefaultEndpoint
    94  var _ = internal.Version
    95  
    96  const apiId = "pubsub:v1beta2"
    97  const apiName = "pubsub"
    98  const apiVersion = "v1beta2"
    99  const basePath = "https://pubsub.googleapis.com/"
   100  const basePathTemplate = "https://pubsub.UNIVERSE_DOMAIN/"
   101  const mtlsBasePath = "https://pubsub.mtls.googleapis.com/"
   102  
   103  // OAuth2 scopes used by this API.
   104  const (
   105  	// See, edit, configure, and delete your Google Cloud data and see the email
   106  	// address for your Google Account.
   107  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
   108  
   109  	// View and manage Pub/Sub topics and subscriptions
   110  	PubsubScope = "https://www.googleapis.com/auth/pubsub"
   111  )
   112  
   113  // NewService creates a new Service.
   114  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   115  	scopesOption := internaloption.WithDefaultScopes(
   116  		"https://www.googleapis.com/auth/cloud-platform",
   117  		"https://www.googleapis.com/auth/pubsub",
   118  	)
   119  	// NOTE: prepend, so we don't override user-specified scopes.
   120  	opts = append([]option.ClientOption{scopesOption}, opts...)
   121  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   122  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   123  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   124  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   125  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   126  	if err != nil {
   127  		return nil, err
   128  	}
   129  	s, err := New(client)
   130  	if err != nil {
   131  		return nil, err
   132  	}
   133  	if endpoint != "" {
   134  		s.BasePath = endpoint
   135  	}
   136  	return s, nil
   137  }
   138  
   139  // New creates a new Service. It uses the provided http.Client for requests.
   140  //
   141  // Deprecated: please use NewService instead.
   142  // To provide a custom HTTP client, use option.WithHTTPClient.
   143  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   144  func New(client *http.Client) (*Service, error) {
   145  	if client == nil {
   146  		return nil, errors.New("client is nil")
   147  	}
   148  	s := &Service{client: client, BasePath: basePath}
   149  	s.Projects = NewProjectsService(s)
   150  	return s, nil
   151  }
   152  
   153  type Service struct {
   154  	client    *http.Client
   155  	BasePath  string // API endpoint base URL
   156  	UserAgent string // optional additional User-Agent fragment
   157  
   158  	Projects *ProjectsService
   159  }
   160  
   161  func (s *Service) userAgent() string {
   162  	if s.UserAgent == "" {
   163  		return googleapi.UserAgent
   164  	}
   165  	return googleapi.UserAgent + " " + s.UserAgent
   166  }
   167  
   168  func NewProjectsService(s *Service) *ProjectsService {
   169  	rs := &ProjectsService{s: s}
   170  	rs.Subscriptions = NewProjectsSubscriptionsService(s)
   171  	rs.Topics = NewProjectsTopicsService(s)
   172  	return rs
   173  }
   174  
   175  type ProjectsService struct {
   176  	s *Service
   177  
   178  	Subscriptions *ProjectsSubscriptionsService
   179  
   180  	Topics *ProjectsTopicsService
   181  }
   182  
   183  func NewProjectsSubscriptionsService(s *Service) *ProjectsSubscriptionsService {
   184  	rs := &ProjectsSubscriptionsService{s: s}
   185  	return rs
   186  }
   187  
   188  type ProjectsSubscriptionsService struct {
   189  	s *Service
   190  }
   191  
   192  func NewProjectsTopicsService(s *Service) *ProjectsTopicsService {
   193  	rs := &ProjectsTopicsService{s: s}
   194  	rs.Subscriptions = NewProjectsTopicsSubscriptionsService(s)
   195  	return rs
   196  }
   197  
   198  type ProjectsTopicsService struct {
   199  	s *Service
   200  
   201  	Subscriptions *ProjectsTopicsSubscriptionsService
   202  }
   203  
   204  func NewProjectsTopicsSubscriptionsService(s *Service) *ProjectsTopicsSubscriptionsService {
   205  	rs := &ProjectsTopicsSubscriptionsService{s: s}
   206  	return rs
   207  }
   208  
   209  type ProjectsTopicsSubscriptionsService struct {
   210  	s *Service
   211  }
   212  
   213  // AcknowledgeRequest: Request for the Acknowledge method.
   214  type AcknowledgeRequest struct {
   215  	// AckIds: The acknowledgment ID for the messages being acknowledged that was
   216  	// returned by the Pub/Sub system in the `Pull` response. Must not be empty.
   217  	AckIds []string `json:"ackIds,omitempty"`
   218  	// ForceSendFields is a list of field names (e.g. "AckIds") to unconditionally
   219  	// include in API requests. By default, fields with empty or default values are
   220  	// omitted from API requests. See
   221  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   222  	// details.
   223  	ForceSendFields []string `json:"-"`
   224  	// NullFields is a list of field names (e.g. "AckIds") to include in API
   225  	// requests with the JSON null value. By default, fields with empty values are
   226  	// omitted from API requests. See
   227  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   228  	NullFields []string `json:"-"`
   229  }
   230  
   231  func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) {
   232  	type NoMethod AcknowledgeRequest
   233  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   234  }
   235  
   236  // Binding: Associates `members`, or principals, with a `role`.
   237  type Binding struct {
   238  	// Condition: The condition that is associated with this binding. If the
   239  	// condition evaluates to `true`, then this binding applies to the current
   240  	// request. If the condition evaluates to `false`, then this binding does not
   241  	// apply to the current request. However, a different role binding might grant
   242  	// the same role to one or more of the principals in this binding. To learn
   243  	// which resources support conditions in their IAM policies, see the IAM
   244  	// documentation
   245  	// (https://cloud.google.com/iam/help/conditions/resource-policies).
   246  	Condition *Expr `json:"condition,omitempty"`
   247  	// Members: Specifies the principals requesting access for a Google Cloud
   248  	// resource. `members` can have the following values: * `allUsers`: A special
   249  	// identifier that represents anyone who is on the internet; with or without a
   250  	// Google account. * `allAuthenticatedUsers`: A special identifier that
   251  	// represents anyone who is authenticated with a Google account or a service
   252  	// account. Does not include identities that come from external identity
   253  	// providers (IdPs) through identity federation. * `user:{emailid}`: An email
   254  	// address that represents a specific Google account. For example,
   255  	// `alice@example.com` . * `serviceAccount:{emailid}`: An email address that
   256  	// represents a Google service account. For example,
   257  	// `my-other-app@appspot.gserviceaccount.com`. *
   258  	// `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An
   259  	// identifier for a Kubernetes service account
   260  	// (https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts).
   261  	// For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. *
   262  	// `group:{emailid}`: An email address that represents a Google group. For
   263  	// example, `admins@example.com`. * `domain:{domain}`: The G Suite domain
   264  	// (primary) that represents all the users of that domain. For example,
   265  	// `google.com` or `example.com`. *
   266  	// `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/sub
   267  	// ject/{subject_attribute_value}`: A single identity in a workforce identity
   268  	// pool. *
   269  	// `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/
   270  	// group/{group_id}`: All workforce identities in a group. *
   271  	// `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/
   272  	// attribute.{attribute_name}/{attribute_value}`: All workforce identities with
   273  	// a specific attribute value. *
   274  	// `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/
   275  	// *`: All identities in a workforce identity pool. *
   276  	// `principal://iam.googleapis.com/projects/{project_number}/locations/global/wo
   277  	// rkloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single
   278  	// identity in a workload identity pool. *
   279  	// `principalSet://iam.googleapis.com/projects/{project_number}/locations/global
   280  	// /workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool
   281  	// group. *
   282  	// `principalSet://iam.googleapis.com/projects/{project_number}/locations/global
   283  	// /workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}
   284  	// `: All identities in a workload identity pool with a certain attribute. *
   285  	// `principalSet://iam.googleapis.com/projects/{project_number}/locations/global
   286  	// /workloadIdentityPools/{pool_id}/*`: All identities in a workload identity
   287  	// pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus
   288  	// unique identifier) representing a user that has been recently deleted. For
   289  	// example, `alice@example.com?uid=123456789012345678901`. If the user is
   290  	// recovered, this value reverts to `user:{emailid}` and the recovered user
   291  	// retains the role in the binding. *
   292  	// `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus
   293  	// unique identifier) representing a service account that has been recently
   294  	// deleted. For example,
   295  	// `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the
   296  	// service account is undeleted, this value reverts to
   297  	// `serviceAccount:{emailid}` and the undeleted service account retains the
   298  	// role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email
   299  	// address (plus unique identifier) representing a Google group that has been
   300  	// recently deleted. For example,
   301  	// `admins@example.com?uid=123456789012345678901`. If the group is recovered,
   302  	// this value reverts to `group:{emailid}` and the recovered group retains the
   303  	// role in the binding. *
   304  	// `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool
   305  	// _id}/subject/{subject_attribute_value}`: Deleted single identity in a
   306  	// workforce identity pool. For example,
   307  	// `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-po
   308  	// ol-id/subject/my-subject-attribute-value`.
   309  	Members []string `json:"members,omitempty"`
   310  	// Role: Role that is assigned to the list of `members`, or principals. For
   311  	// example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview
   312  	// of the IAM roles and permissions, see the IAM documentation
   313  	// (https://cloud.google.com/iam/docs/roles-overview). For a list of the
   314  	// available pre-defined roles, see here
   315  	// (https://cloud.google.com/iam/docs/understanding-roles).
   316  	Role string `json:"role,omitempty"`
   317  	// ForceSendFields is a list of field names (e.g. "Condition") to
   318  	// unconditionally include in API requests. By default, fields with empty or
   319  	// default values are omitted from API requests. See
   320  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   321  	// details.
   322  	ForceSendFields []string `json:"-"`
   323  	// NullFields is a list of field names (e.g. "Condition") to include in API
   324  	// requests with the JSON null value. By default, fields with empty values are
   325  	// omitted from API requests. See
   326  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   327  	NullFields []string `json:"-"`
   328  }
   329  
   330  func (s *Binding) MarshalJSON() ([]byte, error) {
   331  	type NoMethod Binding
   332  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   333  }
   334  
   335  // Empty: A generic empty message that you can re-use to avoid defining
   336  // duplicated empty messages in your APIs. A typical example is to use it as
   337  // the request or the response type of an API method. For instance: service Foo
   338  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   339  type Empty struct {
   340  	// ServerResponse contains the HTTP response code and headers from the server.
   341  	googleapi.ServerResponse `json:"-"`
   342  }
   343  
   344  // Expr: Represents a textual expression in the Common Expression Language
   345  // (CEL) syntax. CEL is a C-like expression language. The syntax and semantics
   346  // of CEL are documented at https://github.com/google/cel-spec. Example
   347  // (Comparison): title: "Summary size limit" description: "Determines if a
   348  // summary is less than 100 chars" expression: "document.summary.size() < 100"
   349  // Example (Equality): title: "Requestor is owner" description: "Determines if
   350  // requestor is the document owner" expression: "document.owner ==
   351  // request.auth.claims.email" Example (Logic): title: "Public documents"
   352  // description: "Determine whether the document should be publicly visible"
   353  // expression: "document.type != 'private' && document.type != 'internal'"
   354  // Example (Data Manipulation): title: "Notification string" description:
   355  // "Create a notification string with a timestamp." expression: "'New message
   356  // received at ' + string(document.create_time)" The exact variables and
   357  // functions that may be referenced within an expression are determined by the
   358  // service that evaluates it. See the service documentation for additional
   359  // information.
   360  type Expr struct {
   361  	// Description: Optional. Description of the expression. This is a longer text
   362  	// which describes the expression, e.g. when hovered over it in a UI.
   363  	Description string `json:"description,omitempty"`
   364  	// Expression: Textual representation of an expression in Common Expression
   365  	// Language syntax.
   366  	Expression string `json:"expression,omitempty"`
   367  	// Location: Optional. String indicating the location of the expression for
   368  	// error reporting, e.g. a file name and a position in the file.
   369  	Location string `json:"location,omitempty"`
   370  	// Title: Optional. Title for the expression, i.e. a short string describing
   371  	// its purpose. This can be used e.g. in UIs which allow to enter the
   372  	// expression.
   373  	Title string `json:"title,omitempty"`
   374  	// ForceSendFields is a list of field names (e.g. "Description") to
   375  	// unconditionally include in API requests. By default, fields with empty or
   376  	// default values are omitted from API requests. See
   377  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   378  	// details.
   379  	ForceSendFields []string `json:"-"`
   380  	// NullFields is a list of field names (e.g. "Description") to include in API
   381  	// requests with the JSON null value. By default, fields with empty values are
   382  	// omitted from API requests. See
   383  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   384  	NullFields []string `json:"-"`
   385  }
   386  
   387  func (s *Expr) MarshalJSON() ([]byte, error) {
   388  	type NoMethod Expr
   389  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   390  }
   391  
   392  // ListSubscriptionsResponse: Response for the `ListSubscriptions` method.
   393  type ListSubscriptionsResponse struct {
   394  	// NextPageToken: If not empty, indicates that there may be more subscriptions
   395  	// that match the request; this value should be passed in a new
   396  	// `ListSubscriptionsRequest` to get more subscriptions.
   397  	NextPageToken string `json:"nextPageToken,omitempty"`
   398  	// Subscriptions: The subscriptions that match the request.
   399  	Subscriptions []*Subscription `json:"subscriptions,omitempty"`
   400  
   401  	// ServerResponse contains the HTTP response code and headers from the server.
   402  	googleapi.ServerResponse `json:"-"`
   403  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   404  	// unconditionally include in API requests. By default, fields with empty or
   405  	// default values are omitted from API requests. See
   406  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   407  	// details.
   408  	ForceSendFields []string `json:"-"`
   409  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   410  	// requests with the JSON null value. By default, fields with empty values are
   411  	// omitted from API requests. See
   412  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   413  	NullFields []string `json:"-"`
   414  }
   415  
   416  func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) {
   417  	type NoMethod ListSubscriptionsResponse
   418  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   419  }
   420  
   421  // ListTopicSubscriptionsResponse: Response for the `ListTopicSubscriptions`
   422  // method.
   423  type ListTopicSubscriptionsResponse struct {
   424  	// NextPageToken: If not empty, indicates that there may be more subscriptions
   425  	// that match the request; this value should be passed in a new
   426  	// `ListTopicSubscriptionsRequest` to get more subscriptions.
   427  	NextPageToken string `json:"nextPageToken,omitempty"`
   428  	// Subscriptions: The names of the subscriptions that match the request.
   429  	Subscriptions []string `json:"subscriptions,omitempty"`
   430  
   431  	// ServerResponse contains the HTTP response code and headers from the server.
   432  	googleapi.ServerResponse `json:"-"`
   433  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   434  	// unconditionally include in API requests. By default, fields with empty or
   435  	// default values are omitted from API requests. See
   436  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   437  	// details.
   438  	ForceSendFields []string `json:"-"`
   439  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   440  	// requests with the JSON null value. By default, fields with empty values are
   441  	// omitted from API requests. See
   442  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   443  	NullFields []string `json:"-"`
   444  }
   445  
   446  func (s *ListTopicSubscriptionsResponse) MarshalJSON() ([]byte, error) {
   447  	type NoMethod ListTopicSubscriptionsResponse
   448  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   449  }
   450  
   451  // ListTopicsResponse: Response for the `ListTopics` method.
   452  type ListTopicsResponse struct {
   453  	// NextPageToken: If not empty, indicates that there may be more topics that
   454  	// match the request; this value should be passed in a new `ListTopicsRequest`.
   455  	NextPageToken string `json:"nextPageToken,omitempty"`
   456  	// Topics: The resulting topics.
   457  	Topics []*Topic `json:"topics,omitempty"`
   458  
   459  	// ServerResponse contains the HTTP response code and headers from the server.
   460  	googleapi.ServerResponse `json:"-"`
   461  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   462  	// unconditionally include in API requests. By default, fields with empty or
   463  	// default values are omitted from API requests. See
   464  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   465  	// details.
   466  	ForceSendFields []string `json:"-"`
   467  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   468  	// requests with the JSON null value. By default, fields with empty values are
   469  	// omitted from API requests. See
   470  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   471  	NullFields []string `json:"-"`
   472  }
   473  
   474  func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) {
   475  	type NoMethod ListTopicsResponse
   476  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   477  }
   478  
   479  // ModifyAckDeadlineRequest: Request for the ModifyAckDeadline method.
   480  type ModifyAckDeadlineRequest struct {
   481  	// AckDeadlineSeconds: The new ack deadline with respect to the time this
   482  	// request was sent to the Pub/Sub system. Must be >= 0. For example, if the
   483  	// value is 10, the new ack deadline will expire 10 seconds after the
   484  	// `ModifyAckDeadline` call was made. Specifying zero may immediately make the
   485  	// message available for another pull request.
   486  	AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
   487  	// AckId: The acknowledgment ID. Either this or ack_ids must be populated, but
   488  	// not both.
   489  	AckId string `json:"ackId,omitempty"`
   490  	// AckIds: List of acknowledgment IDs.
   491  	AckIds []string `json:"ackIds,omitempty"`
   492  	// ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds") to
   493  	// unconditionally include in API requests. By default, fields with empty or
   494  	// default values are omitted from API requests. See
   495  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   496  	// details.
   497  	ForceSendFields []string `json:"-"`
   498  	// NullFields is a list of field names (e.g. "AckDeadlineSeconds") to include
   499  	// in API requests with the JSON null value. By default, fields with empty
   500  	// values are omitted from API requests. See
   501  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   502  	NullFields []string `json:"-"`
   503  }
   504  
   505  func (s *ModifyAckDeadlineRequest) MarshalJSON() ([]byte, error) {
   506  	type NoMethod ModifyAckDeadlineRequest
   507  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   508  }
   509  
   510  // ModifyPushConfigRequest: Request for the ModifyPushConfig method.
   511  type ModifyPushConfigRequest struct {
   512  	// PushConfig: The push configuration for future deliveries. An empty
   513  	// `pushConfig` indicates that the Pub/Sub system should stop pushing messages
   514  	// from the given subscription and allow messages to be pulled and acknowledged
   515  	// - effectively pausing the subscription if `Pull` is not called.
   516  	PushConfig *PushConfig `json:"pushConfig,omitempty"`
   517  	// ForceSendFields is a list of field names (e.g. "PushConfig") to
   518  	// unconditionally include in API requests. By default, fields with empty or
   519  	// default values are omitted from API requests. See
   520  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   521  	// details.
   522  	ForceSendFields []string `json:"-"`
   523  	// NullFields is a list of field names (e.g. "PushConfig") to include in API
   524  	// requests with the JSON null value. By default, fields with empty values are
   525  	// omitted from API requests. See
   526  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   527  	NullFields []string `json:"-"`
   528  }
   529  
   530  func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) {
   531  	type NoMethod ModifyPushConfigRequest
   532  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   533  }
   534  
   535  // OidcToken: Contains information needed for generating an OpenID Connect
   536  // token (https://developers.google.com/identity/protocols/OpenIDConnect).
   537  type OidcToken struct {
   538  	// Audience: Audience to be used when generating OIDC token. The audience claim
   539  	// identifies the recipients that the JWT is intended for. The audience value
   540  	// is a single case-sensitive string. Having multiple values (array) for the
   541  	// audience field is not supported. More info about the OIDC JWT token audience
   542  	// here: https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not
   543  	// specified, the Push endpoint URL will be used.
   544  	Audience string `json:"audience,omitempty"`
   545  	// ServiceAccountEmail: Service account email
   546  	// (https://cloud.google.com/iam/docs/service-accounts) to be used for
   547  	// generating the OIDC token. The caller (for CreateSubscription,
   548  	// UpdateSubscription, and ModifyPushConfig RPCs) must have the
   549  	// iam.serviceAccounts.actAs permission for the service account.
   550  	ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"`
   551  	// ForceSendFields is a list of field names (e.g. "Audience") to
   552  	// unconditionally include in API requests. By default, fields with empty or
   553  	// default values are omitted from API requests. See
   554  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   555  	// details.
   556  	ForceSendFields []string `json:"-"`
   557  	// NullFields is a list of field names (e.g. "Audience") to include in API
   558  	// requests with the JSON null value. By default, fields with empty values are
   559  	// omitted from API requests. See
   560  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   561  	NullFields []string `json:"-"`
   562  }
   563  
   564  func (s *OidcToken) MarshalJSON() ([]byte, error) {
   565  	type NoMethod OidcToken
   566  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   567  }
   568  
   569  // Policy: An Identity and Access Management (IAM) policy, which specifies
   570  // access controls for Google Cloud resources. A `Policy` is a collection of
   571  // `bindings`. A `binding` binds one or more `members`, or principals, to a
   572  // single `role`. Principals can be user accounts, service accounts, Google
   573  // groups, and domains (such as G Suite). A `role` is a named list of
   574  // permissions; each `role` can be an IAM predefined role or a user-created
   575  // custom role. For some types of Google Cloud resources, a `binding` can also
   576  // specify a `condition`, which is a logical expression that allows access to a
   577  // resource only if the expression evaluates to `true`. A condition can add
   578  // constraints based on attributes of the request, the resource, or both. To
   579  // learn which resources support conditions in their IAM policies, see the IAM
   580  // documentation
   581  // (https://cloud.google.com/iam/help/conditions/resource-policies). **JSON
   582  // example:** ``` { "bindings": [ { "role":
   583  // "roles/resourcemanager.organizationAdmin", "members": [
   584  // "user:mike@example.com", "group:admins@example.com", "domain:google.com",
   585  // "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role":
   586  // "roles/resourcemanager.organizationViewer", "members": [
   587  // "user:eve@example.com" ], "condition": { "title": "expirable access",
   588  // "description": "Does not grant access after Sep 2020", "expression":
   589  // "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag":
   590  // "BwWWja0YfJA=", "version": 3 } ``` **YAML example:** ``` bindings: -
   591  // members: - user:mike@example.com - group:admins@example.com -
   592  // domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com
   593  // role: roles/resourcemanager.organizationAdmin - members: -
   594  // user:eve@example.com role: roles/resourcemanager.organizationViewer
   595  // condition: title: expirable access description: Does not grant access after
   596  // Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
   597  // etag: BwWWja0YfJA= version: 3 ``` For a description of IAM and its features,
   598  // see the IAM documentation (https://cloud.google.com/iam/docs/).
   599  type Policy struct {
   600  	// Bindings: Associates a list of `members`, or principals, with a `role`.
   601  	// Optionally, may specify a `condition` that determines how and when the
   602  	// `bindings` are applied. Each of the `bindings` must contain at least one
   603  	// principal. The `bindings` in a `Policy` can refer to up to 1,500 principals;
   604  	// up to 250 of these principals can be Google groups. Each occurrence of a
   605  	// principal counts towards these limits. For example, if the `bindings` grant
   606  	// 50 different roles to `user:alice@example.com`, and not to any other
   607  	// principal, then you can add another 1,450 principals to the `bindings` in
   608  	// the `Policy`.
   609  	Bindings []*Binding `json:"bindings,omitempty"`
   610  	// Etag: `etag` is used for optimistic concurrency control as a way to help
   611  	// prevent simultaneous updates of a policy from overwriting each other. It is
   612  	// strongly suggested that systems make use of the `etag` in the
   613  	// read-modify-write cycle to perform policy updates in order to avoid race
   614  	// conditions: An `etag` is returned in the response to `getIamPolicy`, and
   615  	// systems are expected to put that etag in the request to `setIamPolicy` to
   616  	// ensure that their change will be applied to the same version of the policy.
   617  	// **Important:** If you use IAM Conditions, you must include the `etag` field
   618  	// whenever you call `setIamPolicy`. If you omit this field, then IAM allows
   619  	// you to overwrite a version `3` policy with a version `1` policy, and all of
   620  	// the conditions in the version `3` policy are lost.
   621  	Etag string `json:"etag,omitempty"`
   622  	// Version: Specifies the format of the policy. Valid values are `0`, `1`, and
   623  	// `3`. Requests that specify an invalid value are rejected. Any operation that
   624  	// affects conditional role bindings must specify version `3`. This requirement
   625  	// applies to the following operations: * Getting a policy that includes a
   626  	// conditional role binding * Adding a conditional role binding to a policy *
   627  	// Changing a conditional role binding in a policy * Removing any role binding,
   628  	// with or without a condition, from a policy that includes conditions
   629  	// **Important:** If you use IAM Conditions, you must include the `etag` field
   630  	// whenever you call `setIamPolicy`. If you omit this field, then IAM allows
   631  	// you to overwrite a version `3` policy with a version `1` policy, and all of
   632  	// the conditions in the version `3` policy are lost. If a policy does not
   633  	// include any conditions, operations on that policy may specify any valid
   634  	// version or leave the field unset. To learn which resources support
   635  	// conditions in their IAM policies, see the IAM documentation
   636  	// (https://cloud.google.com/iam/help/conditions/resource-policies).
   637  	Version int64 `json:"version,omitempty"`
   638  
   639  	// ServerResponse contains the HTTP response code and headers from the server.
   640  	googleapi.ServerResponse `json:"-"`
   641  	// ForceSendFields is a list of field names (e.g. "Bindings") to
   642  	// unconditionally include in API requests. By default, fields with empty or
   643  	// default values are omitted from API requests. See
   644  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   645  	// details.
   646  	ForceSendFields []string `json:"-"`
   647  	// NullFields is a list of field names (e.g. "Bindings") to include in API
   648  	// requests with the JSON null value. By default, fields with empty values are
   649  	// omitted from API requests. See
   650  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   651  	NullFields []string `json:"-"`
   652  }
   653  
   654  func (s *Policy) MarshalJSON() ([]byte, error) {
   655  	type NoMethod Policy
   656  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   657  }
   658  
   659  // PublishRequest: Request for the Publish method.
   660  type PublishRequest struct {
   661  	// Messages: The messages to publish.
   662  	Messages []*PubsubMessage `json:"messages,omitempty"`
   663  	// ForceSendFields is a list of field names (e.g. "Messages") to
   664  	// unconditionally include in API requests. By default, fields with empty or
   665  	// default values are omitted from API requests. See
   666  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   667  	// details.
   668  	ForceSendFields []string `json:"-"`
   669  	// NullFields is a list of field names (e.g. "Messages") to include in API
   670  	// requests with the JSON null value. By default, fields with empty values are
   671  	// omitted from API requests. See
   672  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   673  	NullFields []string `json:"-"`
   674  }
   675  
   676  func (s *PublishRequest) MarshalJSON() ([]byte, error) {
   677  	type NoMethod PublishRequest
   678  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   679  }
   680  
   681  // PublishResponse: Response for the `Publish` method.
   682  type PublishResponse struct {
   683  	// MessageIds: The server-assigned ID of each published message, in the same
   684  	// order as the messages in the request. IDs are guaranteed to be unique within
   685  	// the topic.
   686  	MessageIds []string `json:"messageIds,omitempty"`
   687  
   688  	// ServerResponse contains the HTTP response code and headers from the server.
   689  	googleapi.ServerResponse `json:"-"`
   690  	// ForceSendFields is a list of field names (e.g. "MessageIds") to
   691  	// unconditionally include in API requests. By default, fields with empty or
   692  	// default values are omitted from API requests. See
   693  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   694  	// details.
   695  	ForceSendFields []string `json:"-"`
   696  	// NullFields is a list of field names (e.g. "MessageIds") to include in API
   697  	// requests with the JSON null value. By default, fields with empty values are
   698  	// omitted from API requests. See
   699  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   700  	NullFields []string `json:"-"`
   701  }
   702  
   703  func (s *PublishResponse) MarshalJSON() ([]byte, error) {
   704  	type NoMethod PublishResponse
   705  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   706  }
   707  
   708  // PubsubMessage: A message data and its attributes. The message payload must
   709  // not be empty; it must contain either a non-empty data field, or at least one
   710  // attribute.
   711  type PubsubMessage struct {
   712  	// Attributes: Optional attributes for this message.
   713  	Attributes map[string]string `json:"attributes,omitempty"`
   714  	// Data: The message payload. For JSON requests, the value of this field must
   715  	// be base64-encoded (https://tools.ietf.org/html/rfc4648).
   716  	Data string `json:"data,omitempty"`
   717  	// MessageId: ID of this message, assigned by the server when the message is
   718  	// published. Guaranteed to be unique within the topic. This value may be read
   719  	// by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push
   720  	// delivery. It must not be populated by the publisher in a `Publish` call.
   721  	MessageId string `json:"messageId,omitempty"`
   722  	// PublishTime: The time at which the message was published, populated by the
   723  	// server when it receives the `Publish` call. It must not be populated by the
   724  	// publisher in a `Publish` call.
   725  	PublishTime string `json:"publishTime,omitempty"`
   726  	// ForceSendFields is a list of field names (e.g. "Attributes") to
   727  	// unconditionally include in API requests. By default, fields with empty or
   728  	// default values are omitted from API requests. See
   729  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   730  	// details.
   731  	ForceSendFields []string `json:"-"`
   732  	// NullFields is a list of field names (e.g. "Attributes") to include in API
   733  	// requests with the JSON null value. By default, fields with empty values are
   734  	// omitted from API requests. See
   735  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   736  	NullFields []string `json:"-"`
   737  }
   738  
   739  func (s *PubsubMessage) MarshalJSON() ([]byte, error) {
   740  	type NoMethod PubsubMessage
   741  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   742  }
   743  
   744  // PullRequest: Request for the `Pull` method.
   745  type PullRequest struct {
   746  	// MaxMessages: The maximum number of messages returned for this request. The
   747  	// Pub/Sub system may return fewer than the number specified.
   748  	MaxMessages int64 `json:"maxMessages,omitempty"`
   749  	// ReturnImmediately: Optional. If this is specified as true the system will
   750  	// respond immediately even if it is not able to return a message in the `Pull`
   751  	// response. Otherwise the system is allowed to wait until at least one message
   752  	// is available rather than returning no messages. The client may cancel the
   753  	// request if it does not wish to wait any longer for the response. Warning:
   754  	// setting this field to `true` is discouraged because it adversely impacts the
   755  	// performance of `Pull` operations. We recommend that users do not set this
   756  	// field.
   757  	ReturnImmediately bool `json:"returnImmediately,omitempty"`
   758  	// ForceSendFields is a list of field names (e.g. "MaxMessages") to
   759  	// unconditionally include in API requests. By default, fields with empty or
   760  	// default values are omitted from API requests. See
   761  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   762  	// details.
   763  	ForceSendFields []string `json:"-"`
   764  	// NullFields is a list of field names (e.g. "MaxMessages") to include in API
   765  	// requests with the JSON null value. By default, fields with empty values are
   766  	// omitted from API requests. See
   767  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   768  	NullFields []string `json:"-"`
   769  }
   770  
   771  func (s *PullRequest) MarshalJSON() ([]byte, error) {
   772  	type NoMethod PullRequest
   773  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   774  }
   775  
   776  // PullResponse: Response for the `Pull` method.
   777  type PullResponse struct {
   778  	// ReceivedMessages: Received Pub/Sub messages. The Pub/Sub system will return
   779  	// zero messages if there are no more available in the backlog. The Pub/Sub
   780  	// system may return fewer than the `maxMessages` requested even if there are
   781  	// more messages available in the backlog.
   782  	ReceivedMessages []*ReceivedMessage `json:"receivedMessages,omitempty"`
   783  
   784  	// ServerResponse contains the HTTP response code and headers from the server.
   785  	googleapi.ServerResponse `json:"-"`
   786  	// ForceSendFields is a list of field names (e.g. "ReceivedMessages") to
   787  	// unconditionally include in API requests. By default, fields with empty or
   788  	// default values are omitted from API requests. See
   789  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   790  	// details.
   791  	ForceSendFields []string `json:"-"`
   792  	// NullFields is a list of field names (e.g. "ReceivedMessages") to include in
   793  	// API requests with the JSON null value. By default, fields with empty values
   794  	// are omitted from API requests. See
   795  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   796  	NullFields []string `json:"-"`
   797  }
   798  
   799  func (s *PullResponse) MarshalJSON() ([]byte, error) {
   800  	type NoMethod PullResponse
   801  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   802  }
   803  
   804  // PushConfig: Configuration for a push delivery endpoint.
   805  type PushConfig struct {
   806  	// Attributes: Endpoint configuration attributes. Every endpoint has a set of
   807  	// API supported attributes that can be used to control different aspects of
   808  	// the message delivery. The currently supported attribute is `x-goog-version`,
   809  	// which you can use to change the format of the push message. This attribute
   810  	// indicates the version of the data expected by the endpoint. This controls
   811  	// the shape of the envelope (i.e. its fields and metadata). The endpoint
   812  	// version is based on the version of the Pub/Sub API. If not present during
   813  	// the `CreateSubscription` call, it will default to the version of the API
   814  	// used to make such call. If not present during a `ModifyPushConfig` call, its
   815  	// value will not be changed. `GetSubscription` calls will always return a
   816  	// valid version, even if the subscription was created without this attribute.
   817  	// The possible values for this attribute are: * `v1beta1`: uses the push
   818  	// format defined in the v1beta1 Pub/Sub API. * `v1` or `v1beta2`: uses the
   819  	// push format defined in the v1 Pub/Sub API.
   820  	Attributes map[string]string `json:"attributes,omitempty"`
   821  	// OidcToken: If specified, Pub/Sub will generate and attach an OIDC JWT token
   822  	// as an `Authorization` header in the HTTP request for every pushed message.
   823  	OidcToken *OidcToken `json:"oidcToken,omitempty"`
   824  	// PushEndpoint: A URL locating the endpoint to which messages should be
   825  	// pushed. For example, a Webhook endpoint might use
   826  	// "https://example.com/push".
   827  	PushEndpoint string `json:"pushEndpoint,omitempty"`
   828  	// ForceSendFields is a list of field names (e.g. "Attributes") to
   829  	// unconditionally include in API requests. By default, fields with empty or
   830  	// default values are omitted from API requests. See
   831  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   832  	// details.
   833  	ForceSendFields []string `json:"-"`
   834  	// NullFields is a list of field names (e.g. "Attributes") to include in API
   835  	// requests with the JSON null value. By default, fields with empty values are
   836  	// omitted from API requests. See
   837  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   838  	NullFields []string `json:"-"`
   839  }
   840  
   841  func (s *PushConfig) MarshalJSON() ([]byte, error) {
   842  	type NoMethod PushConfig
   843  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   844  }
   845  
   846  // ReceivedMessage: A message and its corresponding acknowledgment ID.
   847  type ReceivedMessage struct {
   848  	// AckId: This ID can be used to acknowledge the received message.
   849  	AckId string `json:"ackId,omitempty"`
   850  	// Message: The message.
   851  	Message *PubsubMessage `json:"message,omitempty"`
   852  	// ForceSendFields is a list of field names (e.g. "AckId") to unconditionally
   853  	// include in API requests. By default, fields with empty or default values are
   854  	// omitted from API requests. See
   855  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   856  	// details.
   857  	ForceSendFields []string `json:"-"`
   858  	// NullFields is a list of field names (e.g. "AckId") to include in API
   859  	// requests with the JSON null value. By default, fields with empty values are
   860  	// omitted from API requests. See
   861  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   862  	NullFields []string `json:"-"`
   863  }
   864  
   865  func (s *ReceivedMessage) MarshalJSON() ([]byte, error) {
   866  	type NoMethod ReceivedMessage
   867  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   868  }
   869  
   870  // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
   871  type SetIamPolicyRequest struct {
   872  	// Policy: REQUIRED: The complete policy to be applied to the `resource`. The
   873  	// size of the policy is limited to a few 10s of KB. An empty policy is a valid
   874  	// policy but certain Google Cloud services (such as Projects) might reject
   875  	// them.
   876  	Policy *Policy `json:"policy,omitempty"`
   877  	// ForceSendFields is a list of field names (e.g. "Policy") to unconditionally
   878  	// include in API requests. By default, fields with empty or default values are
   879  	// omitted from API requests. See
   880  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   881  	// details.
   882  	ForceSendFields []string `json:"-"`
   883  	// NullFields is a list of field names (e.g. "Policy") to include in API
   884  	// requests with the JSON null value. By default, fields with empty values are
   885  	// omitted from API requests. See
   886  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   887  	NullFields []string `json:"-"`
   888  }
   889  
   890  func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
   891  	type NoMethod SetIamPolicyRequest
   892  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   893  }
   894  
   895  // Subscription: A subscription resource.
   896  type Subscription struct {
   897  	// AckDeadlineSeconds: This value is the maximum time after a subscriber
   898  	// receives a message before the subscriber should acknowledge the message.
   899  	// After message delivery but before the ack deadline expires and before the
   900  	// message is acknowledged, it is an outstanding message and will not be
   901  	// delivered again during that time (on a best-effort basis). For pull
   902  	// subscriptions, this value is used as the initial value for the ack deadline.
   903  	// To override this value for a given message, call `ModifyAckDeadline` with
   904  	// the corresponding `ack_id` if using pull. The maximum custom deadline you
   905  	// can specify is 600 seconds (10 minutes). For push delivery, this value is
   906  	// also used to set the request timeout for the call to the push endpoint. If
   907  	// the subscriber never acknowledges the message, the Pub/Sub system will
   908  	// eventually redeliver the message. If this parameter is 0, a default value of
   909  	// 10 seconds is used.
   910  	AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
   911  	// Name: The name of the subscription. It must have the format
   912  	// "projects/{project}/subscriptions/{subscription}". `{subscription}` must
   913  	// start with a letter, and contain only letters (`[A-Za-z]`), numbers
   914  	// (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
   915  	// plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
   916  	// in length, and it must not start with "goog".
   917  	Name string `json:"name,omitempty"`
   918  	// PushConfig: If push delivery is used with this subscription, this field is
   919  	// used to configure it. An empty `pushConfig` signifies that the subscriber
   920  	// will pull and ack messages using API methods.
   921  	PushConfig *PushConfig `json:"pushConfig,omitempty"`
   922  	// Topic: The name of the topic from which this subscription is receiving
   923  	// messages. The value of this field will be `_deleted-topic_` if the topic has
   924  	// been deleted.
   925  	Topic string `json:"topic,omitempty"`
   926  
   927  	// ServerResponse contains the HTTP response code and headers from the server.
   928  	googleapi.ServerResponse `json:"-"`
   929  	// ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds") to
   930  	// unconditionally include in API requests. By default, fields with empty or
   931  	// default values are omitted from API requests. See
   932  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   933  	// details.
   934  	ForceSendFields []string `json:"-"`
   935  	// NullFields is a list of field names (e.g. "AckDeadlineSeconds") to include
   936  	// in API requests with the JSON null value. By default, fields with empty
   937  	// values are omitted from API requests. See
   938  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   939  	NullFields []string `json:"-"`
   940  }
   941  
   942  func (s *Subscription) MarshalJSON() ([]byte, error) {
   943  	type NoMethod Subscription
   944  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   945  }
   946  
   947  // TestIamPermissionsRequest: Request message for `TestIamPermissions` method.
   948  type TestIamPermissionsRequest struct {
   949  	// Permissions: The set of permissions to check for the `resource`. Permissions
   950  	// with wildcards (such as `*` or `storage.*`) are not allowed. For more
   951  	// information see IAM Overview
   952  	// (https://cloud.google.com/iam/docs/overview#permissions).
   953  	Permissions []string `json:"permissions,omitempty"`
   954  	// ForceSendFields is a list of field names (e.g. "Permissions") to
   955  	// unconditionally include in API requests. By default, fields with empty or
   956  	// default values are omitted from API requests. See
   957  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   958  	// details.
   959  	ForceSendFields []string `json:"-"`
   960  	// NullFields is a list of field names (e.g. "Permissions") to include in API
   961  	// requests with the JSON null value. By default, fields with empty values are
   962  	// omitted from API requests. See
   963  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   964  	NullFields []string `json:"-"`
   965  }
   966  
   967  func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
   968  	type NoMethod TestIamPermissionsRequest
   969  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   970  }
   971  
   972  // TestIamPermissionsResponse: Response message for `TestIamPermissions`
   973  // method.
   974  type TestIamPermissionsResponse struct {
   975  	// Permissions: A subset of `TestPermissionsRequest.permissions` that the
   976  	// caller is allowed.
   977  	Permissions []string `json:"permissions,omitempty"`
   978  
   979  	// ServerResponse contains the HTTP response code and headers from the server.
   980  	googleapi.ServerResponse `json:"-"`
   981  	// ForceSendFields is a list of field names (e.g. "Permissions") to
   982  	// unconditionally include in API requests. By default, fields with empty or
   983  	// default values are omitted from API requests. See
   984  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   985  	// details.
   986  	ForceSendFields []string `json:"-"`
   987  	// NullFields is a list of field names (e.g. "Permissions") to include in API
   988  	// requests with the JSON null value. By default, fields with empty values are
   989  	// omitted from API requests. See
   990  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   991  	NullFields []string `json:"-"`
   992  }
   993  
   994  func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
   995  	type NoMethod TestIamPermissionsResponse
   996  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   997  }
   998  
   999  // Topic: A topic resource.
  1000  type Topic struct {
  1001  	// Name: The name of the topic. It must have the format
  1002  	// "projects/{project}/topics/{topic}". `{topic}` must start with a letter,
  1003  	// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
  1004  	// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs
  1005  	// (`%`). It must be between 3 and 255 characters in length, and it must not
  1006  	// start with "goog".
  1007  	Name string `json:"name,omitempty"`
  1008  
  1009  	// ServerResponse contains the HTTP response code and headers from the server.
  1010  	googleapi.ServerResponse `json:"-"`
  1011  	// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
  1012  	// include in API requests. By default, fields with empty or default values are
  1013  	// omitted from API requests. See
  1014  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1015  	// details.
  1016  	ForceSendFields []string `json:"-"`
  1017  	// NullFields is a list of field names (e.g. "Name") to include in API requests
  1018  	// with the JSON null value. By default, fields with empty values are omitted
  1019  	// from API requests. See
  1020  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1021  	NullFields []string `json:"-"`
  1022  }
  1023  
  1024  func (s *Topic) MarshalJSON() ([]byte, error) {
  1025  	type NoMethod Topic
  1026  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1027  }
  1028  
  1029  type ProjectsSubscriptionsAcknowledgeCall struct {
  1030  	s                  *Service
  1031  	subscription       string
  1032  	acknowledgerequest *AcknowledgeRequest
  1033  	urlParams_         gensupport.URLParams
  1034  	ctx_               context.Context
  1035  	header_            http.Header
  1036  }
  1037  
  1038  // Acknowledge: Acknowledges the messages associated with the `ack_ids` in the
  1039  // `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages
  1040  // from the subscription. Acknowledging a message whose ack deadline has
  1041  // expired may succeed, but such a message may be redelivered later.
  1042  // Acknowledging a message more than once will not result in an error.
  1043  //
  1044  // - subscription: The subscription whose message is being acknowledged.
  1045  func (r *ProjectsSubscriptionsService) Acknowledge(subscription string, acknowledgerequest *AcknowledgeRequest) *ProjectsSubscriptionsAcknowledgeCall {
  1046  	c := &ProjectsSubscriptionsAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1047  	c.subscription = subscription
  1048  	c.acknowledgerequest = acknowledgerequest
  1049  	return c
  1050  }
  1051  
  1052  // Fields allows partial responses to be retrieved. See
  1053  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1054  // details.
  1055  func (c *ProjectsSubscriptionsAcknowledgeCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsAcknowledgeCall {
  1056  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1057  	return c
  1058  }
  1059  
  1060  // Context sets the context to be used in this call's Do method.
  1061  func (c *ProjectsSubscriptionsAcknowledgeCall) Context(ctx context.Context) *ProjectsSubscriptionsAcknowledgeCall {
  1062  	c.ctx_ = ctx
  1063  	return c
  1064  }
  1065  
  1066  // Header returns a http.Header that can be modified by the caller to add
  1067  // headers to the request.
  1068  func (c *ProjectsSubscriptionsAcknowledgeCall) Header() http.Header {
  1069  	if c.header_ == nil {
  1070  		c.header_ = make(http.Header)
  1071  	}
  1072  	return c.header_
  1073  }
  1074  
  1075  func (c *ProjectsSubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
  1076  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1077  	var body io.Reader = nil
  1078  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest)
  1079  	if err != nil {
  1080  		return nil, err
  1081  	}
  1082  	c.urlParams_.Set("alt", alt)
  1083  	c.urlParams_.Set("prettyPrint", "false")
  1084  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:acknowledge")
  1085  	urls += "?" + c.urlParams_.Encode()
  1086  	req, err := http.NewRequest("POST", urls, body)
  1087  	if err != nil {
  1088  		return nil, err
  1089  	}
  1090  	req.Header = reqHeaders
  1091  	googleapi.Expand(req.URL, map[string]string{
  1092  		"subscription": c.subscription,
  1093  	})
  1094  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1095  }
  1096  
  1097  // Do executes the "pubsub.projects.subscriptions.acknowledge" call.
  1098  // Any non-2xx status code is an error. Response headers are in either
  1099  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1100  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1101  // whether the returned error was because http.StatusNotModified was returned.
  1102  func (c *ProjectsSubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1103  	gensupport.SetOptions(c.urlParams_, opts...)
  1104  	res, err := c.doRequest("json")
  1105  	if res != nil && res.StatusCode == http.StatusNotModified {
  1106  		if res.Body != nil {
  1107  			res.Body.Close()
  1108  		}
  1109  		return nil, gensupport.WrapError(&googleapi.Error{
  1110  			Code:   res.StatusCode,
  1111  			Header: res.Header,
  1112  		})
  1113  	}
  1114  	if err != nil {
  1115  		return nil, err
  1116  	}
  1117  	defer googleapi.CloseBody(res)
  1118  	if err := googleapi.CheckResponse(res); err != nil {
  1119  		return nil, gensupport.WrapError(err)
  1120  	}
  1121  	ret := &Empty{
  1122  		ServerResponse: googleapi.ServerResponse{
  1123  			Header:         res.Header,
  1124  			HTTPStatusCode: res.StatusCode,
  1125  		},
  1126  	}
  1127  	target := &ret
  1128  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1129  		return nil, err
  1130  	}
  1131  	return ret, nil
  1132  }
  1133  
  1134  type ProjectsSubscriptionsCreateCall struct {
  1135  	s            *Service
  1136  	name         string
  1137  	subscription *Subscription
  1138  	urlParams_   gensupport.URLParams
  1139  	ctx_         context.Context
  1140  	header_      http.Header
  1141  }
  1142  
  1143  // Create: Creates a subscription to a given topic. If the subscription already
  1144  // exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist,
  1145  // returns `NOT_FOUND`. If the name is not provided in the request, the server
  1146  // will assign a random name for this subscription on the same project as the
  1147  // topic. Note that for REST API requests, you must specify a name.
  1148  //
  1149  //   - name: The name of the subscription. It must have the format
  1150  //     "projects/{project}/subscriptions/{subscription}". `{subscription}` must
  1151  //     start with a letter, and contain only letters (`[A-Za-z]`), numbers
  1152  //     (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
  1153  //     plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
  1154  //     in length, and it must not start with "goog".
  1155  func (r *ProjectsSubscriptionsService) Create(name string, subscription *Subscription) *ProjectsSubscriptionsCreateCall {
  1156  	c := &ProjectsSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1157  	c.name = name
  1158  	c.subscription = subscription
  1159  	return c
  1160  }
  1161  
  1162  // Fields allows partial responses to be retrieved. See
  1163  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1164  // details.
  1165  func (c *ProjectsSubscriptionsCreateCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsCreateCall {
  1166  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1167  	return c
  1168  }
  1169  
  1170  // Context sets the context to be used in this call's Do method.
  1171  func (c *ProjectsSubscriptionsCreateCall) Context(ctx context.Context) *ProjectsSubscriptionsCreateCall {
  1172  	c.ctx_ = ctx
  1173  	return c
  1174  }
  1175  
  1176  // Header returns a http.Header that can be modified by the caller to add
  1177  // headers to the request.
  1178  func (c *ProjectsSubscriptionsCreateCall) Header() http.Header {
  1179  	if c.header_ == nil {
  1180  		c.header_ = make(http.Header)
  1181  	}
  1182  	return c.header_
  1183  }
  1184  
  1185  func (c *ProjectsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
  1186  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1187  	var body io.Reader = nil
  1188  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
  1189  	if err != nil {
  1190  		return nil, err
  1191  	}
  1192  	c.urlParams_.Set("alt", alt)
  1193  	c.urlParams_.Set("prettyPrint", "false")
  1194  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
  1195  	urls += "?" + c.urlParams_.Encode()
  1196  	req, err := http.NewRequest("PUT", urls, body)
  1197  	if err != nil {
  1198  		return nil, err
  1199  	}
  1200  	req.Header = reqHeaders
  1201  	googleapi.Expand(req.URL, map[string]string{
  1202  		"name": c.name,
  1203  	})
  1204  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1205  }
  1206  
  1207  // Do executes the "pubsub.projects.subscriptions.create" call.
  1208  // Any non-2xx status code is an error. Response headers are in either
  1209  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  1210  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1211  // whether the returned error was because http.StatusNotModified was returned.
  1212  func (c *ProjectsSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1213  	gensupport.SetOptions(c.urlParams_, opts...)
  1214  	res, err := c.doRequest("json")
  1215  	if res != nil && res.StatusCode == http.StatusNotModified {
  1216  		if res.Body != nil {
  1217  			res.Body.Close()
  1218  		}
  1219  		return nil, gensupport.WrapError(&googleapi.Error{
  1220  			Code:   res.StatusCode,
  1221  			Header: res.Header,
  1222  		})
  1223  	}
  1224  	if err != nil {
  1225  		return nil, err
  1226  	}
  1227  	defer googleapi.CloseBody(res)
  1228  	if err := googleapi.CheckResponse(res); err != nil {
  1229  		return nil, gensupport.WrapError(err)
  1230  	}
  1231  	ret := &Subscription{
  1232  		ServerResponse: googleapi.ServerResponse{
  1233  			Header:         res.Header,
  1234  			HTTPStatusCode: res.StatusCode,
  1235  		},
  1236  	}
  1237  	target := &ret
  1238  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1239  		return nil, err
  1240  	}
  1241  	return ret, nil
  1242  }
  1243  
  1244  type ProjectsSubscriptionsDeleteCall struct {
  1245  	s            *Service
  1246  	subscription string
  1247  	urlParams_   gensupport.URLParams
  1248  	ctx_         context.Context
  1249  	header_      http.Header
  1250  }
  1251  
  1252  // Delete: Deletes an existing subscription. All pending messages in the
  1253  // subscription are immediately dropped. Calls to `Pull` after deletion will
  1254  // return `NOT_FOUND`. After a subscription is deleted, a new one may be
  1255  // created with the same name, but the new one has no association with the old
  1256  // subscription, or its topic unless the same topic is specified.
  1257  //
  1258  // - subscription: The subscription to delete.
  1259  func (r *ProjectsSubscriptionsService) Delete(subscription string) *ProjectsSubscriptionsDeleteCall {
  1260  	c := &ProjectsSubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1261  	c.subscription = subscription
  1262  	return c
  1263  }
  1264  
  1265  // Fields allows partial responses to be retrieved. See
  1266  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1267  // details.
  1268  func (c *ProjectsSubscriptionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsDeleteCall {
  1269  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1270  	return c
  1271  }
  1272  
  1273  // Context sets the context to be used in this call's Do method.
  1274  func (c *ProjectsSubscriptionsDeleteCall) Context(ctx context.Context) *ProjectsSubscriptionsDeleteCall {
  1275  	c.ctx_ = ctx
  1276  	return c
  1277  }
  1278  
  1279  // Header returns a http.Header that can be modified by the caller to add
  1280  // headers to the request.
  1281  func (c *ProjectsSubscriptionsDeleteCall) Header() http.Header {
  1282  	if c.header_ == nil {
  1283  		c.header_ = make(http.Header)
  1284  	}
  1285  	return c.header_
  1286  }
  1287  
  1288  func (c *ProjectsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1289  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1290  	var body io.Reader = nil
  1291  	c.urlParams_.Set("alt", alt)
  1292  	c.urlParams_.Set("prettyPrint", "false")
  1293  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}")
  1294  	urls += "?" + c.urlParams_.Encode()
  1295  	req, err := http.NewRequest("DELETE", urls, body)
  1296  	if err != nil {
  1297  		return nil, err
  1298  	}
  1299  	req.Header = reqHeaders
  1300  	googleapi.Expand(req.URL, map[string]string{
  1301  		"subscription": c.subscription,
  1302  	})
  1303  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1304  }
  1305  
  1306  // Do executes the "pubsub.projects.subscriptions.delete" call.
  1307  // Any non-2xx status code is an error. Response headers are in either
  1308  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1309  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1310  // whether the returned error was because http.StatusNotModified was returned.
  1311  func (c *ProjectsSubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1312  	gensupport.SetOptions(c.urlParams_, opts...)
  1313  	res, err := c.doRequest("json")
  1314  	if res != nil && res.StatusCode == http.StatusNotModified {
  1315  		if res.Body != nil {
  1316  			res.Body.Close()
  1317  		}
  1318  		return nil, gensupport.WrapError(&googleapi.Error{
  1319  			Code:   res.StatusCode,
  1320  			Header: res.Header,
  1321  		})
  1322  	}
  1323  	if err != nil {
  1324  		return nil, err
  1325  	}
  1326  	defer googleapi.CloseBody(res)
  1327  	if err := googleapi.CheckResponse(res); err != nil {
  1328  		return nil, gensupport.WrapError(err)
  1329  	}
  1330  	ret := &Empty{
  1331  		ServerResponse: googleapi.ServerResponse{
  1332  			Header:         res.Header,
  1333  			HTTPStatusCode: res.StatusCode,
  1334  		},
  1335  	}
  1336  	target := &ret
  1337  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1338  		return nil, err
  1339  	}
  1340  	return ret, nil
  1341  }
  1342  
  1343  type ProjectsSubscriptionsGetCall struct {
  1344  	s            *Service
  1345  	subscription string
  1346  	urlParams_   gensupport.URLParams
  1347  	ifNoneMatch_ string
  1348  	ctx_         context.Context
  1349  	header_      http.Header
  1350  }
  1351  
  1352  // Get: Gets the configuration details of a subscription.
  1353  //
  1354  // - subscription: The name of the subscription to get.
  1355  func (r *ProjectsSubscriptionsService) Get(subscription string) *ProjectsSubscriptionsGetCall {
  1356  	c := &ProjectsSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1357  	c.subscription = subscription
  1358  	return c
  1359  }
  1360  
  1361  // Fields allows partial responses to be retrieved. See
  1362  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1363  // details.
  1364  func (c *ProjectsSubscriptionsGetCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetCall {
  1365  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1366  	return c
  1367  }
  1368  
  1369  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1370  // object's ETag matches the given value. This is useful for getting updates
  1371  // only after the object has changed since the last request.
  1372  func (c *ProjectsSubscriptionsGetCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetCall {
  1373  	c.ifNoneMatch_ = entityTag
  1374  	return c
  1375  }
  1376  
  1377  // Context sets the context to be used in this call's Do method.
  1378  func (c *ProjectsSubscriptionsGetCall) Context(ctx context.Context) *ProjectsSubscriptionsGetCall {
  1379  	c.ctx_ = ctx
  1380  	return c
  1381  }
  1382  
  1383  // Header returns a http.Header that can be modified by the caller to add
  1384  // headers to the request.
  1385  func (c *ProjectsSubscriptionsGetCall) Header() http.Header {
  1386  	if c.header_ == nil {
  1387  		c.header_ = make(http.Header)
  1388  	}
  1389  	return c.header_
  1390  }
  1391  
  1392  func (c *ProjectsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
  1393  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1394  	if c.ifNoneMatch_ != "" {
  1395  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1396  	}
  1397  	var body io.Reader = nil
  1398  	c.urlParams_.Set("alt", alt)
  1399  	c.urlParams_.Set("prettyPrint", "false")
  1400  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}")
  1401  	urls += "?" + c.urlParams_.Encode()
  1402  	req, err := http.NewRequest("GET", urls, body)
  1403  	if err != nil {
  1404  		return nil, err
  1405  	}
  1406  	req.Header = reqHeaders
  1407  	googleapi.Expand(req.URL, map[string]string{
  1408  		"subscription": c.subscription,
  1409  	})
  1410  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1411  }
  1412  
  1413  // Do executes the "pubsub.projects.subscriptions.get" call.
  1414  // Any non-2xx status code is an error. Response headers are in either
  1415  // *Subscription.ServerResponse.Header or (if a response was returned at all)
  1416  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1417  // whether the returned error was because http.StatusNotModified was returned.
  1418  func (c *ProjectsSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1419  	gensupport.SetOptions(c.urlParams_, opts...)
  1420  	res, err := c.doRequest("json")
  1421  	if res != nil && res.StatusCode == http.StatusNotModified {
  1422  		if res.Body != nil {
  1423  			res.Body.Close()
  1424  		}
  1425  		return nil, gensupport.WrapError(&googleapi.Error{
  1426  			Code:   res.StatusCode,
  1427  			Header: res.Header,
  1428  		})
  1429  	}
  1430  	if err != nil {
  1431  		return nil, err
  1432  	}
  1433  	defer googleapi.CloseBody(res)
  1434  	if err := googleapi.CheckResponse(res); err != nil {
  1435  		return nil, gensupport.WrapError(err)
  1436  	}
  1437  	ret := &Subscription{
  1438  		ServerResponse: googleapi.ServerResponse{
  1439  			Header:         res.Header,
  1440  			HTTPStatusCode: res.StatusCode,
  1441  		},
  1442  	}
  1443  	target := &ret
  1444  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1445  		return nil, err
  1446  	}
  1447  	return ret, nil
  1448  }
  1449  
  1450  type ProjectsSubscriptionsGetIamPolicyCall struct {
  1451  	s            *Service
  1452  	resource     string
  1453  	urlParams_   gensupport.URLParams
  1454  	ifNoneMatch_ string
  1455  	ctx_         context.Context
  1456  	header_      http.Header
  1457  }
  1458  
  1459  // GetIamPolicy: Gets the access control policy for a resource. Returns an
  1460  // empty policy if the resource exists and does not have a policy set.
  1461  //
  1462  //   - resource: REQUIRED: The resource for which the policy is being requested.
  1463  //     See Resource names (https://cloud.google.com/apis/design/resource_names)
  1464  //     for the appropriate value for this field.
  1465  func (r *ProjectsSubscriptionsService) GetIamPolicy(resource string) *ProjectsSubscriptionsGetIamPolicyCall {
  1466  	c := &ProjectsSubscriptionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1467  	c.resource = resource
  1468  	return c
  1469  }
  1470  
  1471  // OptionsRequestedPolicyVersion sets the optional parameter
  1472  // "options.requestedPolicyVersion": The maximum policy version that will be
  1473  // used to format the policy. Valid values are 0, 1, and 3. Requests specifying
  1474  // an invalid value will be rejected. Requests for policies with any
  1475  // conditional role bindings must specify version 3. Policies with no
  1476  // conditional role bindings may specify any valid value or leave the field
  1477  // unset. The policy in the response might use the policy version that you
  1478  // specified, or it might use a lower policy version. For example, if you
  1479  // specify version 3, but the policy has no conditional role bindings, the
  1480  // response uses version 1. To learn which resources support conditions in
  1481  // their IAM policies, see the IAM documentation
  1482  // (https://cloud.google.com/iam/help/conditions/resource-policies).
  1483  func (c *ProjectsSubscriptionsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsSubscriptionsGetIamPolicyCall {
  1484  	c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
  1485  	return c
  1486  }
  1487  
  1488  // Fields allows partial responses to be retrieved. See
  1489  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1490  // details.
  1491  func (c *ProjectsSubscriptionsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetIamPolicyCall {
  1492  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1493  	return c
  1494  }
  1495  
  1496  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1497  // object's ETag matches the given value. This is useful for getting updates
  1498  // only after the object has changed since the last request.
  1499  func (c *ProjectsSubscriptionsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetIamPolicyCall {
  1500  	c.ifNoneMatch_ = entityTag
  1501  	return c
  1502  }
  1503  
  1504  // Context sets the context to be used in this call's Do method.
  1505  func (c *ProjectsSubscriptionsGetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsGetIamPolicyCall {
  1506  	c.ctx_ = ctx
  1507  	return c
  1508  }
  1509  
  1510  // Header returns a http.Header that can be modified by the caller to add
  1511  // headers to the request.
  1512  func (c *ProjectsSubscriptionsGetIamPolicyCall) Header() http.Header {
  1513  	if c.header_ == nil {
  1514  		c.header_ = make(http.Header)
  1515  	}
  1516  	return c.header_
  1517  }
  1518  
  1519  func (c *ProjectsSubscriptionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1520  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1521  	if c.ifNoneMatch_ != "" {
  1522  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1523  	}
  1524  	var body io.Reader = nil
  1525  	c.urlParams_.Set("alt", alt)
  1526  	c.urlParams_.Set("prettyPrint", "false")
  1527  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy")
  1528  	urls += "?" + c.urlParams_.Encode()
  1529  	req, err := http.NewRequest("GET", urls, body)
  1530  	if err != nil {
  1531  		return nil, err
  1532  	}
  1533  	req.Header = reqHeaders
  1534  	googleapi.Expand(req.URL, map[string]string{
  1535  		"resource": c.resource,
  1536  	})
  1537  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1538  }
  1539  
  1540  // Do executes the "pubsub.projects.subscriptions.getIamPolicy" call.
  1541  // Any non-2xx status code is an error. Response headers are in either
  1542  // *Policy.ServerResponse.Header or (if a response was returned at all) in
  1543  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1544  // whether the returned error was because http.StatusNotModified was returned.
  1545  func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1546  	gensupport.SetOptions(c.urlParams_, opts...)
  1547  	res, err := c.doRequest("json")
  1548  	if res != nil && res.StatusCode == http.StatusNotModified {
  1549  		if res.Body != nil {
  1550  			res.Body.Close()
  1551  		}
  1552  		return nil, gensupport.WrapError(&googleapi.Error{
  1553  			Code:   res.StatusCode,
  1554  			Header: res.Header,
  1555  		})
  1556  	}
  1557  	if err != nil {
  1558  		return nil, err
  1559  	}
  1560  	defer googleapi.CloseBody(res)
  1561  	if err := googleapi.CheckResponse(res); err != nil {
  1562  		return nil, gensupport.WrapError(err)
  1563  	}
  1564  	ret := &Policy{
  1565  		ServerResponse: googleapi.ServerResponse{
  1566  			Header:         res.Header,
  1567  			HTTPStatusCode: res.StatusCode,
  1568  		},
  1569  	}
  1570  	target := &ret
  1571  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1572  		return nil, err
  1573  	}
  1574  	return ret, nil
  1575  }
  1576  
  1577  type ProjectsSubscriptionsListCall struct {
  1578  	s            *Service
  1579  	project      string
  1580  	urlParams_   gensupport.URLParams
  1581  	ifNoneMatch_ string
  1582  	ctx_         context.Context
  1583  	header_      http.Header
  1584  }
  1585  
  1586  // List: Lists matching subscriptions.
  1587  //
  1588  // - project: The name of the cloud project that subscriptions belong to.
  1589  func (r *ProjectsSubscriptionsService) List(project string) *ProjectsSubscriptionsListCall {
  1590  	c := &ProjectsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1591  	c.project = project
  1592  	return c
  1593  }
  1594  
  1595  // PageSize sets the optional parameter "pageSize": Maximum number of
  1596  // subscriptions to return.
  1597  func (c *ProjectsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsSubscriptionsListCall {
  1598  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1599  	return c
  1600  }
  1601  
  1602  // PageToken sets the optional parameter "pageToken": The value returned by the
  1603  // last `ListSubscriptionsResponse`; indicates that this is a continuation of a
  1604  // prior `ListSubscriptions` call, and that the system should return the next
  1605  // page of data.
  1606  func (c *ProjectsSubscriptionsListCall) PageToken(pageToken string) *ProjectsSubscriptionsListCall {
  1607  	c.urlParams_.Set("pageToken", pageToken)
  1608  	return c
  1609  }
  1610  
  1611  // Fields allows partial responses to be retrieved. See
  1612  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1613  // details.
  1614  func (c *ProjectsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsListCall {
  1615  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1616  	return c
  1617  }
  1618  
  1619  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1620  // object's ETag matches the given value. This is useful for getting updates
  1621  // only after the object has changed since the last request.
  1622  func (c *ProjectsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsListCall {
  1623  	c.ifNoneMatch_ = entityTag
  1624  	return c
  1625  }
  1626  
  1627  // Context sets the context to be used in this call's Do method.
  1628  func (c *ProjectsSubscriptionsListCall) Context(ctx context.Context) *ProjectsSubscriptionsListCall {
  1629  	c.ctx_ = ctx
  1630  	return c
  1631  }
  1632  
  1633  // Header returns a http.Header that can be modified by the caller to add
  1634  // headers to the request.
  1635  func (c *ProjectsSubscriptionsListCall) Header() http.Header {
  1636  	if c.header_ == nil {
  1637  		c.header_ = make(http.Header)
  1638  	}
  1639  	return c.header_
  1640  }
  1641  
  1642  func (c *ProjectsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
  1643  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1644  	if c.ifNoneMatch_ != "" {
  1645  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1646  	}
  1647  	var body io.Reader = nil
  1648  	c.urlParams_.Set("alt", alt)
  1649  	c.urlParams_.Set("prettyPrint", "false")
  1650  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/subscriptions")
  1651  	urls += "?" + c.urlParams_.Encode()
  1652  	req, err := http.NewRequest("GET", urls, body)
  1653  	if err != nil {
  1654  		return nil, err
  1655  	}
  1656  	req.Header = reqHeaders
  1657  	googleapi.Expand(req.URL, map[string]string{
  1658  		"project": c.project,
  1659  	})
  1660  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1661  }
  1662  
  1663  // Do executes the "pubsub.projects.subscriptions.list" call.
  1664  // Any non-2xx status code is an error. Response headers are in either
  1665  // *ListSubscriptionsResponse.ServerResponse.Header or (if a response was
  1666  // returned at all) in error.(*googleapi.Error).Header. Use
  1667  // googleapi.IsNotModified to check whether the returned error was because
  1668  // http.StatusNotModified was returned.
  1669  func (c *ProjectsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) {
  1670  	gensupport.SetOptions(c.urlParams_, opts...)
  1671  	res, err := c.doRequest("json")
  1672  	if res != nil && res.StatusCode == http.StatusNotModified {
  1673  		if res.Body != nil {
  1674  			res.Body.Close()
  1675  		}
  1676  		return nil, gensupport.WrapError(&googleapi.Error{
  1677  			Code:   res.StatusCode,
  1678  			Header: res.Header,
  1679  		})
  1680  	}
  1681  	if err != nil {
  1682  		return nil, err
  1683  	}
  1684  	defer googleapi.CloseBody(res)
  1685  	if err := googleapi.CheckResponse(res); err != nil {
  1686  		return nil, gensupport.WrapError(err)
  1687  	}
  1688  	ret := &ListSubscriptionsResponse{
  1689  		ServerResponse: googleapi.ServerResponse{
  1690  			Header:         res.Header,
  1691  			HTTPStatusCode: res.StatusCode,
  1692  		},
  1693  	}
  1694  	target := &ret
  1695  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1696  		return nil, err
  1697  	}
  1698  	return ret, nil
  1699  }
  1700  
  1701  // Pages invokes f for each page of results.
  1702  // A non-nil error returned from f will halt the iteration.
  1703  // The provided context supersedes any context provided to the Context method.
  1704  func (c *ProjectsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error {
  1705  	c.ctx_ = ctx
  1706  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1707  	for {
  1708  		x, err := c.Do()
  1709  		if err != nil {
  1710  			return err
  1711  		}
  1712  		if err := f(x); err != nil {
  1713  			return err
  1714  		}
  1715  		if x.NextPageToken == "" {
  1716  			return nil
  1717  		}
  1718  		c.PageToken(x.NextPageToken)
  1719  	}
  1720  }
  1721  
  1722  type ProjectsSubscriptionsModifyAckDeadlineCall struct {
  1723  	s                        *Service
  1724  	subscription             string
  1725  	modifyackdeadlinerequest *ModifyAckDeadlineRequest
  1726  	urlParams_               gensupport.URLParams
  1727  	ctx_                     context.Context
  1728  	header_                  http.Header
  1729  }
  1730  
  1731  // ModifyAckDeadline: Modifies the ack deadline for a specific message. This
  1732  // method is useful to indicate that more time is needed to process a message
  1733  // by the subscriber, or to make the message available for redelivery if the
  1734  // processing was interrupted. Note that this does not modify the
  1735  // subscription-level `ackDeadlineSeconds` used for subsequent messages.
  1736  //
  1737  // - subscription: The name of the subscription.
  1738  func (r *ProjectsSubscriptionsService) ModifyAckDeadline(subscription string, modifyackdeadlinerequest *ModifyAckDeadlineRequest) *ProjectsSubscriptionsModifyAckDeadlineCall {
  1739  	c := &ProjectsSubscriptionsModifyAckDeadlineCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1740  	c.subscription = subscription
  1741  	c.modifyackdeadlinerequest = modifyackdeadlinerequest
  1742  	return c
  1743  }
  1744  
  1745  // Fields allows partial responses to be retrieved. See
  1746  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1747  // details.
  1748  func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyAckDeadlineCall {
  1749  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1750  	return c
  1751  }
  1752  
  1753  // Context sets the context to be used in this call's Do method.
  1754  func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyAckDeadlineCall {
  1755  	c.ctx_ = ctx
  1756  	return c
  1757  }
  1758  
  1759  // Header returns a http.Header that can be modified by the caller to add
  1760  // headers to the request.
  1761  func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Header() http.Header {
  1762  	if c.header_ == nil {
  1763  		c.header_ = make(http.Header)
  1764  	}
  1765  	return c.header_
  1766  }
  1767  
  1768  func (c *ProjectsSubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) {
  1769  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1770  	var body io.Reader = nil
  1771  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest)
  1772  	if err != nil {
  1773  		return nil, err
  1774  	}
  1775  	c.urlParams_.Set("alt", alt)
  1776  	c.urlParams_.Set("prettyPrint", "false")
  1777  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyAckDeadline")
  1778  	urls += "?" + c.urlParams_.Encode()
  1779  	req, err := http.NewRequest("POST", urls, body)
  1780  	if err != nil {
  1781  		return nil, err
  1782  	}
  1783  	req.Header = reqHeaders
  1784  	googleapi.Expand(req.URL, map[string]string{
  1785  		"subscription": c.subscription,
  1786  	})
  1787  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1788  }
  1789  
  1790  // Do executes the "pubsub.projects.subscriptions.modifyAckDeadline" call.
  1791  // Any non-2xx status code is an error. Response headers are in either
  1792  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1793  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1794  // whether the returned error was because http.StatusNotModified was returned.
  1795  func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1796  	gensupport.SetOptions(c.urlParams_, opts...)
  1797  	res, err := c.doRequest("json")
  1798  	if res != nil && res.StatusCode == http.StatusNotModified {
  1799  		if res.Body != nil {
  1800  			res.Body.Close()
  1801  		}
  1802  		return nil, gensupport.WrapError(&googleapi.Error{
  1803  			Code:   res.StatusCode,
  1804  			Header: res.Header,
  1805  		})
  1806  	}
  1807  	if err != nil {
  1808  		return nil, err
  1809  	}
  1810  	defer googleapi.CloseBody(res)
  1811  	if err := googleapi.CheckResponse(res); err != nil {
  1812  		return nil, gensupport.WrapError(err)
  1813  	}
  1814  	ret := &Empty{
  1815  		ServerResponse: googleapi.ServerResponse{
  1816  			Header:         res.Header,
  1817  			HTTPStatusCode: res.StatusCode,
  1818  		},
  1819  	}
  1820  	target := &ret
  1821  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1822  		return nil, err
  1823  	}
  1824  	return ret, nil
  1825  }
  1826  
  1827  type ProjectsSubscriptionsModifyPushConfigCall struct {
  1828  	s                       *Service
  1829  	subscription            string
  1830  	modifypushconfigrequest *ModifyPushConfigRequest
  1831  	urlParams_              gensupport.URLParams
  1832  	ctx_                    context.Context
  1833  	header_                 http.Header
  1834  }
  1835  
  1836  // ModifyPushConfig: Modifies the `PushConfig` for a specified subscription.
  1837  // This may be used to change a push subscription to a pull one (signified by
  1838  // an empty `PushConfig`) or vice versa, or change the endpoint URL and other
  1839  // attributes of a push subscription. Messages will accumulate for delivery
  1840  // continuously through the call regardless of changes to the `PushConfig`.
  1841  //
  1842  // - subscription: The name of the subscription.
  1843  func (r *ProjectsSubscriptionsService) ModifyPushConfig(subscription string, modifypushconfigrequest *ModifyPushConfigRequest) *ProjectsSubscriptionsModifyPushConfigCall {
  1844  	c := &ProjectsSubscriptionsModifyPushConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1845  	c.subscription = subscription
  1846  	c.modifypushconfigrequest = modifypushconfigrequest
  1847  	return c
  1848  }
  1849  
  1850  // Fields allows partial responses to be retrieved. See
  1851  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1852  // details.
  1853  func (c *ProjectsSubscriptionsModifyPushConfigCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyPushConfigCall {
  1854  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1855  	return c
  1856  }
  1857  
  1858  // Context sets the context to be used in this call's Do method.
  1859  func (c *ProjectsSubscriptionsModifyPushConfigCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyPushConfigCall {
  1860  	c.ctx_ = ctx
  1861  	return c
  1862  }
  1863  
  1864  // Header returns a http.Header that can be modified by the caller to add
  1865  // headers to the request.
  1866  func (c *ProjectsSubscriptionsModifyPushConfigCall) Header() http.Header {
  1867  	if c.header_ == nil {
  1868  		c.header_ = make(http.Header)
  1869  	}
  1870  	return c.header_
  1871  }
  1872  
  1873  func (c *ProjectsSubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) {
  1874  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1875  	var body io.Reader = nil
  1876  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest)
  1877  	if err != nil {
  1878  		return nil, err
  1879  	}
  1880  	c.urlParams_.Set("alt", alt)
  1881  	c.urlParams_.Set("prettyPrint", "false")
  1882  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyPushConfig")
  1883  	urls += "?" + c.urlParams_.Encode()
  1884  	req, err := http.NewRequest("POST", urls, body)
  1885  	if err != nil {
  1886  		return nil, err
  1887  	}
  1888  	req.Header = reqHeaders
  1889  	googleapi.Expand(req.URL, map[string]string{
  1890  		"subscription": c.subscription,
  1891  	})
  1892  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1893  }
  1894  
  1895  // Do executes the "pubsub.projects.subscriptions.modifyPushConfig" call.
  1896  // Any non-2xx status code is an error. Response headers are in either
  1897  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1898  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1899  // whether the returned error was because http.StatusNotModified was returned.
  1900  func (c *ProjectsSubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1901  	gensupport.SetOptions(c.urlParams_, opts...)
  1902  	res, err := c.doRequest("json")
  1903  	if res != nil && res.StatusCode == http.StatusNotModified {
  1904  		if res.Body != nil {
  1905  			res.Body.Close()
  1906  		}
  1907  		return nil, gensupport.WrapError(&googleapi.Error{
  1908  			Code:   res.StatusCode,
  1909  			Header: res.Header,
  1910  		})
  1911  	}
  1912  	if err != nil {
  1913  		return nil, err
  1914  	}
  1915  	defer googleapi.CloseBody(res)
  1916  	if err := googleapi.CheckResponse(res); err != nil {
  1917  		return nil, gensupport.WrapError(err)
  1918  	}
  1919  	ret := &Empty{
  1920  		ServerResponse: googleapi.ServerResponse{
  1921  			Header:         res.Header,
  1922  			HTTPStatusCode: res.StatusCode,
  1923  		},
  1924  	}
  1925  	target := &ret
  1926  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1927  		return nil, err
  1928  	}
  1929  	return ret, nil
  1930  }
  1931  
  1932  type ProjectsSubscriptionsPullCall struct {
  1933  	s            *Service
  1934  	subscription string
  1935  	pullrequest  *PullRequest
  1936  	urlParams_   gensupport.URLParams
  1937  	ctx_         context.Context
  1938  	header_      http.Header
  1939  }
  1940  
  1941  // Pull: Pulls messages from the server. Returns an empty list if there are no
  1942  // messages available in the backlog. The server may return `UNAVAILABLE` if
  1943  // there are too many concurrent pull requests pending for the given
  1944  // subscription.
  1945  //
  1946  // - subscription: The subscription from which messages should be pulled.
  1947  func (r *ProjectsSubscriptionsService) Pull(subscription string, pullrequest *PullRequest) *ProjectsSubscriptionsPullCall {
  1948  	c := &ProjectsSubscriptionsPullCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1949  	c.subscription = subscription
  1950  	c.pullrequest = pullrequest
  1951  	return c
  1952  }
  1953  
  1954  // Fields allows partial responses to be retrieved. See
  1955  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1956  // details.
  1957  func (c *ProjectsSubscriptionsPullCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsPullCall {
  1958  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1959  	return c
  1960  }
  1961  
  1962  // Context sets the context to be used in this call's Do method.
  1963  func (c *ProjectsSubscriptionsPullCall) Context(ctx context.Context) *ProjectsSubscriptionsPullCall {
  1964  	c.ctx_ = ctx
  1965  	return c
  1966  }
  1967  
  1968  // Header returns a http.Header that can be modified by the caller to add
  1969  // headers to the request.
  1970  func (c *ProjectsSubscriptionsPullCall) Header() http.Header {
  1971  	if c.header_ == nil {
  1972  		c.header_ = make(http.Header)
  1973  	}
  1974  	return c.header_
  1975  }
  1976  
  1977  func (c *ProjectsSubscriptionsPullCall) doRequest(alt string) (*http.Response, error) {
  1978  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1979  	var body io.Reader = nil
  1980  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest)
  1981  	if err != nil {
  1982  		return nil, err
  1983  	}
  1984  	c.urlParams_.Set("alt", alt)
  1985  	c.urlParams_.Set("prettyPrint", "false")
  1986  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:pull")
  1987  	urls += "?" + c.urlParams_.Encode()
  1988  	req, err := http.NewRequest("POST", urls, body)
  1989  	if err != nil {
  1990  		return nil, err
  1991  	}
  1992  	req.Header = reqHeaders
  1993  	googleapi.Expand(req.URL, map[string]string{
  1994  		"subscription": c.subscription,
  1995  	})
  1996  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1997  }
  1998  
  1999  // Do executes the "pubsub.projects.subscriptions.pull" call.
  2000  // Any non-2xx status code is an error. Response headers are in either
  2001  // *PullResponse.ServerResponse.Header or (if a response was returned at all)
  2002  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2003  // whether the returned error was because http.StatusNotModified was returned.
  2004  func (c *ProjectsSubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullResponse, error) {
  2005  	gensupport.SetOptions(c.urlParams_, opts...)
  2006  	res, err := c.doRequest("json")
  2007  	if res != nil && res.StatusCode == http.StatusNotModified {
  2008  		if res.Body != nil {
  2009  			res.Body.Close()
  2010  		}
  2011  		return nil, gensupport.WrapError(&googleapi.Error{
  2012  			Code:   res.StatusCode,
  2013  			Header: res.Header,
  2014  		})
  2015  	}
  2016  	if err != nil {
  2017  		return nil, err
  2018  	}
  2019  	defer googleapi.CloseBody(res)
  2020  	if err := googleapi.CheckResponse(res); err != nil {
  2021  		return nil, gensupport.WrapError(err)
  2022  	}
  2023  	ret := &PullResponse{
  2024  		ServerResponse: googleapi.ServerResponse{
  2025  			Header:         res.Header,
  2026  			HTTPStatusCode: res.StatusCode,
  2027  		},
  2028  	}
  2029  	target := &ret
  2030  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2031  		return nil, err
  2032  	}
  2033  	return ret, nil
  2034  }
  2035  
  2036  type ProjectsSubscriptionsSetIamPolicyCall struct {
  2037  	s                   *Service
  2038  	resource            string
  2039  	setiampolicyrequest *SetIamPolicyRequest
  2040  	urlParams_          gensupport.URLParams
  2041  	ctx_                context.Context
  2042  	header_             http.Header
  2043  }
  2044  
  2045  // SetIamPolicy: Sets the access control policy on the specified resource.
  2046  // Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`,
  2047  // and `PERMISSION_DENIED` errors.
  2048  //
  2049  //   - resource: REQUIRED: The resource for which the policy is being specified.
  2050  //     See Resource names (https://cloud.google.com/apis/design/resource_names)
  2051  //     for the appropriate value for this field.
  2052  func (r *ProjectsSubscriptionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSubscriptionsSetIamPolicyCall {
  2053  	c := &ProjectsSubscriptionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2054  	c.resource = resource
  2055  	c.setiampolicyrequest = setiampolicyrequest
  2056  	return c
  2057  }
  2058  
  2059  // Fields allows partial responses to be retrieved. See
  2060  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2061  // details.
  2062  func (c *ProjectsSubscriptionsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsSetIamPolicyCall {
  2063  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2064  	return c
  2065  }
  2066  
  2067  // Context sets the context to be used in this call's Do method.
  2068  func (c *ProjectsSubscriptionsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsSetIamPolicyCall {
  2069  	c.ctx_ = ctx
  2070  	return c
  2071  }
  2072  
  2073  // Header returns a http.Header that can be modified by the caller to add
  2074  // headers to the request.
  2075  func (c *ProjectsSubscriptionsSetIamPolicyCall) Header() http.Header {
  2076  	if c.header_ == nil {
  2077  		c.header_ = make(http.Header)
  2078  	}
  2079  	return c.header_
  2080  }
  2081  
  2082  func (c *ProjectsSubscriptionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2083  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2084  	var body io.Reader = nil
  2085  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2086  	if err != nil {
  2087  		return nil, err
  2088  	}
  2089  	c.urlParams_.Set("alt", alt)
  2090  	c.urlParams_.Set("prettyPrint", "false")
  2091  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy")
  2092  	urls += "?" + c.urlParams_.Encode()
  2093  	req, err := http.NewRequest("POST", urls, body)
  2094  	if err != nil {
  2095  		return nil, err
  2096  	}
  2097  	req.Header = reqHeaders
  2098  	googleapi.Expand(req.URL, map[string]string{
  2099  		"resource": c.resource,
  2100  	})
  2101  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2102  }
  2103  
  2104  // Do executes the "pubsub.projects.subscriptions.setIamPolicy" call.
  2105  // Any non-2xx status code is an error. Response headers are in either
  2106  // *Policy.ServerResponse.Header or (if a response was returned at all) in
  2107  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2108  // whether the returned error was because http.StatusNotModified was returned.
  2109  func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2110  	gensupport.SetOptions(c.urlParams_, opts...)
  2111  	res, err := c.doRequest("json")
  2112  	if res != nil && res.StatusCode == http.StatusNotModified {
  2113  		if res.Body != nil {
  2114  			res.Body.Close()
  2115  		}
  2116  		return nil, gensupport.WrapError(&googleapi.Error{
  2117  			Code:   res.StatusCode,
  2118  			Header: res.Header,
  2119  		})
  2120  	}
  2121  	if err != nil {
  2122  		return nil, err
  2123  	}
  2124  	defer googleapi.CloseBody(res)
  2125  	if err := googleapi.CheckResponse(res); err != nil {
  2126  		return nil, gensupport.WrapError(err)
  2127  	}
  2128  	ret := &Policy{
  2129  		ServerResponse: googleapi.ServerResponse{
  2130  			Header:         res.Header,
  2131  			HTTPStatusCode: res.StatusCode,
  2132  		},
  2133  	}
  2134  	target := &ret
  2135  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2136  		return nil, err
  2137  	}
  2138  	return ret, nil
  2139  }
  2140  
  2141  type ProjectsSubscriptionsTestIamPermissionsCall struct {
  2142  	s                         *Service
  2143  	resource                  string
  2144  	testiampermissionsrequest *TestIamPermissionsRequest
  2145  	urlParams_                gensupport.URLParams
  2146  	ctx_                      context.Context
  2147  	header_                   http.Header
  2148  }
  2149  
  2150  // TestIamPermissions: Returns permissions that a caller has on the specified
  2151  // resource. If the resource does not exist, this will return an empty set of
  2152  // permissions, not a `NOT_FOUND` error. Note: This operation is designed to be
  2153  // used for building permission-aware UIs and command-line tools, not for
  2154  // authorization checking. This operation may "fail open" without warning.
  2155  //
  2156  //   - resource: REQUIRED: The resource for which the policy detail is being
  2157  //     requested. See Resource names
  2158  //     (https://cloud.google.com/apis/design/resource_names) for the appropriate
  2159  //     value for this field.
  2160  func (r *ProjectsSubscriptionsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsSubscriptionsTestIamPermissionsCall {
  2161  	c := &ProjectsSubscriptionsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2162  	c.resource = resource
  2163  	c.testiampermissionsrequest = testiampermissionsrequest
  2164  	return c
  2165  }
  2166  
  2167  // Fields allows partial responses to be retrieved. See
  2168  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2169  // details.
  2170  func (c *ProjectsSubscriptionsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsTestIamPermissionsCall {
  2171  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2172  	return c
  2173  }
  2174  
  2175  // Context sets the context to be used in this call's Do method.
  2176  func (c *ProjectsSubscriptionsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsSubscriptionsTestIamPermissionsCall {
  2177  	c.ctx_ = ctx
  2178  	return c
  2179  }
  2180  
  2181  // Header returns a http.Header that can be modified by the caller to add
  2182  // headers to the request.
  2183  func (c *ProjectsSubscriptionsTestIamPermissionsCall) Header() http.Header {
  2184  	if c.header_ == nil {
  2185  		c.header_ = make(http.Header)
  2186  	}
  2187  	return c.header_
  2188  }
  2189  
  2190  func (c *ProjectsSubscriptionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2191  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2192  	var body io.Reader = nil
  2193  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2194  	if err != nil {
  2195  		return nil, err
  2196  	}
  2197  	c.urlParams_.Set("alt", alt)
  2198  	c.urlParams_.Set("prettyPrint", "false")
  2199  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions")
  2200  	urls += "?" + c.urlParams_.Encode()
  2201  	req, err := http.NewRequest("POST", urls, body)
  2202  	if err != nil {
  2203  		return nil, err
  2204  	}
  2205  	req.Header = reqHeaders
  2206  	googleapi.Expand(req.URL, map[string]string{
  2207  		"resource": c.resource,
  2208  	})
  2209  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2210  }
  2211  
  2212  // Do executes the "pubsub.projects.subscriptions.testIamPermissions" call.
  2213  // Any non-2xx status code is an error. Response headers are in either
  2214  // *TestIamPermissionsResponse.ServerResponse.Header or (if a response was
  2215  // returned at all) in error.(*googleapi.Error).Header. Use
  2216  // googleapi.IsNotModified to check whether the returned error was because
  2217  // http.StatusNotModified was returned.
  2218  func (c *ProjectsSubscriptionsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2219  	gensupport.SetOptions(c.urlParams_, opts...)
  2220  	res, err := c.doRequest("json")
  2221  	if res != nil && res.StatusCode == http.StatusNotModified {
  2222  		if res.Body != nil {
  2223  			res.Body.Close()
  2224  		}
  2225  		return nil, gensupport.WrapError(&googleapi.Error{
  2226  			Code:   res.StatusCode,
  2227  			Header: res.Header,
  2228  		})
  2229  	}
  2230  	if err != nil {
  2231  		return nil, err
  2232  	}
  2233  	defer googleapi.CloseBody(res)
  2234  	if err := googleapi.CheckResponse(res); err != nil {
  2235  		return nil, gensupport.WrapError(err)
  2236  	}
  2237  	ret := &TestIamPermissionsResponse{
  2238  		ServerResponse: googleapi.ServerResponse{
  2239  			Header:         res.Header,
  2240  			HTTPStatusCode: res.StatusCode,
  2241  		},
  2242  	}
  2243  	target := &ret
  2244  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2245  		return nil, err
  2246  	}
  2247  	return ret, nil
  2248  }
  2249  
  2250  type ProjectsTopicsCreateCall struct {
  2251  	s          *Service
  2252  	name       string
  2253  	topic      *Topic
  2254  	urlParams_ gensupport.URLParams
  2255  	ctx_       context.Context
  2256  	header_    http.Header
  2257  }
  2258  
  2259  // Create: Creates the given topic with the given name.
  2260  //
  2261  //   - name: The name of the topic. It must have the format
  2262  //     "projects/{project}/topics/{topic}". `{topic}` must start with a letter,
  2263  //     and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
  2264  //     underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
  2265  //     signs (`%`). It must be between 3 and 255 characters in length, and it
  2266  //     must not start with "goog".
  2267  func (r *ProjectsTopicsService) Create(name string, topic *Topic) *ProjectsTopicsCreateCall {
  2268  	c := &ProjectsTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2269  	c.name = name
  2270  	c.topic = topic
  2271  	return c
  2272  }
  2273  
  2274  // Fields allows partial responses to be retrieved. See
  2275  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2276  // details.
  2277  func (c *ProjectsTopicsCreateCall) Fields(s ...googleapi.Field) *ProjectsTopicsCreateCall {
  2278  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2279  	return c
  2280  }
  2281  
  2282  // Context sets the context to be used in this call's Do method.
  2283  func (c *ProjectsTopicsCreateCall) Context(ctx context.Context) *ProjectsTopicsCreateCall {
  2284  	c.ctx_ = ctx
  2285  	return c
  2286  }
  2287  
  2288  // Header returns a http.Header that can be modified by the caller to add
  2289  // headers to the request.
  2290  func (c *ProjectsTopicsCreateCall) Header() http.Header {
  2291  	if c.header_ == nil {
  2292  		c.header_ = make(http.Header)
  2293  	}
  2294  	return c.header_
  2295  }
  2296  
  2297  func (c *ProjectsTopicsCreateCall) doRequest(alt string) (*http.Response, error) {
  2298  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2299  	var body io.Reader = nil
  2300  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic)
  2301  	if err != nil {
  2302  		return nil, err
  2303  	}
  2304  	c.urlParams_.Set("alt", alt)
  2305  	c.urlParams_.Set("prettyPrint", "false")
  2306  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
  2307  	urls += "?" + c.urlParams_.Encode()
  2308  	req, err := http.NewRequest("PUT", urls, body)
  2309  	if err != nil {
  2310  		return nil, err
  2311  	}
  2312  	req.Header = reqHeaders
  2313  	googleapi.Expand(req.URL, map[string]string{
  2314  		"name": c.name,
  2315  	})
  2316  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2317  }
  2318  
  2319  // Do executes the "pubsub.projects.topics.create" call.
  2320  // Any non-2xx status code is an error. Response headers are in either
  2321  // *Topic.ServerResponse.Header or (if a response was returned at all) in
  2322  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2323  // whether the returned error was because http.StatusNotModified was returned.
  2324  func (c *ProjectsTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
  2325  	gensupport.SetOptions(c.urlParams_, opts...)
  2326  	res, err := c.doRequest("json")
  2327  	if res != nil && res.StatusCode == http.StatusNotModified {
  2328  		if res.Body != nil {
  2329  			res.Body.Close()
  2330  		}
  2331  		return nil, gensupport.WrapError(&googleapi.Error{
  2332  			Code:   res.StatusCode,
  2333  			Header: res.Header,
  2334  		})
  2335  	}
  2336  	if err != nil {
  2337  		return nil, err
  2338  	}
  2339  	defer googleapi.CloseBody(res)
  2340  	if err := googleapi.CheckResponse(res); err != nil {
  2341  		return nil, gensupport.WrapError(err)
  2342  	}
  2343  	ret := &Topic{
  2344  		ServerResponse: googleapi.ServerResponse{
  2345  			Header:         res.Header,
  2346  			HTTPStatusCode: res.StatusCode,
  2347  		},
  2348  	}
  2349  	target := &ret
  2350  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2351  		return nil, err
  2352  	}
  2353  	return ret, nil
  2354  }
  2355  
  2356  type ProjectsTopicsDeleteCall struct {
  2357  	s          *Service
  2358  	topic      string
  2359  	urlParams_ gensupport.URLParams
  2360  	ctx_       context.Context
  2361  	header_    http.Header
  2362  }
  2363  
  2364  // Delete: Deletes the topic with the given name. Returns `NOT_FOUND` if the
  2365  // topic does not exist. After a topic is deleted, a new topic may be created
  2366  // with the same name; this is an entirely new topic with none of the old
  2367  // configuration or subscriptions. Existing subscriptions to this topic are not
  2368  // deleted, but their `topic` field is set to `_deleted-topic_`.
  2369  //
  2370  // - topic: Name of the topic to delete.
  2371  func (r *ProjectsTopicsService) Delete(topic string) *ProjectsTopicsDeleteCall {
  2372  	c := &ProjectsTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2373  	c.topic = topic
  2374  	return c
  2375  }
  2376  
  2377  // Fields allows partial responses to be retrieved. See
  2378  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2379  // details.
  2380  func (c *ProjectsTopicsDeleteCall) Fields(s ...googleapi.Field) *ProjectsTopicsDeleteCall {
  2381  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2382  	return c
  2383  }
  2384  
  2385  // Context sets the context to be used in this call's Do method.
  2386  func (c *ProjectsTopicsDeleteCall) Context(ctx context.Context) *ProjectsTopicsDeleteCall {
  2387  	c.ctx_ = ctx
  2388  	return c
  2389  }
  2390  
  2391  // Header returns a http.Header that can be modified by the caller to add
  2392  // headers to the request.
  2393  func (c *ProjectsTopicsDeleteCall) Header() http.Header {
  2394  	if c.header_ == nil {
  2395  		c.header_ = make(http.Header)
  2396  	}
  2397  	return c.header_
  2398  }
  2399  
  2400  func (c *ProjectsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2401  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2402  	var body io.Reader = nil
  2403  	c.urlParams_.Set("alt", alt)
  2404  	c.urlParams_.Set("prettyPrint", "false")
  2405  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}")
  2406  	urls += "?" + c.urlParams_.Encode()
  2407  	req, err := http.NewRequest("DELETE", urls, body)
  2408  	if err != nil {
  2409  		return nil, err
  2410  	}
  2411  	req.Header = reqHeaders
  2412  	googleapi.Expand(req.URL, map[string]string{
  2413  		"topic": c.topic,
  2414  	})
  2415  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2416  }
  2417  
  2418  // Do executes the "pubsub.projects.topics.delete" call.
  2419  // Any non-2xx status code is an error. Response headers are in either
  2420  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  2421  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2422  // whether the returned error was because http.StatusNotModified was returned.
  2423  func (c *ProjectsTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2424  	gensupport.SetOptions(c.urlParams_, opts...)
  2425  	res, err := c.doRequest("json")
  2426  	if res != nil && res.StatusCode == http.StatusNotModified {
  2427  		if res.Body != nil {
  2428  			res.Body.Close()
  2429  		}
  2430  		return nil, gensupport.WrapError(&googleapi.Error{
  2431  			Code:   res.StatusCode,
  2432  			Header: res.Header,
  2433  		})
  2434  	}
  2435  	if err != nil {
  2436  		return nil, err
  2437  	}
  2438  	defer googleapi.CloseBody(res)
  2439  	if err := googleapi.CheckResponse(res); err != nil {
  2440  		return nil, gensupport.WrapError(err)
  2441  	}
  2442  	ret := &Empty{
  2443  		ServerResponse: googleapi.ServerResponse{
  2444  			Header:         res.Header,
  2445  			HTTPStatusCode: res.StatusCode,
  2446  		},
  2447  	}
  2448  	target := &ret
  2449  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2450  		return nil, err
  2451  	}
  2452  	return ret, nil
  2453  }
  2454  
  2455  type ProjectsTopicsGetCall struct {
  2456  	s            *Service
  2457  	topic        string
  2458  	urlParams_   gensupport.URLParams
  2459  	ifNoneMatch_ string
  2460  	ctx_         context.Context
  2461  	header_      http.Header
  2462  }
  2463  
  2464  // Get: Gets the configuration of a topic.
  2465  //
  2466  // - topic: The name of the topic to get.
  2467  func (r *ProjectsTopicsService) Get(topic string) *ProjectsTopicsGetCall {
  2468  	c := &ProjectsTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2469  	c.topic = topic
  2470  	return c
  2471  }
  2472  
  2473  // Fields allows partial responses to be retrieved. See
  2474  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2475  // details.
  2476  func (c *ProjectsTopicsGetCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetCall {
  2477  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2478  	return c
  2479  }
  2480  
  2481  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2482  // object's ETag matches the given value. This is useful for getting updates
  2483  // only after the object has changed since the last request.
  2484  func (c *ProjectsTopicsGetCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetCall {
  2485  	c.ifNoneMatch_ = entityTag
  2486  	return c
  2487  }
  2488  
  2489  // Context sets the context to be used in this call's Do method.
  2490  func (c *ProjectsTopicsGetCall) Context(ctx context.Context) *ProjectsTopicsGetCall {
  2491  	c.ctx_ = ctx
  2492  	return c
  2493  }
  2494  
  2495  // Header returns a http.Header that can be modified by the caller to add
  2496  // headers to the request.
  2497  func (c *ProjectsTopicsGetCall) Header() http.Header {
  2498  	if c.header_ == nil {
  2499  		c.header_ = make(http.Header)
  2500  	}
  2501  	return c.header_
  2502  }
  2503  
  2504  func (c *ProjectsTopicsGetCall) doRequest(alt string) (*http.Response, error) {
  2505  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2506  	if c.ifNoneMatch_ != "" {
  2507  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2508  	}
  2509  	var body io.Reader = nil
  2510  	c.urlParams_.Set("alt", alt)
  2511  	c.urlParams_.Set("prettyPrint", "false")
  2512  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}")
  2513  	urls += "?" + c.urlParams_.Encode()
  2514  	req, err := http.NewRequest("GET", urls, body)
  2515  	if err != nil {
  2516  		return nil, err
  2517  	}
  2518  	req.Header = reqHeaders
  2519  	googleapi.Expand(req.URL, map[string]string{
  2520  		"topic": c.topic,
  2521  	})
  2522  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2523  }
  2524  
  2525  // Do executes the "pubsub.projects.topics.get" call.
  2526  // Any non-2xx status code is an error. Response headers are in either
  2527  // *Topic.ServerResponse.Header or (if a response was returned at all) in
  2528  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2529  // whether the returned error was because http.StatusNotModified was returned.
  2530  func (c *ProjectsTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
  2531  	gensupport.SetOptions(c.urlParams_, opts...)
  2532  	res, err := c.doRequest("json")
  2533  	if res != nil && res.StatusCode == http.StatusNotModified {
  2534  		if res.Body != nil {
  2535  			res.Body.Close()
  2536  		}
  2537  		return nil, gensupport.WrapError(&googleapi.Error{
  2538  			Code:   res.StatusCode,
  2539  			Header: res.Header,
  2540  		})
  2541  	}
  2542  	if err != nil {
  2543  		return nil, err
  2544  	}
  2545  	defer googleapi.CloseBody(res)
  2546  	if err := googleapi.CheckResponse(res); err != nil {
  2547  		return nil, gensupport.WrapError(err)
  2548  	}
  2549  	ret := &Topic{
  2550  		ServerResponse: googleapi.ServerResponse{
  2551  			Header:         res.Header,
  2552  			HTTPStatusCode: res.StatusCode,
  2553  		},
  2554  	}
  2555  	target := &ret
  2556  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2557  		return nil, err
  2558  	}
  2559  	return ret, nil
  2560  }
  2561  
  2562  type ProjectsTopicsGetIamPolicyCall struct {
  2563  	s            *Service
  2564  	resource     string
  2565  	urlParams_   gensupport.URLParams
  2566  	ifNoneMatch_ string
  2567  	ctx_         context.Context
  2568  	header_      http.Header
  2569  }
  2570  
  2571  // GetIamPolicy: Gets the access control policy for a resource. Returns an
  2572  // empty policy if the resource exists and does not have a policy set.
  2573  //
  2574  //   - resource: REQUIRED: The resource for which the policy is being requested.
  2575  //     See Resource names (https://cloud.google.com/apis/design/resource_names)
  2576  //     for the appropriate value for this field.
  2577  func (r *ProjectsTopicsService) GetIamPolicy(resource string) *ProjectsTopicsGetIamPolicyCall {
  2578  	c := &ProjectsTopicsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2579  	c.resource = resource
  2580  	return c
  2581  }
  2582  
  2583  // OptionsRequestedPolicyVersion sets the optional parameter
  2584  // "options.requestedPolicyVersion": The maximum policy version that will be
  2585  // used to format the policy. Valid values are 0, 1, and 3. Requests specifying
  2586  // an invalid value will be rejected. Requests for policies with any
  2587  // conditional role bindings must specify version 3. Policies with no
  2588  // conditional role bindings may specify any valid value or leave the field
  2589  // unset. The policy in the response might use the policy version that you
  2590  // specified, or it might use a lower policy version. For example, if you
  2591  // specify version 3, but the policy has no conditional role bindings, the
  2592  // response uses version 1. To learn which resources support conditions in
  2593  // their IAM policies, see the IAM documentation
  2594  // (https://cloud.google.com/iam/help/conditions/resource-policies).
  2595  func (c *ProjectsTopicsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsTopicsGetIamPolicyCall {
  2596  	c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
  2597  	return c
  2598  }
  2599  
  2600  // Fields allows partial responses to be retrieved. See
  2601  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2602  // details.
  2603  func (c *ProjectsTopicsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetIamPolicyCall {
  2604  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2605  	return c
  2606  }
  2607  
  2608  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2609  // object's ETag matches the given value. This is useful for getting updates
  2610  // only after the object has changed since the last request.
  2611  func (c *ProjectsTopicsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetIamPolicyCall {
  2612  	c.ifNoneMatch_ = entityTag
  2613  	return c
  2614  }
  2615  
  2616  // Context sets the context to be used in this call's Do method.
  2617  func (c *ProjectsTopicsGetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsGetIamPolicyCall {
  2618  	c.ctx_ = ctx
  2619  	return c
  2620  }
  2621  
  2622  // Header returns a http.Header that can be modified by the caller to add
  2623  // headers to the request.
  2624  func (c *ProjectsTopicsGetIamPolicyCall) Header() http.Header {
  2625  	if c.header_ == nil {
  2626  		c.header_ = make(http.Header)
  2627  	}
  2628  	return c.header_
  2629  }
  2630  
  2631  func (c *ProjectsTopicsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2632  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2633  	if c.ifNoneMatch_ != "" {
  2634  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2635  	}
  2636  	var body io.Reader = nil
  2637  	c.urlParams_.Set("alt", alt)
  2638  	c.urlParams_.Set("prettyPrint", "false")
  2639  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy")
  2640  	urls += "?" + c.urlParams_.Encode()
  2641  	req, err := http.NewRequest("GET", urls, body)
  2642  	if err != nil {
  2643  		return nil, err
  2644  	}
  2645  	req.Header = reqHeaders
  2646  	googleapi.Expand(req.URL, map[string]string{
  2647  		"resource": c.resource,
  2648  	})
  2649  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2650  }
  2651  
  2652  // Do executes the "pubsub.projects.topics.getIamPolicy" call.
  2653  // Any non-2xx status code is an error. Response headers are in either
  2654  // *Policy.ServerResponse.Header or (if a response was returned at all) in
  2655  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2656  // whether the returned error was because http.StatusNotModified was returned.
  2657  func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2658  	gensupport.SetOptions(c.urlParams_, opts...)
  2659  	res, err := c.doRequest("json")
  2660  	if res != nil && res.StatusCode == http.StatusNotModified {
  2661  		if res.Body != nil {
  2662  			res.Body.Close()
  2663  		}
  2664  		return nil, gensupport.WrapError(&googleapi.Error{
  2665  			Code:   res.StatusCode,
  2666  			Header: res.Header,
  2667  		})
  2668  	}
  2669  	if err != nil {
  2670  		return nil, err
  2671  	}
  2672  	defer googleapi.CloseBody(res)
  2673  	if err := googleapi.CheckResponse(res); err != nil {
  2674  		return nil, gensupport.WrapError(err)
  2675  	}
  2676  	ret := &Policy{
  2677  		ServerResponse: googleapi.ServerResponse{
  2678  			Header:         res.Header,
  2679  			HTTPStatusCode: res.StatusCode,
  2680  		},
  2681  	}
  2682  	target := &ret
  2683  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2684  		return nil, err
  2685  	}
  2686  	return ret, nil
  2687  }
  2688  
  2689  type ProjectsTopicsListCall struct {
  2690  	s            *Service
  2691  	project      string
  2692  	urlParams_   gensupport.URLParams
  2693  	ifNoneMatch_ string
  2694  	ctx_         context.Context
  2695  	header_      http.Header
  2696  }
  2697  
  2698  // List: Lists matching topics.
  2699  //
  2700  // - project: The name of the cloud project that topics belong to.
  2701  func (r *ProjectsTopicsService) List(project string) *ProjectsTopicsListCall {
  2702  	c := &ProjectsTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2703  	c.project = project
  2704  	return c
  2705  }
  2706  
  2707  // PageSize sets the optional parameter "pageSize": Maximum number of topics to
  2708  // return.
  2709  func (c *ProjectsTopicsListCall) PageSize(pageSize int64) *ProjectsTopicsListCall {
  2710  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2711  	return c
  2712  }
  2713  
  2714  // PageToken sets the optional parameter "pageToken": The value returned by the
  2715  // last `ListTopicsResponse`; indicates that this is a continuation of a prior
  2716  // `ListTopics` call, and that the system should return the next page of data.
  2717  func (c *ProjectsTopicsListCall) PageToken(pageToken string) *ProjectsTopicsListCall {
  2718  	c.urlParams_.Set("pageToken", pageToken)
  2719  	return c
  2720  }
  2721  
  2722  // Fields allows partial responses to be retrieved. See
  2723  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2724  // details.
  2725  func (c *ProjectsTopicsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsListCall {
  2726  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2727  	return c
  2728  }
  2729  
  2730  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2731  // object's ETag matches the given value. This is useful for getting updates
  2732  // only after the object has changed since the last request.
  2733  func (c *ProjectsTopicsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsListCall {
  2734  	c.ifNoneMatch_ = entityTag
  2735  	return c
  2736  }
  2737  
  2738  // Context sets the context to be used in this call's Do method.
  2739  func (c *ProjectsTopicsListCall) Context(ctx context.Context) *ProjectsTopicsListCall {
  2740  	c.ctx_ = ctx
  2741  	return c
  2742  }
  2743  
  2744  // Header returns a http.Header that can be modified by the caller to add
  2745  // headers to the request.
  2746  func (c *ProjectsTopicsListCall) Header() http.Header {
  2747  	if c.header_ == nil {
  2748  		c.header_ = make(http.Header)
  2749  	}
  2750  	return c.header_
  2751  }
  2752  
  2753  func (c *ProjectsTopicsListCall) doRequest(alt string) (*http.Response, error) {
  2754  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2755  	if c.ifNoneMatch_ != "" {
  2756  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2757  	}
  2758  	var body io.Reader = nil
  2759  	c.urlParams_.Set("alt", alt)
  2760  	c.urlParams_.Set("prettyPrint", "false")
  2761  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/topics")
  2762  	urls += "?" + c.urlParams_.Encode()
  2763  	req, err := http.NewRequest("GET", urls, body)
  2764  	if err != nil {
  2765  		return nil, err
  2766  	}
  2767  	req.Header = reqHeaders
  2768  	googleapi.Expand(req.URL, map[string]string{
  2769  		"project": c.project,
  2770  	})
  2771  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2772  }
  2773  
  2774  // Do executes the "pubsub.projects.topics.list" call.
  2775  // Any non-2xx status code is an error. Response headers are in either
  2776  // *ListTopicsResponse.ServerResponse.Header or (if a response was returned at
  2777  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2778  // check whether the returned error was because http.StatusNotModified was
  2779  // returned.
  2780  func (c *ProjectsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) {
  2781  	gensupport.SetOptions(c.urlParams_, opts...)
  2782  	res, err := c.doRequest("json")
  2783  	if res != nil && res.StatusCode == http.StatusNotModified {
  2784  		if res.Body != nil {
  2785  			res.Body.Close()
  2786  		}
  2787  		return nil, gensupport.WrapError(&googleapi.Error{
  2788  			Code:   res.StatusCode,
  2789  			Header: res.Header,
  2790  		})
  2791  	}
  2792  	if err != nil {
  2793  		return nil, err
  2794  	}
  2795  	defer googleapi.CloseBody(res)
  2796  	if err := googleapi.CheckResponse(res); err != nil {
  2797  		return nil, gensupport.WrapError(err)
  2798  	}
  2799  	ret := &ListTopicsResponse{
  2800  		ServerResponse: googleapi.ServerResponse{
  2801  			Header:         res.Header,
  2802  			HTTPStatusCode: res.StatusCode,
  2803  		},
  2804  	}
  2805  	target := &ret
  2806  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2807  		return nil, err
  2808  	}
  2809  	return ret, nil
  2810  }
  2811  
  2812  // Pages invokes f for each page of results.
  2813  // A non-nil error returned from f will halt the iteration.
  2814  // The provided context supersedes any context provided to the Context method.
  2815  func (c *ProjectsTopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error {
  2816  	c.ctx_ = ctx
  2817  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2818  	for {
  2819  		x, err := c.Do()
  2820  		if err != nil {
  2821  			return err
  2822  		}
  2823  		if err := f(x); err != nil {
  2824  			return err
  2825  		}
  2826  		if x.NextPageToken == "" {
  2827  			return nil
  2828  		}
  2829  		c.PageToken(x.NextPageToken)
  2830  	}
  2831  }
  2832  
  2833  type ProjectsTopicsPublishCall struct {
  2834  	s              *Service
  2835  	topic          string
  2836  	publishrequest *PublishRequest
  2837  	urlParams_     gensupport.URLParams
  2838  	ctx_           context.Context
  2839  	header_        http.Header
  2840  }
  2841  
  2842  // Publish: Adds one or more messages to the topic. Returns `NOT_FOUND` if the
  2843  // topic does not exist. The message payload must not be empty; it must contain
  2844  // either a non-empty data field, or at least one attribute.
  2845  //
  2846  // - topic: The messages in the request will be published on this topic.
  2847  func (r *ProjectsTopicsService) Publish(topic string, publishrequest *PublishRequest) *ProjectsTopicsPublishCall {
  2848  	c := &ProjectsTopicsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2849  	c.topic = topic
  2850  	c.publishrequest = publishrequest
  2851  	return c
  2852  }
  2853  
  2854  // Fields allows partial responses to be retrieved. See
  2855  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2856  // details.
  2857  func (c *ProjectsTopicsPublishCall) Fields(s ...googleapi.Field) *ProjectsTopicsPublishCall {
  2858  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2859  	return c
  2860  }
  2861  
  2862  // Context sets the context to be used in this call's Do method.
  2863  func (c *ProjectsTopicsPublishCall) Context(ctx context.Context) *ProjectsTopicsPublishCall {
  2864  	c.ctx_ = ctx
  2865  	return c
  2866  }
  2867  
  2868  // Header returns a http.Header that can be modified by the caller to add
  2869  // headers to the request.
  2870  func (c *ProjectsTopicsPublishCall) Header() http.Header {
  2871  	if c.header_ == nil {
  2872  		c.header_ = make(http.Header)
  2873  	}
  2874  	return c.header_
  2875  }
  2876  
  2877  func (c *ProjectsTopicsPublishCall) doRequest(alt string) (*http.Response, error) {
  2878  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2879  	var body io.Reader = nil
  2880  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest)
  2881  	if err != nil {
  2882  		return nil, err
  2883  	}
  2884  	c.urlParams_.Set("alt", alt)
  2885  	c.urlParams_.Set("prettyPrint", "false")
  2886  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}:publish")
  2887  	urls += "?" + c.urlParams_.Encode()
  2888  	req, err := http.NewRequest("POST", urls, body)
  2889  	if err != nil {
  2890  		return nil, err
  2891  	}
  2892  	req.Header = reqHeaders
  2893  	googleapi.Expand(req.URL, map[string]string{
  2894  		"topic": c.topic,
  2895  	})
  2896  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2897  }
  2898  
  2899  // Do executes the "pubsub.projects.topics.publish" call.
  2900  // Any non-2xx status code is an error. Response headers are in either
  2901  // *PublishResponse.ServerResponse.Header or (if a response was returned at
  2902  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2903  // check whether the returned error was because http.StatusNotModified was
  2904  // returned.
  2905  func (c *ProjectsTopicsPublishCall) Do(opts ...googleapi.CallOption) (*PublishResponse, error) {
  2906  	gensupport.SetOptions(c.urlParams_, opts...)
  2907  	res, err := c.doRequest("json")
  2908  	if res != nil && res.StatusCode == http.StatusNotModified {
  2909  		if res.Body != nil {
  2910  			res.Body.Close()
  2911  		}
  2912  		return nil, gensupport.WrapError(&googleapi.Error{
  2913  			Code:   res.StatusCode,
  2914  			Header: res.Header,
  2915  		})
  2916  	}
  2917  	if err != nil {
  2918  		return nil, err
  2919  	}
  2920  	defer googleapi.CloseBody(res)
  2921  	if err := googleapi.CheckResponse(res); err != nil {
  2922  		return nil, gensupport.WrapError(err)
  2923  	}
  2924  	ret := &PublishResponse{
  2925  		ServerResponse: googleapi.ServerResponse{
  2926  			Header:         res.Header,
  2927  			HTTPStatusCode: res.StatusCode,
  2928  		},
  2929  	}
  2930  	target := &ret
  2931  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2932  		return nil, err
  2933  	}
  2934  	return ret, nil
  2935  }
  2936  
  2937  type ProjectsTopicsSetIamPolicyCall struct {
  2938  	s                   *Service
  2939  	resource            string
  2940  	setiampolicyrequest *SetIamPolicyRequest
  2941  	urlParams_          gensupport.URLParams
  2942  	ctx_                context.Context
  2943  	header_             http.Header
  2944  }
  2945  
  2946  // SetIamPolicy: Sets the access control policy on the specified resource.
  2947  // Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`,
  2948  // and `PERMISSION_DENIED` errors.
  2949  //
  2950  //   - resource: REQUIRED: The resource for which the policy is being specified.
  2951  //     See Resource names (https://cloud.google.com/apis/design/resource_names)
  2952  //     for the appropriate value for this field.
  2953  func (r *ProjectsTopicsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsTopicsSetIamPolicyCall {
  2954  	c := &ProjectsTopicsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2955  	c.resource = resource
  2956  	c.setiampolicyrequest = setiampolicyrequest
  2957  	return c
  2958  }
  2959  
  2960  // Fields allows partial responses to be retrieved. See
  2961  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2962  // details.
  2963  func (c *ProjectsTopicsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsSetIamPolicyCall {
  2964  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2965  	return c
  2966  }
  2967  
  2968  // Context sets the context to be used in this call's Do method.
  2969  func (c *ProjectsTopicsSetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsSetIamPolicyCall {
  2970  	c.ctx_ = ctx
  2971  	return c
  2972  }
  2973  
  2974  // Header returns a http.Header that can be modified by the caller to add
  2975  // headers to the request.
  2976  func (c *ProjectsTopicsSetIamPolicyCall) Header() http.Header {
  2977  	if c.header_ == nil {
  2978  		c.header_ = make(http.Header)
  2979  	}
  2980  	return c.header_
  2981  }
  2982  
  2983  func (c *ProjectsTopicsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2984  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2985  	var body io.Reader = nil
  2986  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2987  	if err != nil {
  2988  		return nil, err
  2989  	}
  2990  	c.urlParams_.Set("alt", alt)
  2991  	c.urlParams_.Set("prettyPrint", "false")
  2992  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy")
  2993  	urls += "?" + c.urlParams_.Encode()
  2994  	req, err := http.NewRequest("POST", urls, body)
  2995  	if err != nil {
  2996  		return nil, err
  2997  	}
  2998  	req.Header = reqHeaders
  2999  	googleapi.Expand(req.URL, map[string]string{
  3000  		"resource": c.resource,
  3001  	})
  3002  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3003  }
  3004  
  3005  // Do executes the "pubsub.projects.topics.setIamPolicy" call.
  3006  // Any non-2xx status code is an error. Response headers are in either
  3007  // *Policy.ServerResponse.Header or (if a response was returned at all) in
  3008  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3009  // whether the returned error was because http.StatusNotModified was returned.
  3010  func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3011  	gensupport.SetOptions(c.urlParams_, opts...)
  3012  	res, err := c.doRequest("json")
  3013  	if res != nil && res.StatusCode == http.StatusNotModified {
  3014  		if res.Body != nil {
  3015  			res.Body.Close()
  3016  		}
  3017  		return nil, gensupport.WrapError(&googleapi.Error{
  3018  			Code:   res.StatusCode,
  3019  			Header: res.Header,
  3020  		})
  3021  	}
  3022  	if err != nil {
  3023  		return nil, err
  3024  	}
  3025  	defer googleapi.CloseBody(res)
  3026  	if err := googleapi.CheckResponse(res); err != nil {
  3027  		return nil, gensupport.WrapError(err)
  3028  	}
  3029  	ret := &Policy{
  3030  		ServerResponse: googleapi.ServerResponse{
  3031  			Header:         res.Header,
  3032  			HTTPStatusCode: res.StatusCode,
  3033  		},
  3034  	}
  3035  	target := &ret
  3036  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3037  		return nil, err
  3038  	}
  3039  	return ret, nil
  3040  }
  3041  
  3042  type ProjectsTopicsTestIamPermissionsCall struct {
  3043  	s                         *Service
  3044  	resource                  string
  3045  	testiampermissionsrequest *TestIamPermissionsRequest
  3046  	urlParams_                gensupport.URLParams
  3047  	ctx_                      context.Context
  3048  	header_                   http.Header
  3049  }
  3050  
  3051  // TestIamPermissions: Returns permissions that a caller has on the specified
  3052  // resource. If the resource does not exist, this will return an empty set of
  3053  // permissions, not a `NOT_FOUND` error. Note: This operation is designed to be
  3054  // used for building permission-aware UIs and command-line tools, not for
  3055  // authorization checking. This operation may "fail open" without warning.
  3056  //
  3057  //   - resource: REQUIRED: The resource for which the policy detail is being
  3058  //     requested. See Resource names
  3059  //     (https://cloud.google.com/apis/design/resource_names) for the appropriate
  3060  //     value for this field.
  3061  func (r *ProjectsTopicsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTopicsTestIamPermissionsCall {
  3062  	c := &ProjectsTopicsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3063  	c.resource = resource
  3064  	c.testiampermissionsrequest = testiampermissionsrequest
  3065  	return c
  3066  }
  3067  
  3068  // Fields allows partial responses to be retrieved. See
  3069  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3070  // details.
  3071  func (c *ProjectsTopicsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTopicsTestIamPermissionsCall {
  3072  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3073  	return c
  3074  }
  3075  
  3076  // Context sets the context to be used in this call's Do method.
  3077  func (c *ProjectsTopicsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTopicsTestIamPermissionsCall {
  3078  	c.ctx_ = ctx
  3079  	return c
  3080  }
  3081  
  3082  // Header returns a http.Header that can be modified by the caller to add
  3083  // headers to the request.
  3084  func (c *ProjectsTopicsTestIamPermissionsCall) Header() http.Header {
  3085  	if c.header_ == nil {
  3086  		c.header_ = make(http.Header)
  3087  	}
  3088  	return c.header_
  3089  }
  3090  
  3091  func (c *ProjectsTopicsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  3092  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3093  	var body io.Reader = nil
  3094  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  3095  	if err != nil {
  3096  		return nil, err
  3097  	}
  3098  	c.urlParams_.Set("alt", alt)
  3099  	c.urlParams_.Set("prettyPrint", "false")
  3100  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions")
  3101  	urls += "?" + c.urlParams_.Encode()
  3102  	req, err := http.NewRequest("POST", urls, body)
  3103  	if err != nil {
  3104  		return nil, err
  3105  	}
  3106  	req.Header = reqHeaders
  3107  	googleapi.Expand(req.URL, map[string]string{
  3108  		"resource": c.resource,
  3109  	})
  3110  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3111  }
  3112  
  3113  // Do executes the "pubsub.projects.topics.testIamPermissions" call.
  3114  // Any non-2xx status code is an error. Response headers are in either
  3115  // *TestIamPermissionsResponse.ServerResponse.Header or (if a response was
  3116  // returned at all) in error.(*googleapi.Error).Header. Use
  3117  // googleapi.IsNotModified to check whether the returned error was because
  3118  // http.StatusNotModified was returned.
  3119  func (c *ProjectsTopicsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  3120  	gensupport.SetOptions(c.urlParams_, opts...)
  3121  	res, err := c.doRequest("json")
  3122  	if res != nil && res.StatusCode == http.StatusNotModified {
  3123  		if res.Body != nil {
  3124  			res.Body.Close()
  3125  		}
  3126  		return nil, gensupport.WrapError(&googleapi.Error{
  3127  			Code:   res.StatusCode,
  3128  			Header: res.Header,
  3129  		})
  3130  	}
  3131  	if err != nil {
  3132  		return nil, err
  3133  	}
  3134  	defer googleapi.CloseBody(res)
  3135  	if err := googleapi.CheckResponse(res); err != nil {
  3136  		return nil, gensupport.WrapError(err)
  3137  	}
  3138  	ret := &TestIamPermissionsResponse{
  3139  		ServerResponse: googleapi.ServerResponse{
  3140  			Header:         res.Header,
  3141  			HTTPStatusCode: res.StatusCode,
  3142  		},
  3143  	}
  3144  	target := &ret
  3145  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3146  		return nil, err
  3147  	}
  3148  	return ret, nil
  3149  }
  3150  
  3151  type ProjectsTopicsSubscriptionsListCall struct {
  3152  	s            *Service
  3153  	topic        string
  3154  	urlParams_   gensupport.URLParams
  3155  	ifNoneMatch_ string
  3156  	ctx_         context.Context
  3157  	header_      http.Header
  3158  }
  3159  
  3160  // List: Lists the name of the subscriptions for this topic.
  3161  //
  3162  // - topic: The name of the topic that subscriptions are attached to.
  3163  func (r *ProjectsTopicsSubscriptionsService) List(topic string) *ProjectsTopicsSubscriptionsListCall {
  3164  	c := &ProjectsTopicsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3165  	c.topic = topic
  3166  	return c
  3167  }
  3168  
  3169  // PageSize sets the optional parameter "pageSize": Maximum number of
  3170  // subscription names to return.
  3171  func (c *ProjectsTopicsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsTopicsSubscriptionsListCall {
  3172  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3173  	return c
  3174  }
  3175  
  3176  // PageToken sets the optional parameter "pageToken": The value returned by the
  3177  // last `ListTopicSubscriptionsResponse`; indicates that this is a continuation
  3178  // of a prior `ListTopicSubscriptions` call, and that the system should return
  3179  // the next page of data.
  3180  func (c *ProjectsTopicsSubscriptionsListCall) PageToken(pageToken string) *ProjectsTopicsSubscriptionsListCall {
  3181  	c.urlParams_.Set("pageToken", pageToken)
  3182  	return c
  3183  }
  3184  
  3185  // Fields allows partial responses to be retrieved. See
  3186  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3187  // details.
  3188  func (c *ProjectsTopicsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsSubscriptionsListCall {
  3189  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3190  	return c
  3191  }
  3192  
  3193  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  3194  // object's ETag matches the given value. This is useful for getting updates
  3195  // only after the object has changed since the last request.
  3196  func (c *ProjectsTopicsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsSubscriptionsListCall {
  3197  	c.ifNoneMatch_ = entityTag
  3198  	return c
  3199  }
  3200  
  3201  // Context sets the context to be used in this call's Do method.
  3202  func (c *ProjectsTopicsSubscriptionsListCall) Context(ctx context.Context) *ProjectsTopicsSubscriptionsListCall {
  3203  	c.ctx_ = ctx
  3204  	return c
  3205  }
  3206  
  3207  // Header returns a http.Header that can be modified by the caller to add
  3208  // headers to the request.
  3209  func (c *ProjectsTopicsSubscriptionsListCall) Header() http.Header {
  3210  	if c.header_ == nil {
  3211  		c.header_ = make(http.Header)
  3212  	}
  3213  	return c.header_
  3214  }
  3215  
  3216  func (c *ProjectsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
  3217  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3218  	if c.ifNoneMatch_ != "" {
  3219  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3220  	}
  3221  	var body io.Reader = nil
  3222  	c.urlParams_.Set("alt", alt)
  3223  	c.urlParams_.Set("prettyPrint", "false")
  3224  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}/subscriptions")
  3225  	urls += "?" + c.urlParams_.Encode()
  3226  	req, err := http.NewRequest("GET", urls, body)
  3227  	if err != nil {
  3228  		return nil, err
  3229  	}
  3230  	req.Header = reqHeaders
  3231  	googleapi.Expand(req.URL, map[string]string{
  3232  		"topic": c.topic,
  3233  	})
  3234  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3235  }
  3236  
  3237  // Do executes the "pubsub.projects.topics.subscriptions.list" call.
  3238  // Any non-2xx status code is an error. Response headers are in either
  3239  // *ListTopicSubscriptionsResponse.ServerResponse.Header or (if a response was
  3240  // returned at all) in error.(*googleapi.Error).Header. Use
  3241  // googleapi.IsNotModified to check whether the returned error was because
  3242  // http.StatusNotModified was returned.
  3243  func (c *ProjectsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListTopicSubscriptionsResponse, error) {
  3244  	gensupport.SetOptions(c.urlParams_, opts...)
  3245  	res, err := c.doRequest("json")
  3246  	if res != nil && res.StatusCode == http.StatusNotModified {
  3247  		if res.Body != nil {
  3248  			res.Body.Close()
  3249  		}
  3250  		return nil, gensupport.WrapError(&googleapi.Error{
  3251  			Code:   res.StatusCode,
  3252  			Header: res.Header,
  3253  		})
  3254  	}
  3255  	if err != nil {
  3256  		return nil, err
  3257  	}
  3258  	defer googleapi.CloseBody(res)
  3259  	if err := googleapi.CheckResponse(res); err != nil {
  3260  		return nil, gensupport.WrapError(err)
  3261  	}
  3262  	ret := &ListTopicSubscriptionsResponse{
  3263  		ServerResponse: googleapi.ServerResponse{
  3264  			Header:         res.Header,
  3265  			HTTPStatusCode: res.StatusCode,
  3266  		},
  3267  	}
  3268  	target := &ret
  3269  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3270  		return nil, err
  3271  	}
  3272  	return ret, nil
  3273  }
  3274  
  3275  // Pages invokes f for each page of results.
  3276  // A non-nil error returned from f will halt the iteration.
  3277  // The provided context supersedes any context provided to the Context method.
  3278  func (c *ProjectsTopicsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListTopicSubscriptionsResponse) error) error {
  3279  	c.ctx_ = ctx
  3280  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  3281  	for {
  3282  		x, err := c.Do()
  3283  		if err != nil {
  3284  			return err
  3285  		}
  3286  		if err := f(x); err != nil {
  3287  			return err
  3288  		}
  3289  		if x.NextPageToken == "" {
  3290  			return nil
  3291  		}
  3292  		c.PageToken(x.NextPageToken)
  3293  	}
  3294  }
  3295  

View as plain text