1// Copyright 2021 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// Creating a client 14// 15// Usage example: 16// 17// import "google.golang.org/api/pubsub/v1beta2" 18// ... 19// ctx := context.Background() 20// pubsubService, err := pubsub.NewService(ctx) 21// 22// In this example, Google Application Default Credentials are used for authentication. 23// 24// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 25// 26// Other authentication options 27// 28// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 29// 30// pubsubService, err := pubsub.NewService(ctx, option.WithScopes(pubsub.PubsubScope)) 31// 32// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 33// 34// pubsubService, err := pubsub.NewService(ctx, option.WithAPIKey("AIza...")) 35// 36// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 37// 38// config := &oauth2.Config{...} 39// // ... 40// token, err := config.Exchange(ctx, ...) 41// pubsubService, err := pubsub.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 42// 43// See https://godoc.org/google.golang.org/api/option/ for details on options. 44package pubsub // import "google.golang.org/api/pubsub/v1beta2" 45 46import ( 47 "bytes" 48 "context" 49 "encoding/json" 50 "errors" 51 "fmt" 52 "io" 53 "net/http" 54 "net/url" 55 "strconv" 56 "strings" 57 58 googleapi "google.golang.org/api/googleapi" 59 gensupport "google.golang.org/api/internal/gensupport" 60 option "google.golang.org/api/option" 61 internaloption "google.golang.org/api/option/internaloption" 62 htransport "google.golang.org/api/transport/http" 63) 64 65// Always reference these packages, just in case the auto-generated code 66// below doesn't. 67var _ = bytes.NewBuffer 68var _ = strconv.Itoa 69var _ = fmt.Sprintf 70var _ = json.NewDecoder 71var _ = io.Copy 72var _ = url.Parse 73var _ = gensupport.MarshalJSON 74var _ = googleapi.Version 75var _ = errors.New 76var _ = strings.Replace 77var _ = context.Canceled 78var _ = internaloption.WithDefaultEndpoint 79 80const apiId = "pubsub:v1beta2" 81const apiName = "pubsub" 82const apiVersion = "v1beta2" 83const basePath = "https://pubsub.googleapis.com/" 84const mtlsBasePath = "https://pubsub.mtls.googleapis.com/" 85 86// OAuth2 scopes used by this API. 87const ( 88 // See, edit, configure, and delete your Google Cloud data and see the 89 // email address for your Google Account. 90 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 91 92 // View and manage Pub/Sub topics and subscriptions 93 PubsubScope = "https://www.googleapis.com/auth/pubsub" 94) 95 96// NewService creates a new Service. 97func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 98 scopesOption := option.WithScopes( 99 "https://www.googleapis.com/auth/cloud-platform", 100 "https://www.googleapis.com/auth/pubsub", 101 ) 102 // NOTE: prepend, so we don't override user-specified scopes. 103 opts = append([]option.ClientOption{scopesOption}, opts...) 104 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 105 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 106 client, endpoint, err := htransport.NewClient(ctx, opts...) 107 if err != nil { 108 return nil, err 109 } 110 s, err := New(client) 111 if err != nil { 112 return nil, err 113 } 114 if endpoint != "" { 115 s.BasePath = endpoint 116 } 117 return s, nil 118} 119 120// New creates a new Service. It uses the provided http.Client for requests. 121// 122// Deprecated: please use NewService instead. 123// To provide a custom HTTP client, use option.WithHTTPClient. 124// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 125func New(client *http.Client) (*Service, error) { 126 if client == nil { 127 return nil, errors.New("client is nil") 128 } 129 s := &Service{client: client, BasePath: basePath} 130 s.Projects = NewProjectsService(s) 131 return s, nil 132} 133 134type Service struct { 135 client *http.Client 136 BasePath string // API endpoint base URL 137 UserAgent string // optional additional User-Agent fragment 138 139 Projects *ProjectsService 140} 141 142func (s *Service) userAgent() string { 143 if s.UserAgent == "" { 144 return googleapi.UserAgent 145 } 146 return googleapi.UserAgent + " " + s.UserAgent 147} 148 149func NewProjectsService(s *Service) *ProjectsService { 150 rs := &ProjectsService{s: s} 151 rs.Subscriptions = NewProjectsSubscriptionsService(s) 152 rs.Topics = NewProjectsTopicsService(s) 153 return rs 154} 155 156type ProjectsService struct { 157 s *Service 158 159 Subscriptions *ProjectsSubscriptionsService 160 161 Topics *ProjectsTopicsService 162} 163 164func NewProjectsSubscriptionsService(s *Service) *ProjectsSubscriptionsService { 165 rs := &ProjectsSubscriptionsService{s: s} 166 return rs 167} 168 169type ProjectsSubscriptionsService struct { 170 s *Service 171} 172 173func NewProjectsTopicsService(s *Service) *ProjectsTopicsService { 174 rs := &ProjectsTopicsService{s: s} 175 rs.Subscriptions = NewProjectsTopicsSubscriptionsService(s) 176 return rs 177} 178 179type ProjectsTopicsService struct { 180 s *Service 181 182 Subscriptions *ProjectsTopicsSubscriptionsService 183} 184 185func NewProjectsTopicsSubscriptionsService(s *Service) *ProjectsTopicsSubscriptionsService { 186 rs := &ProjectsTopicsSubscriptionsService{s: s} 187 return rs 188} 189 190type ProjectsTopicsSubscriptionsService struct { 191 s *Service 192} 193 194// AcknowledgeRequest: Request for the Acknowledge method. 195type AcknowledgeRequest struct { 196 // AckIds: The acknowledgment ID for the messages being acknowledged 197 // that was returned by the Pub/Sub system in the `Pull` response. Must 198 // not be empty. 199 AckIds []string `json:"ackIds,omitempty"` 200 201 // ForceSendFields is a list of field names (e.g. "AckIds") to 202 // unconditionally include in API requests. By default, fields with 203 // empty or default values are omitted from API requests. However, any 204 // non-pointer, non-interface field appearing in ForceSendFields will be 205 // sent to the server regardless of whether the field is empty or not. 206 // This may be used to include empty fields in Patch requests. 207 ForceSendFields []string `json:"-"` 208 209 // NullFields is a list of field names (e.g. "AckIds") to include in API 210 // requests with the JSON null value. By default, fields with empty 211 // values are omitted from API requests. However, any field with an 212 // empty value appearing in NullFields will be sent to the server as 213 // null. It is an error if a field in this list has a non-empty value. 214 // This may be used to include null fields in Patch requests. 215 NullFields []string `json:"-"` 216} 217 218func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) { 219 type NoMethod AcknowledgeRequest 220 raw := NoMethod(*s) 221 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 222} 223 224// Binding: Associates `members` with a `role`. 225type Binding struct { 226 // Condition: The condition that is associated with this binding. If the 227 // condition evaluates to `true`, then this binding applies to the 228 // current request. If the condition evaluates to `false`, then this 229 // binding does not apply to the current request. However, a different 230 // role binding might grant the same role to one or more of the members 231 // in this binding. To learn which resources support conditions in their 232 // IAM policies, see the IAM documentation 233 // (https://cloud.google.com/iam/help/conditions/resource-policies). 234 Condition *Expr `json:"condition,omitempty"` 235 236 // Members: Specifies the identities requesting access for a Cloud 237 // Platform resource. `members` can have the following values: * 238 // `allUsers`: A special identifier that represents anyone who is on the 239 // internet; with or without a Google account. * 240 // `allAuthenticatedUsers`: A special identifier that represents anyone 241 // who is authenticated with a Google account or a service account. * 242 // `user:{emailid}`: An email address that represents a specific Google 243 // account. For example, `alice@example.com` . * 244 // `serviceAccount:{emailid}`: An email address that represents a 245 // service account. For example, 246 // `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An 247 // email address that represents a Google group. For example, 248 // `admins@example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An 249 // email address (plus unique identifier) representing a user that has 250 // been recently deleted. For example, 251 // `alice@example.com?uid=123456789012345678901`. If the user is 252 // recovered, this value reverts to `user:{emailid}` and the recovered 253 // user retains the role in the binding. * 254 // `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address 255 // (plus unique identifier) representing a service account that has been 256 // recently deleted. For example, 257 // `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. 258 // If the service account is undeleted, this value reverts to 259 // `serviceAccount:{emailid}` and the undeleted service account retains 260 // the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: 261 // An email address (plus unique identifier) representing a Google group 262 // that has been recently deleted. For example, 263 // `admins@example.com?uid=123456789012345678901`. If the group is 264 // recovered, this value reverts to `group:{emailid}` and the recovered 265 // group retains the role in the binding. * `domain:{domain}`: The G 266 // Suite domain (primary) that represents all the users of that domain. 267 // For example, `google.com` or `example.com`. 268 Members []string `json:"members,omitempty"` 269 270 // Role: Role that is assigned to `members`. For example, 271 // `roles/viewer`, `roles/editor`, or `roles/owner`. 272 Role string `json:"role,omitempty"` 273 274 // ForceSendFields is a list of field names (e.g. "Condition") to 275 // unconditionally include in API requests. By default, fields with 276 // empty or default values are omitted from API requests. However, any 277 // non-pointer, non-interface field appearing in ForceSendFields will be 278 // sent to the server regardless of whether the field is empty or not. 279 // This may be used to include empty fields in Patch requests. 280 ForceSendFields []string `json:"-"` 281 282 // NullFields is a list of field names (e.g. "Condition") to include in 283 // API requests with the JSON null value. By default, fields with empty 284 // values are omitted from API requests. However, any field with an 285 // empty value appearing in NullFields will be sent to the server as 286 // null. It is an error if a field in this list has a non-empty value. 287 // This may be used to include null fields in Patch requests. 288 NullFields []string `json:"-"` 289} 290 291func (s *Binding) MarshalJSON() ([]byte, error) { 292 type NoMethod Binding 293 raw := NoMethod(*s) 294 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 295} 296 297// Empty: A generic empty message that you can re-use to avoid defining 298// duplicated empty messages in your APIs. A typical example is to use 299// it as the request or the response type of an API method. For 300// instance: service Foo { rpc Bar(google.protobuf.Empty) returns 301// (google.protobuf.Empty); } The JSON representation for `Empty` is 302// empty JSON object `{}`. 303type Empty struct { 304 // ServerResponse contains the HTTP response code and headers from the 305 // server. 306 googleapi.ServerResponse `json:"-"` 307} 308 309// Expr: Represents a textual expression in the Common Expression 310// Language (CEL) syntax. CEL is a C-like expression language. The 311// syntax and semantics of CEL are documented at 312// https://github.com/google/cel-spec. Example (Comparison): title: 313// "Summary size limit" description: "Determines if a summary is less 314// than 100 chars" expression: "document.summary.size() < 100" Example 315// (Equality): title: "Requestor is owner" description: "Determines if 316// requestor is the document owner" expression: "document.owner == 317// request.auth.claims.email" Example (Logic): title: "Public documents" 318// description: "Determine whether the document should be publicly 319// visible" expression: "document.type != 'private' && document.type != 320// 'internal'" Example (Data Manipulation): title: "Notification string" 321// description: "Create a notification string with a timestamp." 322// expression: "'New message received at ' + 323// string(document.create_time)" The exact variables and functions that 324// may be referenced within an expression are determined by the service 325// that evaluates it. See the service documentation for additional 326// information. 327type Expr struct { 328 // Description: Optional. Description of the expression. This is a 329 // longer text which describes the expression, e.g. when hovered over it 330 // in a UI. 331 Description string `json:"description,omitempty"` 332 333 // Expression: Textual representation of an expression in Common 334 // Expression Language syntax. 335 Expression string `json:"expression,omitempty"` 336 337 // Location: Optional. String indicating the location of the expression 338 // for error reporting, e.g. a file name and a position in the file. 339 Location string `json:"location,omitempty"` 340 341 // Title: Optional. Title for the expression, i.e. a short string 342 // describing its purpose. This can be used e.g. in UIs which allow to 343 // enter the expression. 344 Title string `json:"title,omitempty"` 345 346 // ForceSendFields is a list of field names (e.g. "Description") to 347 // unconditionally include in API requests. By default, fields with 348 // empty or default values are omitted from API requests. However, any 349 // non-pointer, non-interface field appearing in ForceSendFields will be 350 // sent to the server regardless of whether the field is empty or not. 351 // This may be used to include empty fields in Patch requests. 352 ForceSendFields []string `json:"-"` 353 354 // NullFields is a list of field names (e.g. "Description") to include 355 // in API requests with the JSON null value. By default, fields with 356 // empty values are omitted from API requests. However, any field with 357 // an empty value appearing in NullFields will be sent to the server as 358 // null. It is an error if a field in this list has a non-empty value. 359 // This may be used to include null fields in Patch requests. 360 NullFields []string `json:"-"` 361} 362 363func (s *Expr) MarshalJSON() ([]byte, error) { 364 type NoMethod Expr 365 raw := NoMethod(*s) 366 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 367} 368 369// ListSubscriptionsResponse: Response for the `ListSubscriptions` 370// method. 371type ListSubscriptionsResponse struct { 372 // NextPageToken: If not empty, indicates that there may be more 373 // subscriptions that match the request; this value should be passed in 374 // a new `ListSubscriptionsRequest` to get more subscriptions. 375 NextPageToken string `json:"nextPageToken,omitempty"` 376 377 // Subscriptions: The subscriptions that match the request. 378 Subscriptions []*Subscription `json:"subscriptions,omitempty"` 379 380 // ServerResponse contains the HTTP response code and headers from the 381 // server. 382 googleapi.ServerResponse `json:"-"` 383 384 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 385 // unconditionally include in API requests. By default, fields with 386 // empty or default values are omitted from API requests. However, any 387 // non-pointer, non-interface field appearing in ForceSendFields will be 388 // sent to the server regardless of whether the field is empty or not. 389 // This may be used to include empty fields in Patch requests. 390 ForceSendFields []string `json:"-"` 391 392 // NullFields is a list of field names (e.g. "NextPageToken") to include 393 // in API requests with the JSON null value. By default, fields with 394 // empty values are omitted from API requests. However, any field with 395 // an empty value appearing in NullFields will be sent to the server as 396 // null. It is an error if a field in this list has a non-empty value. 397 // This may be used to include null fields in Patch requests. 398 NullFields []string `json:"-"` 399} 400 401func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) { 402 type NoMethod ListSubscriptionsResponse 403 raw := NoMethod(*s) 404 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 405} 406 407// ListTopicSubscriptionsResponse: Response for the 408// `ListTopicSubscriptions` method. 409type ListTopicSubscriptionsResponse struct { 410 // NextPageToken: If not empty, indicates that there may be more 411 // subscriptions that match the request; this value should be passed in 412 // a new `ListTopicSubscriptionsRequest` to get more subscriptions. 413 NextPageToken string `json:"nextPageToken,omitempty"` 414 415 // Subscriptions: The names of the subscriptions that match the request. 416 Subscriptions []string `json:"subscriptions,omitempty"` 417 418 // ServerResponse contains the HTTP response code and headers from the 419 // server. 420 googleapi.ServerResponse `json:"-"` 421 422 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 423 // unconditionally include in API requests. By default, fields with 424 // empty or default values are omitted from API requests. However, any 425 // non-pointer, non-interface field appearing in ForceSendFields will be 426 // sent to the server regardless of whether the field is empty or not. 427 // This may be used to include empty fields in Patch requests. 428 ForceSendFields []string `json:"-"` 429 430 // NullFields is a list of field names (e.g. "NextPageToken") to include 431 // in API requests with the JSON null value. By default, fields with 432 // empty values are omitted from API requests. However, any field with 433 // an empty value appearing in NullFields will be sent to the server as 434 // null. It is an error if a field in this list has a non-empty value. 435 // This may be used to include null fields in Patch requests. 436 NullFields []string `json:"-"` 437} 438 439func (s *ListTopicSubscriptionsResponse) MarshalJSON() ([]byte, error) { 440 type NoMethod ListTopicSubscriptionsResponse 441 raw := NoMethod(*s) 442 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 443} 444 445// ListTopicsResponse: Response for the `ListTopics` method. 446type ListTopicsResponse struct { 447 // NextPageToken: If not empty, indicates that there may be more topics 448 // that match the request; this value should be passed in a new 449 // `ListTopicsRequest`. 450 NextPageToken string `json:"nextPageToken,omitempty"` 451 452 // Topics: The resulting topics. 453 Topics []*Topic `json:"topics,omitempty"` 454 455 // ServerResponse contains the HTTP response code and headers from the 456 // server. 457 googleapi.ServerResponse `json:"-"` 458 459 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 460 // unconditionally include in API requests. By default, fields with 461 // empty or default values are omitted from API requests. However, any 462 // non-pointer, non-interface field appearing in ForceSendFields will be 463 // sent to the server regardless of whether the field is empty or not. 464 // This may be used to include empty fields in Patch requests. 465 ForceSendFields []string `json:"-"` 466 467 // NullFields is a list of field names (e.g. "NextPageToken") to include 468 // in API requests with the JSON null value. By default, fields with 469 // empty values are omitted from API requests. However, any field with 470 // an empty value appearing in NullFields will be sent to the server as 471 // null. It is an error if a field in this list has a non-empty value. 472 // This may be used to include null fields in Patch requests. 473 NullFields []string `json:"-"` 474} 475 476func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) { 477 type NoMethod ListTopicsResponse 478 raw := NoMethod(*s) 479 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 480} 481 482// ModifyAckDeadlineRequest: Request for the ModifyAckDeadline method. 483type ModifyAckDeadlineRequest struct { 484 // AckDeadlineSeconds: The new ack deadline with respect to the time 485 // this request was sent to the Pub/Sub system. Must be >= 0. For 486 // example, if the value is 10, the new ack deadline will expire 10 487 // seconds after the `ModifyAckDeadline` call was made. Specifying zero 488 // may immediately make the message available for another pull request. 489 AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"` 490 491 // AckId: The acknowledgment ID. Either this or ack_ids must be 492 // populated, but not both. 493 AckId string `json:"ackId,omitempty"` 494 495 // AckIds: List of acknowledgment IDs. 496 AckIds []string `json:"ackIds,omitempty"` 497 498 // ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds") 499 // to unconditionally include in API requests. By default, fields with 500 // empty or default values are omitted from API requests. However, any 501 // non-pointer, non-interface field appearing in ForceSendFields will be 502 // sent to the server regardless of whether the field is empty or not. 503 // This may be used to include empty fields in Patch requests. 504 ForceSendFields []string `json:"-"` 505 506 // NullFields is a list of field names (e.g. "AckDeadlineSeconds") to 507 // include in API requests with the JSON null value. By default, fields 508 // with empty values are omitted from API requests. However, any field 509 // with an empty value appearing in NullFields will be sent to the 510 // server as null. It is an error if a field in this list has a 511 // non-empty value. This may be used to include null fields in Patch 512 // requests. 513 NullFields []string `json:"-"` 514} 515 516func (s *ModifyAckDeadlineRequest) MarshalJSON() ([]byte, error) { 517 type NoMethod ModifyAckDeadlineRequest 518 raw := NoMethod(*s) 519 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 520} 521 522// ModifyPushConfigRequest: Request for the ModifyPushConfig method. 523type ModifyPushConfigRequest struct { 524 // PushConfig: The push configuration for future deliveries. An empty 525 // `pushConfig` indicates that the Pub/Sub system should stop pushing 526 // messages from the given subscription and allow messages to be pulled 527 // and acknowledged - effectively pausing the subscription if `Pull` is 528 // not called. 529 PushConfig *PushConfig `json:"pushConfig,omitempty"` 530 531 // ForceSendFields is a list of field names (e.g. "PushConfig") to 532 // unconditionally include in API requests. By default, fields with 533 // empty or default values are omitted from API requests. However, any 534 // non-pointer, non-interface field appearing in ForceSendFields will be 535 // sent to the server regardless of whether the field is empty or not. 536 // This may be used to include empty fields in Patch requests. 537 ForceSendFields []string `json:"-"` 538 539 // NullFields is a list of field names (e.g. "PushConfig") to include in 540 // API requests with the JSON null value. By default, fields with empty 541 // values are omitted from API requests. However, any field with an 542 // empty value appearing in NullFields will be sent to the server as 543 // null. It is an error if a field in this list has a non-empty value. 544 // This may be used to include null fields in Patch requests. 545 NullFields []string `json:"-"` 546} 547 548func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) { 549 type NoMethod ModifyPushConfigRequest 550 raw := NoMethod(*s) 551 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 552} 553 554// OidcToken: Contains information needed for generating an OpenID 555// Connect token 556// (https://developers.google.com/identity/protocols/OpenIDConnect). 557type OidcToken struct { 558 // Audience: Audience to be used when generating OIDC token. The 559 // audience claim identifies the recipients that the JWT is intended 560 // for. The audience value is a single case-sensitive string. Having 561 // multiple values (array) for the audience field is not supported. More 562 // info about the OIDC JWT token audience here: 563 // https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not 564 // specified, the Push endpoint URL will be used. 565 Audience string `json:"audience,omitempty"` 566 567 // ServiceAccountEmail: Service account email 568 // (https://cloud.google.com/iam/docs/service-accounts) to be used for 569 // generating the OIDC token. The caller (for CreateSubscription, 570 // UpdateSubscription, and ModifyPushConfig RPCs) must have the 571 // iam.serviceAccounts.actAs permission for the service account. 572 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 573 574 // ForceSendFields is a list of field names (e.g. "Audience") to 575 // unconditionally include in API requests. By default, fields with 576 // empty or default values are omitted from API requests. However, any 577 // non-pointer, non-interface field appearing in ForceSendFields will be 578 // sent to the server regardless of whether the field is empty or not. 579 // This may be used to include empty fields in Patch requests. 580 ForceSendFields []string `json:"-"` 581 582 // NullFields is a list of field names (e.g. "Audience") to include in 583 // API requests with the JSON null value. By default, fields with empty 584 // values are omitted from API requests. However, any field with an 585 // empty value appearing in NullFields will be sent to the server as 586 // null. It is an error if a field in this list has a non-empty value. 587 // This may be used to include null fields in Patch requests. 588 NullFields []string `json:"-"` 589} 590 591func (s *OidcToken) MarshalJSON() ([]byte, error) { 592 type NoMethod OidcToken 593 raw := NoMethod(*s) 594 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 595} 596 597// Policy: An Identity and Access Management (IAM) policy, which 598// specifies access controls for Google Cloud resources. A `Policy` is a 599// collection of `bindings`. A `binding` binds one or more `members` to 600// a single `role`. Members can be user accounts, service accounts, 601// Google groups, and domains (such as G Suite). A `role` is a named 602// list of permissions; each `role` can be an IAM predefined role or a 603// user-created custom role. For some types of Google Cloud resources, a 604// `binding` can also specify a `condition`, which is a logical 605// expression that allows access to a resource only if the expression 606// evaluates to `true`. A condition can add constraints based on 607// attributes of the request, the resource, or both. To learn which 608// resources support conditions in their IAM policies, see the IAM 609// documentation 610// (https://cloud.google.com/iam/help/conditions/resource-policies). 611// **JSON example:** { "bindings": [ { "role": 612// "roles/resourcemanager.organizationAdmin", "members": [ 613// "user:mike@example.com", "group:admins@example.com", 614// "domain:google.com", 615// "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { 616// "role": "roles/resourcemanager.organizationViewer", "members": [ 617// "user:eve@example.com" ], "condition": { "title": "expirable access", 618// "description": "Does not grant access after Sep 2020", "expression": 619// "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], 620// "etag": "BwWWja0YfJA=", "version": 3 } **YAML example:** bindings: - 621// members: - user:mike@example.com - group:admins@example.com - 622// domain:google.com - 623// serviceAccount:my-project-id@appspot.gserviceaccount.com role: 624// roles/resourcemanager.organizationAdmin - members: - 625// user:eve@example.com role: roles/resourcemanager.organizationViewer 626// condition: title: expirable access description: Does not grant access 627// after Sep 2020 expression: request.time < 628// timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3 629// For a description of IAM and its features, see the IAM documentation 630// (https://cloud.google.com/iam/docs/). 631type Policy struct { 632 // Bindings: Associates a list of `members` to a `role`. Optionally, may 633 // specify a `condition` that determines how and when the `bindings` are 634 // applied. Each of the `bindings` must contain at least one member. 635 Bindings []*Binding `json:"bindings,omitempty"` 636 637 // Etag: `etag` is used for optimistic concurrency control as a way to 638 // help prevent simultaneous updates of a policy from overwriting each 639 // other. It is strongly suggested that systems make use of the `etag` 640 // in the read-modify-write cycle to perform policy updates in order to 641 // avoid race conditions: An `etag` is returned in the response to 642 // `getIamPolicy`, and systems are expected to put that etag in the 643 // request to `setIamPolicy` to ensure that their change will be applied 644 // to the same version of the policy. **Important:** If you use IAM 645 // Conditions, you must include the `etag` field whenever you call 646 // `setIamPolicy`. If you omit this field, then IAM allows you to 647 // overwrite a version `3` policy with a version `1` policy, and all of 648 // the conditions in the version `3` policy are lost. 649 Etag string `json:"etag,omitempty"` 650 651 // Version: Specifies the format of the policy. Valid values are `0`, 652 // `1`, and `3`. Requests that specify an invalid value are rejected. 653 // Any operation that affects conditional role bindings must specify 654 // version `3`. This requirement applies to the following operations: * 655 // Getting a policy that includes a conditional role binding * Adding a 656 // conditional role binding to a policy * Changing a conditional role 657 // binding in a policy * Removing any role binding, with or without a 658 // condition, from a policy that includes conditions **Important:** If 659 // you use IAM Conditions, you must include the `etag` field whenever 660 // you call `setIamPolicy`. If you omit this field, then IAM allows you 661 // to overwrite a version `3` policy with a version `1` policy, and all 662 // of the conditions in the version `3` policy are lost. If a policy 663 // does not include any conditions, operations on that policy may 664 // specify any valid version or leave the field unset. To learn which 665 // resources support conditions in their IAM policies, see the IAM 666 // documentation 667 // (https://cloud.google.com/iam/help/conditions/resource-policies). 668 Version int64 `json:"version,omitempty"` 669 670 // ServerResponse contains the HTTP response code and headers from the 671 // server. 672 googleapi.ServerResponse `json:"-"` 673 674 // ForceSendFields is a list of field names (e.g. "Bindings") to 675 // unconditionally include in API requests. By default, fields with 676 // empty or default values are omitted from API requests. However, any 677 // non-pointer, non-interface field appearing in ForceSendFields will be 678 // sent to the server regardless of whether the field is empty or not. 679 // This may be used to include empty fields in Patch requests. 680 ForceSendFields []string `json:"-"` 681 682 // NullFields is a list of field names (e.g. "Bindings") to include in 683 // API requests with the JSON null value. By default, fields with empty 684 // values are omitted from API requests. However, any field with an 685 // empty value appearing in NullFields will be sent to the server as 686 // null. It is an error if a field in this list has a non-empty value. 687 // This may be used to include null fields in Patch requests. 688 NullFields []string `json:"-"` 689} 690 691func (s *Policy) MarshalJSON() ([]byte, error) { 692 type NoMethod Policy 693 raw := NoMethod(*s) 694 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 695} 696 697// PublishRequest: Request for the Publish method. 698type PublishRequest struct { 699 // Messages: The messages to publish. 700 Messages []*PubsubMessage `json:"messages,omitempty"` 701 702 // ForceSendFields is a list of field names (e.g. "Messages") to 703 // unconditionally include in API requests. By default, fields with 704 // empty or default values are omitted from API requests. However, any 705 // non-pointer, non-interface field appearing in ForceSendFields will be 706 // sent to the server regardless of whether the field is empty or not. 707 // This may be used to include empty fields in Patch requests. 708 ForceSendFields []string `json:"-"` 709 710 // NullFields is a list of field names (e.g. "Messages") to include in 711 // API requests with the JSON null value. By default, fields with empty 712 // values are omitted from API requests. However, any field with an 713 // empty value appearing in NullFields will be sent to the server as 714 // null. It is an error if a field in this list has a non-empty value. 715 // This may be used to include null fields in Patch requests. 716 NullFields []string `json:"-"` 717} 718 719func (s *PublishRequest) MarshalJSON() ([]byte, error) { 720 type NoMethod PublishRequest 721 raw := NoMethod(*s) 722 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 723} 724 725// PublishResponse: Response for the `Publish` method. 726type PublishResponse struct { 727 // MessageIds: The server-assigned ID of each published message, in the 728 // same order as the messages in the request. IDs are guaranteed to be 729 // unique within the topic. 730 MessageIds []string `json:"messageIds,omitempty"` 731 732 // ServerResponse contains the HTTP response code and headers from the 733 // server. 734 googleapi.ServerResponse `json:"-"` 735 736 // ForceSendFields is a list of field names (e.g. "MessageIds") to 737 // unconditionally include in API requests. By default, fields with 738 // empty or default values are omitted from API requests. However, any 739 // non-pointer, non-interface field appearing in ForceSendFields will be 740 // sent to the server regardless of whether the field is empty or not. 741 // This may be used to include empty fields in Patch requests. 742 ForceSendFields []string `json:"-"` 743 744 // NullFields is a list of field names (e.g. "MessageIds") to include in 745 // API requests with the JSON null value. By default, fields with empty 746 // values are omitted from API requests. However, any field with an 747 // empty value appearing in NullFields will be sent to the server as 748 // null. It is an error if a field in this list has a non-empty value. 749 // This may be used to include null fields in Patch requests. 750 NullFields []string `json:"-"` 751} 752 753func (s *PublishResponse) MarshalJSON() ([]byte, error) { 754 type NoMethod PublishResponse 755 raw := NoMethod(*s) 756 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 757} 758 759// PubsubMessage: A message data and its attributes. The message payload 760// must not be empty; it must contain either a non-empty data field, or 761// at least one attribute. 762type PubsubMessage struct { 763 // Attributes: Optional attributes for this message. 764 Attributes map[string]string `json:"attributes,omitempty"` 765 766 // Data: The message payload. For JSON requests, the value of this field 767 // must be base64-encoded (https://tools.ietf.org/html/rfc4648). 768 Data string `json:"data,omitempty"` 769 770 // MessageId: ID of this message, assigned by the server when the 771 // message is published. Guaranteed to be unique within the topic. This 772 // value may be read by a subscriber that receives a `PubsubMessage` via 773 // a `Pull` call or a push delivery. It must not be populated by the 774 // publisher in a `Publish` call. 775 MessageId string `json:"messageId,omitempty"` 776 777 // PublishTime: The time at which the message was published, populated 778 // by the server when it receives the `Publish` call. It must not be 779 // populated by the publisher in a `Publish` call. 780 PublishTime string `json:"publishTime,omitempty"` 781 782 // ForceSendFields is a list of field names (e.g. "Attributes") to 783 // unconditionally include in API requests. By default, fields with 784 // empty or default values are omitted from API requests. However, any 785 // non-pointer, non-interface field appearing in ForceSendFields will be 786 // sent to the server regardless of whether the field is empty or not. 787 // This may be used to include empty fields in Patch requests. 788 ForceSendFields []string `json:"-"` 789 790 // NullFields is a list of field names (e.g. "Attributes") to include in 791 // API requests with the JSON null value. By default, fields with empty 792 // values are omitted from API requests. However, any field with an 793 // empty value appearing in NullFields will be sent to the server as 794 // null. It is an error if a field in this list has a non-empty value. 795 // This may be used to include null fields in Patch requests. 796 NullFields []string `json:"-"` 797} 798 799func (s *PubsubMessage) MarshalJSON() ([]byte, error) { 800 type NoMethod PubsubMessage 801 raw := NoMethod(*s) 802 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 803} 804 805// PullRequest: Request for the `Pull` method. 806type PullRequest struct { 807 // MaxMessages: The maximum number of messages returned for this 808 // request. The Pub/Sub system may return fewer than the number 809 // specified. 810 MaxMessages int64 `json:"maxMessages,omitempty"` 811 812 // ReturnImmediately: Optional. If this is specified as true the system 813 // will respond immediately even if it is not able to return a message 814 // in the `Pull` response. Otherwise the system is allowed to wait until 815 // at least one message is available rather than returning no messages. 816 // The client may cancel the request if it does not wish to wait any 817 // longer for the response. Warning: setting this field to `true` is 818 // discouraged because it adversely impacts the performance of `Pull` 819 // operations. We recommend that users do not set this field. 820 ReturnImmediately bool `json:"returnImmediately,omitempty"` 821 822 // ForceSendFields is a list of field names (e.g. "MaxMessages") to 823 // unconditionally include in API requests. By default, fields with 824 // empty or default values are omitted from API requests. However, any 825 // non-pointer, non-interface field appearing in ForceSendFields will be 826 // sent to the server regardless of whether the field is empty or not. 827 // This may be used to include empty fields in Patch requests. 828 ForceSendFields []string `json:"-"` 829 830 // NullFields is a list of field names (e.g. "MaxMessages") to include 831 // in API requests with the JSON null value. By default, fields with 832 // empty values are omitted from API requests. However, any field with 833 // an empty value appearing in NullFields will be sent to the server as 834 // null. It is an error if a field in this list has a non-empty value. 835 // This may be used to include null fields in Patch requests. 836 NullFields []string `json:"-"` 837} 838 839func (s *PullRequest) MarshalJSON() ([]byte, error) { 840 type NoMethod PullRequest 841 raw := NoMethod(*s) 842 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 843} 844 845// PullResponse: Response for the `Pull` method. 846type PullResponse struct { 847 // ReceivedMessages: Received Pub/Sub messages. The Pub/Sub system will 848 // return zero messages if there are no more available in the backlog. 849 // The Pub/Sub system may return fewer than the `maxMessages` requested 850 // even if there are more messages available in the backlog. 851 ReceivedMessages []*ReceivedMessage `json:"receivedMessages,omitempty"` 852 853 // ServerResponse contains the HTTP response code and headers from the 854 // server. 855 googleapi.ServerResponse `json:"-"` 856 857 // ForceSendFields is a list of field names (e.g. "ReceivedMessages") to 858 // unconditionally include in API requests. By default, fields with 859 // empty or default values are omitted from API requests. However, any 860 // non-pointer, non-interface field appearing in ForceSendFields will be 861 // sent to the server regardless of whether the field is empty or not. 862 // This may be used to include empty fields in Patch requests. 863 ForceSendFields []string `json:"-"` 864 865 // NullFields is a list of field names (e.g. "ReceivedMessages") to 866 // include in API requests with the JSON null value. By default, fields 867 // with empty values are omitted from API requests. However, any field 868 // with an empty value appearing in NullFields will be sent to the 869 // server as null. It is an error if a field in this list has a 870 // non-empty value. This may be used to include null fields in Patch 871 // requests. 872 NullFields []string `json:"-"` 873} 874 875func (s *PullResponse) MarshalJSON() ([]byte, error) { 876 type NoMethod PullResponse 877 raw := NoMethod(*s) 878 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 879} 880 881// PushConfig: Configuration for a push delivery endpoint. 882type PushConfig struct { 883 // Attributes: Endpoint configuration attributes. Every endpoint has a 884 // set of API supported attributes that can be used to control different 885 // aspects of the message delivery. The currently supported attribute is 886 // `x-goog-version`, which you can use to change the format of the push 887 // message. This attribute indicates the version of the data expected by 888 // the endpoint. This controls the shape of the envelope (i.e. its 889 // fields and metadata). The endpoint version is based on the version of 890 // the Pub/Sub API. If not present during the `CreateSubscription` call, 891 // it will default to the version of the API used to make such call. If 892 // not present during a `ModifyPushConfig` call, its value will not be 893 // changed. `GetSubscription` calls will always return a valid version, 894 // even if the subscription was created without this attribute. The 895 // possible values for this attribute are: * `v1beta1`: uses the push 896 // format defined in the v1beta1 Pub/Sub API. * `v1` or `v1beta2`: uses 897 // the push format defined in the v1 Pub/Sub API. 898 Attributes map[string]string `json:"attributes,omitempty"` 899 900 // OidcToken: If specified, Pub/Sub will generate and attach an OIDC JWT 901 // token as an `Authorization` header in the HTTP request for every 902 // pushed message. 903 OidcToken *OidcToken `json:"oidcToken,omitempty"` 904 905 // PushEndpoint: A URL locating the endpoint to which messages should be 906 // pushed. For example, a Webhook endpoint might use 907 // "https://example.com/push". 908 PushEndpoint string `json:"pushEndpoint,omitempty"` 909 910 // ForceSendFields is a list of field names (e.g. "Attributes") to 911 // unconditionally include in API requests. By default, fields with 912 // empty or default values are omitted from API requests. However, any 913 // non-pointer, non-interface field appearing in ForceSendFields will be 914 // sent to the server regardless of whether the field is empty or not. 915 // This may be used to include empty fields in Patch requests. 916 ForceSendFields []string `json:"-"` 917 918 // NullFields is a list of field names (e.g. "Attributes") to include in 919 // API requests with the JSON null value. By default, fields with empty 920 // values are omitted from API requests. However, any field with an 921 // empty value appearing in NullFields will be sent to the server as 922 // null. It is an error if a field in this list has a non-empty value. 923 // This may be used to include null fields in Patch requests. 924 NullFields []string `json:"-"` 925} 926 927func (s *PushConfig) MarshalJSON() ([]byte, error) { 928 type NoMethod PushConfig 929 raw := NoMethod(*s) 930 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 931} 932 933// ReceivedMessage: A message and its corresponding acknowledgment ID. 934type ReceivedMessage struct { 935 // AckId: This ID can be used to acknowledge the received message. 936 AckId string `json:"ackId,omitempty"` 937 938 // Message: The message. 939 Message *PubsubMessage `json:"message,omitempty"` 940 941 // ForceSendFields is a list of field names (e.g. "AckId") to 942 // unconditionally include in API requests. By default, fields with 943 // empty or default values are omitted from API requests. However, any 944 // non-pointer, non-interface field appearing in ForceSendFields will be 945 // sent to the server regardless of whether the field is empty or not. 946 // This may be used to include empty fields in Patch requests. 947 ForceSendFields []string `json:"-"` 948 949 // NullFields is a list of field names (e.g. "AckId") to include in API 950 // requests with the JSON null value. By default, fields with empty 951 // values are omitted from API requests. However, any field with an 952 // empty value appearing in NullFields will be sent to the server as 953 // null. It is an error if a field in this list has a non-empty value. 954 // This may be used to include null fields in Patch requests. 955 NullFields []string `json:"-"` 956} 957 958func (s *ReceivedMessage) MarshalJSON() ([]byte, error) { 959 type NoMethod ReceivedMessage 960 raw := NoMethod(*s) 961 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 962} 963 964// SetIamPolicyRequest: Request message for `SetIamPolicy` method. 965type SetIamPolicyRequest struct { 966 // Policy: REQUIRED: The complete policy to be applied to the 967 // `resource`. The size of the policy is limited to a few 10s of KB. An 968 // empty policy is a valid policy but certain Cloud Platform services 969 // (such as Projects) might reject them. 970 Policy *Policy `json:"policy,omitempty"` 971 972 // ForceSendFields is a list of field names (e.g. "Policy") to 973 // unconditionally include in API requests. By default, fields with 974 // empty or default values are omitted from API requests. However, any 975 // non-pointer, non-interface field appearing in ForceSendFields will be 976 // sent to the server regardless of whether the field is empty or not. 977 // This may be used to include empty fields in Patch requests. 978 ForceSendFields []string `json:"-"` 979 980 // NullFields is a list of field names (e.g. "Policy") to include in API 981 // requests with the JSON null value. By default, fields with empty 982 // values are omitted from API requests. However, any field with an 983 // empty value appearing in NullFields will be sent to the server as 984 // null. It is an error if a field in this list has a non-empty value. 985 // This may be used to include null fields in Patch requests. 986 NullFields []string `json:"-"` 987} 988 989func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) { 990 type NoMethod SetIamPolicyRequest 991 raw := NoMethod(*s) 992 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 993} 994 995// Subscription: A subscription resource. 996type Subscription struct { 997 // AckDeadlineSeconds: This value is the maximum time after a subscriber 998 // receives a message before the subscriber should acknowledge the 999 // message. After message delivery but before the ack deadline expires 1000 // and before the message is acknowledged, it is an outstanding message 1001 // and will not be delivered again during that time (on a best-effort 1002 // basis). For pull subscriptions, this value is used as the initial 1003 // value for the ack deadline. To override this value for a given 1004 // message, call `ModifyAckDeadline` with the corresponding `ack_id` if 1005 // using pull. The maximum custom deadline you can specify is 600 1006 // seconds (10 minutes). For push delivery, this value is also used to 1007 // set the request timeout for the call to the push endpoint. If the 1008 // subscriber never acknowledges the message, the Pub/Sub system will 1009 // eventually redeliver the message. If this parameter is 0, a default 1010 // value of 10 seconds is used. 1011 AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"` 1012 1013 // Name: The name of the subscription. It must have the format 1014 // "projects/{project}/subscriptions/{subscription}". `{subscription}` 1015 // must start with a letter, and contain only letters (`[A-Za-z]`), 1016 // numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), 1017 // tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 1018 // and 255 characters in length, and it must not start with "goog". 1019 Name string `json:"name,omitempty"` 1020 1021 // PushConfig: If push delivery is used with this subscription, this 1022 // field is used to configure it. An empty `pushConfig` signifies that 1023 // the subscriber will pull and ack messages using API methods. 1024 PushConfig *PushConfig `json:"pushConfig,omitempty"` 1025 1026 // Topic: The name of the topic from which this subscription is 1027 // receiving messages. The value of this field will be `_deleted-topic_` 1028 // if the topic has been deleted. 1029 Topic string `json:"topic,omitempty"` 1030 1031 // ServerResponse contains the HTTP response code and headers from the 1032 // server. 1033 googleapi.ServerResponse `json:"-"` 1034 1035 // ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds") 1036 // to unconditionally include in API requests. By default, fields with 1037 // empty or default values are omitted from API requests. However, any 1038 // non-pointer, non-interface field appearing in ForceSendFields will be 1039 // sent to the server regardless of whether the field is empty or not. 1040 // This may be used to include empty fields in Patch requests. 1041 ForceSendFields []string `json:"-"` 1042 1043 // NullFields is a list of field names (e.g. "AckDeadlineSeconds") to 1044 // include in API requests with the JSON null value. By default, fields 1045 // with empty values are omitted from API requests. However, any field 1046 // with an empty value appearing in NullFields will be sent to the 1047 // server as null. It is an error if a field in this list has a 1048 // non-empty value. This may be used to include null fields in Patch 1049 // requests. 1050 NullFields []string `json:"-"` 1051} 1052 1053func (s *Subscription) MarshalJSON() ([]byte, error) { 1054 type NoMethod Subscription 1055 raw := NoMethod(*s) 1056 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1057} 1058 1059// TestIamPermissionsRequest: Request message for `TestIamPermissions` 1060// method. 1061type TestIamPermissionsRequest struct { 1062 // Permissions: The set of permissions to check for the `resource`. 1063 // Permissions with wildcards (such as '*' or 'storage.*') are not 1064 // allowed. For more information see IAM Overview 1065 // (https://cloud.google.com/iam/docs/overview#permissions). 1066 Permissions []string `json:"permissions,omitempty"` 1067 1068 // ForceSendFields is a list of field names (e.g. "Permissions") to 1069 // unconditionally include in API requests. By default, fields with 1070 // empty or default values are omitted from API requests. However, any 1071 // non-pointer, non-interface field appearing in ForceSendFields will be 1072 // sent to the server regardless of whether the field is empty or not. 1073 // This may be used to include empty fields in Patch requests. 1074 ForceSendFields []string `json:"-"` 1075 1076 // NullFields is a list of field names (e.g. "Permissions") to include 1077 // in API requests with the JSON null value. By default, fields with 1078 // empty values are omitted from API requests. However, any field with 1079 // an empty value appearing in NullFields will be sent to the server as 1080 // null. It is an error if a field in this list has a non-empty value. 1081 // This may be used to include null fields in Patch requests. 1082 NullFields []string `json:"-"` 1083} 1084 1085func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) { 1086 type NoMethod TestIamPermissionsRequest 1087 raw := NoMethod(*s) 1088 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1089} 1090 1091// TestIamPermissionsResponse: Response message for `TestIamPermissions` 1092// method. 1093type TestIamPermissionsResponse struct { 1094 // Permissions: A subset of `TestPermissionsRequest.permissions` that 1095 // the caller is allowed. 1096 Permissions []string `json:"permissions,omitempty"` 1097 1098 // ServerResponse contains the HTTP response code and headers from the 1099 // server. 1100 googleapi.ServerResponse `json:"-"` 1101 1102 // ForceSendFields is a list of field names (e.g. "Permissions") to 1103 // unconditionally include in API requests. By default, fields with 1104 // empty or default values are omitted from API requests. However, any 1105 // non-pointer, non-interface field appearing in ForceSendFields will be 1106 // sent to the server regardless of whether the field is empty or not. 1107 // This may be used to include empty fields in Patch requests. 1108 ForceSendFields []string `json:"-"` 1109 1110 // NullFields is a list of field names (e.g. "Permissions") to include 1111 // in API requests with the JSON null value. By default, fields with 1112 // empty values are omitted from API requests. However, any field with 1113 // an empty value appearing in NullFields will be sent to the server as 1114 // null. It is an error if a field in this list has a non-empty value. 1115 // This may be used to include null fields in Patch requests. 1116 NullFields []string `json:"-"` 1117} 1118 1119func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { 1120 type NoMethod TestIamPermissionsResponse 1121 raw := NoMethod(*s) 1122 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1123} 1124 1125// Topic: A topic resource. 1126type Topic struct { 1127 // Name: The name of the topic. It must have the format 1128 // "projects/{project}/topics/{topic}". `{topic}` must start with a 1129 // letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), 1130 // dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus 1131 // (`+`) or percent signs (`%`). It must be between 3 and 255 characters 1132 // in length, and it must not start with "goog". 1133 Name string `json:"name,omitempty"` 1134 1135 // ServerResponse contains the HTTP response code and headers from the 1136 // server. 1137 googleapi.ServerResponse `json:"-"` 1138 1139 // ForceSendFields is a list of field names (e.g. "Name") to 1140 // unconditionally include in API requests. By default, fields with 1141 // empty or default values are omitted from API requests. However, any 1142 // non-pointer, non-interface field appearing in ForceSendFields will be 1143 // sent to the server regardless of whether the field is empty or not. 1144 // This may be used to include empty fields in Patch requests. 1145 ForceSendFields []string `json:"-"` 1146 1147 // NullFields is a list of field names (e.g. "Name") to include in API 1148 // requests with the JSON null value. By default, fields with empty 1149 // values are omitted from API requests. However, any field with an 1150 // empty value appearing in NullFields will be sent to the server as 1151 // null. It is an error if a field in this list has a non-empty value. 1152 // This may be used to include null fields in Patch requests. 1153 NullFields []string `json:"-"` 1154} 1155 1156func (s *Topic) MarshalJSON() ([]byte, error) { 1157 type NoMethod Topic 1158 raw := NoMethod(*s) 1159 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1160} 1161 1162// method id "pubsub.projects.subscriptions.acknowledge": 1163 1164type ProjectsSubscriptionsAcknowledgeCall struct { 1165 s *Service 1166 subscription string 1167 acknowledgerequest *AcknowledgeRequest 1168 urlParams_ gensupport.URLParams 1169 ctx_ context.Context 1170 header_ http.Header 1171} 1172 1173// Acknowledge: Acknowledges the messages associated with the `ack_ids` 1174// in the `AcknowledgeRequest`. The Pub/Sub system can remove the 1175// relevant messages from the subscription. Acknowledging a message 1176// whose ack deadline has expired may succeed, but such a message may be 1177// redelivered later. Acknowledging a message more than once will not 1178// result in an error. 1179// 1180// - subscription: The subscription whose message is being acknowledged. 1181func (r *ProjectsSubscriptionsService) Acknowledge(subscription string, acknowledgerequest *AcknowledgeRequest) *ProjectsSubscriptionsAcknowledgeCall { 1182 c := &ProjectsSubscriptionsAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1183 c.subscription = subscription 1184 c.acknowledgerequest = acknowledgerequest 1185 return c 1186} 1187 1188// Fields allows partial responses to be retrieved. See 1189// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1190// for more information. 1191func (c *ProjectsSubscriptionsAcknowledgeCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsAcknowledgeCall { 1192 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1193 return c 1194} 1195 1196// Context sets the context to be used in this call's Do method. Any 1197// pending HTTP request will be aborted if the provided context is 1198// canceled. 1199func (c *ProjectsSubscriptionsAcknowledgeCall) Context(ctx context.Context) *ProjectsSubscriptionsAcknowledgeCall { 1200 c.ctx_ = ctx 1201 return c 1202} 1203 1204// Header returns an http.Header that can be modified by the caller to 1205// add HTTP headers to the request. 1206func (c *ProjectsSubscriptionsAcknowledgeCall) Header() http.Header { 1207 if c.header_ == nil { 1208 c.header_ = make(http.Header) 1209 } 1210 return c.header_ 1211} 1212 1213func (c *ProjectsSubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) { 1214 reqHeaders := make(http.Header) 1215 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1216 for k, v := range c.header_ { 1217 reqHeaders[k] = v 1218 } 1219 reqHeaders.Set("User-Agent", c.s.userAgent()) 1220 var body io.Reader = nil 1221 body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest) 1222 if err != nil { 1223 return nil, err 1224 } 1225 reqHeaders.Set("Content-Type", "application/json") 1226 c.urlParams_.Set("alt", alt) 1227 c.urlParams_.Set("prettyPrint", "false") 1228 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:acknowledge") 1229 urls += "?" + c.urlParams_.Encode() 1230 req, err := http.NewRequest("POST", urls, body) 1231 if err != nil { 1232 return nil, err 1233 } 1234 req.Header = reqHeaders 1235 googleapi.Expand(req.URL, map[string]string{ 1236 "subscription": c.subscription, 1237 }) 1238 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1239} 1240 1241// Do executes the "pubsub.projects.subscriptions.acknowledge" call. 1242// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1243// code is an error. Response headers are in either 1244// *Empty.ServerResponse.Header or (if a response was returned at all) 1245// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1246// check whether the returned error was because http.StatusNotModified 1247// was returned. 1248func (c *ProjectsSubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1249 gensupport.SetOptions(c.urlParams_, opts...) 1250 res, err := c.doRequest("json") 1251 if res != nil && res.StatusCode == http.StatusNotModified { 1252 if res.Body != nil { 1253 res.Body.Close() 1254 } 1255 return nil, &googleapi.Error{ 1256 Code: res.StatusCode, 1257 Header: res.Header, 1258 } 1259 } 1260 if err != nil { 1261 return nil, err 1262 } 1263 defer googleapi.CloseBody(res) 1264 if err := googleapi.CheckResponse(res); err != nil { 1265 return nil, err 1266 } 1267 ret := &Empty{ 1268 ServerResponse: googleapi.ServerResponse{ 1269 Header: res.Header, 1270 HTTPStatusCode: res.StatusCode, 1271 }, 1272 } 1273 target := &ret 1274 if err := gensupport.DecodeResponse(target, res); err != nil { 1275 return nil, err 1276 } 1277 return ret, nil 1278 // { 1279 // "description": "Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription. Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error.", 1280 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:acknowledge", 1281 // "httpMethod": "POST", 1282 // "id": "pubsub.projects.subscriptions.acknowledge", 1283 // "parameterOrder": [ 1284 // "subscription" 1285 // ], 1286 // "parameters": { 1287 // "subscription": { 1288 // "description": "The subscription whose message is being acknowledged.", 1289 // "location": "path", 1290 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1291 // "required": true, 1292 // "type": "string" 1293 // } 1294 // }, 1295 // "path": "v1beta2/{+subscription}:acknowledge", 1296 // "request": { 1297 // "$ref": "AcknowledgeRequest" 1298 // }, 1299 // "response": { 1300 // "$ref": "Empty" 1301 // }, 1302 // "scopes": [ 1303 // "https://www.googleapis.com/auth/cloud-platform", 1304 // "https://www.googleapis.com/auth/pubsub" 1305 // ] 1306 // } 1307 1308} 1309 1310// method id "pubsub.projects.subscriptions.create": 1311 1312type ProjectsSubscriptionsCreateCall struct { 1313 s *Service 1314 name string 1315 subscription *Subscription 1316 urlParams_ gensupport.URLParams 1317 ctx_ context.Context 1318 header_ http.Header 1319} 1320 1321// Create: Creates a subscription to a given topic. If the subscription 1322// already exists, returns `ALREADY_EXISTS`. If the corresponding topic 1323// doesn't exist, returns `NOT_FOUND`. If the name is not provided in 1324// the request, the server will assign a random name for this 1325// subscription on the same project as the topic. Note that for REST API 1326// requests, you must specify a name. 1327// 1328// - name: The name of the subscription. It must have the format 1329// "projects/{project}/subscriptions/{subscription}". 1330// `{subscription}` must start with a letter, and contain only letters 1331// (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), 1332// periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It 1333// must be between 3 and 255 characters in length, and it must not 1334// start with "goog". 1335func (r *ProjectsSubscriptionsService) Create(name string, subscription *Subscription) *ProjectsSubscriptionsCreateCall { 1336 c := &ProjectsSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1337 c.name = name 1338 c.subscription = subscription 1339 return c 1340} 1341 1342// Fields allows partial responses to be retrieved. See 1343// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1344// for more information. 1345func (c *ProjectsSubscriptionsCreateCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsCreateCall { 1346 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1347 return c 1348} 1349 1350// Context sets the context to be used in this call's Do method. Any 1351// pending HTTP request will be aborted if the provided context is 1352// canceled. 1353func (c *ProjectsSubscriptionsCreateCall) Context(ctx context.Context) *ProjectsSubscriptionsCreateCall { 1354 c.ctx_ = ctx 1355 return c 1356} 1357 1358// Header returns an http.Header that can be modified by the caller to 1359// add HTTP headers to the request. 1360func (c *ProjectsSubscriptionsCreateCall) Header() http.Header { 1361 if c.header_ == nil { 1362 c.header_ = make(http.Header) 1363 } 1364 return c.header_ 1365} 1366 1367func (c *ProjectsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) { 1368 reqHeaders := make(http.Header) 1369 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1370 for k, v := range c.header_ { 1371 reqHeaders[k] = v 1372 } 1373 reqHeaders.Set("User-Agent", c.s.userAgent()) 1374 var body io.Reader = nil 1375 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription) 1376 if err != nil { 1377 return nil, err 1378 } 1379 reqHeaders.Set("Content-Type", "application/json") 1380 c.urlParams_.Set("alt", alt) 1381 c.urlParams_.Set("prettyPrint", "false") 1382 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}") 1383 urls += "?" + c.urlParams_.Encode() 1384 req, err := http.NewRequest("PUT", urls, body) 1385 if err != nil { 1386 return nil, err 1387 } 1388 req.Header = reqHeaders 1389 googleapi.Expand(req.URL, map[string]string{ 1390 "name": c.name, 1391 }) 1392 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1393} 1394 1395// Do executes the "pubsub.projects.subscriptions.create" call. 1396// Exactly one of *Subscription or error will be non-nil. Any non-2xx 1397// status code is an error. Response headers are in either 1398// *Subscription.ServerResponse.Header or (if a response was returned at 1399// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1400// to check whether the returned error was because 1401// http.StatusNotModified was returned. 1402func (c *ProjectsSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { 1403 gensupport.SetOptions(c.urlParams_, opts...) 1404 res, err := c.doRequest("json") 1405 if res != nil && res.StatusCode == http.StatusNotModified { 1406 if res.Body != nil { 1407 res.Body.Close() 1408 } 1409 return nil, &googleapi.Error{ 1410 Code: res.StatusCode, 1411 Header: res.Header, 1412 } 1413 } 1414 if err != nil { 1415 return nil, err 1416 } 1417 defer googleapi.CloseBody(res) 1418 if err := googleapi.CheckResponse(res); err != nil { 1419 return nil, err 1420 } 1421 ret := &Subscription{ 1422 ServerResponse: googleapi.ServerResponse{ 1423 Header: res.Header, 1424 HTTPStatusCode: res.StatusCode, 1425 }, 1426 } 1427 target := &ret 1428 if err := gensupport.DecodeResponse(target, res); err != nil { 1429 return nil, err 1430 } 1431 return ret, nil 1432 // { 1433 // "description": "Creates a subscription to a given topic. If the subscription already exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns `NOT_FOUND`. If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic. Note that for REST API requests, you must specify a name.", 1434 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", 1435 // "httpMethod": "PUT", 1436 // "id": "pubsub.projects.subscriptions.create", 1437 // "parameterOrder": [ 1438 // "name" 1439 // ], 1440 // "parameters": { 1441 // "name": { 1442 // "description": "The name of the subscription. It must have the format `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`.", 1443 // "location": "path", 1444 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1445 // "required": true, 1446 // "type": "string" 1447 // } 1448 // }, 1449 // "path": "v1beta2/{+name}", 1450 // "request": { 1451 // "$ref": "Subscription" 1452 // }, 1453 // "response": { 1454 // "$ref": "Subscription" 1455 // }, 1456 // "scopes": [ 1457 // "https://www.googleapis.com/auth/cloud-platform", 1458 // "https://www.googleapis.com/auth/pubsub" 1459 // ] 1460 // } 1461 1462} 1463 1464// method id "pubsub.projects.subscriptions.delete": 1465 1466type ProjectsSubscriptionsDeleteCall struct { 1467 s *Service 1468 subscription string 1469 urlParams_ gensupport.URLParams 1470 ctx_ context.Context 1471 header_ http.Header 1472} 1473 1474// Delete: Deletes an existing subscription. All pending messages in the 1475// subscription are immediately dropped. Calls to `Pull` after deletion 1476// will return `NOT_FOUND`. After a subscription is deleted, a new one 1477// may be created with the same name, but the new one has no association 1478// with the old subscription, or its topic unless the same topic is 1479// specified. 1480// 1481// - subscription: The subscription to delete. 1482func (r *ProjectsSubscriptionsService) Delete(subscription string) *ProjectsSubscriptionsDeleteCall { 1483 c := &ProjectsSubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1484 c.subscription = subscription 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 1490// for more information. 1491func (c *ProjectsSubscriptionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsDeleteCall { 1492 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1493 return c 1494} 1495 1496// Context sets the context to be used in this call's Do method. Any 1497// pending HTTP request will be aborted if the provided context is 1498// canceled. 1499func (c *ProjectsSubscriptionsDeleteCall) Context(ctx context.Context) *ProjectsSubscriptionsDeleteCall { 1500 c.ctx_ = ctx 1501 return c 1502} 1503 1504// Header returns an http.Header that can be modified by the caller to 1505// add HTTP headers to the request. 1506func (c *ProjectsSubscriptionsDeleteCall) Header() http.Header { 1507 if c.header_ == nil { 1508 c.header_ = make(http.Header) 1509 } 1510 return c.header_ 1511} 1512 1513func (c *ProjectsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) { 1514 reqHeaders := make(http.Header) 1515 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1516 for k, v := range c.header_ { 1517 reqHeaders[k] = v 1518 } 1519 reqHeaders.Set("User-Agent", c.s.userAgent()) 1520 var body io.Reader = nil 1521 c.urlParams_.Set("alt", alt) 1522 c.urlParams_.Set("prettyPrint", "false") 1523 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}") 1524 urls += "?" + c.urlParams_.Encode() 1525 req, err := http.NewRequest("DELETE", urls, body) 1526 if err != nil { 1527 return nil, err 1528 } 1529 req.Header = reqHeaders 1530 googleapi.Expand(req.URL, map[string]string{ 1531 "subscription": c.subscription, 1532 }) 1533 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1534} 1535 1536// Do executes the "pubsub.projects.subscriptions.delete" call. 1537// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1538// code is an error. Response headers are in either 1539// *Empty.ServerResponse.Header or (if a response was returned at all) 1540// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1541// check whether the returned error was because http.StatusNotModified 1542// was returned. 1543func (c *ProjectsSubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1544 gensupport.SetOptions(c.urlParams_, opts...) 1545 res, err := c.doRequest("json") 1546 if res != nil && res.StatusCode == http.StatusNotModified { 1547 if res.Body != nil { 1548 res.Body.Close() 1549 } 1550 return nil, &googleapi.Error{ 1551 Code: res.StatusCode, 1552 Header: res.Header, 1553 } 1554 } 1555 if err != nil { 1556 return nil, err 1557 } 1558 defer googleapi.CloseBody(res) 1559 if err := googleapi.CheckResponse(res); err != nil { 1560 return nil, err 1561 } 1562 ret := &Empty{ 1563 ServerResponse: googleapi.ServerResponse{ 1564 Header: res.Header, 1565 HTTPStatusCode: res.StatusCode, 1566 }, 1567 } 1568 target := &ret 1569 if err := gensupport.DecodeResponse(target, res); err != nil { 1570 return nil, err 1571 } 1572 return ret, nil 1573 // { 1574 // "description": "Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is deleted, a new one may be created with the same name, but the new one has no association with the old subscription, or its topic unless the same topic is specified.", 1575 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", 1576 // "httpMethod": "DELETE", 1577 // "id": "pubsub.projects.subscriptions.delete", 1578 // "parameterOrder": [ 1579 // "subscription" 1580 // ], 1581 // "parameters": { 1582 // "subscription": { 1583 // "description": "The subscription to delete.", 1584 // "location": "path", 1585 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1586 // "required": true, 1587 // "type": "string" 1588 // } 1589 // }, 1590 // "path": "v1beta2/{+subscription}", 1591 // "response": { 1592 // "$ref": "Empty" 1593 // }, 1594 // "scopes": [ 1595 // "https://www.googleapis.com/auth/cloud-platform", 1596 // "https://www.googleapis.com/auth/pubsub" 1597 // ] 1598 // } 1599 1600} 1601 1602// method id "pubsub.projects.subscriptions.get": 1603 1604type ProjectsSubscriptionsGetCall struct { 1605 s *Service 1606 subscription string 1607 urlParams_ gensupport.URLParams 1608 ifNoneMatch_ string 1609 ctx_ context.Context 1610 header_ http.Header 1611} 1612 1613// Get: Gets the configuration details of a subscription. 1614// 1615// - subscription: The name of the subscription to get. 1616func (r *ProjectsSubscriptionsService) Get(subscription string) *ProjectsSubscriptionsGetCall { 1617 c := &ProjectsSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1618 c.subscription = subscription 1619 return c 1620} 1621 1622// Fields allows partial responses to be retrieved. See 1623// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1624// for more information. 1625func (c *ProjectsSubscriptionsGetCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetCall { 1626 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1627 return c 1628} 1629 1630// IfNoneMatch sets the optional parameter which makes the operation 1631// fail if the object's ETag matches the given value. This is useful for 1632// getting updates only after the object has changed since the last 1633// request. Use googleapi.IsNotModified to check whether the response 1634// error from Do is the result of In-None-Match. 1635func (c *ProjectsSubscriptionsGetCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetCall { 1636 c.ifNoneMatch_ = entityTag 1637 return c 1638} 1639 1640// Context sets the context to be used in this call's Do method. Any 1641// pending HTTP request will be aborted if the provided context is 1642// canceled. 1643func (c *ProjectsSubscriptionsGetCall) Context(ctx context.Context) *ProjectsSubscriptionsGetCall { 1644 c.ctx_ = ctx 1645 return c 1646} 1647 1648// Header returns an http.Header that can be modified by the caller to 1649// add HTTP headers to the request. 1650func (c *ProjectsSubscriptionsGetCall) Header() http.Header { 1651 if c.header_ == nil { 1652 c.header_ = make(http.Header) 1653 } 1654 return c.header_ 1655} 1656 1657func (c *ProjectsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) { 1658 reqHeaders := make(http.Header) 1659 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1660 for k, v := range c.header_ { 1661 reqHeaders[k] = v 1662 } 1663 reqHeaders.Set("User-Agent", c.s.userAgent()) 1664 if c.ifNoneMatch_ != "" { 1665 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1666 } 1667 var body io.Reader = nil 1668 c.urlParams_.Set("alt", alt) 1669 c.urlParams_.Set("prettyPrint", "false") 1670 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}") 1671 urls += "?" + c.urlParams_.Encode() 1672 req, err := http.NewRequest("GET", urls, body) 1673 if err != nil { 1674 return nil, err 1675 } 1676 req.Header = reqHeaders 1677 googleapi.Expand(req.URL, map[string]string{ 1678 "subscription": c.subscription, 1679 }) 1680 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1681} 1682 1683// Do executes the "pubsub.projects.subscriptions.get" call. 1684// Exactly one of *Subscription or error will be non-nil. Any non-2xx 1685// status code is an error. Response headers are in either 1686// *Subscription.ServerResponse.Header or (if a response was returned at 1687// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1688// to check whether the returned error was because 1689// http.StatusNotModified was returned. 1690func (c *ProjectsSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { 1691 gensupport.SetOptions(c.urlParams_, opts...) 1692 res, err := c.doRequest("json") 1693 if res != nil && res.StatusCode == http.StatusNotModified { 1694 if res.Body != nil { 1695 res.Body.Close() 1696 } 1697 return nil, &googleapi.Error{ 1698 Code: res.StatusCode, 1699 Header: res.Header, 1700 } 1701 } 1702 if err != nil { 1703 return nil, err 1704 } 1705 defer googleapi.CloseBody(res) 1706 if err := googleapi.CheckResponse(res); err != nil { 1707 return nil, err 1708 } 1709 ret := &Subscription{ 1710 ServerResponse: googleapi.ServerResponse{ 1711 Header: res.Header, 1712 HTTPStatusCode: res.StatusCode, 1713 }, 1714 } 1715 target := &ret 1716 if err := gensupport.DecodeResponse(target, res); err != nil { 1717 return nil, err 1718 } 1719 return ret, nil 1720 // { 1721 // "description": "Gets the configuration details of a subscription.", 1722 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", 1723 // "httpMethod": "GET", 1724 // "id": "pubsub.projects.subscriptions.get", 1725 // "parameterOrder": [ 1726 // "subscription" 1727 // ], 1728 // "parameters": { 1729 // "subscription": { 1730 // "description": "The name of the subscription to get.", 1731 // "location": "path", 1732 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1733 // "required": true, 1734 // "type": "string" 1735 // } 1736 // }, 1737 // "path": "v1beta2/{+subscription}", 1738 // "response": { 1739 // "$ref": "Subscription" 1740 // }, 1741 // "scopes": [ 1742 // "https://www.googleapis.com/auth/cloud-platform", 1743 // "https://www.googleapis.com/auth/pubsub" 1744 // ] 1745 // } 1746 1747} 1748 1749// method id "pubsub.projects.subscriptions.getIamPolicy": 1750 1751type ProjectsSubscriptionsGetIamPolicyCall struct { 1752 s *Service 1753 resource string 1754 urlParams_ gensupport.URLParams 1755 ifNoneMatch_ string 1756 ctx_ context.Context 1757 header_ http.Header 1758} 1759 1760// GetIamPolicy: Gets the access control policy for a resource. Returns 1761// an empty policy if the resource exists and does not have a policy 1762// set. 1763// 1764// - resource: REQUIRED: The resource for which the policy is being 1765// requested. See the operation documentation for the appropriate 1766// value for this field. 1767func (r *ProjectsSubscriptionsService) GetIamPolicy(resource string) *ProjectsSubscriptionsGetIamPolicyCall { 1768 c := &ProjectsSubscriptionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1769 c.resource = resource 1770 return c 1771} 1772 1773// OptionsRequestedPolicyVersion sets the optional parameter 1774// "options.requestedPolicyVersion": The policy format version to be 1775// returned. Valid values are 0, 1, and 3. Requests specifying an 1776// invalid value will be rejected. Requests for policies with any 1777// conditional bindings must specify version 3. Policies without any 1778// conditional bindings may specify any valid value or leave the field 1779// unset. To learn which resources support conditions in their IAM 1780// policies, see the IAM documentation 1781// (https://cloud.google.com/iam/help/conditions/resource-policies). 1782func (c *ProjectsSubscriptionsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsSubscriptionsGetIamPolicyCall { 1783 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion)) 1784 return c 1785} 1786 1787// Fields allows partial responses to be retrieved. See 1788// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1789// for more information. 1790func (c *ProjectsSubscriptionsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetIamPolicyCall { 1791 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1792 return c 1793} 1794 1795// IfNoneMatch sets the optional parameter which makes the operation 1796// fail if the object's ETag matches the given value. This is useful for 1797// getting updates only after the object has changed since the last 1798// request. Use googleapi.IsNotModified to check whether the response 1799// error from Do is the result of In-None-Match. 1800func (c *ProjectsSubscriptionsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetIamPolicyCall { 1801 c.ifNoneMatch_ = entityTag 1802 return c 1803} 1804 1805// Context sets the context to be used in this call's Do method. Any 1806// pending HTTP request will be aborted if the provided context is 1807// canceled. 1808func (c *ProjectsSubscriptionsGetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsGetIamPolicyCall { 1809 c.ctx_ = ctx 1810 return c 1811} 1812 1813// Header returns an http.Header that can be modified by the caller to 1814// add HTTP headers to the request. 1815func (c *ProjectsSubscriptionsGetIamPolicyCall) Header() http.Header { 1816 if c.header_ == nil { 1817 c.header_ = make(http.Header) 1818 } 1819 return c.header_ 1820} 1821 1822func (c *ProjectsSubscriptionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 1823 reqHeaders := make(http.Header) 1824 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1825 for k, v := range c.header_ { 1826 reqHeaders[k] = v 1827 } 1828 reqHeaders.Set("User-Agent", c.s.userAgent()) 1829 if c.ifNoneMatch_ != "" { 1830 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1831 } 1832 var body io.Reader = nil 1833 c.urlParams_.Set("alt", alt) 1834 c.urlParams_.Set("prettyPrint", "false") 1835 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy") 1836 urls += "?" + c.urlParams_.Encode() 1837 req, err := http.NewRequest("GET", urls, body) 1838 if err != nil { 1839 return nil, err 1840 } 1841 req.Header = reqHeaders 1842 googleapi.Expand(req.URL, map[string]string{ 1843 "resource": c.resource, 1844 }) 1845 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1846} 1847 1848// Do executes the "pubsub.projects.subscriptions.getIamPolicy" call. 1849// Exactly one of *Policy or error will be non-nil. Any non-2xx status 1850// code is an error. Response headers are in either 1851// *Policy.ServerResponse.Header or (if a response was returned at all) 1852// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1853// check whether the returned error was because http.StatusNotModified 1854// was returned. 1855func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 1856 gensupport.SetOptions(c.urlParams_, opts...) 1857 res, err := c.doRequest("json") 1858 if res != nil && res.StatusCode == http.StatusNotModified { 1859 if res.Body != nil { 1860 res.Body.Close() 1861 } 1862 return nil, &googleapi.Error{ 1863 Code: res.StatusCode, 1864 Header: res.Header, 1865 } 1866 } 1867 if err != nil { 1868 return nil, err 1869 } 1870 defer googleapi.CloseBody(res) 1871 if err := googleapi.CheckResponse(res); err != nil { 1872 return nil, err 1873 } 1874 ret := &Policy{ 1875 ServerResponse: googleapi.ServerResponse{ 1876 Header: res.Header, 1877 HTTPStatusCode: res.StatusCode, 1878 }, 1879 } 1880 target := &ret 1881 if err := gensupport.DecodeResponse(target, res); err != nil { 1882 return nil, err 1883 } 1884 return ret, nil 1885 // { 1886 // "description": "Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.", 1887 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:getIamPolicy", 1888 // "httpMethod": "GET", 1889 // "id": "pubsub.projects.subscriptions.getIamPolicy", 1890 // "parameterOrder": [ 1891 // "resource" 1892 // ], 1893 // "parameters": { 1894 // "options.requestedPolicyVersion": { 1895 // "description": "Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).", 1896 // "format": "int32", 1897 // "location": "query", 1898 // "type": "integer" 1899 // }, 1900 // "resource": { 1901 // "description": "REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.", 1902 // "location": "path", 1903 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1904 // "required": true, 1905 // "type": "string" 1906 // } 1907 // }, 1908 // "path": "v1beta2/{+resource}:getIamPolicy", 1909 // "response": { 1910 // "$ref": "Policy" 1911 // }, 1912 // "scopes": [ 1913 // "https://www.googleapis.com/auth/cloud-platform", 1914 // "https://www.googleapis.com/auth/pubsub" 1915 // ] 1916 // } 1917 1918} 1919 1920// method id "pubsub.projects.subscriptions.list": 1921 1922type ProjectsSubscriptionsListCall struct { 1923 s *Service 1924 project string 1925 urlParams_ gensupport.URLParams 1926 ifNoneMatch_ string 1927 ctx_ context.Context 1928 header_ http.Header 1929} 1930 1931// List: Lists matching subscriptions. 1932// 1933// - project: The name of the cloud project that subscriptions belong 1934// to. 1935func (r *ProjectsSubscriptionsService) List(project string) *ProjectsSubscriptionsListCall { 1936 c := &ProjectsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1937 c.project = project 1938 return c 1939} 1940 1941// PageSize sets the optional parameter "pageSize": Maximum number of 1942// subscriptions to return. 1943func (c *ProjectsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsSubscriptionsListCall { 1944 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1945 return c 1946} 1947 1948// PageToken sets the optional parameter "pageToken": The value returned 1949// by the last `ListSubscriptionsResponse`; indicates that this is a 1950// continuation of a prior `ListSubscriptions` call, and that the system 1951// should return the next page of data. 1952func (c *ProjectsSubscriptionsListCall) PageToken(pageToken string) *ProjectsSubscriptionsListCall { 1953 c.urlParams_.Set("pageToken", pageToken) 1954 return c 1955} 1956 1957// Fields allows partial responses to be retrieved. See 1958// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1959// for more information. 1960func (c *ProjectsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsListCall { 1961 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1962 return c 1963} 1964 1965// IfNoneMatch sets the optional parameter which makes the operation 1966// fail if the object's ETag matches the given value. This is useful for 1967// getting updates only after the object has changed since the last 1968// request. Use googleapi.IsNotModified to check whether the response 1969// error from Do is the result of In-None-Match. 1970func (c *ProjectsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsListCall { 1971 c.ifNoneMatch_ = entityTag 1972 return c 1973} 1974 1975// Context sets the context to be used in this call's Do method. Any 1976// pending HTTP request will be aborted if the provided context is 1977// canceled. 1978func (c *ProjectsSubscriptionsListCall) Context(ctx context.Context) *ProjectsSubscriptionsListCall { 1979 c.ctx_ = ctx 1980 return c 1981} 1982 1983// Header returns an http.Header that can be modified by the caller to 1984// add HTTP headers to the request. 1985func (c *ProjectsSubscriptionsListCall) Header() http.Header { 1986 if c.header_ == nil { 1987 c.header_ = make(http.Header) 1988 } 1989 return c.header_ 1990} 1991 1992func (c *ProjectsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) { 1993 reqHeaders := make(http.Header) 1994 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 1995 for k, v := range c.header_ { 1996 reqHeaders[k] = v 1997 } 1998 reqHeaders.Set("User-Agent", c.s.userAgent()) 1999 if c.ifNoneMatch_ != "" { 2000 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2001 } 2002 var body io.Reader = nil 2003 c.urlParams_.Set("alt", alt) 2004 c.urlParams_.Set("prettyPrint", "false") 2005 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/subscriptions") 2006 urls += "?" + c.urlParams_.Encode() 2007 req, err := http.NewRequest("GET", urls, body) 2008 if err != nil { 2009 return nil, err 2010 } 2011 req.Header = reqHeaders 2012 googleapi.Expand(req.URL, map[string]string{ 2013 "project": c.project, 2014 }) 2015 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2016} 2017 2018// Do executes the "pubsub.projects.subscriptions.list" call. 2019// Exactly one of *ListSubscriptionsResponse or error will be non-nil. 2020// Any non-2xx status code is an error. Response headers are in either 2021// *ListSubscriptionsResponse.ServerResponse.Header or (if a response 2022// was returned at all) in error.(*googleapi.Error).Header. Use 2023// googleapi.IsNotModified to check whether the returned error was 2024// because http.StatusNotModified was returned. 2025func (c *ProjectsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) { 2026 gensupport.SetOptions(c.urlParams_, opts...) 2027 res, err := c.doRequest("json") 2028 if res != nil && res.StatusCode == http.StatusNotModified { 2029 if res.Body != nil { 2030 res.Body.Close() 2031 } 2032 return nil, &googleapi.Error{ 2033 Code: res.StatusCode, 2034 Header: res.Header, 2035 } 2036 } 2037 if err != nil { 2038 return nil, err 2039 } 2040 defer googleapi.CloseBody(res) 2041 if err := googleapi.CheckResponse(res); err != nil { 2042 return nil, err 2043 } 2044 ret := &ListSubscriptionsResponse{ 2045 ServerResponse: googleapi.ServerResponse{ 2046 Header: res.Header, 2047 HTTPStatusCode: res.StatusCode, 2048 }, 2049 } 2050 target := &ret 2051 if err := gensupport.DecodeResponse(target, res); err != nil { 2052 return nil, err 2053 } 2054 return ret, nil 2055 // { 2056 // "description": "Lists matching subscriptions.", 2057 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions", 2058 // "httpMethod": "GET", 2059 // "id": "pubsub.projects.subscriptions.list", 2060 // "parameterOrder": [ 2061 // "project" 2062 // ], 2063 // "parameters": { 2064 // "pageSize": { 2065 // "description": "Maximum number of subscriptions to return.", 2066 // "format": "int32", 2067 // "location": "query", 2068 // "type": "integer" 2069 // }, 2070 // "pageToken": { 2071 // "description": "The value returned by the last `ListSubscriptionsResponse`; indicates that this is a continuation of a prior `ListSubscriptions` call, and that the system should return the next page of data.", 2072 // "location": "query", 2073 // "type": "string" 2074 // }, 2075 // "project": { 2076 // "description": "The name of the cloud project that subscriptions belong to.", 2077 // "location": "path", 2078 // "pattern": "^projects/[^/]+$", 2079 // "required": true, 2080 // "type": "string" 2081 // } 2082 // }, 2083 // "path": "v1beta2/{+project}/subscriptions", 2084 // "response": { 2085 // "$ref": "ListSubscriptionsResponse" 2086 // }, 2087 // "scopes": [ 2088 // "https://www.googleapis.com/auth/cloud-platform", 2089 // "https://www.googleapis.com/auth/pubsub" 2090 // ] 2091 // } 2092 2093} 2094 2095// Pages invokes f for each page of results. 2096// A non-nil error returned from f will halt the iteration. 2097// The provided context supersedes any context provided to the Context method. 2098func (c *ProjectsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error { 2099 c.ctx_ = ctx 2100 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2101 for { 2102 x, err := c.Do() 2103 if err != nil { 2104 return err 2105 } 2106 if err := f(x); err != nil { 2107 return err 2108 } 2109 if x.NextPageToken == "" { 2110 return nil 2111 } 2112 c.PageToken(x.NextPageToken) 2113 } 2114} 2115 2116// method id "pubsub.projects.subscriptions.modifyAckDeadline": 2117 2118type ProjectsSubscriptionsModifyAckDeadlineCall struct { 2119 s *Service 2120 subscription string 2121 modifyackdeadlinerequest *ModifyAckDeadlineRequest 2122 urlParams_ gensupport.URLParams 2123 ctx_ context.Context 2124 header_ http.Header 2125} 2126 2127// ModifyAckDeadline: Modifies the ack deadline for a specific message. 2128// This method is useful to indicate that more time is needed to process 2129// a message by the subscriber, or to make the message available for 2130// redelivery if the processing was interrupted. Note that this does not 2131// modify the subscription-level `ackDeadlineSeconds` used for 2132// subsequent messages. 2133// 2134// - subscription: The name of the subscription. 2135func (r *ProjectsSubscriptionsService) ModifyAckDeadline(subscription string, modifyackdeadlinerequest *ModifyAckDeadlineRequest) *ProjectsSubscriptionsModifyAckDeadlineCall { 2136 c := &ProjectsSubscriptionsModifyAckDeadlineCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2137 c.subscription = subscription 2138 c.modifyackdeadlinerequest = modifyackdeadlinerequest 2139 return c 2140} 2141 2142// Fields allows partial responses to be retrieved. See 2143// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2144// for more information. 2145func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyAckDeadlineCall { 2146 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2147 return c 2148} 2149 2150// Context sets the context to be used in this call's Do method. Any 2151// pending HTTP request will be aborted if the provided context is 2152// canceled. 2153func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyAckDeadlineCall { 2154 c.ctx_ = ctx 2155 return c 2156} 2157 2158// Header returns an http.Header that can be modified by the caller to 2159// add HTTP headers to the request. 2160func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Header() http.Header { 2161 if c.header_ == nil { 2162 c.header_ = make(http.Header) 2163 } 2164 return c.header_ 2165} 2166 2167func (c *ProjectsSubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) { 2168 reqHeaders := make(http.Header) 2169 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 2170 for k, v := range c.header_ { 2171 reqHeaders[k] = v 2172 } 2173 reqHeaders.Set("User-Agent", c.s.userAgent()) 2174 var body io.Reader = nil 2175 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest) 2176 if err != nil { 2177 return nil, err 2178 } 2179 reqHeaders.Set("Content-Type", "application/json") 2180 c.urlParams_.Set("alt", alt) 2181 c.urlParams_.Set("prettyPrint", "false") 2182 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyAckDeadline") 2183 urls += "?" + c.urlParams_.Encode() 2184 req, err := http.NewRequest("POST", urls, body) 2185 if err != nil { 2186 return nil, err 2187 } 2188 req.Header = reqHeaders 2189 googleapi.Expand(req.URL, map[string]string{ 2190 "subscription": c.subscription, 2191 }) 2192 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2193} 2194 2195// Do executes the "pubsub.projects.subscriptions.modifyAckDeadline" call. 2196// Exactly one of *Empty or error will be non-nil. Any non-2xx status 2197// code is an error. Response headers are in either 2198// *Empty.ServerResponse.Header or (if a response was returned at all) 2199// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2200// check whether the returned error was because http.StatusNotModified 2201// was returned. 2202func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2203 gensupport.SetOptions(c.urlParams_, opts...) 2204 res, err := c.doRequest("json") 2205 if res != nil && res.StatusCode == http.StatusNotModified { 2206 if res.Body != nil { 2207 res.Body.Close() 2208 } 2209 return nil, &googleapi.Error{ 2210 Code: res.StatusCode, 2211 Header: res.Header, 2212 } 2213 } 2214 if err != nil { 2215 return nil, err 2216 } 2217 defer googleapi.CloseBody(res) 2218 if err := googleapi.CheckResponse(res); err != nil { 2219 return nil, err 2220 } 2221 ret := &Empty{ 2222 ServerResponse: googleapi.ServerResponse{ 2223 Header: res.Header, 2224 HTTPStatusCode: res.StatusCode, 2225 }, 2226 } 2227 target := &ret 2228 if err := gensupport.DecodeResponse(target, res); err != nil { 2229 return nil, err 2230 } 2231 return ret, nil 2232 // { 2233 // "description": "Modifies the ack deadline for a specific message. This method is useful to indicate that more time is needed to process a message by the subscriber, or to make the message available for redelivery if the processing was interrupted. Note that this does not modify the subscription-level `ackDeadlineSeconds` used for subsequent messages.", 2234 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyAckDeadline", 2235 // "httpMethod": "POST", 2236 // "id": "pubsub.projects.subscriptions.modifyAckDeadline", 2237 // "parameterOrder": [ 2238 // "subscription" 2239 // ], 2240 // "parameters": { 2241 // "subscription": { 2242 // "description": "The name of the subscription.", 2243 // "location": "path", 2244 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2245 // "required": true, 2246 // "type": "string" 2247 // } 2248 // }, 2249 // "path": "v1beta2/{+subscription}:modifyAckDeadline", 2250 // "request": { 2251 // "$ref": "ModifyAckDeadlineRequest" 2252 // }, 2253 // "response": { 2254 // "$ref": "Empty" 2255 // }, 2256 // "scopes": [ 2257 // "https://www.googleapis.com/auth/cloud-platform", 2258 // "https://www.googleapis.com/auth/pubsub" 2259 // ] 2260 // } 2261 2262} 2263 2264// method id "pubsub.projects.subscriptions.modifyPushConfig": 2265 2266type ProjectsSubscriptionsModifyPushConfigCall struct { 2267 s *Service 2268 subscription string 2269 modifypushconfigrequest *ModifyPushConfigRequest 2270 urlParams_ gensupport.URLParams 2271 ctx_ context.Context 2272 header_ http.Header 2273} 2274 2275// ModifyPushConfig: Modifies the `PushConfig` for a specified 2276// subscription. This may be used to change a push subscription to a 2277// pull one (signified by an empty `PushConfig`) or vice versa, or 2278// change the endpoint URL and other attributes of a push subscription. 2279// Messages will accumulate for delivery continuously through the call 2280// regardless of changes to the `PushConfig`. 2281// 2282// - subscription: The name of the subscription. 2283func (r *ProjectsSubscriptionsService) ModifyPushConfig(subscription string, modifypushconfigrequest *ModifyPushConfigRequest) *ProjectsSubscriptionsModifyPushConfigCall { 2284 c := &ProjectsSubscriptionsModifyPushConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2285 c.subscription = subscription 2286 c.modifypushconfigrequest = modifypushconfigrequest 2287 return c 2288} 2289 2290// Fields allows partial responses to be retrieved. See 2291// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2292// for more information. 2293func (c *ProjectsSubscriptionsModifyPushConfigCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyPushConfigCall { 2294 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2295 return c 2296} 2297 2298// Context sets the context to be used in this call's Do method. Any 2299// pending HTTP request will be aborted if the provided context is 2300// canceled. 2301func (c *ProjectsSubscriptionsModifyPushConfigCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyPushConfigCall { 2302 c.ctx_ = ctx 2303 return c 2304} 2305 2306// Header returns an http.Header that can be modified by the caller to 2307// add HTTP headers to the request. 2308func (c *ProjectsSubscriptionsModifyPushConfigCall) Header() http.Header { 2309 if c.header_ == nil { 2310 c.header_ = make(http.Header) 2311 } 2312 return c.header_ 2313} 2314 2315func (c *ProjectsSubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) { 2316 reqHeaders := make(http.Header) 2317 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 2318 for k, v := range c.header_ { 2319 reqHeaders[k] = v 2320 } 2321 reqHeaders.Set("User-Agent", c.s.userAgent()) 2322 var body io.Reader = nil 2323 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest) 2324 if err != nil { 2325 return nil, err 2326 } 2327 reqHeaders.Set("Content-Type", "application/json") 2328 c.urlParams_.Set("alt", alt) 2329 c.urlParams_.Set("prettyPrint", "false") 2330 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyPushConfig") 2331 urls += "?" + c.urlParams_.Encode() 2332 req, err := http.NewRequest("POST", urls, body) 2333 if err != nil { 2334 return nil, err 2335 } 2336 req.Header = reqHeaders 2337 googleapi.Expand(req.URL, map[string]string{ 2338 "subscription": c.subscription, 2339 }) 2340 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2341} 2342 2343// Do executes the "pubsub.projects.subscriptions.modifyPushConfig" call. 2344// Exactly one of *Empty or error will be non-nil. Any non-2xx status 2345// code is an error. Response headers are in either 2346// *Empty.ServerResponse.Header or (if a response was returned at all) 2347// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2348// check whether the returned error was because http.StatusNotModified 2349// was returned. 2350func (c *ProjectsSubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2351 gensupport.SetOptions(c.urlParams_, opts...) 2352 res, err := c.doRequest("json") 2353 if res != nil && res.StatusCode == http.StatusNotModified { 2354 if res.Body != nil { 2355 res.Body.Close() 2356 } 2357 return nil, &googleapi.Error{ 2358 Code: res.StatusCode, 2359 Header: res.Header, 2360 } 2361 } 2362 if err != nil { 2363 return nil, err 2364 } 2365 defer googleapi.CloseBody(res) 2366 if err := googleapi.CheckResponse(res); err != nil { 2367 return nil, err 2368 } 2369 ret := &Empty{ 2370 ServerResponse: googleapi.ServerResponse{ 2371 Header: res.Header, 2372 HTTPStatusCode: res.StatusCode, 2373 }, 2374 } 2375 target := &ret 2376 if err := gensupport.DecodeResponse(target, res); err != nil { 2377 return nil, err 2378 } 2379 return ret, nil 2380 // { 2381 // "description": "Modifies the `PushConfig` for a specified subscription. This may be used to change a push subscription to a pull one (signified by an empty `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the `PushConfig`.", 2382 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyPushConfig", 2383 // "httpMethod": "POST", 2384 // "id": "pubsub.projects.subscriptions.modifyPushConfig", 2385 // "parameterOrder": [ 2386 // "subscription" 2387 // ], 2388 // "parameters": { 2389 // "subscription": { 2390 // "description": "The name of the subscription.", 2391 // "location": "path", 2392 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2393 // "required": true, 2394 // "type": "string" 2395 // } 2396 // }, 2397 // "path": "v1beta2/{+subscription}:modifyPushConfig", 2398 // "request": { 2399 // "$ref": "ModifyPushConfigRequest" 2400 // }, 2401 // "response": { 2402 // "$ref": "Empty" 2403 // }, 2404 // "scopes": [ 2405 // "https://www.googleapis.com/auth/cloud-platform", 2406 // "https://www.googleapis.com/auth/pubsub" 2407 // ] 2408 // } 2409 2410} 2411 2412// method id "pubsub.projects.subscriptions.pull": 2413 2414type ProjectsSubscriptionsPullCall struct { 2415 s *Service 2416 subscription string 2417 pullrequest *PullRequest 2418 urlParams_ gensupport.URLParams 2419 ctx_ context.Context 2420 header_ http.Header 2421} 2422 2423// Pull: Pulls messages from the server. Returns an empty list if there 2424// are no messages available in the backlog. The server may return 2425// `UNAVAILABLE` if there are too many concurrent pull requests pending 2426// for the given subscription. 2427// 2428// - subscription: The subscription from which messages should be 2429// pulled. 2430func (r *ProjectsSubscriptionsService) Pull(subscription string, pullrequest *PullRequest) *ProjectsSubscriptionsPullCall { 2431 c := &ProjectsSubscriptionsPullCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2432 c.subscription = subscription 2433 c.pullrequest = pullrequest 2434 return c 2435} 2436 2437// Fields allows partial responses to be retrieved. See 2438// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2439// for more information. 2440func (c *ProjectsSubscriptionsPullCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsPullCall { 2441 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2442 return c 2443} 2444 2445// Context sets the context to be used in this call's Do method. Any 2446// pending HTTP request will be aborted if the provided context is 2447// canceled. 2448func (c *ProjectsSubscriptionsPullCall) Context(ctx context.Context) *ProjectsSubscriptionsPullCall { 2449 c.ctx_ = ctx 2450 return c 2451} 2452 2453// Header returns an http.Header that can be modified by the caller to 2454// add HTTP headers to the request. 2455func (c *ProjectsSubscriptionsPullCall) Header() http.Header { 2456 if c.header_ == nil { 2457 c.header_ = make(http.Header) 2458 } 2459 return c.header_ 2460} 2461 2462func (c *ProjectsSubscriptionsPullCall) doRequest(alt string) (*http.Response, error) { 2463 reqHeaders := make(http.Header) 2464 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 2465 for k, v := range c.header_ { 2466 reqHeaders[k] = v 2467 } 2468 reqHeaders.Set("User-Agent", c.s.userAgent()) 2469 var body io.Reader = nil 2470 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest) 2471 if err != nil { 2472 return nil, err 2473 } 2474 reqHeaders.Set("Content-Type", "application/json") 2475 c.urlParams_.Set("alt", alt) 2476 c.urlParams_.Set("prettyPrint", "false") 2477 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:pull") 2478 urls += "?" + c.urlParams_.Encode() 2479 req, err := http.NewRequest("POST", urls, body) 2480 if err != nil { 2481 return nil, err 2482 } 2483 req.Header = reqHeaders 2484 googleapi.Expand(req.URL, map[string]string{ 2485 "subscription": c.subscription, 2486 }) 2487 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2488} 2489 2490// Do executes the "pubsub.projects.subscriptions.pull" call. 2491// Exactly one of *PullResponse or error will be non-nil. Any non-2xx 2492// status code is an error. Response headers are in either 2493// *PullResponse.ServerResponse.Header or (if a response was returned at 2494// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2495// to check whether the returned error was because 2496// http.StatusNotModified was returned. 2497func (c *ProjectsSubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullResponse, error) { 2498 gensupport.SetOptions(c.urlParams_, opts...) 2499 res, err := c.doRequest("json") 2500 if res != nil && res.StatusCode == http.StatusNotModified { 2501 if res.Body != nil { 2502 res.Body.Close() 2503 } 2504 return nil, &googleapi.Error{ 2505 Code: res.StatusCode, 2506 Header: res.Header, 2507 } 2508 } 2509 if err != nil { 2510 return nil, err 2511 } 2512 defer googleapi.CloseBody(res) 2513 if err := googleapi.CheckResponse(res); err != nil { 2514 return nil, err 2515 } 2516 ret := &PullResponse{ 2517 ServerResponse: googleapi.ServerResponse{ 2518 Header: res.Header, 2519 HTTPStatusCode: res.StatusCode, 2520 }, 2521 } 2522 target := &ret 2523 if err := gensupport.DecodeResponse(target, res); err != nil { 2524 return nil, err 2525 } 2526 return ret, nil 2527 // { 2528 // "description": "Pulls messages from the server. Returns an empty list if there are no messages available in the backlog. The server may return `UNAVAILABLE` if there are too many concurrent pull requests pending for the given subscription.", 2529 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:pull", 2530 // "httpMethod": "POST", 2531 // "id": "pubsub.projects.subscriptions.pull", 2532 // "parameterOrder": [ 2533 // "subscription" 2534 // ], 2535 // "parameters": { 2536 // "subscription": { 2537 // "description": "The subscription from which messages should be pulled.", 2538 // "location": "path", 2539 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2540 // "required": true, 2541 // "type": "string" 2542 // } 2543 // }, 2544 // "path": "v1beta2/{+subscription}:pull", 2545 // "request": { 2546 // "$ref": "PullRequest" 2547 // }, 2548 // "response": { 2549 // "$ref": "PullResponse" 2550 // }, 2551 // "scopes": [ 2552 // "https://www.googleapis.com/auth/cloud-platform", 2553 // "https://www.googleapis.com/auth/pubsub" 2554 // ] 2555 // } 2556 2557} 2558 2559// method id "pubsub.projects.subscriptions.setIamPolicy": 2560 2561type ProjectsSubscriptionsSetIamPolicyCall struct { 2562 s *Service 2563 resource string 2564 setiampolicyrequest *SetIamPolicyRequest 2565 urlParams_ gensupport.URLParams 2566 ctx_ context.Context 2567 header_ http.Header 2568} 2569 2570// SetIamPolicy: Sets the access control policy on the specified 2571// resource. Replaces any existing policy. Can return `NOT_FOUND`, 2572// `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. 2573// 2574// - resource: REQUIRED: The resource for which the policy is being 2575// specified. See the operation documentation for the appropriate 2576// value for this field. 2577func (r *ProjectsSubscriptionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSubscriptionsSetIamPolicyCall { 2578 c := &ProjectsSubscriptionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2579 c.resource = resource 2580 c.setiampolicyrequest = setiampolicyrequest 2581 return c 2582} 2583 2584// Fields allows partial responses to be retrieved. See 2585// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2586// for more information. 2587func (c *ProjectsSubscriptionsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsSetIamPolicyCall { 2588 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2589 return c 2590} 2591 2592// Context sets the context to be used in this call's Do method. Any 2593// pending HTTP request will be aborted if the provided context is 2594// canceled. 2595func (c *ProjectsSubscriptionsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsSetIamPolicyCall { 2596 c.ctx_ = ctx 2597 return c 2598} 2599 2600// Header returns an http.Header that can be modified by the caller to 2601// add HTTP headers to the request. 2602func (c *ProjectsSubscriptionsSetIamPolicyCall) Header() http.Header { 2603 if c.header_ == nil { 2604 c.header_ = make(http.Header) 2605 } 2606 return c.header_ 2607} 2608 2609func (c *ProjectsSubscriptionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 2610 reqHeaders := make(http.Header) 2611 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 2612 for k, v := range c.header_ { 2613 reqHeaders[k] = v 2614 } 2615 reqHeaders.Set("User-Agent", c.s.userAgent()) 2616 var body io.Reader = nil 2617 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 2618 if err != nil { 2619 return nil, err 2620 } 2621 reqHeaders.Set("Content-Type", "application/json") 2622 c.urlParams_.Set("alt", alt) 2623 c.urlParams_.Set("prettyPrint", "false") 2624 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy") 2625 urls += "?" + c.urlParams_.Encode() 2626 req, err := http.NewRequest("POST", urls, body) 2627 if err != nil { 2628 return nil, err 2629 } 2630 req.Header = reqHeaders 2631 googleapi.Expand(req.URL, map[string]string{ 2632 "resource": c.resource, 2633 }) 2634 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2635} 2636 2637// Do executes the "pubsub.projects.subscriptions.setIamPolicy" call. 2638// Exactly one of *Policy or error will be non-nil. Any non-2xx status 2639// code is an error. Response headers are in either 2640// *Policy.ServerResponse.Header or (if a response was returned at all) 2641// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2642// check whether the returned error was because http.StatusNotModified 2643// was returned. 2644func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 2645 gensupport.SetOptions(c.urlParams_, opts...) 2646 res, err := c.doRequest("json") 2647 if res != nil && res.StatusCode == http.StatusNotModified { 2648 if res.Body != nil { 2649 res.Body.Close() 2650 } 2651 return nil, &googleapi.Error{ 2652 Code: res.StatusCode, 2653 Header: res.Header, 2654 } 2655 } 2656 if err != nil { 2657 return nil, err 2658 } 2659 defer googleapi.CloseBody(res) 2660 if err := googleapi.CheckResponse(res); err != nil { 2661 return nil, err 2662 } 2663 ret := &Policy{ 2664 ServerResponse: googleapi.ServerResponse{ 2665 Header: res.Header, 2666 HTTPStatusCode: res.StatusCode, 2667 }, 2668 } 2669 target := &ret 2670 if err := gensupport.DecodeResponse(target, res); err != nil { 2671 return nil, err 2672 } 2673 return ret, nil 2674 // { 2675 // "description": "Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.", 2676 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:setIamPolicy", 2677 // "httpMethod": "POST", 2678 // "id": "pubsub.projects.subscriptions.setIamPolicy", 2679 // "parameterOrder": [ 2680 // "resource" 2681 // ], 2682 // "parameters": { 2683 // "resource": { 2684 // "description": "REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.", 2685 // "location": "path", 2686 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2687 // "required": true, 2688 // "type": "string" 2689 // } 2690 // }, 2691 // "path": "v1beta2/{+resource}:setIamPolicy", 2692 // "request": { 2693 // "$ref": "SetIamPolicyRequest" 2694 // }, 2695 // "response": { 2696 // "$ref": "Policy" 2697 // }, 2698 // "scopes": [ 2699 // "https://www.googleapis.com/auth/cloud-platform", 2700 // "https://www.googleapis.com/auth/pubsub" 2701 // ] 2702 // } 2703 2704} 2705 2706// method id "pubsub.projects.subscriptions.testIamPermissions": 2707 2708type ProjectsSubscriptionsTestIamPermissionsCall struct { 2709 s *Service 2710 resource string 2711 testiampermissionsrequest *TestIamPermissionsRequest 2712 urlParams_ gensupport.URLParams 2713 ctx_ context.Context 2714 header_ http.Header 2715} 2716 2717// TestIamPermissions: Returns permissions that a caller has on the 2718// specified resource. If the resource does not exist, this will return 2719// an empty set of permissions, not a `NOT_FOUND` error. Note: This 2720// operation is designed to be used for building permission-aware UIs 2721// and command-line tools, not for authorization checking. This 2722// operation may "fail open" without warning. 2723// 2724// - resource: REQUIRED: The resource for which the policy detail is 2725// being requested. See the operation documentation for the 2726// appropriate value for this field. 2727func (r *ProjectsSubscriptionsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsSubscriptionsTestIamPermissionsCall { 2728 c := &ProjectsSubscriptionsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2729 c.resource = resource 2730 c.testiampermissionsrequest = testiampermissionsrequest 2731 return c 2732} 2733 2734// Fields allows partial responses to be retrieved. See 2735// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2736// for more information. 2737func (c *ProjectsSubscriptionsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsTestIamPermissionsCall { 2738 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2739 return c 2740} 2741 2742// Context sets the context to be used in this call's Do method. Any 2743// pending HTTP request will be aborted if the provided context is 2744// canceled. 2745func (c *ProjectsSubscriptionsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsSubscriptionsTestIamPermissionsCall { 2746 c.ctx_ = ctx 2747 return c 2748} 2749 2750// Header returns an http.Header that can be modified by the caller to 2751// add HTTP headers to the request. 2752func (c *ProjectsSubscriptionsTestIamPermissionsCall) Header() http.Header { 2753 if c.header_ == nil { 2754 c.header_ = make(http.Header) 2755 } 2756 return c.header_ 2757} 2758 2759func (c *ProjectsSubscriptionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 2760 reqHeaders := make(http.Header) 2761 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 2762 for k, v := range c.header_ { 2763 reqHeaders[k] = v 2764 } 2765 reqHeaders.Set("User-Agent", c.s.userAgent()) 2766 var body io.Reader = nil 2767 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 2768 if err != nil { 2769 return nil, err 2770 } 2771 reqHeaders.Set("Content-Type", "application/json") 2772 c.urlParams_.Set("alt", alt) 2773 c.urlParams_.Set("prettyPrint", "false") 2774 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions") 2775 urls += "?" + c.urlParams_.Encode() 2776 req, err := http.NewRequest("POST", urls, body) 2777 if err != nil { 2778 return nil, err 2779 } 2780 req.Header = reqHeaders 2781 googleapi.Expand(req.URL, map[string]string{ 2782 "resource": c.resource, 2783 }) 2784 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2785} 2786 2787// Do executes the "pubsub.projects.subscriptions.testIamPermissions" call. 2788// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 2789// Any non-2xx status code is an error. Response headers are in either 2790// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 2791// was returned at all) in error.(*googleapi.Error).Header. Use 2792// googleapi.IsNotModified to check whether the returned error was 2793// because http.StatusNotModified was returned. 2794func (c *ProjectsSubscriptionsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 2795 gensupport.SetOptions(c.urlParams_, opts...) 2796 res, err := c.doRequest("json") 2797 if res != nil && res.StatusCode == http.StatusNotModified { 2798 if res.Body != nil { 2799 res.Body.Close() 2800 } 2801 return nil, &googleapi.Error{ 2802 Code: res.StatusCode, 2803 Header: res.Header, 2804 } 2805 } 2806 if err != nil { 2807 return nil, err 2808 } 2809 defer googleapi.CloseBody(res) 2810 if err := googleapi.CheckResponse(res); err != nil { 2811 return nil, err 2812 } 2813 ret := &TestIamPermissionsResponse{ 2814 ServerResponse: googleapi.ServerResponse{ 2815 Header: res.Header, 2816 HTTPStatusCode: res.StatusCode, 2817 }, 2818 } 2819 target := &ret 2820 if err := gensupport.DecodeResponse(target, res); err != nil { 2821 return nil, err 2822 } 2823 return ret, nil 2824 // { 2825 // "description": "Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may \"fail open\" without warning.", 2826 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:testIamPermissions", 2827 // "httpMethod": "POST", 2828 // "id": "pubsub.projects.subscriptions.testIamPermissions", 2829 // "parameterOrder": [ 2830 // "resource" 2831 // ], 2832 // "parameters": { 2833 // "resource": { 2834 // "description": "REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.", 2835 // "location": "path", 2836 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2837 // "required": true, 2838 // "type": "string" 2839 // } 2840 // }, 2841 // "path": "v1beta2/{+resource}:testIamPermissions", 2842 // "request": { 2843 // "$ref": "TestIamPermissionsRequest" 2844 // }, 2845 // "response": { 2846 // "$ref": "TestIamPermissionsResponse" 2847 // }, 2848 // "scopes": [ 2849 // "https://www.googleapis.com/auth/cloud-platform", 2850 // "https://www.googleapis.com/auth/pubsub" 2851 // ] 2852 // } 2853 2854} 2855 2856// method id "pubsub.projects.topics.create": 2857 2858type ProjectsTopicsCreateCall struct { 2859 s *Service 2860 name string 2861 topic *Topic 2862 urlParams_ gensupport.URLParams 2863 ctx_ context.Context 2864 header_ http.Header 2865} 2866 2867// Create: Creates the given topic with the given name. 2868// 2869// - name: The name of the topic. It must have the format 2870// "projects/{project}/topics/{topic}". `{topic}` must start with a 2871// letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), 2872// dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus 2873// (`+`) or percent signs (`%`). It must be between 3 and 255 2874// characters in length, and it must not start with "goog". 2875func (r *ProjectsTopicsService) Create(name string, topic *Topic) *ProjectsTopicsCreateCall { 2876 c := &ProjectsTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2877 c.name = name 2878 c.topic = topic 2879 return c 2880} 2881 2882// Fields allows partial responses to be retrieved. See 2883// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2884// for more information. 2885func (c *ProjectsTopicsCreateCall) Fields(s ...googleapi.Field) *ProjectsTopicsCreateCall { 2886 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2887 return c 2888} 2889 2890// Context sets the context to be used in this call's Do method. Any 2891// pending HTTP request will be aborted if the provided context is 2892// canceled. 2893func (c *ProjectsTopicsCreateCall) Context(ctx context.Context) *ProjectsTopicsCreateCall { 2894 c.ctx_ = ctx 2895 return c 2896} 2897 2898// Header returns an http.Header that can be modified by the caller to 2899// add HTTP headers to the request. 2900func (c *ProjectsTopicsCreateCall) Header() http.Header { 2901 if c.header_ == nil { 2902 c.header_ = make(http.Header) 2903 } 2904 return c.header_ 2905} 2906 2907func (c *ProjectsTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 2908 reqHeaders := make(http.Header) 2909 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 2910 for k, v := range c.header_ { 2911 reqHeaders[k] = v 2912 } 2913 reqHeaders.Set("User-Agent", c.s.userAgent()) 2914 var body io.Reader = nil 2915 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 2916 if err != nil { 2917 return nil, err 2918 } 2919 reqHeaders.Set("Content-Type", "application/json") 2920 c.urlParams_.Set("alt", alt) 2921 c.urlParams_.Set("prettyPrint", "false") 2922 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}") 2923 urls += "?" + c.urlParams_.Encode() 2924 req, err := http.NewRequest("PUT", urls, body) 2925 if err != nil { 2926 return nil, err 2927 } 2928 req.Header = reqHeaders 2929 googleapi.Expand(req.URL, map[string]string{ 2930 "name": c.name, 2931 }) 2932 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2933} 2934 2935// Do executes the "pubsub.projects.topics.create" call. 2936// Exactly one of *Topic or error will be non-nil. Any non-2xx status 2937// code is an error. Response headers are in either 2938// *Topic.ServerResponse.Header or (if a response was returned at all) 2939// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2940// check whether the returned error was because http.StatusNotModified 2941// was returned. 2942func (c *ProjectsTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 2943 gensupport.SetOptions(c.urlParams_, opts...) 2944 res, err := c.doRequest("json") 2945 if res != nil && res.StatusCode == http.StatusNotModified { 2946 if res.Body != nil { 2947 res.Body.Close() 2948 } 2949 return nil, &googleapi.Error{ 2950 Code: res.StatusCode, 2951 Header: res.Header, 2952 } 2953 } 2954 if err != nil { 2955 return nil, err 2956 } 2957 defer googleapi.CloseBody(res) 2958 if err := googleapi.CheckResponse(res); err != nil { 2959 return nil, err 2960 } 2961 ret := &Topic{ 2962 ServerResponse: googleapi.ServerResponse{ 2963 Header: res.Header, 2964 HTTPStatusCode: res.StatusCode, 2965 }, 2966 } 2967 target := &ret 2968 if err := gensupport.DecodeResponse(target, res); err != nil { 2969 return nil, err 2970 } 2971 return ret, nil 2972 // { 2973 // "description": "Creates the given topic with the given name.", 2974 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", 2975 // "httpMethod": "PUT", 2976 // "id": "pubsub.projects.topics.create", 2977 // "parameterOrder": [ 2978 // "name" 2979 // ], 2980 // "parameters": { 2981 // "name": { 2982 // "description": "The name of the topic. It must have the format `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `\"goog\"`.", 2983 // "location": "path", 2984 // "pattern": "^projects/[^/]+/topics/[^/]+$", 2985 // "required": true, 2986 // "type": "string" 2987 // } 2988 // }, 2989 // "path": "v1beta2/{+name}", 2990 // "request": { 2991 // "$ref": "Topic" 2992 // }, 2993 // "response": { 2994 // "$ref": "Topic" 2995 // }, 2996 // "scopes": [ 2997 // "https://www.googleapis.com/auth/cloud-platform", 2998 // "https://www.googleapis.com/auth/pubsub" 2999 // ] 3000 // } 3001 3002} 3003 3004// method id "pubsub.projects.topics.delete": 3005 3006type ProjectsTopicsDeleteCall struct { 3007 s *Service 3008 topic string 3009 urlParams_ gensupport.URLParams 3010 ctx_ context.Context 3011 header_ http.Header 3012} 3013 3014// Delete: Deletes the topic with the given name. Returns `NOT_FOUND` if 3015// the topic does not exist. After a topic is deleted, a new topic may 3016// be created with the same name; this is an entirely new topic with 3017// none of the old configuration or subscriptions. Existing 3018// subscriptions to this topic are not deleted, but their `topic` field 3019// is set to `_deleted-topic_`. 3020// 3021// - topic: Name of the topic to delete. 3022func (r *ProjectsTopicsService) Delete(topic string) *ProjectsTopicsDeleteCall { 3023 c := &ProjectsTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3024 c.topic = topic 3025 return c 3026} 3027 3028// Fields allows partial responses to be retrieved. See 3029// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3030// for more information. 3031func (c *ProjectsTopicsDeleteCall) Fields(s ...googleapi.Field) *ProjectsTopicsDeleteCall { 3032 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3033 return c 3034} 3035 3036// Context sets the context to be used in this call's Do method. Any 3037// pending HTTP request will be aborted if the provided context is 3038// canceled. 3039func (c *ProjectsTopicsDeleteCall) Context(ctx context.Context) *ProjectsTopicsDeleteCall { 3040 c.ctx_ = ctx 3041 return c 3042} 3043 3044// Header returns an http.Header that can be modified by the caller to 3045// add HTTP headers to the request. 3046func (c *ProjectsTopicsDeleteCall) Header() http.Header { 3047 if c.header_ == nil { 3048 c.header_ = make(http.Header) 3049 } 3050 return c.header_ 3051} 3052 3053func (c *ProjectsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 3054 reqHeaders := make(http.Header) 3055 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3056 for k, v := range c.header_ { 3057 reqHeaders[k] = v 3058 } 3059 reqHeaders.Set("User-Agent", c.s.userAgent()) 3060 var body io.Reader = nil 3061 c.urlParams_.Set("alt", alt) 3062 c.urlParams_.Set("prettyPrint", "false") 3063 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}") 3064 urls += "?" + c.urlParams_.Encode() 3065 req, err := http.NewRequest("DELETE", urls, body) 3066 if err != nil { 3067 return nil, err 3068 } 3069 req.Header = reqHeaders 3070 googleapi.Expand(req.URL, map[string]string{ 3071 "topic": c.topic, 3072 }) 3073 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3074} 3075 3076// Do executes the "pubsub.projects.topics.delete" call. 3077// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3078// code is an error. Response headers are in either 3079// *Empty.ServerResponse.Header or (if a response was returned at all) 3080// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3081// check whether the returned error was because http.StatusNotModified 3082// was returned. 3083func (c *ProjectsTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3084 gensupport.SetOptions(c.urlParams_, opts...) 3085 res, err := c.doRequest("json") 3086 if res != nil && res.StatusCode == http.StatusNotModified { 3087 if res.Body != nil { 3088 res.Body.Close() 3089 } 3090 return nil, &googleapi.Error{ 3091 Code: res.StatusCode, 3092 Header: res.Header, 3093 } 3094 } 3095 if err != nil { 3096 return nil, err 3097 } 3098 defer googleapi.CloseBody(res) 3099 if err := googleapi.CheckResponse(res); err != nil { 3100 return nil, err 3101 } 3102 ret := &Empty{ 3103 ServerResponse: googleapi.ServerResponse{ 3104 Header: res.Header, 3105 HTTPStatusCode: res.StatusCode, 3106 }, 3107 } 3108 target := &ret 3109 if err := gensupport.DecodeResponse(target, res); err != nil { 3110 return nil, err 3111 } 3112 return ret, nil 3113 // { 3114 // "description": "Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`.", 3115 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", 3116 // "httpMethod": "DELETE", 3117 // "id": "pubsub.projects.topics.delete", 3118 // "parameterOrder": [ 3119 // "topic" 3120 // ], 3121 // "parameters": { 3122 // "topic": { 3123 // "description": "Name of the topic to delete.", 3124 // "location": "path", 3125 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3126 // "required": true, 3127 // "type": "string" 3128 // } 3129 // }, 3130 // "path": "v1beta2/{+topic}", 3131 // "response": { 3132 // "$ref": "Empty" 3133 // }, 3134 // "scopes": [ 3135 // "https://www.googleapis.com/auth/cloud-platform", 3136 // "https://www.googleapis.com/auth/pubsub" 3137 // ] 3138 // } 3139 3140} 3141 3142// method id "pubsub.projects.topics.get": 3143 3144type ProjectsTopicsGetCall struct { 3145 s *Service 3146 topic string 3147 urlParams_ gensupport.URLParams 3148 ifNoneMatch_ string 3149 ctx_ context.Context 3150 header_ http.Header 3151} 3152 3153// Get: Gets the configuration of a topic. 3154// 3155// - topic: The name of the topic to get. 3156func (r *ProjectsTopicsService) Get(topic string) *ProjectsTopicsGetCall { 3157 c := &ProjectsTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3158 c.topic = topic 3159 return c 3160} 3161 3162// Fields allows partial responses to be retrieved. See 3163// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3164// for more information. 3165func (c *ProjectsTopicsGetCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetCall { 3166 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3167 return c 3168} 3169 3170// IfNoneMatch sets the optional parameter which makes the operation 3171// fail if the object's ETag matches the given value. This is useful for 3172// getting updates only after the object has changed since the last 3173// request. Use googleapi.IsNotModified to check whether the response 3174// error from Do is the result of In-None-Match. 3175func (c *ProjectsTopicsGetCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetCall { 3176 c.ifNoneMatch_ = entityTag 3177 return c 3178} 3179 3180// Context sets the context to be used in this call's Do method. Any 3181// pending HTTP request will be aborted if the provided context is 3182// canceled. 3183func (c *ProjectsTopicsGetCall) Context(ctx context.Context) *ProjectsTopicsGetCall { 3184 c.ctx_ = ctx 3185 return c 3186} 3187 3188// Header returns an http.Header that can be modified by the caller to 3189// add HTTP headers to the request. 3190func (c *ProjectsTopicsGetCall) Header() http.Header { 3191 if c.header_ == nil { 3192 c.header_ = make(http.Header) 3193 } 3194 return c.header_ 3195} 3196 3197func (c *ProjectsTopicsGetCall) doRequest(alt string) (*http.Response, error) { 3198 reqHeaders := make(http.Header) 3199 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3200 for k, v := range c.header_ { 3201 reqHeaders[k] = v 3202 } 3203 reqHeaders.Set("User-Agent", c.s.userAgent()) 3204 if c.ifNoneMatch_ != "" { 3205 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3206 } 3207 var body io.Reader = nil 3208 c.urlParams_.Set("alt", alt) 3209 c.urlParams_.Set("prettyPrint", "false") 3210 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}") 3211 urls += "?" + c.urlParams_.Encode() 3212 req, err := http.NewRequest("GET", urls, body) 3213 if err != nil { 3214 return nil, err 3215 } 3216 req.Header = reqHeaders 3217 googleapi.Expand(req.URL, map[string]string{ 3218 "topic": c.topic, 3219 }) 3220 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3221} 3222 3223// Do executes the "pubsub.projects.topics.get" call. 3224// Exactly one of *Topic or error will be non-nil. Any non-2xx status 3225// code is an error. Response headers are in either 3226// *Topic.ServerResponse.Header or (if a response was returned at all) 3227// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3228// check whether the returned error was because http.StatusNotModified 3229// was returned. 3230func (c *ProjectsTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 3231 gensupport.SetOptions(c.urlParams_, opts...) 3232 res, err := c.doRequest("json") 3233 if res != nil && res.StatusCode == http.StatusNotModified { 3234 if res.Body != nil { 3235 res.Body.Close() 3236 } 3237 return nil, &googleapi.Error{ 3238 Code: res.StatusCode, 3239 Header: res.Header, 3240 } 3241 } 3242 if err != nil { 3243 return nil, err 3244 } 3245 defer googleapi.CloseBody(res) 3246 if err := googleapi.CheckResponse(res); err != nil { 3247 return nil, err 3248 } 3249 ret := &Topic{ 3250 ServerResponse: googleapi.ServerResponse{ 3251 Header: res.Header, 3252 HTTPStatusCode: res.StatusCode, 3253 }, 3254 } 3255 target := &ret 3256 if err := gensupport.DecodeResponse(target, res); err != nil { 3257 return nil, err 3258 } 3259 return ret, nil 3260 // { 3261 // "description": "Gets the configuration of a topic.", 3262 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", 3263 // "httpMethod": "GET", 3264 // "id": "pubsub.projects.topics.get", 3265 // "parameterOrder": [ 3266 // "topic" 3267 // ], 3268 // "parameters": { 3269 // "topic": { 3270 // "description": "The name of the topic to get.", 3271 // "location": "path", 3272 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3273 // "required": true, 3274 // "type": "string" 3275 // } 3276 // }, 3277 // "path": "v1beta2/{+topic}", 3278 // "response": { 3279 // "$ref": "Topic" 3280 // }, 3281 // "scopes": [ 3282 // "https://www.googleapis.com/auth/cloud-platform", 3283 // "https://www.googleapis.com/auth/pubsub" 3284 // ] 3285 // } 3286 3287} 3288 3289// method id "pubsub.projects.topics.getIamPolicy": 3290 3291type ProjectsTopicsGetIamPolicyCall struct { 3292 s *Service 3293 resource string 3294 urlParams_ gensupport.URLParams 3295 ifNoneMatch_ string 3296 ctx_ context.Context 3297 header_ http.Header 3298} 3299 3300// GetIamPolicy: Gets the access control policy for a resource. Returns 3301// an empty policy if the resource exists and does not have a policy 3302// set. 3303// 3304// - resource: REQUIRED: The resource for which the policy is being 3305// requested. See the operation documentation for the appropriate 3306// value for this field. 3307func (r *ProjectsTopicsService) GetIamPolicy(resource string) *ProjectsTopicsGetIamPolicyCall { 3308 c := &ProjectsTopicsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3309 c.resource = resource 3310 return c 3311} 3312 3313// OptionsRequestedPolicyVersion sets the optional parameter 3314// "options.requestedPolicyVersion": The policy format version to be 3315// returned. Valid values are 0, 1, and 3. Requests specifying an 3316// invalid value will be rejected. Requests for policies with any 3317// conditional bindings must specify version 3. Policies without any 3318// conditional bindings may specify any valid value or leave the field 3319// unset. To learn which resources support conditions in their IAM 3320// policies, see the IAM documentation 3321// (https://cloud.google.com/iam/help/conditions/resource-policies). 3322func (c *ProjectsTopicsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsTopicsGetIamPolicyCall { 3323 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion)) 3324 return c 3325} 3326 3327// Fields allows partial responses to be retrieved. See 3328// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3329// for more information. 3330func (c *ProjectsTopicsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetIamPolicyCall { 3331 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3332 return c 3333} 3334 3335// IfNoneMatch sets the optional parameter which makes the operation 3336// fail if the object's ETag matches the given value. This is useful for 3337// getting updates only after the object has changed since the last 3338// request. Use googleapi.IsNotModified to check whether the response 3339// error from Do is the result of In-None-Match. 3340func (c *ProjectsTopicsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetIamPolicyCall { 3341 c.ifNoneMatch_ = entityTag 3342 return c 3343} 3344 3345// Context sets the context to be used in this call's Do method. Any 3346// pending HTTP request will be aborted if the provided context is 3347// canceled. 3348func (c *ProjectsTopicsGetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsGetIamPolicyCall { 3349 c.ctx_ = ctx 3350 return c 3351} 3352 3353// Header returns an http.Header that can be modified by the caller to 3354// add HTTP headers to the request. 3355func (c *ProjectsTopicsGetIamPolicyCall) Header() http.Header { 3356 if c.header_ == nil { 3357 c.header_ = make(http.Header) 3358 } 3359 return c.header_ 3360} 3361 3362func (c *ProjectsTopicsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 3363 reqHeaders := make(http.Header) 3364 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3365 for k, v := range c.header_ { 3366 reqHeaders[k] = v 3367 } 3368 reqHeaders.Set("User-Agent", c.s.userAgent()) 3369 if c.ifNoneMatch_ != "" { 3370 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3371 } 3372 var body io.Reader = nil 3373 c.urlParams_.Set("alt", alt) 3374 c.urlParams_.Set("prettyPrint", "false") 3375 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy") 3376 urls += "?" + c.urlParams_.Encode() 3377 req, err := http.NewRequest("GET", urls, body) 3378 if err != nil { 3379 return nil, err 3380 } 3381 req.Header = reqHeaders 3382 googleapi.Expand(req.URL, map[string]string{ 3383 "resource": c.resource, 3384 }) 3385 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3386} 3387 3388// Do executes the "pubsub.projects.topics.getIamPolicy" call. 3389// Exactly one of *Policy or error will be non-nil. Any non-2xx status 3390// code is an error. Response headers are in either 3391// *Policy.ServerResponse.Header or (if a response was returned at all) 3392// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3393// check whether the returned error was because http.StatusNotModified 3394// was returned. 3395func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 3396 gensupport.SetOptions(c.urlParams_, opts...) 3397 res, err := c.doRequest("json") 3398 if res != nil && res.StatusCode == http.StatusNotModified { 3399 if res.Body != nil { 3400 res.Body.Close() 3401 } 3402 return nil, &googleapi.Error{ 3403 Code: res.StatusCode, 3404 Header: res.Header, 3405 } 3406 } 3407 if err != nil { 3408 return nil, err 3409 } 3410 defer googleapi.CloseBody(res) 3411 if err := googleapi.CheckResponse(res); err != nil { 3412 return nil, err 3413 } 3414 ret := &Policy{ 3415 ServerResponse: googleapi.ServerResponse{ 3416 Header: res.Header, 3417 HTTPStatusCode: res.StatusCode, 3418 }, 3419 } 3420 target := &ret 3421 if err := gensupport.DecodeResponse(target, res); err != nil { 3422 return nil, err 3423 } 3424 return ret, nil 3425 // { 3426 // "description": "Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.", 3427 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:getIamPolicy", 3428 // "httpMethod": "GET", 3429 // "id": "pubsub.projects.topics.getIamPolicy", 3430 // "parameterOrder": [ 3431 // "resource" 3432 // ], 3433 // "parameters": { 3434 // "options.requestedPolicyVersion": { 3435 // "description": "Optional. The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).", 3436 // "format": "int32", 3437 // "location": "query", 3438 // "type": "integer" 3439 // }, 3440 // "resource": { 3441 // "description": "REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.", 3442 // "location": "path", 3443 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3444 // "required": true, 3445 // "type": "string" 3446 // } 3447 // }, 3448 // "path": "v1beta2/{+resource}:getIamPolicy", 3449 // "response": { 3450 // "$ref": "Policy" 3451 // }, 3452 // "scopes": [ 3453 // "https://www.googleapis.com/auth/cloud-platform", 3454 // "https://www.googleapis.com/auth/pubsub" 3455 // ] 3456 // } 3457 3458} 3459 3460// method id "pubsub.projects.topics.list": 3461 3462type ProjectsTopicsListCall struct { 3463 s *Service 3464 project string 3465 urlParams_ gensupport.URLParams 3466 ifNoneMatch_ string 3467 ctx_ context.Context 3468 header_ http.Header 3469} 3470 3471// List: Lists matching topics. 3472// 3473// - project: The name of the cloud project that topics belong to. 3474func (r *ProjectsTopicsService) List(project string) *ProjectsTopicsListCall { 3475 c := &ProjectsTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3476 c.project = project 3477 return c 3478} 3479 3480// PageSize sets the optional parameter "pageSize": Maximum number of 3481// topics to return. 3482func (c *ProjectsTopicsListCall) PageSize(pageSize int64) *ProjectsTopicsListCall { 3483 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3484 return c 3485} 3486 3487// PageToken sets the optional parameter "pageToken": The value returned 3488// by the last `ListTopicsResponse`; indicates that this is a 3489// continuation of a prior `ListTopics` call, and that the system should 3490// return the next page of data. 3491func (c *ProjectsTopicsListCall) PageToken(pageToken string) *ProjectsTopicsListCall { 3492 c.urlParams_.Set("pageToken", pageToken) 3493 return c 3494} 3495 3496// Fields allows partial responses to be retrieved. See 3497// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3498// for more information. 3499func (c *ProjectsTopicsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsListCall { 3500 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3501 return c 3502} 3503 3504// IfNoneMatch sets the optional parameter which makes the operation 3505// fail if the object's ETag matches the given value. This is useful for 3506// getting updates only after the object has changed since the last 3507// request. Use googleapi.IsNotModified to check whether the response 3508// error from Do is the result of In-None-Match. 3509func (c *ProjectsTopicsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsListCall { 3510 c.ifNoneMatch_ = entityTag 3511 return c 3512} 3513 3514// Context sets the context to be used in this call's Do method. Any 3515// pending HTTP request will be aborted if the provided context is 3516// canceled. 3517func (c *ProjectsTopicsListCall) Context(ctx context.Context) *ProjectsTopicsListCall { 3518 c.ctx_ = ctx 3519 return c 3520} 3521 3522// Header returns an http.Header that can be modified by the caller to 3523// add HTTP headers to the request. 3524func (c *ProjectsTopicsListCall) Header() http.Header { 3525 if c.header_ == nil { 3526 c.header_ = make(http.Header) 3527 } 3528 return c.header_ 3529} 3530 3531func (c *ProjectsTopicsListCall) doRequest(alt string) (*http.Response, error) { 3532 reqHeaders := make(http.Header) 3533 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3534 for k, v := range c.header_ { 3535 reqHeaders[k] = v 3536 } 3537 reqHeaders.Set("User-Agent", c.s.userAgent()) 3538 if c.ifNoneMatch_ != "" { 3539 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3540 } 3541 var body io.Reader = nil 3542 c.urlParams_.Set("alt", alt) 3543 c.urlParams_.Set("prettyPrint", "false") 3544 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/topics") 3545 urls += "?" + c.urlParams_.Encode() 3546 req, err := http.NewRequest("GET", urls, body) 3547 if err != nil { 3548 return nil, err 3549 } 3550 req.Header = reqHeaders 3551 googleapi.Expand(req.URL, map[string]string{ 3552 "project": c.project, 3553 }) 3554 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3555} 3556 3557// Do executes the "pubsub.projects.topics.list" call. 3558// Exactly one of *ListTopicsResponse or error will be non-nil. Any 3559// non-2xx status code is an error. Response headers are in either 3560// *ListTopicsResponse.ServerResponse.Header or (if a response was 3561// returned at all) in error.(*googleapi.Error).Header. Use 3562// googleapi.IsNotModified to check whether the returned error was 3563// because http.StatusNotModified was returned. 3564func (c *ProjectsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) { 3565 gensupport.SetOptions(c.urlParams_, opts...) 3566 res, err := c.doRequest("json") 3567 if res != nil && res.StatusCode == http.StatusNotModified { 3568 if res.Body != nil { 3569 res.Body.Close() 3570 } 3571 return nil, &googleapi.Error{ 3572 Code: res.StatusCode, 3573 Header: res.Header, 3574 } 3575 } 3576 if err != nil { 3577 return nil, err 3578 } 3579 defer googleapi.CloseBody(res) 3580 if err := googleapi.CheckResponse(res); err != nil { 3581 return nil, err 3582 } 3583 ret := &ListTopicsResponse{ 3584 ServerResponse: googleapi.ServerResponse{ 3585 Header: res.Header, 3586 HTTPStatusCode: res.StatusCode, 3587 }, 3588 } 3589 target := &ret 3590 if err := gensupport.DecodeResponse(target, res); err != nil { 3591 return nil, err 3592 } 3593 return ret, nil 3594 // { 3595 // "description": "Lists matching topics.", 3596 // "flatPath": "v1beta2/projects/{projectsId}/topics", 3597 // "httpMethod": "GET", 3598 // "id": "pubsub.projects.topics.list", 3599 // "parameterOrder": [ 3600 // "project" 3601 // ], 3602 // "parameters": { 3603 // "pageSize": { 3604 // "description": "Maximum number of topics to return.", 3605 // "format": "int32", 3606 // "location": "query", 3607 // "type": "integer" 3608 // }, 3609 // "pageToken": { 3610 // "description": "The value returned by the last `ListTopicsResponse`; indicates that this is a continuation of a prior `ListTopics` call, and that the system should return the next page of data.", 3611 // "location": "query", 3612 // "type": "string" 3613 // }, 3614 // "project": { 3615 // "description": "The name of the cloud project that topics belong to.", 3616 // "location": "path", 3617 // "pattern": "^projects/[^/]+$", 3618 // "required": true, 3619 // "type": "string" 3620 // } 3621 // }, 3622 // "path": "v1beta2/{+project}/topics", 3623 // "response": { 3624 // "$ref": "ListTopicsResponse" 3625 // }, 3626 // "scopes": [ 3627 // "https://www.googleapis.com/auth/cloud-platform", 3628 // "https://www.googleapis.com/auth/pubsub" 3629 // ] 3630 // } 3631 3632} 3633 3634// Pages invokes f for each page of results. 3635// A non-nil error returned from f will halt the iteration. 3636// The provided context supersedes any context provided to the Context method. 3637func (c *ProjectsTopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error { 3638 c.ctx_ = ctx 3639 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3640 for { 3641 x, err := c.Do() 3642 if err != nil { 3643 return err 3644 } 3645 if err := f(x); err != nil { 3646 return err 3647 } 3648 if x.NextPageToken == "" { 3649 return nil 3650 } 3651 c.PageToken(x.NextPageToken) 3652 } 3653} 3654 3655// method id "pubsub.projects.topics.publish": 3656 3657type ProjectsTopicsPublishCall struct { 3658 s *Service 3659 topic string 3660 publishrequest *PublishRequest 3661 urlParams_ gensupport.URLParams 3662 ctx_ context.Context 3663 header_ http.Header 3664} 3665 3666// Publish: Adds one or more messages to the topic. Returns `NOT_FOUND` 3667// if the topic does not exist. The message payload must not be empty; 3668// it must contain either a non-empty data field, or at least one 3669// attribute. 3670// 3671// - topic: The messages in the request will be published on this topic. 3672func (r *ProjectsTopicsService) Publish(topic string, publishrequest *PublishRequest) *ProjectsTopicsPublishCall { 3673 c := &ProjectsTopicsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3674 c.topic = topic 3675 c.publishrequest = publishrequest 3676 return c 3677} 3678 3679// Fields allows partial responses to be retrieved. See 3680// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3681// for more information. 3682func (c *ProjectsTopicsPublishCall) Fields(s ...googleapi.Field) *ProjectsTopicsPublishCall { 3683 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3684 return c 3685} 3686 3687// Context sets the context to be used in this call's Do method. Any 3688// pending HTTP request will be aborted if the provided context is 3689// canceled. 3690func (c *ProjectsTopicsPublishCall) Context(ctx context.Context) *ProjectsTopicsPublishCall { 3691 c.ctx_ = ctx 3692 return c 3693} 3694 3695// Header returns an http.Header that can be modified by the caller to 3696// add HTTP headers to the request. 3697func (c *ProjectsTopicsPublishCall) Header() http.Header { 3698 if c.header_ == nil { 3699 c.header_ = make(http.Header) 3700 } 3701 return c.header_ 3702} 3703 3704func (c *ProjectsTopicsPublishCall) doRequest(alt string) (*http.Response, error) { 3705 reqHeaders := make(http.Header) 3706 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3707 for k, v := range c.header_ { 3708 reqHeaders[k] = v 3709 } 3710 reqHeaders.Set("User-Agent", c.s.userAgent()) 3711 var body io.Reader = nil 3712 body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest) 3713 if err != nil { 3714 return nil, err 3715 } 3716 reqHeaders.Set("Content-Type", "application/json") 3717 c.urlParams_.Set("alt", alt) 3718 c.urlParams_.Set("prettyPrint", "false") 3719 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}:publish") 3720 urls += "?" + c.urlParams_.Encode() 3721 req, err := http.NewRequest("POST", urls, body) 3722 if err != nil { 3723 return nil, err 3724 } 3725 req.Header = reqHeaders 3726 googleapi.Expand(req.URL, map[string]string{ 3727 "topic": c.topic, 3728 }) 3729 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3730} 3731 3732// Do executes the "pubsub.projects.topics.publish" call. 3733// Exactly one of *PublishResponse or error will be non-nil. Any non-2xx 3734// status code is an error. Response headers are in either 3735// *PublishResponse.ServerResponse.Header or (if a response was returned 3736// at all) in error.(*googleapi.Error).Header. Use 3737// googleapi.IsNotModified to check whether the returned error was 3738// because http.StatusNotModified was returned. 3739func (c *ProjectsTopicsPublishCall) Do(opts ...googleapi.CallOption) (*PublishResponse, error) { 3740 gensupport.SetOptions(c.urlParams_, opts...) 3741 res, err := c.doRequest("json") 3742 if res != nil && res.StatusCode == http.StatusNotModified { 3743 if res.Body != nil { 3744 res.Body.Close() 3745 } 3746 return nil, &googleapi.Error{ 3747 Code: res.StatusCode, 3748 Header: res.Header, 3749 } 3750 } 3751 if err != nil { 3752 return nil, err 3753 } 3754 defer googleapi.CloseBody(res) 3755 if err := googleapi.CheckResponse(res); err != nil { 3756 return nil, err 3757 } 3758 ret := &PublishResponse{ 3759 ServerResponse: googleapi.ServerResponse{ 3760 Header: res.Header, 3761 HTTPStatusCode: res.StatusCode, 3762 }, 3763 } 3764 target := &ret 3765 if err := gensupport.DecodeResponse(target, res); err != nil { 3766 return nil, err 3767 } 3768 return ret, nil 3769 // { 3770 // "description": "Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. The message payload must not be empty; it must contain either a non-empty data field, or at least one attribute.", 3771 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:publish", 3772 // "httpMethod": "POST", 3773 // "id": "pubsub.projects.topics.publish", 3774 // "parameterOrder": [ 3775 // "topic" 3776 // ], 3777 // "parameters": { 3778 // "topic": { 3779 // "description": "The messages in the request will be published on this topic.", 3780 // "location": "path", 3781 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3782 // "required": true, 3783 // "type": "string" 3784 // } 3785 // }, 3786 // "path": "v1beta2/{+topic}:publish", 3787 // "request": { 3788 // "$ref": "PublishRequest" 3789 // }, 3790 // "response": { 3791 // "$ref": "PublishResponse" 3792 // }, 3793 // "scopes": [ 3794 // "https://www.googleapis.com/auth/cloud-platform", 3795 // "https://www.googleapis.com/auth/pubsub" 3796 // ] 3797 // } 3798 3799} 3800 3801// method id "pubsub.projects.topics.setIamPolicy": 3802 3803type ProjectsTopicsSetIamPolicyCall struct { 3804 s *Service 3805 resource string 3806 setiampolicyrequest *SetIamPolicyRequest 3807 urlParams_ gensupport.URLParams 3808 ctx_ context.Context 3809 header_ http.Header 3810} 3811 3812// SetIamPolicy: Sets the access control policy on the specified 3813// resource. Replaces any existing policy. Can return `NOT_FOUND`, 3814// `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. 3815// 3816// - resource: REQUIRED: The resource for which the policy is being 3817// specified. See the operation documentation for the appropriate 3818// value for this field. 3819func (r *ProjectsTopicsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsTopicsSetIamPolicyCall { 3820 c := &ProjectsTopicsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3821 c.resource = resource 3822 c.setiampolicyrequest = setiampolicyrequest 3823 return c 3824} 3825 3826// Fields allows partial responses to be retrieved. See 3827// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3828// for more information. 3829func (c *ProjectsTopicsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsSetIamPolicyCall { 3830 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3831 return c 3832} 3833 3834// Context sets the context to be used in this call's Do method. Any 3835// pending HTTP request will be aborted if the provided context is 3836// canceled. 3837func (c *ProjectsTopicsSetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsSetIamPolicyCall { 3838 c.ctx_ = ctx 3839 return c 3840} 3841 3842// Header returns an http.Header that can be modified by the caller to 3843// add HTTP headers to the request. 3844func (c *ProjectsTopicsSetIamPolicyCall) Header() http.Header { 3845 if c.header_ == nil { 3846 c.header_ = make(http.Header) 3847 } 3848 return c.header_ 3849} 3850 3851func (c *ProjectsTopicsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 3852 reqHeaders := make(http.Header) 3853 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 3854 for k, v := range c.header_ { 3855 reqHeaders[k] = v 3856 } 3857 reqHeaders.Set("User-Agent", c.s.userAgent()) 3858 var body io.Reader = nil 3859 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 3860 if err != nil { 3861 return nil, err 3862 } 3863 reqHeaders.Set("Content-Type", "application/json") 3864 c.urlParams_.Set("alt", alt) 3865 c.urlParams_.Set("prettyPrint", "false") 3866 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy") 3867 urls += "?" + c.urlParams_.Encode() 3868 req, err := http.NewRequest("POST", urls, body) 3869 if err != nil { 3870 return nil, err 3871 } 3872 req.Header = reqHeaders 3873 googleapi.Expand(req.URL, map[string]string{ 3874 "resource": c.resource, 3875 }) 3876 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3877} 3878 3879// Do executes the "pubsub.projects.topics.setIamPolicy" call. 3880// Exactly one of *Policy or error will be non-nil. Any non-2xx status 3881// code is an error. Response headers are in either 3882// *Policy.ServerResponse.Header or (if a response was returned at all) 3883// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3884// check whether the returned error was because http.StatusNotModified 3885// was returned. 3886func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 3887 gensupport.SetOptions(c.urlParams_, opts...) 3888 res, err := c.doRequest("json") 3889 if res != nil && res.StatusCode == http.StatusNotModified { 3890 if res.Body != nil { 3891 res.Body.Close() 3892 } 3893 return nil, &googleapi.Error{ 3894 Code: res.StatusCode, 3895 Header: res.Header, 3896 } 3897 } 3898 if err != nil { 3899 return nil, err 3900 } 3901 defer googleapi.CloseBody(res) 3902 if err := googleapi.CheckResponse(res); err != nil { 3903 return nil, err 3904 } 3905 ret := &Policy{ 3906 ServerResponse: googleapi.ServerResponse{ 3907 Header: res.Header, 3908 HTTPStatusCode: res.StatusCode, 3909 }, 3910 } 3911 target := &ret 3912 if err := gensupport.DecodeResponse(target, res); err != nil { 3913 return nil, err 3914 } 3915 return ret, nil 3916 // { 3917 // "description": "Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.", 3918 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:setIamPolicy", 3919 // "httpMethod": "POST", 3920 // "id": "pubsub.projects.topics.setIamPolicy", 3921 // "parameterOrder": [ 3922 // "resource" 3923 // ], 3924 // "parameters": { 3925 // "resource": { 3926 // "description": "REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.", 3927 // "location": "path", 3928 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3929 // "required": true, 3930 // "type": "string" 3931 // } 3932 // }, 3933 // "path": "v1beta2/{+resource}:setIamPolicy", 3934 // "request": { 3935 // "$ref": "SetIamPolicyRequest" 3936 // }, 3937 // "response": { 3938 // "$ref": "Policy" 3939 // }, 3940 // "scopes": [ 3941 // "https://www.googleapis.com/auth/cloud-platform", 3942 // "https://www.googleapis.com/auth/pubsub" 3943 // ] 3944 // } 3945 3946} 3947 3948// method id "pubsub.projects.topics.testIamPermissions": 3949 3950type ProjectsTopicsTestIamPermissionsCall struct { 3951 s *Service 3952 resource string 3953 testiampermissionsrequest *TestIamPermissionsRequest 3954 urlParams_ gensupport.URLParams 3955 ctx_ context.Context 3956 header_ http.Header 3957} 3958 3959// TestIamPermissions: Returns permissions that a caller has on the 3960// specified resource. If the resource does not exist, this will return 3961// an empty set of permissions, not a `NOT_FOUND` error. Note: This 3962// operation is designed to be used for building permission-aware UIs 3963// and command-line tools, not for authorization checking. This 3964// operation may "fail open" without warning. 3965// 3966// - resource: REQUIRED: The resource for which the policy detail is 3967// being requested. See the operation documentation for the 3968// appropriate value for this field. 3969func (r *ProjectsTopicsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTopicsTestIamPermissionsCall { 3970 c := &ProjectsTopicsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3971 c.resource = resource 3972 c.testiampermissionsrequest = testiampermissionsrequest 3973 return c 3974} 3975 3976// Fields allows partial responses to be retrieved. See 3977// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3978// for more information. 3979func (c *ProjectsTopicsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTopicsTestIamPermissionsCall { 3980 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3981 return c 3982} 3983 3984// Context sets the context to be used in this call's Do method. Any 3985// pending HTTP request will be aborted if the provided context is 3986// canceled. 3987func (c *ProjectsTopicsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTopicsTestIamPermissionsCall { 3988 c.ctx_ = ctx 3989 return c 3990} 3991 3992// Header returns an http.Header that can be modified by the caller to 3993// add HTTP headers to the request. 3994func (c *ProjectsTopicsTestIamPermissionsCall) Header() http.Header { 3995 if c.header_ == nil { 3996 c.header_ = make(http.Header) 3997 } 3998 return c.header_ 3999} 4000 4001func (c *ProjectsTopicsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 4002 reqHeaders := make(http.Header) 4003 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4004 for k, v := range c.header_ { 4005 reqHeaders[k] = v 4006 } 4007 reqHeaders.Set("User-Agent", c.s.userAgent()) 4008 var body io.Reader = nil 4009 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 4010 if err != nil { 4011 return nil, err 4012 } 4013 reqHeaders.Set("Content-Type", "application/json") 4014 c.urlParams_.Set("alt", alt) 4015 c.urlParams_.Set("prettyPrint", "false") 4016 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions") 4017 urls += "?" + c.urlParams_.Encode() 4018 req, err := http.NewRequest("POST", urls, body) 4019 if err != nil { 4020 return nil, err 4021 } 4022 req.Header = reqHeaders 4023 googleapi.Expand(req.URL, map[string]string{ 4024 "resource": c.resource, 4025 }) 4026 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4027} 4028 4029// Do executes the "pubsub.projects.topics.testIamPermissions" call. 4030// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 4031// Any non-2xx status code is an error. Response headers are in either 4032// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 4033// was returned at all) in error.(*googleapi.Error).Header. Use 4034// googleapi.IsNotModified to check whether the returned error was 4035// because http.StatusNotModified was returned. 4036func (c *ProjectsTopicsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 4037 gensupport.SetOptions(c.urlParams_, opts...) 4038 res, err := c.doRequest("json") 4039 if res != nil && res.StatusCode == http.StatusNotModified { 4040 if res.Body != nil { 4041 res.Body.Close() 4042 } 4043 return nil, &googleapi.Error{ 4044 Code: res.StatusCode, 4045 Header: res.Header, 4046 } 4047 } 4048 if err != nil { 4049 return nil, err 4050 } 4051 defer googleapi.CloseBody(res) 4052 if err := googleapi.CheckResponse(res); err != nil { 4053 return nil, err 4054 } 4055 ret := &TestIamPermissionsResponse{ 4056 ServerResponse: googleapi.ServerResponse{ 4057 Header: res.Header, 4058 HTTPStatusCode: res.StatusCode, 4059 }, 4060 } 4061 target := &ret 4062 if err := gensupport.DecodeResponse(target, res); err != nil { 4063 return nil, err 4064 } 4065 return ret, nil 4066 // { 4067 // "description": "Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may \"fail open\" without warning.", 4068 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:testIamPermissions", 4069 // "httpMethod": "POST", 4070 // "id": "pubsub.projects.topics.testIamPermissions", 4071 // "parameterOrder": [ 4072 // "resource" 4073 // ], 4074 // "parameters": { 4075 // "resource": { 4076 // "description": "REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.", 4077 // "location": "path", 4078 // "pattern": "^projects/[^/]+/topics/[^/]+$", 4079 // "required": true, 4080 // "type": "string" 4081 // } 4082 // }, 4083 // "path": "v1beta2/{+resource}:testIamPermissions", 4084 // "request": { 4085 // "$ref": "TestIamPermissionsRequest" 4086 // }, 4087 // "response": { 4088 // "$ref": "TestIamPermissionsResponse" 4089 // }, 4090 // "scopes": [ 4091 // "https://www.googleapis.com/auth/cloud-platform", 4092 // "https://www.googleapis.com/auth/pubsub" 4093 // ] 4094 // } 4095 4096} 4097 4098// method id "pubsub.projects.topics.subscriptions.list": 4099 4100type ProjectsTopicsSubscriptionsListCall struct { 4101 s *Service 4102 topic string 4103 urlParams_ gensupport.URLParams 4104 ifNoneMatch_ string 4105 ctx_ context.Context 4106 header_ http.Header 4107} 4108 4109// List: Lists the name of the subscriptions for this topic. 4110// 4111// - topic: The name of the topic that subscriptions are attached to. 4112func (r *ProjectsTopicsSubscriptionsService) List(topic string) *ProjectsTopicsSubscriptionsListCall { 4113 c := &ProjectsTopicsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4114 c.topic = topic 4115 return c 4116} 4117 4118// PageSize sets the optional parameter "pageSize": Maximum number of 4119// subscription names to return. 4120func (c *ProjectsTopicsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsTopicsSubscriptionsListCall { 4121 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4122 return c 4123} 4124 4125// PageToken sets the optional parameter "pageToken": The value returned 4126// by the last `ListTopicSubscriptionsResponse`; indicates that this is 4127// a continuation of a prior `ListTopicSubscriptions` call, and that the 4128// system should return the next page of data. 4129func (c *ProjectsTopicsSubscriptionsListCall) PageToken(pageToken string) *ProjectsTopicsSubscriptionsListCall { 4130 c.urlParams_.Set("pageToken", pageToken) 4131 return c 4132} 4133 4134// Fields allows partial responses to be retrieved. See 4135// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4136// for more information. 4137func (c *ProjectsTopicsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsSubscriptionsListCall { 4138 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4139 return c 4140} 4141 4142// IfNoneMatch sets the optional parameter which makes the operation 4143// fail if the object's ETag matches the given value. This is useful for 4144// getting updates only after the object has changed since the last 4145// request. Use googleapi.IsNotModified to check whether the response 4146// error from Do is the result of In-None-Match. 4147func (c *ProjectsTopicsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsSubscriptionsListCall { 4148 c.ifNoneMatch_ = entityTag 4149 return c 4150} 4151 4152// Context sets the context to be used in this call's Do method. Any 4153// pending HTTP request will be aborted if the provided context is 4154// canceled. 4155func (c *ProjectsTopicsSubscriptionsListCall) Context(ctx context.Context) *ProjectsTopicsSubscriptionsListCall { 4156 c.ctx_ = ctx 4157 return c 4158} 4159 4160// Header returns an http.Header that can be modified by the caller to 4161// add HTTP headers to the request. 4162func (c *ProjectsTopicsSubscriptionsListCall) Header() http.Header { 4163 if c.header_ == nil { 4164 c.header_ = make(http.Header) 4165 } 4166 return c.header_ 4167} 4168 4169func (c *ProjectsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) { 4170 reqHeaders := make(http.Header) 4171 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210915") 4172 for k, v := range c.header_ { 4173 reqHeaders[k] = v 4174 } 4175 reqHeaders.Set("User-Agent", c.s.userAgent()) 4176 if c.ifNoneMatch_ != "" { 4177 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4178 } 4179 var body io.Reader = nil 4180 c.urlParams_.Set("alt", alt) 4181 c.urlParams_.Set("prettyPrint", "false") 4182 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}/subscriptions") 4183 urls += "?" + c.urlParams_.Encode() 4184 req, err := http.NewRequest("GET", urls, body) 4185 if err != nil { 4186 return nil, err 4187 } 4188 req.Header = reqHeaders 4189 googleapi.Expand(req.URL, map[string]string{ 4190 "topic": c.topic, 4191 }) 4192 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4193} 4194 4195// Do executes the "pubsub.projects.topics.subscriptions.list" call. 4196// Exactly one of *ListTopicSubscriptionsResponse or error will be 4197// non-nil. Any non-2xx status code is an error. Response headers are in 4198// either *ListTopicSubscriptionsResponse.ServerResponse.Header or (if a 4199// response was returned at all) in error.(*googleapi.Error).Header. Use 4200// googleapi.IsNotModified to check whether the returned error was 4201// because http.StatusNotModified was returned. 4202func (c *ProjectsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListTopicSubscriptionsResponse, error) { 4203 gensupport.SetOptions(c.urlParams_, opts...) 4204 res, err := c.doRequest("json") 4205 if res != nil && res.StatusCode == http.StatusNotModified { 4206 if res.Body != nil { 4207 res.Body.Close() 4208 } 4209 return nil, &googleapi.Error{ 4210 Code: res.StatusCode, 4211 Header: res.Header, 4212 } 4213 } 4214 if err != nil { 4215 return nil, err 4216 } 4217 defer googleapi.CloseBody(res) 4218 if err := googleapi.CheckResponse(res); err != nil { 4219 return nil, err 4220 } 4221 ret := &ListTopicSubscriptionsResponse{ 4222 ServerResponse: googleapi.ServerResponse{ 4223 Header: res.Header, 4224 HTTPStatusCode: res.StatusCode, 4225 }, 4226 } 4227 target := &ret 4228 if err := gensupport.DecodeResponse(target, res); err != nil { 4229 return nil, err 4230 } 4231 return ret, nil 4232 // { 4233 // "description": "Lists the name of the subscriptions for this topic.", 4234 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}/subscriptions", 4235 // "httpMethod": "GET", 4236 // "id": "pubsub.projects.topics.subscriptions.list", 4237 // "parameterOrder": [ 4238 // "topic" 4239 // ], 4240 // "parameters": { 4241 // "pageSize": { 4242 // "description": "Maximum number of subscription names to return.", 4243 // "format": "int32", 4244 // "location": "query", 4245 // "type": "integer" 4246 // }, 4247 // "pageToken": { 4248 // "description": "The value returned by the last `ListTopicSubscriptionsResponse`; indicates that this is a continuation of a prior `ListTopicSubscriptions` call, and that the system should return the next page of data.", 4249 // "location": "query", 4250 // "type": "string" 4251 // }, 4252 // "topic": { 4253 // "description": "The name of the topic that subscriptions are attached to.", 4254 // "location": "path", 4255 // "pattern": "^projects/[^/]+/topics/[^/]+$", 4256 // "required": true, 4257 // "type": "string" 4258 // } 4259 // }, 4260 // "path": "v1beta2/{+topic}/subscriptions", 4261 // "response": { 4262 // "$ref": "ListTopicSubscriptionsResponse" 4263 // }, 4264 // "scopes": [ 4265 // "https://www.googleapis.com/auth/cloud-platform", 4266 // "https://www.googleapis.com/auth/pubsub" 4267 // ] 4268 // } 4269 4270} 4271 4272// Pages invokes f for each page of results. 4273// A non-nil error returned from f will halt the iteration. 4274// The provided context supersedes any context provided to the Context method. 4275func (c *ProjectsTopicsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListTopicSubscriptionsResponse) error) error { 4276 c.ctx_ = ctx 4277 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4278 for { 4279 x, err := c.Do() 4280 if err != nil { 4281 return err 4282 } 4283 if err := f(x); err != nil { 4284 return err 4285 } 4286 if x.NextPageToken == "" { 4287 return nil 4288 } 4289 c.PageToken(x.NextPageToken) 4290 } 4291} 4292