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