1 // Copyright 2023 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 accesscontextmanager provides access to the Access Context Manager API. 8 // 9 // For product documentation, see: https://cloud.google.com/access-context-manager/docs/reference/rest/ 10 // 11 // # Library status 12 // 13 // These client libraries are officially supported by Google. However, this 14 // library is considered complete and is in maintenance mode. This means 15 // that we will address critical bugs and security issues but will not add 16 // any new features. 17 // 18 // When possible, we recommend using our newer 19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) 20 // that are still actively being worked and iterated on. 21 // 22 // # Creating a client 23 // 24 // Usage example: 25 // 26 // import "google.golang.org/api/accesscontextmanager/v1beta" 27 // ... 28 // ctx := context.Background() 29 // accesscontextmanagerService, err := accesscontextmanager.NewService(ctx) 30 // 31 // In this example, Google Application Default Credentials are used for 32 // authentication. For information on how to create and obtain Application 33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 34 // 35 // # Other authentication options 36 // 37 // To use an API key for authentication (note: some APIs do not support API 38 // keys), use [google.golang.org/api/option.WithAPIKey]: 39 // 40 // accesscontextmanagerService, err := accesscontextmanager.NewService(ctx, option.WithAPIKey("AIza...")) 41 // 42 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth 43 // flow, use [google.golang.org/api/option.WithTokenSource]: 44 // 45 // config := &oauth2.Config{...} 46 // // ... 47 // token, err := config.Exchange(ctx, ...) 48 // accesscontextmanagerService, err := accesscontextmanager.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 49 // 50 // See [google.golang.org/api/option.ClientOption] for details on options. 51 package accesscontextmanager // import "google.golang.org/api/accesscontextmanager/v1beta" 52 53 import ( 54 "bytes" 55 "context" 56 "encoding/json" 57 "errors" 58 "fmt" 59 "io" 60 "net/http" 61 "net/url" 62 "strconv" 63 "strings" 64 65 googleapi "google.golang.org/api/googleapi" 66 internal "google.golang.org/api/internal" 67 gensupport "google.golang.org/api/internal/gensupport" 68 option "google.golang.org/api/option" 69 internaloption "google.golang.org/api/option/internaloption" 70 htransport "google.golang.org/api/transport/http" 71 ) 72 73 // Always reference these packages, just in case the auto-generated code 74 // below doesn't. 75 var _ = bytes.NewBuffer 76 var _ = strconv.Itoa 77 var _ = fmt.Sprintf 78 var _ = json.NewDecoder 79 var _ = io.Copy 80 var _ = url.Parse 81 var _ = gensupport.MarshalJSON 82 var _ = googleapi.Version 83 var _ = errors.New 84 var _ = strings.Replace 85 var _ = context.Canceled 86 var _ = internaloption.WithDefaultEndpoint 87 var _ = internal.Version 88 89 const apiId = "accesscontextmanager:v1beta" 90 const apiName = "accesscontextmanager" 91 const apiVersion = "v1beta" 92 const basePath = "https://accesscontextmanager.googleapis.com/" 93 const mtlsBasePath = "https://accesscontextmanager.mtls.googleapis.com/" 94 95 // OAuth2 scopes used by this API. 96 const ( 97 // See, edit, configure, and delete your Google Cloud data and see the 98 // email address for your Google Account. 99 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 100 ) 101 102 // NewService creates a new Service. 103 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 104 scopesOption := internaloption.WithDefaultScopes( 105 "https://www.googleapis.com/auth/cloud-platform", 106 ) 107 // NOTE: prepend, so we don't override user-specified scopes. 108 opts = append([]option.ClientOption{scopesOption}, opts...) 109 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 110 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 111 client, endpoint, err := htransport.NewClient(ctx, opts...) 112 if err != nil { 113 return nil, err 114 } 115 s, err := New(client) 116 if err != nil { 117 return nil, err 118 } 119 if endpoint != "" { 120 s.BasePath = endpoint 121 } 122 return s, nil 123 } 124 125 // New creates a new Service. It uses the provided http.Client for requests. 126 // 127 // Deprecated: please use NewService instead. 128 // To provide a custom HTTP client, use option.WithHTTPClient. 129 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 130 func New(client *http.Client) (*Service, error) { 131 if client == nil { 132 return nil, errors.New("client is nil") 133 } 134 s := &Service{client: client, BasePath: basePath} 135 s.AccessPolicies = NewAccessPoliciesService(s) 136 s.Operations = NewOperationsService(s) 137 return s, nil 138 } 139 140 type Service struct { 141 client *http.Client 142 BasePath string // API endpoint base URL 143 UserAgent string // optional additional User-Agent fragment 144 145 AccessPolicies *AccessPoliciesService 146 147 Operations *OperationsService 148 } 149 150 func (s *Service) userAgent() string { 151 if s.UserAgent == "" { 152 return googleapi.UserAgent 153 } 154 return googleapi.UserAgent + " " + s.UserAgent 155 } 156 157 func NewAccessPoliciesService(s *Service) *AccessPoliciesService { 158 rs := &AccessPoliciesService{s: s} 159 rs.AccessLevels = NewAccessPoliciesAccessLevelsService(s) 160 rs.ServicePerimeters = NewAccessPoliciesServicePerimetersService(s) 161 return rs 162 } 163 164 type AccessPoliciesService struct { 165 s *Service 166 167 AccessLevels *AccessPoliciesAccessLevelsService 168 169 ServicePerimeters *AccessPoliciesServicePerimetersService 170 } 171 172 func NewAccessPoliciesAccessLevelsService(s *Service) *AccessPoliciesAccessLevelsService { 173 rs := &AccessPoliciesAccessLevelsService{s: s} 174 return rs 175 } 176 177 type AccessPoliciesAccessLevelsService struct { 178 s *Service 179 } 180 181 func NewAccessPoliciesServicePerimetersService(s *Service) *AccessPoliciesServicePerimetersService { 182 rs := &AccessPoliciesServicePerimetersService{s: s} 183 return rs 184 } 185 186 type AccessPoliciesServicePerimetersService struct { 187 s *Service 188 } 189 190 func NewOperationsService(s *Service) *OperationsService { 191 rs := &OperationsService{s: s} 192 return rs 193 } 194 195 type OperationsService struct { 196 s *Service 197 } 198 199 // AccessContextManagerOperationMetadata: Metadata of Access Context 200 // Manager's Long Running Operations. 201 type AccessContextManagerOperationMetadata struct { 202 } 203 204 // AccessLevel: An `AccessLevel` is a label that can be applied to 205 // requests to Google Cloud services, along with a list of requirements 206 // necessary for the label to be applied. 207 type AccessLevel struct { 208 // Basic: A `BasicLevel` composed of `Conditions`. 209 Basic *BasicLevel `json:"basic,omitempty"` 210 211 // Custom: A `CustomLevel` written in the Common Expression Language. 212 Custom *CustomLevel `json:"custom,omitempty"` 213 214 // Description: Description of the `AccessLevel` and its use. Does not 215 // affect behavior. 216 Description string `json:"description,omitempty"` 217 218 // Name: Resource name for the `AccessLevel`. Format: 219 // `accessPolicies/{access_policy}/accessLevels/{access_level}`. The 220 // `access_level` component must begin with a letter, followed by 221 // alphanumeric characters or `_`. Its maximum length is 50 characters. 222 // After you create an `AccessLevel`, you cannot change its `name`. 223 Name string `json:"name,omitempty"` 224 225 // Title: Human readable title. Must be unique within the Policy. 226 Title string `json:"title,omitempty"` 227 228 // ServerResponse contains the HTTP response code and headers from the 229 // server. 230 googleapi.ServerResponse `json:"-"` 231 232 // ForceSendFields is a list of field names (e.g. "Basic") to 233 // unconditionally include in API requests. By default, fields with 234 // empty or default values are omitted from API requests. However, any 235 // non-pointer, non-interface field appearing in ForceSendFields will be 236 // sent to the server regardless of whether the field is empty or not. 237 // This may be used to include empty fields in Patch requests. 238 ForceSendFields []string `json:"-"` 239 240 // NullFields is a list of field names (e.g. "Basic") to include in API 241 // requests with the JSON null value. By default, fields with empty 242 // values are omitted from API requests. However, any field with an 243 // empty value appearing in NullFields will be sent to the server as 244 // null. It is an error if a field in this list has a non-empty value. 245 // This may be used to include null fields in Patch requests. 246 NullFields []string `json:"-"` 247 } 248 249 func (s *AccessLevel) MarshalJSON() ([]byte, error) { 250 type NoMethod AccessLevel 251 raw := NoMethod(*s) 252 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 253 } 254 255 // AccessPolicy: `AccessPolicy` is a container for `AccessLevels` (which 256 // define the necessary attributes to use Google Cloud services) and 257 // `ServicePerimeters` (which define regions of services able to freely 258 // pass data within a perimeter). An access policy is globally visible 259 // within an organization, and the restrictions it specifies apply to 260 // all projects within an organization. 261 type AccessPolicy struct { 262 // Name: Output only. Resource name of the `AccessPolicy`. Format: 263 // `accessPolicies/{policy_id}` 264 Name string `json:"name,omitempty"` 265 266 // Parent: Required. The parent of this `AccessPolicy` in the Cloud 267 // Resource Hierarchy. Currently immutable once created. Format: 268 // `organizations/{organization_id}` 269 Parent string `json:"parent,omitempty"` 270 271 // Title: Required. Human readable title. Does not affect behavior. 272 Title string `json:"title,omitempty"` 273 274 // ServerResponse contains the HTTP response code and headers from the 275 // server. 276 googleapi.ServerResponse `json:"-"` 277 278 // ForceSendFields is a list of field names (e.g. "Name") to 279 // unconditionally include in API requests. By default, fields with 280 // empty or default values are omitted from API requests. However, any 281 // non-pointer, non-interface field appearing in ForceSendFields will be 282 // sent to the server regardless of whether the field is empty or not. 283 // This may be used to include empty fields in Patch requests. 284 ForceSendFields []string `json:"-"` 285 286 // NullFields is a list of field names (e.g. "Name") to include in API 287 // requests with the JSON null value. By default, fields with empty 288 // values are omitted from API requests. However, any field with an 289 // empty value appearing in NullFields will be sent to the server as 290 // null. It is an error if a field in this list has a non-empty value. 291 // This may be used to include null fields in Patch requests. 292 NullFields []string `json:"-"` 293 } 294 295 func (s *AccessPolicy) MarshalJSON() ([]byte, error) { 296 type NoMethod AccessPolicy 297 raw := NoMethod(*s) 298 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 299 } 300 301 // BasicLevel: `BasicLevel` is an `AccessLevel` using a set of 302 // recommended features. 303 type BasicLevel struct { 304 // CombiningFunction: How the `conditions` list should be combined to 305 // determine if a request is granted this `AccessLevel`. If AND is used, 306 // each `Condition` in `conditions` must be satisfied for the 307 // `AccessLevel` to be applied. If OR is used, at least one `Condition` 308 // in `conditions` must be satisfied for the `AccessLevel` to be 309 // applied. Default behavior is AND. 310 // 311 // Possible values: 312 // "AND" - All `Conditions` must be true for the `BasicLevel` to be 313 // true. 314 // "OR" - If at least one `Condition` is true, then the `BasicLevel` 315 // is true. 316 CombiningFunction string `json:"combiningFunction,omitempty"` 317 318 // Conditions: Required. A list of requirements for the `AccessLevel` to 319 // be granted. 320 Conditions []*Condition `json:"conditions,omitempty"` 321 322 // ForceSendFields is a list of field names (e.g. "CombiningFunction") 323 // to unconditionally include in API requests. By default, fields with 324 // empty or default values are omitted from API requests. However, any 325 // non-pointer, non-interface field appearing in ForceSendFields will be 326 // sent to the server regardless of whether the field is empty or not. 327 // This may be used to include empty fields in Patch requests. 328 ForceSendFields []string `json:"-"` 329 330 // NullFields is a list of field names (e.g. "CombiningFunction") to 331 // include in API requests with the JSON null value. By default, fields 332 // with empty values are omitted from API requests. However, any field 333 // with an empty value appearing in NullFields will be sent to the 334 // server as null. It is an error if a field in this list has a 335 // non-empty value. This may be used to include null fields in Patch 336 // requests. 337 NullFields []string `json:"-"` 338 } 339 340 func (s *BasicLevel) MarshalJSON() ([]byte, error) { 341 type NoMethod BasicLevel 342 raw := NoMethod(*s) 343 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 344 } 345 346 // Condition: A condition necessary for an `AccessLevel` to be granted. 347 // The Condition is an AND over its fields. So a Condition is true if: 348 // 1) the request IP is from one of the listed subnetworks AND 2) the 349 // originating device complies with the listed device policy AND 3) all 350 // listed access levels are granted AND 4) the request was sent at a 351 // time allowed by the DateTimeRestriction. 352 type Condition struct { 353 // DevicePolicy: Device specific restrictions, all restrictions must 354 // hold for the Condition to be true. If not specified, all devices are 355 // allowed. 356 DevicePolicy *DevicePolicy `json:"devicePolicy,omitempty"` 357 358 // IpSubnetworks: CIDR block IP subnetwork specification. May be IPv4 or 359 // IPv6. Note that for a CIDR IP address block, the specified IP address 360 // portion must be properly truncated (i.e. all the host bits must be 361 // zero) or the input is considered malformed. For example, 362 // "192.0.2.0/24" is accepted but "192.0.2.1/24" is not. Similarly, for 363 // IPv6, "2001:db8::/32" is accepted whereas "2001:db8::1/32" is not. 364 // The originating IP of a request must be in one of the listed subnets 365 // in order for this Condition to be true. If empty, all IP addresses 366 // are allowed. 367 IpSubnetworks []string `json:"ipSubnetworks,omitempty"` 368 369 // Members: The request must be made by one of the provided user or 370 // service accounts. Groups are not supported. Syntax: `user:{emailid}` 371 // `serviceAccount:{emailid}` If not specified, a request may come from 372 // any user. 373 Members []string `json:"members,omitempty"` 374 375 // Negate: Whether to negate the Condition. If true, the Condition 376 // becomes a NAND over its non-empty fields. Any non-empty field 377 // criteria evaluating to false will result in the Condition to be 378 // satisfied. Defaults to false. 379 Negate bool `json:"negate,omitempty"` 380 381 // Regions: The request must originate from one of the provided 382 // countries/regions. Must be valid ISO 3166-1 alpha-2 codes. 383 Regions []string `json:"regions,omitempty"` 384 385 // RequiredAccessLevels: A list of other access levels defined in the 386 // same `Policy`, referenced by resource name. Referencing an 387 // `AccessLevel` which does not exist is an error. All access levels 388 // listed must be granted for the Condition to be true. Example: 389 // "accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME" 390 RequiredAccessLevels []string `json:"requiredAccessLevels,omitempty"` 391 392 // ForceSendFields is a list of field names (e.g. "DevicePolicy") to 393 // unconditionally include in API requests. By default, fields with 394 // empty or default values are omitted from API requests. However, any 395 // non-pointer, non-interface field appearing in ForceSendFields will be 396 // sent to the server regardless of whether the field is empty or not. 397 // This may be used to include empty fields in Patch requests. 398 ForceSendFields []string `json:"-"` 399 400 // NullFields is a list of field names (e.g. "DevicePolicy") to include 401 // in API requests with the JSON null value. By default, fields with 402 // empty values are omitted from API requests. However, any field with 403 // an empty value appearing in NullFields will be sent to the server as 404 // null. It is an error if a field in this list has a non-empty value. 405 // This may be used to include null fields in Patch requests. 406 NullFields []string `json:"-"` 407 } 408 409 func (s *Condition) MarshalJSON() ([]byte, error) { 410 type NoMethod Condition 411 raw := NoMethod(*s) 412 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 413 } 414 415 // CustomLevel: `CustomLevel` is an `AccessLevel` using the Cloud Common 416 // Expression Language to represent the necessary conditions for the 417 // level to apply to a request. See CEL spec at: 418 // https://github.com/google/cel-spec 419 type CustomLevel struct { 420 // Expr: Required. A Cloud CEL expression evaluating to a boolean. 421 Expr *Expr `json:"expr,omitempty"` 422 423 // ForceSendFields is a list of field names (e.g. "Expr") to 424 // unconditionally include in API requests. By default, fields with 425 // empty or default values are omitted from API requests. However, any 426 // non-pointer, non-interface field appearing in ForceSendFields will be 427 // sent to the server regardless of whether the field is empty or not. 428 // This may be used to include empty fields in Patch requests. 429 ForceSendFields []string `json:"-"` 430 431 // NullFields is a list of field names (e.g. "Expr") to include in API 432 // requests with the JSON null value. By default, fields with empty 433 // values are omitted from API requests. However, any field with an 434 // empty value appearing in NullFields will be sent to the server as 435 // null. It is an error if a field in this list has a non-empty value. 436 // This may be used to include null fields in Patch requests. 437 NullFields []string `json:"-"` 438 } 439 440 func (s *CustomLevel) MarshalJSON() ([]byte, error) { 441 type NoMethod CustomLevel 442 raw := NoMethod(*s) 443 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 444 } 445 446 // DevicePolicy: `DevicePolicy` specifies device specific restrictions 447 // necessary to acquire a given access level. A `DevicePolicy` specifies 448 // requirements for requests from devices to be granted access levels, 449 // it does not do any enforcement on the device. `DevicePolicy` acts as 450 // an AND over all specified fields, and each repeated field is an OR 451 // over its elements. Any unset fields are ignored. For example, if the 452 // proto is { os_type : DESKTOP_WINDOWS, os_type : DESKTOP_LINUX, 453 // encryption_status: ENCRYPTED}, then the DevicePolicy will be true for 454 // requests originating from encrypted Linux desktops and encrypted 455 // Windows desktops. 456 type DevicePolicy struct { 457 // AllowedDeviceManagementLevels: Allowed device management levels, an 458 // empty list allows all management levels. 459 // 460 // Possible values: 461 // "MANAGEMENT_UNSPECIFIED" - The device's management level is not 462 // specified or not known. 463 // "NONE" - The device is not managed. 464 // "BASIC" - Basic management is enabled, which is generally limited 465 // to monitoring and wiping the corporate account. 466 // "COMPLETE" - Complete device management. This includes more 467 // thorough monitoring and the ability to directly manage the device 468 // (such as remote wiping). This can be enabled through the Android 469 // Enterprise Platform. 470 AllowedDeviceManagementLevels []string `json:"allowedDeviceManagementLevels,omitempty"` 471 472 // AllowedEncryptionStatuses: Allowed encryptions statuses, an empty 473 // list allows all statuses. 474 // 475 // Possible values: 476 // "ENCRYPTION_UNSPECIFIED" - The encryption status of the device is 477 // not specified or not known. 478 // "ENCRYPTION_UNSUPPORTED" - The device does not support encryption. 479 // "UNENCRYPTED" - The device supports encryption, but is currently 480 // unencrypted. 481 // "ENCRYPTED" - The device is encrypted. 482 AllowedEncryptionStatuses []string `json:"allowedEncryptionStatuses,omitempty"` 483 484 // OsConstraints: Allowed OS versions, an empty list allows all types 485 // and all versions. 486 OsConstraints []*OsConstraint `json:"osConstraints,omitempty"` 487 488 // RequireAdminApproval: Whether the device needs to be approved by the 489 // customer admin. 490 RequireAdminApproval bool `json:"requireAdminApproval,omitempty"` 491 492 // RequireCorpOwned: Whether the device needs to be corp owned. 493 RequireCorpOwned bool `json:"requireCorpOwned,omitempty"` 494 495 // RequireScreenlock: Whether or not screenlock is required for the 496 // DevicePolicy to be true. Defaults to `false`. 497 RequireScreenlock bool `json:"requireScreenlock,omitempty"` 498 499 // ForceSendFields is a list of field names (e.g. 500 // "AllowedDeviceManagementLevels") to unconditionally include in API 501 // requests. By default, fields with empty or default values are omitted 502 // from API requests. However, any non-pointer, non-interface field 503 // appearing in ForceSendFields will be sent to the server regardless of 504 // whether the field is empty or not. This may be used to include empty 505 // fields in Patch requests. 506 ForceSendFields []string `json:"-"` 507 508 // NullFields is a list of field names (e.g. 509 // "AllowedDeviceManagementLevels") to include in API requests with the 510 // JSON null value. By default, fields with empty values are omitted 511 // from API requests. However, any field with an empty value appearing 512 // in NullFields will be sent to the server as null. It is an error if a 513 // field in this list has a non-empty value. This may be used to include 514 // null fields in Patch requests. 515 NullFields []string `json:"-"` 516 } 517 518 func (s *DevicePolicy) MarshalJSON() ([]byte, error) { 519 type NoMethod DevicePolicy 520 raw := NoMethod(*s) 521 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 522 } 523 524 // Expr: Represents a textual expression in the Common Expression 525 // Language (CEL) syntax. CEL is a C-like expression language. The 526 // syntax and semantics of CEL are documented at 527 // https://github.com/google/cel-spec. Example (Comparison): title: 528 // "Summary size limit" description: "Determines if a summary is less 529 // than 100 chars" expression: "document.summary.size() < 100" Example 530 // (Equality): title: "Requestor is owner" description: "Determines if 531 // requestor is the document owner" expression: "document.owner == 532 // request.auth.claims.email" Example (Logic): title: "Public documents" 533 // description: "Determine whether the document should be publicly 534 // visible" expression: "document.type != 'private' && document.type != 535 // 'internal'" Example (Data Manipulation): title: "Notification string" 536 // description: "Create a notification string with a timestamp." 537 // expression: "'New message received at ' + 538 // string(document.create_time)" The exact variables and functions that 539 // may be referenced within an expression are determined by the service 540 // that evaluates it. See the service documentation for additional 541 // information. 542 type Expr struct { 543 // Description: Optional. Description of the expression. This is a 544 // longer text which describes the expression, e.g. when hovered over it 545 // in a UI. 546 Description string `json:"description,omitempty"` 547 548 // Expression: Textual representation of an expression in Common 549 // Expression Language syntax. 550 Expression string `json:"expression,omitempty"` 551 552 // Location: Optional. String indicating the location of the expression 553 // for error reporting, e.g. a file name and a position in the file. 554 Location string `json:"location,omitempty"` 555 556 // Title: Optional. Title for the expression, i.e. a short string 557 // describing its purpose. This can be used e.g. in UIs which allow to 558 // enter the expression. 559 Title string `json:"title,omitempty"` 560 561 // ForceSendFields is a list of field names (e.g. "Description") to 562 // unconditionally include in API requests. By default, fields with 563 // empty or default values are omitted from API requests. However, any 564 // non-pointer, non-interface field appearing in ForceSendFields will be 565 // sent to the server regardless of whether the field is empty or not. 566 // This may be used to include empty fields in Patch requests. 567 ForceSendFields []string `json:"-"` 568 569 // NullFields is a list of field names (e.g. "Description") to include 570 // in API requests with the JSON null value. By default, fields with 571 // empty values are omitted from API requests. However, any field with 572 // an empty value appearing in NullFields will be sent to the server as 573 // null. It is an error if a field in this list has a non-empty value. 574 // This may be used to include null fields in Patch requests. 575 NullFields []string `json:"-"` 576 } 577 578 func (s *Expr) MarshalJSON() ([]byte, error) { 579 type NoMethod Expr 580 raw := NoMethod(*s) 581 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 582 } 583 584 // ListAccessLevelsResponse: A response to `ListAccessLevelsRequest`. 585 type ListAccessLevelsResponse struct { 586 // AccessLevels: List of the Access Level instances. 587 AccessLevels []*AccessLevel `json:"accessLevels,omitempty"` 588 589 // NextPageToken: The pagination token to retrieve the next page of 590 // results. If the value is empty, no further results remain. 591 NextPageToken string `json:"nextPageToken,omitempty"` 592 593 // ServerResponse contains the HTTP response code and headers from the 594 // server. 595 googleapi.ServerResponse `json:"-"` 596 597 // ForceSendFields is a list of field names (e.g. "AccessLevels") to 598 // unconditionally include in API requests. By default, fields with 599 // empty or default values are omitted from API requests. However, any 600 // non-pointer, non-interface field appearing in ForceSendFields will be 601 // sent to the server regardless of whether the field is empty or not. 602 // This may be used to include empty fields in Patch requests. 603 ForceSendFields []string `json:"-"` 604 605 // NullFields is a list of field names (e.g. "AccessLevels") to include 606 // in API requests with the JSON null value. By default, fields with 607 // empty values are omitted from API requests. However, any field with 608 // an empty value appearing in NullFields will be sent to the server as 609 // null. It is an error if a field in this list has a non-empty value. 610 // This may be used to include null fields in Patch requests. 611 NullFields []string `json:"-"` 612 } 613 614 func (s *ListAccessLevelsResponse) MarshalJSON() ([]byte, error) { 615 type NoMethod ListAccessLevelsResponse 616 raw := NoMethod(*s) 617 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 618 } 619 620 // ListAccessPoliciesResponse: A response to 621 // `ListAccessPoliciesRequest`. 622 type ListAccessPoliciesResponse struct { 623 // AccessPolicies: List of the AccessPolicy instances. 624 AccessPolicies []*AccessPolicy `json:"accessPolicies,omitempty"` 625 626 // NextPageToken: The pagination token to retrieve the next page of 627 // results. If the value is empty, no further results remain. 628 NextPageToken string `json:"nextPageToken,omitempty"` 629 630 // ServerResponse contains the HTTP response code and headers from the 631 // server. 632 googleapi.ServerResponse `json:"-"` 633 634 // ForceSendFields is a list of field names (e.g. "AccessPolicies") to 635 // unconditionally include in API requests. By default, fields with 636 // empty or default values are omitted from API requests. However, any 637 // non-pointer, non-interface field appearing in ForceSendFields will be 638 // sent to the server regardless of whether the field is empty or not. 639 // This may be used to include empty fields in Patch requests. 640 ForceSendFields []string `json:"-"` 641 642 // NullFields is a list of field names (e.g. "AccessPolicies") to 643 // include in API requests with the JSON null value. By default, fields 644 // with empty values are omitted from API requests. However, any field 645 // with an empty value appearing in NullFields will be sent to the 646 // server as null. It is an error if a field in this list has a 647 // non-empty value. This may be used to include null fields in Patch 648 // requests. 649 NullFields []string `json:"-"` 650 } 651 652 func (s *ListAccessPoliciesResponse) MarshalJSON() ([]byte, error) { 653 type NoMethod ListAccessPoliciesResponse 654 raw := NoMethod(*s) 655 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 656 } 657 658 // ListServicePerimetersResponse: A response to 659 // `ListServicePerimetersRequest`. 660 type ListServicePerimetersResponse struct { 661 // NextPageToken: The pagination token to retrieve the next page of 662 // results. If the value is empty, no further results remain. 663 NextPageToken string `json:"nextPageToken,omitempty"` 664 665 // ServicePerimeters: List of the Service Perimeter instances. 666 ServicePerimeters []*ServicePerimeter `json:"servicePerimeters,omitempty"` 667 668 // ServerResponse contains the HTTP response code and headers from the 669 // server. 670 googleapi.ServerResponse `json:"-"` 671 672 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 673 // unconditionally include in API requests. By default, fields with 674 // empty or default values are omitted from API requests. However, any 675 // non-pointer, non-interface field appearing in ForceSendFields will be 676 // sent to the server regardless of whether the field is empty or not. 677 // This may be used to include empty fields in Patch requests. 678 ForceSendFields []string `json:"-"` 679 680 // NullFields is a list of field names (e.g. "NextPageToken") to include 681 // in API requests with the JSON null value. By default, fields with 682 // empty values are omitted from API requests. However, any field with 683 // an empty value appearing in NullFields will be sent to the server as 684 // null. It is an error if a field in this list has a non-empty value. 685 // This may be used to include null fields in Patch requests. 686 NullFields []string `json:"-"` 687 } 688 689 func (s *ListServicePerimetersResponse) MarshalJSON() ([]byte, error) { 690 type NoMethod ListServicePerimetersResponse 691 raw := NoMethod(*s) 692 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 693 } 694 695 // Operation: This resource represents a long-running operation that is 696 // the result of a network API call. 697 type Operation struct { 698 // Done: If the value is `false`, it means the operation is still in 699 // progress. If `true`, the operation is completed, and either `error` 700 // or `response` is available. 701 Done bool `json:"done,omitempty"` 702 703 // Error: The error result of the operation in case of failure or 704 // cancellation. 705 Error *Status `json:"error,omitempty"` 706 707 // Metadata: Service-specific metadata associated with the operation. It 708 // typically contains progress information and common metadata such as 709 // create time. Some services might not provide such metadata. Any 710 // method that returns a long-running operation should document the 711 // metadata type, if any. 712 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 713 714 // Name: The server-assigned name, which is only unique within the same 715 // service that originally returns it. If you use the default HTTP 716 // mapping, the `name` should be a resource name ending with 717 // `operations/{unique_id}`. 718 Name string `json:"name,omitempty"` 719 720 // Response: The normal, successful response of the operation. If the 721 // original method returns no data on success, such as `Delete`, the 722 // response is `google.protobuf.Empty`. If the original method is 723 // standard `Get`/`Create`/`Update`, the response should be the 724 // resource. For other methods, the response should have the type 725 // `XxxResponse`, where `Xxx` is the original method name. For example, 726 // if the original method name is `TakeSnapshot()`, the inferred 727 // response type is `TakeSnapshotResponse`. 728 Response googleapi.RawMessage `json:"response,omitempty"` 729 730 // ServerResponse contains the HTTP response code and headers from the 731 // server. 732 googleapi.ServerResponse `json:"-"` 733 734 // ForceSendFields is a list of field names (e.g. "Done") to 735 // unconditionally include in API requests. By default, fields with 736 // empty or default values are omitted from API requests. However, any 737 // non-pointer, non-interface field appearing in ForceSendFields will be 738 // sent to the server regardless of whether the field is empty or not. 739 // This may be used to include empty fields in Patch requests. 740 ForceSendFields []string `json:"-"` 741 742 // NullFields is a list of field names (e.g. "Done") to include in API 743 // requests with the JSON null value. By default, fields with empty 744 // values are omitted from API requests. However, any field with an 745 // empty value appearing in NullFields will be sent to the server as 746 // null. It is an error if a field in this list has a non-empty value. 747 // This may be used to include null fields in Patch requests. 748 NullFields []string `json:"-"` 749 } 750 751 func (s *Operation) MarshalJSON() ([]byte, error) { 752 type NoMethod Operation 753 raw := NoMethod(*s) 754 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 755 } 756 757 // OsConstraint: A restriction on the OS type and version of devices 758 // making requests. 759 type OsConstraint struct { 760 // MinimumVersion: The minimum allowed OS version. If not set, any 761 // version of this OS satisfies the constraint. Format: 762 // "major.minor.patch". Examples: "10.5.301", "9.2.1". 763 MinimumVersion string `json:"minimumVersion,omitempty"` 764 765 // OsType: Required. The allowed OS type. 766 // 767 // Possible values: 768 // "OS_UNSPECIFIED" - The operating system of the device is not 769 // specified or not known. 770 // "DESKTOP_MAC" - A desktop Mac operating system. 771 // "DESKTOP_WINDOWS" - A desktop Windows operating system. 772 // "DESKTOP_LINUX" - A desktop Linux operating system. 773 // "DESKTOP_CHROME_OS" - A desktop ChromeOS operating system. 774 // "ANDROID" - An Android operating system. 775 // "IOS" - An iOS operating system. 776 OsType string `json:"osType,omitempty"` 777 778 // RequireVerifiedChromeOs: Only allows requests from devices with a 779 // verified Chrome OS. Verifications includes requirements that the 780 // device is enterprise-managed, conformant to domain policies, and the 781 // caller has permission to call the API targeted by the request. 782 RequireVerifiedChromeOs bool `json:"requireVerifiedChromeOs,omitempty"` 783 784 // ForceSendFields is a list of field names (e.g. "MinimumVersion") to 785 // unconditionally include in API requests. By default, fields with 786 // empty or default values are omitted from API requests. However, any 787 // non-pointer, non-interface field appearing in ForceSendFields will be 788 // sent to the server regardless of whether the field is empty or not. 789 // This may be used to include empty fields in Patch requests. 790 ForceSendFields []string `json:"-"` 791 792 // NullFields is a list of field names (e.g. "MinimumVersion") to 793 // include in API requests with the JSON null value. By default, fields 794 // with empty values are omitted from API requests. However, any field 795 // with an empty value appearing in NullFields will be sent to the 796 // server as null. It is an error if a field in this list has a 797 // non-empty value. This may be used to include null fields in Patch 798 // requests. 799 NullFields []string `json:"-"` 800 } 801 802 func (s *OsConstraint) MarshalJSON() ([]byte, error) { 803 type NoMethod OsConstraint 804 raw := NoMethod(*s) 805 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 806 } 807 808 // ServicePerimeter: `ServicePerimeter` describes a set of Google Cloud 809 // resources which can freely import and export data amongst themselves, 810 // but not export outside of the `ServicePerimeter`. If a request with a 811 // source within this `ServicePerimeter` has a target outside of the 812 // `ServicePerimeter`, the request will be blocked. Otherwise the 813 // request is allowed. There are two types of Service Perimeter - 814 // Regular and Bridge. Regular Service Perimeters cannot overlap, a 815 // single Google Cloud project can only belong to a single regular 816 // Service Perimeter. Service Perimeter Bridges can contain only Google 817 // Cloud projects as members, a single Google Cloud project may belong 818 // to multiple Service Perimeter Bridges. 819 type ServicePerimeter struct { 820 // Description: Description of the `ServicePerimeter` and its use. Does 821 // not affect behavior. 822 Description string `json:"description,omitempty"` 823 824 // Name: Resource name for the `ServicePerimeter`. Format: 825 // `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}` 826 // . The `service_perimeter` component must begin with a letter, 827 // followed by alphanumeric characters or `_`. After you create a 828 // `ServicePerimeter`, you cannot change its `name`. 829 Name string `json:"name,omitempty"` 830 831 // PerimeterType: Perimeter type indicator. A single project is allowed 832 // to be a member of single regular perimeter, but multiple service 833 // perimeter bridges. A project cannot be a included in a perimeter 834 // bridge without being included in regular perimeter. For perimeter 835 // bridges, restricted/unrestricted service lists as well as access 836 // lists must be empty. 837 // 838 // Possible values: 839 // "PERIMETER_TYPE_REGULAR" - Regular Perimeter. When no value is 840 // specified, the perimeter uses this type. 841 // "PERIMETER_TYPE_BRIDGE" - Perimeter Bridge. 842 PerimeterType string `json:"perimeterType,omitempty"` 843 844 // Status: Current ServicePerimeter configuration. Specifies sets of 845 // resources, restricted/unrestricted services and access levels that 846 // determine perimeter content and boundaries. 847 Status *ServicePerimeterConfig `json:"status,omitempty"` 848 849 // Title: Human readable title. Must be unique within the Policy. 850 Title string `json:"title,omitempty"` 851 852 // ServerResponse contains the HTTP response code and headers from the 853 // server. 854 googleapi.ServerResponse `json:"-"` 855 856 // ForceSendFields is a list of field names (e.g. "Description") to 857 // unconditionally include in API requests. By default, fields with 858 // empty or default values are omitted from API requests. However, any 859 // non-pointer, non-interface field appearing in ForceSendFields will be 860 // sent to the server regardless of whether the field is empty or not. 861 // This may be used to include empty fields in Patch requests. 862 ForceSendFields []string `json:"-"` 863 864 // NullFields is a list of field names (e.g. "Description") to include 865 // in API requests with the JSON null value. By default, fields with 866 // empty values are omitted from API requests. However, any field with 867 // an empty value appearing in NullFields will be sent to the server as 868 // null. It is an error if a field in this list has a non-empty value. 869 // This may be used to include null fields in Patch requests. 870 NullFields []string `json:"-"` 871 } 872 873 func (s *ServicePerimeter) MarshalJSON() ([]byte, error) { 874 type NoMethod ServicePerimeter 875 raw := NoMethod(*s) 876 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 877 } 878 879 // ServicePerimeterConfig: `ServicePerimeterConfig` specifies a set of 880 // Google Cloud resources that describe specific Service Perimeter 881 // configuration. 882 type ServicePerimeterConfig struct { 883 // AccessLevels: A list of `AccessLevel` resource names that allow 884 // resources within the `ServicePerimeter` to be accessed from the 885 // internet. `AccessLevels` listed must be in the same policy as this 886 // `ServicePerimeter`. Referencing a nonexistent `AccessLevel` is a 887 // syntax error. If no `AccessLevel` names are listed, resources within 888 // the perimeter can only be accessed via Google Cloud calls with 889 // request origins within the perimeter. Example: 890 // "accessPolicies/MY_POLICY/accessLevels/MY_LEVEL". For Service 891 // Perimeter Bridge, must be empty. 892 AccessLevels []string `json:"accessLevels,omitempty"` 893 894 // Resources: A list of Google Cloud resources that are inside of the 895 // service perimeter. Currently only projects are allowed. Format: 896 // `projects/{project_number}` 897 Resources []string `json:"resources,omitempty"` 898 899 // RestrictedServices: Google Cloud services that are subject to the 900 // Service Perimeter restrictions. Must contain a list of services. For 901 // example, if `storage.googleapis.com` is specified, access to the 902 // storage buckets inside the perimeter must meet the perimeter's access 903 // restrictions. 904 RestrictedServices []string `json:"restrictedServices,omitempty"` 905 906 // UnrestrictedServices: Google Cloud services that are not subject to 907 // the Service Perimeter restrictions. Deprecated. Must be set to a 908 // single wildcard "*". The wildcard means that unless explicitly 909 // specified by "restricted_services" list, any service is treated as 910 // unrestricted. 911 UnrestrictedServices []string `json:"unrestrictedServices,omitempty"` 912 913 // VpcAccessibleServices: Beta. Configuration for APIs allowed within 914 // Perimeter. 915 VpcAccessibleServices *VpcAccessibleServices `json:"vpcAccessibleServices,omitempty"` 916 917 // ForceSendFields is a list of field names (e.g. "AccessLevels") to 918 // unconditionally include in API requests. By default, fields with 919 // empty or default values are omitted from API requests. However, any 920 // non-pointer, non-interface field appearing in ForceSendFields will be 921 // sent to the server regardless of whether the field is empty or not. 922 // This may be used to include empty fields in Patch requests. 923 ForceSendFields []string `json:"-"` 924 925 // NullFields is a list of field names (e.g. "AccessLevels") to include 926 // in API requests with the JSON null value. By default, fields with 927 // empty values are omitted from API requests. However, any field with 928 // an empty value appearing in NullFields will be sent to the server as 929 // null. It is an error if a field in this list has a non-empty value. 930 // This may be used to include null fields in Patch requests. 931 NullFields []string `json:"-"` 932 } 933 934 func (s *ServicePerimeterConfig) MarshalJSON() ([]byte, error) { 935 type NoMethod ServicePerimeterConfig 936 raw := NoMethod(*s) 937 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 938 } 939 940 // Status: The `Status` type defines a logical error model that is 941 // suitable for different programming environments, including REST APIs 942 // and RPC APIs. It is used by gRPC (https://github.com/grpc). Each 943 // `Status` message contains three pieces of data: error code, error 944 // message, and error details. You can find out more about this error 945 // model and how to work with it in the API Design Guide 946 // (https://cloud.google.com/apis/design/errors). 947 type Status struct { 948 // Code: The status code, which should be an enum value of 949 // google.rpc.Code. 950 Code int64 `json:"code,omitempty"` 951 952 // Details: A list of messages that carry the error details. There is a 953 // common set of message types for APIs to use. 954 Details []googleapi.RawMessage `json:"details,omitempty"` 955 956 // Message: A developer-facing error message, which should be in 957 // English. Any user-facing error message should be localized and sent 958 // in the google.rpc.Status.details field, or localized by the client. 959 Message string `json:"message,omitempty"` 960 961 // ForceSendFields is a list of field names (e.g. "Code") to 962 // unconditionally include in API requests. By default, fields with 963 // empty or default values are omitted from API requests. However, any 964 // non-pointer, non-interface field appearing in ForceSendFields will be 965 // sent to the server regardless of whether the field is empty or not. 966 // This may be used to include empty fields in Patch requests. 967 ForceSendFields []string `json:"-"` 968 969 // NullFields is a list of field names (e.g. "Code") to include in API 970 // requests with the JSON null value. By default, fields with empty 971 // values are omitted from API requests. However, any field with an 972 // empty value appearing in NullFields will be sent to the server as 973 // null. It is an error if a field in this list has a non-empty value. 974 // This may be used to include null fields in Patch requests. 975 NullFields []string `json:"-"` 976 } 977 978 func (s *Status) MarshalJSON() ([]byte, error) { 979 type NoMethod Status 980 raw := NoMethod(*s) 981 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 982 } 983 984 // VpcAccessibleServices: Specifies how APIs are allowed to communicate 985 // within the Service Perimeter. 986 type VpcAccessibleServices struct { 987 // AllowedServices: The list of APIs usable within the Service 988 // Perimeter. Must be empty unless 'enable_restriction' is True. You can 989 // specify a list of individual services, as well as include the 990 // 'RESTRICTED-SERVICES' value, which automatically includes all of the 991 // services protected by the perimeter. 992 AllowedServices []string `json:"allowedServices,omitempty"` 993 994 // EnableRestriction: Whether to restrict API calls within the Service 995 // Perimeter to the list of APIs specified in 'allowed_services'. 996 EnableRestriction bool `json:"enableRestriction,omitempty"` 997 998 // ForceSendFields is a list of field names (e.g. "AllowedServices") to 999 // unconditionally include in API requests. By default, fields with 1000 // empty or default values are omitted from API requests. However, any 1001 // non-pointer, non-interface field appearing in ForceSendFields will be 1002 // sent to the server regardless of whether the field is empty or not. 1003 // This may be used to include empty fields in Patch requests. 1004 ForceSendFields []string `json:"-"` 1005 1006 // NullFields is a list of field names (e.g. "AllowedServices") to 1007 // include in API requests with the JSON null value. By default, fields 1008 // with empty values are omitted from API requests. However, any field 1009 // with an empty value appearing in NullFields will be sent to the 1010 // server as null. It is an error if a field in this list has a 1011 // non-empty value. This may be used to include null fields in Patch 1012 // requests. 1013 NullFields []string `json:"-"` 1014 } 1015 1016 func (s *VpcAccessibleServices) MarshalJSON() ([]byte, error) { 1017 type NoMethod VpcAccessibleServices 1018 raw := NoMethod(*s) 1019 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1020 } 1021 1022 // method id "accesscontextmanager.accessPolicies.create": 1023 1024 type AccessPoliciesCreateCall struct { 1025 s *Service 1026 accesspolicy *AccessPolicy 1027 urlParams_ gensupport.URLParams 1028 ctx_ context.Context 1029 header_ http.Header 1030 } 1031 1032 // Create: Create an `AccessPolicy`. Fails if this organization already 1033 // has a `AccessPolicy`. The longrunning Operation will have a 1034 // successful status once the `AccessPolicy` has propagated to 1035 // long-lasting storage. Syntactic and basic semantic errors will be 1036 // returned in `metadata` as a BadRequest proto. 1037 func (r *AccessPoliciesService) Create(accesspolicy *AccessPolicy) *AccessPoliciesCreateCall { 1038 c := &AccessPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1039 c.accesspolicy = accesspolicy 1040 return c 1041 } 1042 1043 // Fields allows partial responses to be retrieved. See 1044 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1045 // for more information. 1046 func (c *AccessPoliciesCreateCall) Fields(s ...googleapi.Field) *AccessPoliciesCreateCall { 1047 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1048 return c 1049 } 1050 1051 // Context sets the context to be used in this call's Do method. Any 1052 // pending HTTP request will be aborted if the provided context is 1053 // canceled. 1054 func (c *AccessPoliciesCreateCall) Context(ctx context.Context) *AccessPoliciesCreateCall { 1055 c.ctx_ = ctx 1056 return c 1057 } 1058 1059 // Header returns an http.Header that can be modified by the caller to 1060 // add HTTP headers to the request. 1061 func (c *AccessPoliciesCreateCall) Header() http.Header { 1062 if c.header_ == nil { 1063 c.header_ = make(http.Header) 1064 } 1065 return c.header_ 1066 } 1067 1068 func (c *AccessPoliciesCreateCall) doRequest(alt string) (*http.Response, error) { 1069 reqHeaders := make(http.Header) 1070 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1071 for k, v := range c.header_ { 1072 reqHeaders[k] = v 1073 } 1074 reqHeaders.Set("User-Agent", c.s.userAgent()) 1075 var body io.Reader = nil 1076 body, err := googleapi.WithoutDataWrapper.JSONReader(c.accesspolicy) 1077 if err != nil { 1078 return nil, err 1079 } 1080 reqHeaders.Set("Content-Type", "application/json") 1081 c.urlParams_.Set("alt", alt) 1082 c.urlParams_.Set("prettyPrint", "false") 1083 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/accessPolicies") 1084 urls += "?" + c.urlParams_.Encode() 1085 req, err := http.NewRequest("POST", urls, body) 1086 if err != nil { 1087 return nil, err 1088 } 1089 req.Header = reqHeaders 1090 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1091 } 1092 1093 // Do executes the "accesscontextmanager.accessPolicies.create" call. 1094 // Exactly one of *Operation or error will be non-nil. Any non-2xx 1095 // status code is an error. Response headers are in either 1096 // *Operation.ServerResponse.Header or (if a response was returned at 1097 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1098 // to check whether the returned error was because 1099 // http.StatusNotModified was returned. 1100 func (c *AccessPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1101 gensupport.SetOptions(c.urlParams_, opts...) 1102 res, err := c.doRequest("json") 1103 if res != nil && res.StatusCode == http.StatusNotModified { 1104 if res.Body != nil { 1105 res.Body.Close() 1106 } 1107 return nil, gensupport.WrapError(&googleapi.Error{ 1108 Code: res.StatusCode, 1109 Header: res.Header, 1110 }) 1111 } 1112 if err != nil { 1113 return nil, err 1114 } 1115 defer googleapi.CloseBody(res) 1116 if err := googleapi.CheckResponse(res); err != nil { 1117 return nil, gensupport.WrapError(err) 1118 } 1119 ret := &Operation{ 1120 ServerResponse: googleapi.ServerResponse{ 1121 Header: res.Header, 1122 HTTPStatusCode: res.StatusCode, 1123 }, 1124 } 1125 target := &ret 1126 if err := gensupport.DecodeResponse(target, res); err != nil { 1127 return nil, err 1128 } 1129 return ret, nil 1130 // { 1131 // "description": "Create an `AccessPolicy`. Fails if this organization already has a `AccessPolicy`. The longrunning Operation will have a successful status once the `AccessPolicy` has propagated to long-lasting storage. Syntactic and basic semantic errors will be returned in `metadata` as a BadRequest proto.", 1132 // "flatPath": "v1beta/accessPolicies", 1133 // "httpMethod": "POST", 1134 // "id": "accesscontextmanager.accessPolicies.create", 1135 // "parameterOrder": [], 1136 // "parameters": {}, 1137 // "path": "v1beta/accessPolicies", 1138 // "request": { 1139 // "$ref": "AccessPolicy" 1140 // }, 1141 // "response": { 1142 // "$ref": "Operation" 1143 // }, 1144 // "scopes": [ 1145 // "https://www.googleapis.com/auth/cloud-platform" 1146 // ] 1147 // } 1148 1149 } 1150 1151 // method id "accesscontextmanager.accessPolicies.delete": 1152 1153 type AccessPoliciesDeleteCall struct { 1154 s *Service 1155 name string 1156 urlParams_ gensupport.URLParams 1157 ctx_ context.Context 1158 header_ http.Header 1159 } 1160 1161 // Delete: Delete an AccessPolicy by resource name. The longrunning 1162 // Operation will have a successful status once the AccessPolicy has 1163 // been removed from long-lasting storage. 1164 // 1165 // - name: Resource name for the access policy to delete. Format 1166 // `accessPolicies/{policy_id}`. 1167 func (r *AccessPoliciesService) Delete(name string) *AccessPoliciesDeleteCall { 1168 c := &AccessPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1169 c.name = name 1170 return c 1171 } 1172 1173 // Fields allows partial responses to be retrieved. See 1174 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1175 // for more information. 1176 func (c *AccessPoliciesDeleteCall) Fields(s ...googleapi.Field) *AccessPoliciesDeleteCall { 1177 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1178 return c 1179 } 1180 1181 // Context sets the context to be used in this call's Do method. Any 1182 // pending HTTP request will be aborted if the provided context is 1183 // canceled. 1184 func (c *AccessPoliciesDeleteCall) Context(ctx context.Context) *AccessPoliciesDeleteCall { 1185 c.ctx_ = ctx 1186 return c 1187 } 1188 1189 // Header returns an http.Header that can be modified by the caller to 1190 // add HTTP headers to the request. 1191 func (c *AccessPoliciesDeleteCall) Header() http.Header { 1192 if c.header_ == nil { 1193 c.header_ = make(http.Header) 1194 } 1195 return c.header_ 1196 } 1197 1198 func (c *AccessPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) { 1199 reqHeaders := make(http.Header) 1200 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1201 for k, v := range c.header_ { 1202 reqHeaders[k] = v 1203 } 1204 reqHeaders.Set("User-Agent", c.s.userAgent()) 1205 var body io.Reader = nil 1206 c.urlParams_.Set("alt", alt) 1207 c.urlParams_.Set("prettyPrint", "false") 1208 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 1209 urls += "?" + c.urlParams_.Encode() 1210 req, err := http.NewRequest("DELETE", urls, body) 1211 if err != nil { 1212 return nil, err 1213 } 1214 req.Header = reqHeaders 1215 googleapi.Expand(req.URL, map[string]string{ 1216 "name": c.name, 1217 }) 1218 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1219 } 1220 1221 // Do executes the "accesscontextmanager.accessPolicies.delete" call. 1222 // Exactly one of *Operation or error will be non-nil. Any non-2xx 1223 // status code is an error. Response headers are in either 1224 // *Operation.ServerResponse.Header or (if a response was returned at 1225 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1226 // to check whether the returned error was because 1227 // http.StatusNotModified was returned. 1228 func (c *AccessPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1229 gensupport.SetOptions(c.urlParams_, opts...) 1230 res, err := c.doRequest("json") 1231 if res != nil && res.StatusCode == http.StatusNotModified { 1232 if res.Body != nil { 1233 res.Body.Close() 1234 } 1235 return nil, gensupport.WrapError(&googleapi.Error{ 1236 Code: res.StatusCode, 1237 Header: res.Header, 1238 }) 1239 } 1240 if err != nil { 1241 return nil, err 1242 } 1243 defer googleapi.CloseBody(res) 1244 if err := googleapi.CheckResponse(res); err != nil { 1245 return nil, gensupport.WrapError(err) 1246 } 1247 ret := &Operation{ 1248 ServerResponse: googleapi.ServerResponse{ 1249 Header: res.Header, 1250 HTTPStatusCode: res.StatusCode, 1251 }, 1252 } 1253 target := &ret 1254 if err := gensupport.DecodeResponse(target, res); err != nil { 1255 return nil, err 1256 } 1257 return ret, nil 1258 // { 1259 // "description": "Delete an AccessPolicy by resource name. The longrunning Operation will have a successful status once the AccessPolicy has been removed from long-lasting storage.", 1260 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}", 1261 // "httpMethod": "DELETE", 1262 // "id": "accesscontextmanager.accessPolicies.delete", 1263 // "parameterOrder": [ 1264 // "name" 1265 // ], 1266 // "parameters": { 1267 // "name": { 1268 // "description": "Required. Resource name for the access policy to delete. Format `accessPolicies/{policy_id}`", 1269 // "location": "path", 1270 // "pattern": "^accessPolicies/[^/]+$", 1271 // "required": true, 1272 // "type": "string" 1273 // } 1274 // }, 1275 // "path": "v1beta/{+name}", 1276 // "response": { 1277 // "$ref": "Operation" 1278 // }, 1279 // "scopes": [ 1280 // "https://www.googleapis.com/auth/cloud-platform" 1281 // ] 1282 // } 1283 1284 } 1285 1286 // method id "accesscontextmanager.accessPolicies.get": 1287 1288 type AccessPoliciesGetCall struct { 1289 s *Service 1290 name string 1291 urlParams_ gensupport.URLParams 1292 ifNoneMatch_ string 1293 ctx_ context.Context 1294 header_ http.Header 1295 } 1296 1297 // Get: Get an AccessPolicy by name. 1298 // 1299 // - name: Resource name for the access policy to get. Format 1300 // `accessPolicies/{policy_id}`. 1301 func (r *AccessPoliciesService) Get(name string) *AccessPoliciesGetCall { 1302 c := &AccessPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1303 c.name = name 1304 return c 1305 } 1306 1307 // Fields allows partial responses to be retrieved. See 1308 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1309 // for more information. 1310 func (c *AccessPoliciesGetCall) Fields(s ...googleapi.Field) *AccessPoliciesGetCall { 1311 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1312 return c 1313 } 1314 1315 // IfNoneMatch sets the optional parameter which makes the operation 1316 // fail if the object's ETag matches the given value. This is useful for 1317 // getting updates only after the object has changed since the last 1318 // request. Use googleapi.IsNotModified to check whether the response 1319 // error from Do is the result of In-None-Match. 1320 func (c *AccessPoliciesGetCall) IfNoneMatch(entityTag string) *AccessPoliciesGetCall { 1321 c.ifNoneMatch_ = entityTag 1322 return c 1323 } 1324 1325 // Context sets the context to be used in this call's Do method. Any 1326 // pending HTTP request will be aborted if the provided context is 1327 // canceled. 1328 func (c *AccessPoliciesGetCall) Context(ctx context.Context) *AccessPoliciesGetCall { 1329 c.ctx_ = ctx 1330 return c 1331 } 1332 1333 // Header returns an http.Header that can be modified by the caller to 1334 // add HTTP headers to the request. 1335 func (c *AccessPoliciesGetCall) Header() http.Header { 1336 if c.header_ == nil { 1337 c.header_ = make(http.Header) 1338 } 1339 return c.header_ 1340 } 1341 1342 func (c *AccessPoliciesGetCall) doRequest(alt string) (*http.Response, error) { 1343 reqHeaders := make(http.Header) 1344 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1345 for k, v := range c.header_ { 1346 reqHeaders[k] = v 1347 } 1348 reqHeaders.Set("User-Agent", c.s.userAgent()) 1349 if c.ifNoneMatch_ != "" { 1350 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1351 } 1352 var body io.Reader = nil 1353 c.urlParams_.Set("alt", alt) 1354 c.urlParams_.Set("prettyPrint", "false") 1355 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 1356 urls += "?" + c.urlParams_.Encode() 1357 req, err := http.NewRequest("GET", urls, body) 1358 if err != nil { 1359 return nil, err 1360 } 1361 req.Header = reqHeaders 1362 googleapi.Expand(req.URL, map[string]string{ 1363 "name": c.name, 1364 }) 1365 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1366 } 1367 1368 // Do executes the "accesscontextmanager.accessPolicies.get" call. 1369 // Exactly one of *AccessPolicy or error will be non-nil. Any non-2xx 1370 // status code is an error. Response headers are in either 1371 // *AccessPolicy.ServerResponse.Header or (if a response was returned at 1372 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1373 // to check whether the returned error was because 1374 // http.StatusNotModified was returned. 1375 func (c *AccessPoliciesGetCall) Do(opts ...googleapi.CallOption) (*AccessPolicy, error) { 1376 gensupport.SetOptions(c.urlParams_, opts...) 1377 res, err := c.doRequest("json") 1378 if res != nil && res.StatusCode == http.StatusNotModified { 1379 if res.Body != nil { 1380 res.Body.Close() 1381 } 1382 return nil, gensupport.WrapError(&googleapi.Error{ 1383 Code: res.StatusCode, 1384 Header: res.Header, 1385 }) 1386 } 1387 if err != nil { 1388 return nil, err 1389 } 1390 defer googleapi.CloseBody(res) 1391 if err := googleapi.CheckResponse(res); err != nil { 1392 return nil, gensupport.WrapError(err) 1393 } 1394 ret := &AccessPolicy{ 1395 ServerResponse: googleapi.ServerResponse{ 1396 Header: res.Header, 1397 HTTPStatusCode: res.StatusCode, 1398 }, 1399 } 1400 target := &ret 1401 if err := gensupport.DecodeResponse(target, res); err != nil { 1402 return nil, err 1403 } 1404 return ret, nil 1405 // { 1406 // "description": "Get an AccessPolicy by name.", 1407 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}", 1408 // "httpMethod": "GET", 1409 // "id": "accesscontextmanager.accessPolicies.get", 1410 // "parameterOrder": [ 1411 // "name" 1412 // ], 1413 // "parameters": { 1414 // "name": { 1415 // "description": "Required. Resource name for the access policy to get. Format `accessPolicies/{policy_id}`", 1416 // "location": "path", 1417 // "pattern": "^accessPolicies/[^/]+$", 1418 // "required": true, 1419 // "type": "string" 1420 // } 1421 // }, 1422 // "path": "v1beta/{+name}", 1423 // "response": { 1424 // "$ref": "AccessPolicy" 1425 // }, 1426 // "scopes": [ 1427 // "https://www.googleapis.com/auth/cloud-platform" 1428 // ] 1429 // } 1430 1431 } 1432 1433 // method id "accesscontextmanager.accessPolicies.list": 1434 1435 type AccessPoliciesListCall struct { 1436 s *Service 1437 urlParams_ gensupport.URLParams 1438 ifNoneMatch_ string 1439 ctx_ context.Context 1440 header_ http.Header 1441 } 1442 1443 // List: List all AccessPolicies under a container. 1444 func (r *AccessPoliciesService) List() *AccessPoliciesListCall { 1445 c := &AccessPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1446 return c 1447 } 1448 1449 // PageSize sets the optional parameter "pageSize": Number of 1450 // AccessPolicy instances to include in the list. Default 100. 1451 func (c *AccessPoliciesListCall) PageSize(pageSize int64) *AccessPoliciesListCall { 1452 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1453 return c 1454 } 1455 1456 // PageToken sets the optional parameter "pageToken": Next page token 1457 // for the next batch of AccessPolicy instances. Defaults to the first 1458 // page of results. 1459 func (c *AccessPoliciesListCall) PageToken(pageToken string) *AccessPoliciesListCall { 1460 c.urlParams_.Set("pageToken", pageToken) 1461 return c 1462 } 1463 1464 // Parent sets the optional parameter "parent": Required. Resource name 1465 // for the container to list AccessPolicy instances from. Format: 1466 // `organizations/{org_id}` 1467 func (c *AccessPoliciesListCall) Parent(parent string) *AccessPoliciesListCall { 1468 c.urlParams_.Set("parent", parent) 1469 return c 1470 } 1471 1472 // Fields allows partial responses to be retrieved. See 1473 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1474 // for more information. 1475 func (c *AccessPoliciesListCall) Fields(s ...googleapi.Field) *AccessPoliciesListCall { 1476 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1477 return c 1478 } 1479 1480 // IfNoneMatch sets the optional parameter which makes the operation 1481 // fail if the object's ETag matches the given value. This is useful for 1482 // getting updates only after the object has changed since the last 1483 // request. Use googleapi.IsNotModified to check whether the response 1484 // error from Do is the result of In-None-Match. 1485 func (c *AccessPoliciesListCall) IfNoneMatch(entityTag string) *AccessPoliciesListCall { 1486 c.ifNoneMatch_ = entityTag 1487 return c 1488 } 1489 1490 // Context sets the context to be used in this call's Do method. Any 1491 // pending HTTP request will be aborted if the provided context is 1492 // canceled. 1493 func (c *AccessPoliciesListCall) Context(ctx context.Context) *AccessPoliciesListCall { 1494 c.ctx_ = ctx 1495 return c 1496 } 1497 1498 // Header returns an http.Header that can be modified by the caller to 1499 // add HTTP headers to the request. 1500 func (c *AccessPoliciesListCall) Header() http.Header { 1501 if c.header_ == nil { 1502 c.header_ = make(http.Header) 1503 } 1504 return c.header_ 1505 } 1506 1507 func (c *AccessPoliciesListCall) doRequest(alt string) (*http.Response, error) { 1508 reqHeaders := make(http.Header) 1509 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1510 for k, v := range c.header_ { 1511 reqHeaders[k] = v 1512 } 1513 reqHeaders.Set("User-Agent", c.s.userAgent()) 1514 if c.ifNoneMatch_ != "" { 1515 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1516 } 1517 var body io.Reader = nil 1518 c.urlParams_.Set("alt", alt) 1519 c.urlParams_.Set("prettyPrint", "false") 1520 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/accessPolicies") 1521 urls += "?" + c.urlParams_.Encode() 1522 req, err := http.NewRequest("GET", urls, body) 1523 if err != nil { 1524 return nil, err 1525 } 1526 req.Header = reqHeaders 1527 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1528 } 1529 1530 // Do executes the "accesscontextmanager.accessPolicies.list" call. 1531 // Exactly one of *ListAccessPoliciesResponse or error will be non-nil. 1532 // Any non-2xx status code is an error. Response headers are in either 1533 // *ListAccessPoliciesResponse.ServerResponse.Header or (if a response 1534 // was returned at all) in error.(*googleapi.Error).Header. Use 1535 // googleapi.IsNotModified to check whether the returned error was 1536 // because http.StatusNotModified was returned. 1537 func (c *AccessPoliciesListCall) Do(opts ...googleapi.CallOption) (*ListAccessPoliciesResponse, error) { 1538 gensupport.SetOptions(c.urlParams_, opts...) 1539 res, err := c.doRequest("json") 1540 if res != nil && res.StatusCode == http.StatusNotModified { 1541 if res.Body != nil { 1542 res.Body.Close() 1543 } 1544 return nil, gensupport.WrapError(&googleapi.Error{ 1545 Code: res.StatusCode, 1546 Header: res.Header, 1547 }) 1548 } 1549 if err != nil { 1550 return nil, err 1551 } 1552 defer googleapi.CloseBody(res) 1553 if err := googleapi.CheckResponse(res); err != nil { 1554 return nil, gensupport.WrapError(err) 1555 } 1556 ret := &ListAccessPoliciesResponse{ 1557 ServerResponse: googleapi.ServerResponse{ 1558 Header: res.Header, 1559 HTTPStatusCode: res.StatusCode, 1560 }, 1561 } 1562 target := &ret 1563 if err := gensupport.DecodeResponse(target, res); err != nil { 1564 return nil, err 1565 } 1566 return ret, nil 1567 // { 1568 // "description": "List all AccessPolicies under a container.", 1569 // "flatPath": "v1beta/accessPolicies", 1570 // "httpMethod": "GET", 1571 // "id": "accesscontextmanager.accessPolicies.list", 1572 // "parameterOrder": [], 1573 // "parameters": { 1574 // "pageSize": { 1575 // "description": "Number of AccessPolicy instances to include in the list. Default 100.", 1576 // "format": "int32", 1577 // "location": "query", 1578 // "type": "integer" 1579 // }, 1580 // "pageToken": { 1581 // "description": "Next page token for the next batch of AccessPolicy instances. Defaults to the first page of results.", 1582 // "location": "query", 1583 // "type": "string" 1584 // }, 1585 // "parent": { 1586 // "description": "Required. Resource name for the container to list AccessPolicy instances from. Format: `organizations/{org_id}`", 1587 // "location": "query", 1588 // "type": "string" 1589 // } 1590 // }, 1591 // "path": "v1beta/accessPolicies", 1592 // "response": { 1593 // "$ref": "ListAccessPoliciesResponse" 1594 // }, 1595 // "scopes": [ 1596 // "https://www.googleapis.com/auth/cloud-platform" 1597 // ] 1598 // } 1599 1600 } 1601 1602 // Pages invokes f for each page of results. 1603 // A non-nil error returned from f will halt the iteration. 1604 // The provided context supersedes any context provided to the Context method. 1605 func (c *AccessPoliciesListCall) Pages(ctx context.Context, f func(*ListAccessPoliciesResponse) error) error { 1606 c.ctx_ = ctx 1607 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1608 for { 1609 x, err := c.Do() 1610 if err != nil { 1611 return err 1612 } 1613 if err := f(x); err != nil { 1614 return err 1615 } 1616 if x.NextPageToken == "" { 1617 return nil 1618 } 1619 c.PageToken(x.NextPageToken) 1620 } 1621 } 1622 1623 // method id "accesscontextmanager.accessPolicies.patch": 1624 1625 type AccessPoliciesPatchCall struct { 1626 s *Service 1627 name string 1628 accesspolicy *AccessPolicy 1629 urlParams_ gensupport.URLParams 1630 ctx_ context.Context 1631 header_ http.Header 1632 } 1633 1634 // Patch: Update an AccessPolicy. The longrunning Operation from this 1635 // RPC will have a successful status once the changes to the 1636 // AccessPolicy have propagated to long-lasting storage. Syntactic and 1637 // basic semantic errors will be returned in `metadata` as a BadRequest 1638 // proto. 1639 // 1640 // - name: Output only. Resource name of the `AccessPolicy`. Format: 1641 // `accessPolicies/{policy_id}`. 1642 func (r *AccessPoliciesService) Patch(name string, accesspolicy *AccessPolicy) *AccessPoliciesPatchCall { 1643 c := &AccessPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1644 c.name = name 1645 c.accesspolicy = accesspolicy 1646 return c 1647 } 1648 1649 // UpdateMask sets the optional parameter "updateMask": Required. Mask 1650 // to control which fields get updated. Must be non-empty. 1651 func (c *AccessPoliciesPatchCall) UpdateMask(updateMask string) *AccessPoliciesPatchCall { 1652 c.urlParams_.Set("updateMask", updateMask) 1653 return c 1654 } 1655 1656 // Fields allows partial responses to be retrieved. See 1657 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1658 // for more information. 1659 func (c *AccessPoliciesPatchCall) Fields(s ...googleapi.Field) *AccessPoliciesPatchCall { 1660 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1661 return c 1662 } 1663 1664 // Context sets the context to be used in this call's Do method. Any 1665 // pending HTTP request will be aborted if the provided context is 1666 // canceled. 1667 func (c *AccessPoliciesPatchCall) Context(ctx context.Context) *AccessPoliciesPatchCall { 1668 c.ctx_ = ctx 1669 return c 1670 } 1671 1672 // Header returns an http.Header that can be modified by the caller to 1673 // add HTTP headers to the request. 1674 func (c *AccessPoliciesPatchCall) Header() http.Header { 1675 if c.header_ == nil { 1676 c.header_ = make(http.Header) 1677 } 1678 return c.header_ 1679 } 1680 1681 func (c *AccessPoliciesPatchCall) doRequest(alt string) (*http.Response, error) { 1682 reqHeaders := make(http.Header) 1683 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1684 for k, v := range c.header_ { 1685 reqHeaders[k] = v 1686 } 1687 reqHeaders.Set("User-Agent", c.s.userAgent()) 1688 var body io.Reader = nil 1689 body, err := googleapi.WithoutDataWrapper.JSONReader(c.accesspolicy) 1690 if err != nil { 1691 return nil, err 1692 } 1693 reqHeaders.Set("Content-Type", "application/json") 1694 c.urlParams_.Set("alt", alt) 1695 c.urlParams_.Set("prettyPrint", "false") 1696 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 1697 urls += "?" + c.urlParams_.Encode() 1698 req, err := http.NewRequest("PATCH", urls, body) 1699 if err != nil { 1700 return nil, err 1701 } 1702 req.Header = reqHeaders 1703 googleapi.Expand(req.URL, map[string]string{ 1704 "name": c.name, 1705 }) 1706 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1707 } 1708 1709 // Do executes the "accesscontextmanager.accessPolicies.patch" call. 1710 // Exactly one of *Operation or error will be non-nil. Any non-2xx 1711 // status code is an error. Response headers are in either 1712 // *Operation.ServerResponse.Header or (if a response was returned at 1713 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1714 // to check whether the returned error was because 1715 // http.StatusNotModified was returned. 1716 func (c *AccessPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1717 gensupport.SetOptions(c.urlParams_, opts...) 1718 res, err := c.doRequest("json") 1719 if res != nil && res.StatusCode == http.StatusNotModified { 1720 if res.Body != nil { 1721 res.Body.Close() 1722 } 1723 return nil, gensupport.WrapError(&googleapi.Error{ 1724 Code: res.StatusCode, 1725 Header: res.Header, 1726 }) 1727 } 1728 if err != nil { 1729 return nil, err 1730 } 1731 defer googleapi.CloseBody(res) 1732 if err := googleapi.CheckResponse(res); err != nil { 1733 return nil, gensupport.WrapError(err) 1734 } 1735 ret := &Operation{ 1736 ServerResponse: googleapi.ServerResponse{ 1737 Header: res.Header, 1738 HTTPStatusCode: res.StatusCode, 1739 }, 1740 } 1741 target := &ret 1742 if err := gensupport.DecodeResponse(target, res); err != nil { 1743 return nil, err 1744 } 1745 return ret, nil 1746 // { 1747 // "description": "Update an AccessPolicy. The longrunning Operation from this RPC will have a successful status once the changes to the AccessPolicy have propagated to long-lasting storage. Syntactic and basic semantic errors will be returned in `metadata` as a BadRequest proto.", 1748 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}", 1749 // "httpMethod": "PATCH", 1750 // "id": "accesscontextmanager.accessPolicies.patch", 1751 // "parameterOrder": [ 1752 // "name" 1753 // ], 1754 // "parameters": { 1755 // "name": { 1756 // "description": "Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{policy_id}`", 1757 // "location": "path", 1758 // "pattern": "^accessPolicies/[^/]+$", 1759 // "required": true, 1760 // "type": "string" 1761 // }, 1762 // "updateMask": { 1763 // "description": "Required. Mask to control which fields get updated. Must be non-empty.", 1764 // "format": "google-fieldmask", 1765 // "location": "query", 1766 // "type": "string" 1767 // } 1768 // }, 1769 // "path": "v1beta/{+name}", 1770 // "request": { 1771 // "$ref": "AccessPolicy" 1772 // }, 1773 // "response": { 1774 // "$ref": "Operation" 1775 // }, 1776 // "scopes": [ 1777 // "https://www.googleapis.com/auth/cloud-platform" 1778 // ] 1779 // } 1780 1781 } 1782 1783 // method id "accesscontextmanager.accessPolicies.accessLevels.create": 1784 1785 type AccessPoliciesAccessLevelsCreateCall struct { 1786 s *Service 1787 parent string 1788 accesslevel *AccessLevel 1789 urlParams_ gensupport.URLParams 1790 ctx_ context.Context 1791 header_ http.Header 1792 } 1793 1794 // Create: Create an Access Level. The longrunning operation from this 1795 // RPC will have a successful status once the Access Level has 1796 // propagated to long-lasting storage. Access Levels containing errors 1797 // will result in an error response for the first error encountered. 1798 // 1799 // - parent: Resource name for the access policy which owns this Access 1800 // Level. Format: `accessPolicies/{policy_id}`. 1801 func (r *AccessPoliciesAccessLevelsService) Create(parent string, accesslevel *AccessLevel) *AccessPoliciesAccessLevelsCreateCall { 1802 c := &AccessPoliciesAccessLevelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1803 c.parent = parent 1804 c.accesslevel = accesslevel 1805 return c 1806 } 1807 1808 // Fields allows partial responses to be retrieved. See 1809 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1810 // for more information. 1811 func (c *AccessPoliciesAccessLevelsCreateCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsCreateCall { 1812 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1813 return c 1814 } 1815 1816 // Context sets the context to be used in this call's Do method. Any 1817 // pending HTTP request will be aborted if the provided context is 1818 // canceled. 1819 func (c *AccessPoliciesAccessLevelsCreateCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsCreateCall { 1820 c.ctx_ = ctx 1821 return c 1822 } 1823 1824 // Header returns an http.Header that can be modified by the caller to 1825 // add HTTP headers to the request. 1826 func (c *AccessPoliciesAccessLevelsCreateCall) Header() http.Header { 1827 if c.header_ == nil { 1828 c.header_ = make(http.Header) 1829 } 1830 return c.header_ 1831 } 1832 1833 func (c *AccessPoliciesAccessLevelsCreateCall) doRequest(alt string) (*http.Response, error) { 1834 reqHeaders := make(http.Header) 1835 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1836 for k, v := range c.header_ { 1837 reqHeaders[k] = v 1838 } 1839 reqHeaders.Set("User-Agent", c.s.userAgent()) 1840 var body io.Reader = nil 1841 body, err := googleapi.WithoutDataWrapper.JSONReader(c.accesslevel) 1842 if err != nil { 1843 return nil, err 1844 } 1845 reqHeaders.Set("Content-Type", "application/json") 1846 c.urlParams_.Set("alt", alt) 1847 c.urlParams_.Set("prettyPrint", "false") 1848 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/accessLevels") 1849 urls += "?" + c.urlParams_.Encode() 1850 req, err := http.NewRequest("POST", urls, body) 1851 if err != nil { 1852 return nil, err 1853 } 1854 req.Header = reqHeaders 1855 googleapi.Expand(req.URL, map[string]string{ 1856 "parent": c.parent, 1857 }) 1858 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1859 } 1860 1861 // Do executes the "accesscontextmanager.accessPolicies.accessLevels.create" call. 1862 // Exactly one of *Operation or error will be non-nil. Any non-2xx 1863 // status code is an error. Response headers are in either 1864 // *Operation.ServerResponse.Header or (if a response was returned at 1865 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1866 // to check whether the returned error was because 1867 // http.StatusNotModified was returned. 1868 func (c *AccessPoliciesAccessLevelsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1869 gensupport.SetOptions(c.urlParams_, opts...) 1870 res, err := c.doRequest("json") 1871 if res != nil && res.StatusCode == http.StatusNotModified { 1872 if res.Body != nil { 1873 res.Body.Close() 1874 } 1875 return nil, gensupport.WrapError(&googleapi.Error{ 1876 Code: res.StatusCode, 1877 Header: res.Header, 1878 }) 1879 } 1880 if err != nil { 1881 return nil, err 1882 } 1883 defer googleapi.CloseBody(res) 1884 if err := googleapi.CheckResponse(res); err != nil { 1885 return nil, gensupport.WrapError(err) 1886 } 1887 ret := &Operation{ 1888 ServerResponse: googleapi.ServerResponse{ 1889 Header: res.Header, 1890 HTTPStatusCode: res.StatusCode, 1891 }, 1892 } 1893 target := &ret 1894 if err := gensupport.DecodeResponse(target, res); err != nil { 1895 return nil, err 1896 } 1897 return ret, nil 1898 // { 1899 // "description": "Create an Access Level. The longrunning operation from this RPC will have a successful status once the Access Level has propagated to long-lasting storage. Access Levels containing errors will result in an error response for the first error encountered.", 1900 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/accessLevels", 1901 // "httpMethod": "POST", 1902 // "id": "accesscontextmanager.accessPolicies.accessLevels.create", 1903 // "parameterOrder": [ 1904 // "parent" 1905 // ], 1906 // "parameters": { 1907 // "parent": { 1908 // "description": "Required. Resource name for the access policy which owns this Access Level. Format: `accessPolicies/{policy_id}`", 1909 // "location": "path", 1910 // "pattern": "^accessPolicies/[^/]+$", 1911 // "required": true, 1912 // "type": "string" 1913 // } 1914 // }, 1915 // "path": "v1beta/{+parent}/accessLevels", 1916 // "request": { 1917 // "$ref": "AccessLevel" 1918 // }, 1919 // "response": { 1920 // "$ref": "Operation" 1921 // }, 1922 // "scopes": [ 1923 // "https://www.googleapis.com/auth/cloud-platform" 1924 // ] 1925 // } 1926 1927 } 1928 1929 // method id "accesscontextmanager.accessPolicies.accessLevels.delete": 1930 1931 type AccessPoliciesAccessLevelsDeleteCall struct { 1932 s *Service 1933 name string 1934 urlParams_ gensupport.URLParams 1935 ctx_ context.Context 1936 header_ http.Header 1937 } 1938 1939 // Delete: Delete an Access Level by resource name. The longrunning 1940 // operation from this RPC will have a successful status once the Access 1941 // Level has been removed from long-lasting storage. 1942 // 1943 // - name: Resource name for the Access Level. Format: 1944 // `accessPolicies/{policy_id}/accessLevels/{access_level_id}`. 1945 func (r *AccessPoliciesAccessLevelsService) Delete(name string) *AccessPoliciesAccessLevelsDeleteCall { 1946 c := &AccessPoliciesAccessLevelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1947 c.name = name 1948 return c 1949 } 1950 1951 // Fields allows partial responses to be retrieved. See 1952 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1953 // for more information. 1954 func (c *AccessPoliciesAccessLevelsDeleteCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsDeleteCall { 1955 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1956 return c 1957 } 1958 1959 // Context sets the context to be used in this call's Do method. Any 1960 // pending HTTP request will be aborted if the provided context is 1961 // canceled. 1962 func (c *AccessPoliciesAccessLevelsDeleteCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsDeleteCall { 1963 c.ctx_ = ctx 1964 return c 1965 } 1966 1967 // Header returns an http.Header that can be modified by the caller to 1968 // add HTTP headers to the request. 1969 func (c *AccessPoliciesAccessLevelsDeleteCall) Header() http.Header { 1970 if c.header_ == nil { 1971 c.header_ = make(http.Header) 1972 } 1973 return c.header_ 1974 } 1975 1976 func (c *AccessPoliciesAccessLevelsDeleteCall) doRequest(alt string) (*http.Response, error) { 1977 reqHeaders := make(http.Header) 1978 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1979 for k, v := range c.header_ { 1980 reqHeaders[k] = v 1981 } 1982 reqHeaders.Set("User-Agent", c.s.userAgent()) 1983 var body io.Reader = nil 1984 c.urlParams_.Set("alt", alt) 1985 c.urlParams_.Set("prettyPrint", "false") 1986 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 1987 urls += "?" + c.urlParams_.Encode() 1988 req, err := http.NewRequest("DELETE", urls, body) 1989 if err != nil { 1990 return nil, err 1991 } 1992 req.Header = reqHeaders 1993 googleapi.Expand(req.URL, map[string]string{ 1994 "name": c.name, 1995 }) 1996 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1997 } 1998 1999 // Do executes the "accesscontextmanager.accessPolicies.accessLevels.delete" call. 2000 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2001 // status code is an error. Response headers are in either 2002 // *Operation.ServerResponse.Header or (if a response was returned at 2003 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2004 // to check whether the returned error was because 2005 // http.StatusNotModified was returned. 2006 func (c *AccessPoliciesAccessLevelsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2007 gensupport.SetOptions(c.urlParams_, opts...) 2008 res, err := c.doRequest("json") 2009 if res != nil && res.StatusCode == http.StatusNotModified { 2010 if res.Body != nil { 2011 res.Body.Close() 2012 } 2013 return nil, gensupport.WrapError(&googleapi.Error{ 2014 Code: res.StatusCode, 2015 Header: res.Header, 2016 }) 2017 } 2018 if err != nil { 2019 return nil, err 2020 } 2021 defer googleapi.CloseBody(res) 2022 if err := googleapi.CheckResponse(res); err != nil { 2023 return nil, gensupport.WrapError(err) 2024 } 2025 ret := &Operation{ 2026 ServerResponse: googleapi.ServerResponse{ 2027 Header: res.Header, 2028 HTTPStatusCode: res.StatusCode, 2029 }, 2030 } 2031 target := &ret 2032 if err := gensupport.DecodeResponse(target, res); err != nil { 2033 return nil, err 2034 } 2035 return ret, nil 2036 // { 2037 // "description": "Delete an Access Level by resource name. The longrunning operation from this RPC will have a successful status once the Access Level has been removed from long-lasting storage.", 2038 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/accessLevels/{accessLevelsId}", 2039 // "httpMethod": "DELETE", 2040 // "id": "accesscontextmanager.accessPolicies.accessLevels.delete", 2041 // "parameterOrder": [ 2042 // "name" 2043 // ], 2044 // "parameters": { 2045 // "name": { 2046 // "description": "Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`", 2047 // "location": "path", 2048 // "pattern": "^accessPolicies/[^/]+/accessLevels/[^/]+$", 2049 // "required": true, 2050 // "type": "string" 2051 // } 2052 // }, 2053 // "path": "v1beta/{+name}", 2054 // "response": { 2055 // "$ref": "Operation" 2056 // }, 2057 // "scopes": [ 2058 // "https://www.googleapis.com/auth/cloud-platform" 2059 // ] 2060 // } 2061 2062 } 2063 2064 // method id "accesscontextmanager.accessPolicies.accessLevels.get": 2065 2066 type AccessPoliciesAccessLevelsGetCall struct { 2067 s *Service 2068 name string 2069 urlParams_ gensupport.URLParams 2070 ifNoneMatch_ string 2071 ctx_ context.Context 2072 header_ http.Header 2073 } 2074 2075 // Get: Get an Access Level by resource name. 2076 // 2077 // - name: Resource name for the Access Level. Format: 2078 // `accessPolicies/{policy_id}/accessLevels/{access_level_id}`. 2079 func (r *AccessPoliciesAccessLevelsService) Get(name string) *AccessPoliciesAccessLevelsGetCall { 2080 c := &AccessPoliciesAccessLevelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2081 c.name = name 2082 return c 2083 } 2084 2085 // AccessLevelFormat sets the optional parameter "accessLevelFormat": 2086 // Whether to return `BasicLevels` in the Cloud Common Expression 2087 // Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where 2088 // Access Levels are returned as `BasicLevels` or `CustomLevels` based 2089 // on how they were created. If set to CEL, all Access Levels are 2090 // returned as `CustomLevels`. In the CEL case, `BasicLevels` are 2091 // translated to equivalent `CustomLevels`. 2092 // 2093 // Possible values: 2094 // 2095 // "LEVEL_FORMAT_UNSPECIFIED" - The format was not specified. 2096 // "AS_DEFINED" - Uses the format the resource was defined in. 2097 // 2098 // BasicLevels are returned as BasicLevels, CustomLevels are returned as 2099 // CustomLevels. 2100 // 2101 // "CEL" - Use Cloud Common Expression Language when returning the 2102 // 2103 // resource. Both BasicLevels and CustomLevels are returned as 2104 // CustomLevels. 2105 func (c *AccessPoliciesAccessLevelsGetCall) AccessLevelFormat(accessLevelFormat string) *AccessPoliciesAccessLevelsGetCall { 2106 c.urlParams_.Set("accessLevelFormat", accessLevelFormat) 2107 return c 2108 } 2109 2110 // Fields allows partial responses to be retrieved. See 2111 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2112 // for more information. 2113 func (c *AccessPoliciesAccessLevelsGetCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsGetCall { 2114 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2115 return c 2116 } 2117 2118 // IfNoneMatch sets the optional parameter which makes the operation 2119 // fail if the object's ETag matches the given value. This is useful for 2120 // getting updates only after the object has changed since the last 2121 // request. Use googleapi.IsNotModified to check whether the response 2122 // error from Do is the result of In-None-Match. 2123 func (c *AccessPoliciesAccessLevelsGetCall) IfNoneMatch(entityTag string) *AccessPoliciesAccessLevelsGetCall { 2124 c.ifNoneMatch_ = entityTag 2125 return c 2126 } 2127 2128 // Context sets the context to be used in this call's Do method. Any 2129 // pending HTTP request will be aborted if the provided context is 2130 // canceled. 2131 func (c *AccessPoliciesAccessLevelsGetCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsGetCall { 2132 c.ctx_ = ctx 2133 return c 2134 } 2135 2136 // Header returns an http.Header that can be modified by the caller to 2137 // add HTTP headers to the request. 2138 func (c *AccessPoliciesAccessLevelsGetCall) Header() http.Header { 2139 if c.header_ == nil { 2140 c.header_ = make(http.Header) 2141 } 2142 return c.header_ 2143 } 2144 2145 func (c *AccessPoliciesAccessLevelsGetCall) doRequest(alt string) (*http.Response, error) { 2146 reqHeaders := make(http.Header) 2147 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2148 for k, v := range c.header_ { 2149 reqHeaders[k] = v 2150 } 2151 reqHeaders.Set("User-Agent", c.s.userAgent()) 2152 if c.ifNoneMatch_ != "" { 2153 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2154 } 2155 var body io.Reader = nil 2156 c.urlParams_.Set("alt", alt) 2157 c.urlParams_.Set("prettyPrint", "false") 2158 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 2159 urls += "?" + c.urlParams_.Encode() 2160 req, err := http.NewRequest("GET", urls, body) 2161 if err != nil { 2162 return nil, err 2163 } 2164 req.Header = reqHeaders 2165 googleapi.Expand(req.URL, map[string]string{ 2166 "name": c.name, 2167 }) 2168 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2169 } 2170 2171 // Do executes the "accesscontextmanager.accessPolicies.accessLevels.get" call. 2172 // Exactly one of *AccessLevel or error will be non-nil. Any non-2xx 2173 // status code is an error. Response headers are in either 2174 // *AccessLevel.ServerResponse.Header or (if a response was returned at 2175 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2176 // to check whether the returned error was because 2177 // http.StatusNotModified was returned. 2178 func (c *AccessPoliciesAccessLevelsGetCall) Do(opts ...googleapi.CallOption) (*AccessLevel, error) { 2179 gensupport.SetOptions(c.urlParams_, opts...) 2180 res, err := c.doRequest("json") 2181 if res != nil && res.StatusCode == http.StatusNotModified { 2182 if res.Body != nil { 2183 res.Body.Close() 2184 } 2185 return nil, gensupport.WrapError(&googleapi.Error{ 2186 Code: res.StatusCode, 2187 Header: res.Header, 2188 }) 2189 } 2190 if err != nil { 2191 return nil, err 2192 } 2193 defer googleapi.CloseBody(res) 2194 if err := googleapi.CheckResponse(res); err != nil { 2195 return nil, gensupport.WrapError(err) 2196 } 2197 ret := &AccessLevel{ 2198 ServerResponse: googleapi.ServerResponse{ 2199 Header: res.Header, 2200 HTTPStatusCode: res.StatusCode, 2201 }, 2202 } 2203 target := &ret 2204 if err := gensupport.DecodeResponse(target, res); err != nil { 2205 return nil, err 2206 } 2207 return ret, nil 2208 // { 2209 // "description": "Get an Access Level by resource name.", 2210 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/accessLevels/{accessLevelsId}", 2211 // "httpMethod": "GET", 2212 // "id": "accesscontextmanager.accessPolicies.accessLevels.get", 2213 // "parameterOrder": [ 2214 // "name" 2215 // ], 2216 // "parameters": { 2217 // "accessLevelFormat": { 2218 // "description": "Whether to return `BasicLevels` in the Cloud Common Expression Language rather than as `BasicLevels`. Defaults to AS_DEFINED, where Access Levels are returned as `BasicLevels` or `CustomLevels` based on how they were created. If set to CEL, all Access Levels are returned as `CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent `CustomLevels`.", 2219 // "enum": [ 2220 // "LEVEL_FORMAT_UNSPECIFIED", 2221 // "AS_DEFINED", 2222 // "CEL" 2223 // ], 2224 // "enumDescriptions": [ 2225 // "The format was not specified.", 2226 // "Uses the format the resource was defined in. BasicLevels are returned as BasicLevels, CustomLevels are returned as CustomLevels.", 2227 // "Use Cloud Common Expression Language when returning the resource. Both BasicLevels and CustomLevels are returned as CustomLevels." 2228 // ], 2229 // "location": "query", 2230 // "type": "string" 2231 // }, 2232 // "name": { 2233 // "description": "Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`", 2234 // "location": "path", 2235 // "pattern": "^accessPolicies/[^/]+/accessLevels/[^/]+$", 2236 // "required": true, 2237 // "type": "string" 2238 // } 2239 // }, 2240 // "path": "v1beta/{+name}", 2241 // "response": { 2242 // "$ref": "AccessLevel" 2243 // }, 2244 // "scopes": [ 2245 // "https://www.googleapis.com/auth/cloud-platform" 2246 // ] 2247 // } 2248 2249 } 2250 2251 // method id "accesscontextmanager.accessPolicies.accessLevels.list": 2252 2253 type AccessPoliciesAccessLevelsListCall struct { 2254 s *Service 2255 parent string 2256 urlParams_ gensupport.URLParams 2257 ifNoneMatch_ string 2258 ctx_ context.Context 2259 header_ http.Header 2260 } 2261 2262 // List: List all Access Levels for an access policy. 2263 // 2264 // - parent: Resource name for the access policy to list Access Levels 2265 // from. Format: `accessPolicies/{policy_id}`. 2266 func (r *AccessPoliciesAccessLevelsService) List(parent string) *AccessPoliciesAccessLevelsListCall { 2267 c := &AccessPoliciesAccessLevelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2268 c.parent = parent 2269 return c 2270 } 2271 2272 // AccessLevelFormat sets the optional parameter "accessLevelFormat": 2273 // Whether to return `BasicLevels` in the Cloud Common Expression 2274 // language, as `CustomLevels`, rather than as `BasicLevels`. Defaults 2275 // to returning `AccessLevels` in the format they were defined. 2276 // 2277 // Possible values: 2278 // 2279 // "LEVEL_FORMAT_UNSPECIFIED" - The format was not specified. 2280 // "AS_DEFINED" - Uses the format the resource was defined in. 2281 // 2282 // BasicLevels are returned as BasicLevels, CustomLevels are returned as 2283 // CustomLevels. 2284 // 2285 // "CEL" - Use Cloud Common Expression Language when returning the 2286 // 2287 // resource. Both BasicLevels and CustomLevels are returned as 2288 // CustomLevels. 2289 func (c *AccessPoliciesAccessLevelsListCall) AccessLevelFormat(accessLevelFormat string) *AccessPoliciesAccessLevelsListCall { 2290 c.urlParams_.Set("accessLevelFormat", accessLevelFormat) 2291 return c 2292 } 2293 2294 // PageSize sets the optional parameter "pageSize": Number of Access 2295 // Levels to include in the list. Default 100. 2296 func (c *AccessPoliciesAccessLevelsListCall) PageSize(pageSize int64) *AccessPoliciesAccessLevelsListCall { 2297 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2298 return c 2299 } 2300 2301 // PageToken sets the optional parameter "pageToken": Next page token 2302 // for the next batch of Access Level instances. Defaults to the first 2303 // page of results. 2304 func (c *AccessPoliciesAccessLevelsListCall) PageToken(pageToken string) *AccessPoliciesAccessLevelsListCall { 2305 c.urlParams_.Set("pageToken", pageToken) 2306 return c 2307 } 2308 2309 // Fields allows partial responses to be retrieved. See 2310 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2311 // for more information. 2312 func (c *AccessPoliciesAccessLevelsListCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsListCall { 2313 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2314 return c 2315 } 2316 2317 // IfNoneMatch sets the optional parameter which makes the operation 2318 // fail if the object's ETag matches the given value. This is useful for 2319 // getting updates only after the object has changed since the last 2320 // request. Use googleapi.IsNotModified to check whether the response 2321 // error from Do is the result of In-None-Match. 2322 func (c *AccessPoliciesAccessLevelsListCall) IfNoneMatch(entityTag string) *AccessPoliciesAccessLevelsListCall { 2323 c.ifNoneMatch_ = entityTag 2324 return c 2325 } 2326 2327 // Context sets the context to be used in this call's Do method. Any 2328 // pending HTTP request will be aborted if the provided context is 2329 // canceled. 2330 func (c *AccessPoliciesAccessLevelsListCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsListCall { 2331 c.ctx_ = ctx 2332 return c 2333 } 2334 2335 // Header returns an http.Header that can be modified by the caller to 2336 // add HTTP headers to the request. 2337 func (c *AccessPoliciesAccessLevelsListCall) Header() http.Header { 2338 if c.header_ == nil { 2339 c.header_ = make(http.Header) 2340 } 2341 return c.header_ 2342 } 2343 2344 func (c *AccessPoliciesAccessLevelsListCall) doRequest(alt string) (*http.Response, error) { 2345 reqHeaders := make(http.Header) 2346 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2347 for k, v := range c.header_ { 2348 reqHeaders[k] = v 2349 } 2350 reqHeaders.Set("User-Agent", c.s.userAgent()) 2351 if c.ifNoneMatch_ != "" { 2352 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2353 } 2354 var body io.Reader = nil 2355 c.urlParams_.Set("alt", alt) 2356 c.urlParams_.Set("prettyPrint", "false") 2357 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/accessLevels") 2358 urls += "?" + c.urlParams_.Encode() 2359 req, err := http.NewRequest("GET", urls, body) 2360 if err != nil { 2361 return nil, err 2362 } 2363 req.Header = reqHeaders 2364 googleapi.Expand(req.URL, map[string]string{ 2365 "parent": c.parent, 2366 }) 2367 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2368 } 2369 2370 // Do executes the "accesscontextmanager.accessPolicies.accessLevels.list" call. 2371 // Exactly one of *ListAccessLevelsResponse or error will be non-nil. 2372 // Any non-2xx status code is an error. Response headers are in either 2373 // *ListAccessLevelsResponse.ServerResponse.Header or (if a response was 2374 // returned at all) in error.(*googleapi.Error).Header. Use 2375 // googleapi.IsNotModified to check whether the returned error was 2376 // because http.StatusNotModified was returned. 2377 func (c *AccessPoliciesAccessLevelsListCall) Do(opts ...googleapi.CallOption) (*ListAccessLevelsResponse, error) { 2378 gensupport.SetOptions(c.urlParams_, opts...) 2379 res, err := c.doRequest("json") 2380 if res != nil && res.StatusCode == http.StatusNotModified { 2381 if res.Body != nil { 2382 res.Body.Close() 2383 } 2384 return nil, gensupport.WrapError(&googleapi.Error{ 2385 Code: res.StatusCode, 2386 Header: res.Header, 2387 }) 2388 } 2389 if err != nil { 2390 return nil, err 2391 } 2392 defer googleapi.CloseBody(res) 2393 if err := googleapi.CheckResponse(res); err != nil { 2394 return nil, gensupport.WrapError(err) 2395 } 2396 ret := &ListAccessLevelsResponse{ 2397 ServerResponse: googleapi.ServerResponse{ 2398 Header: res.Header, 2399 HTTPStatusCode: res.StatusCode, 2400 }, 2401 } 2402 target := &ret 2403 if err := gensupport.DecodeResponse(target, res); err != nil { 2404 return nil, err 2405 } 2406 return ret, nil 2407 // { 2408 // "description": "List all Access Levels for an access policy.", 2409 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/accessLevels", 2410 // "httpMethod": "GET", 2411 // "id": "accesscontextmanager.accessPolicies.accessLevels.list", 2412 // "parameterOrder": [ 2413 // "parent" 2414 // ], 2415 // "parameters": { 2416 // "accessLevelFormat": { 2417 // "description": "Whether to return `BasicLevels` in the Cloud Common Expression language, as `CustomLevels`, rather than as `BasicLevels`. Defaults to returning `AccessLevels` in the format they were defined.", 2418 // "enum": [ 2419 // "LEVEL_FORMAT_UNSPECIFIED", 2420 // "AS_DEFINED", 2421 // "CEL" 2422 // ], 2423 // "enumDescriptions": [ 2424 // "The format was not specified.", 2425 // "Uses the format the resource was defined in. BasicLevels are returned as BasicLevels, CustomLevels are returned as CustomLevels.", 2426 // "Use Cloud Common Expression Language when returning the resource. Both BasicLevels and CustomLevels are returned as CustomLevels." 2427 // ], 2428 // "location": "query", 2429 // "type": "string" 2430 // }, 2431 // "pageSize": { 2432 // "description": "Number of Access Levels to include in the list. Default 100.", 2433 // "format": "int32", 2434 // "location": "query", 2435 // "type": "integer" 2436 // }, 2437 // "pageToken": { 2438 // "description": "Next page token for the next batch of Access Level instances. Defaults to the first page of results.", 2439 // "location": "query", 2440 // "type": "string" 2441 // }, 2442 // "parent": { 2443 // "description": "Required. Resource name for the access policy to list Access Levels from. Format: `accessPolicies/{policy_id}`", 2444 // "location": "path", 2445 // "pattern": "^accessPolicies/[^/]+$", 2446 // "required": true, 2447 // "type": "string" 2448 // } 2449 // }, 2450 // "path": "v1beta/{+parent}/accessLevels", 2451 // "response": { 2452 // "$ref": "ListAccessLevelsResponse" 2453 // }, 2454 // "scopes": [ 2455 // "https://www.googleapis.com/auth/cloud-platform" 2456 // ] 2457 // } 2458 2459 } 2460 2461 // Pages invokes f for each page of results. 2462 // A non-nil error returned from f will halt the iteration. 2463 // The provided context supersedes any context provided to the Context method. 2464 func (c *AccessPoliciesAccessLevelsListCall) Pages(ctx context.Context, f func(*ListAccessLevelsResponse) error) error { 2465 c.ctx_ = ctx 2466 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2467 for { 2468 x, err := c.Do() 2469 if err != nil { 2470 return err 2471 } 2472 if err := f(x); err != nil { 2473 return err 2474 } 2475 if x.NextPageToken == "" { 2476 return nil 2477 } 2478 c.PageToken(x.NextPageToken) 2479 } 2480 } 2481 2482 // method id "accesscontextmanager.accessPolicies.accessLevels.patch": 2483 2484 type AccessPoliciesAccessLevelsPatchCall struct { 2485 s *Service 2486 name string 2487 accesslevel *AccessLevel 2488 urlParams_ gensupport.URLParams 2489 ctx_ context.Context 2490 header_ http.Header 2491 } 2492 2493 // Patch: Update an Access Level. The longrunning operation from this 2494 // RPC will have a successful status once the changes to the Access 2495 // Level have propagated to long-lasting storage. Access Levels 2496 // containing errors will result in an error response for the first 2497 // error encountered. 2498 // 2499 // - name: Resource name for the `AccessLevel`. Format: 2500 // `accessPolicies/{access_policy}/accessLevels/{access_level}`. The 2501 // `access_level` component must begin with a letter, followed by 2502 // alphanumeric characters or `_`. Its maximum length is 50 2503 // characters. After you create an `AccessLevel`, you cannot change 2504 // its `name`. 2505 func (r *AccessPoliciesAccessLevelsService) Patch(name string, accesslevel *AccessLevel) *AccessPoliciesAccessLevelsPatchCall { 2506 c := &AccessPoliciesAccessLevelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2507 c.name = name 2508 c.accesslevel = accesslevel 2509 return c 2510 } 2511 2512 // UpdateMask sets the optional parameter "updateMask": Required. Mask 2513 // to control which fields get updated. Must be non-empty. 2514 func (c *AccessPoliciesAccessLevelsPatchCall) UpdateMask(updateMask string) *AccessPoliciesAccessLevelsPatchCall { 2515 c.urlParams_.Set("updateMask", updateMask) 2516 return c 2517 } 2518 2519 // Fields allows partial responses to be retrieved. See 2520 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2521 // for more information. 2522 func (c *AccessPoliciesAccessLevelsPatchCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsPatchCall { 2523 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2524 return c 2525 } 2526 2527 // Context sets the context to be used in this call's Do method. Any 2528 // pending HTTP request will be aborted if the provided context is 2529 // canceled. 2530 func (c *AccessPoliciesAccessLevelsPatchCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsPatchCall { 2531 c.ctx_ = ctx 2532 return c 2533 } 2534 2535 // Header returns an http.Header that can be modified by the caller to 2536 // add HTTP headers to the request. 2537 func (c *AccessPoliciesAccessLevelsPatchCall) Header() http.Header { 2538 if c.header_ == nil { 2539 c.header_ = make(http.Header) 2540 } 2541 return c.header_ 2542 } 2543 2544 func (c *AccessPoliciesAccessLevelsPatchCall) doRequest(alt string) (*http.Response, error) { 2545 reqHeaders := make(http.Header) 2546 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2547 for k, v := range c.header_ { 2548 reqHeaders[k] = v 2549 } 2550 reqHeaders.Set("User-Agent", c.s.userAgent()) 2551 var body io.Reader = nil 2552 body, err := googleapi.WithoutDataWrapper.JSONReader(c.accesslevel) 2553 if err != nil { 2554 return nil, err 2555 } 2556 reqHeaders.Set("Content-Type", "application/json") 2557 c.urlParams_.Set("alt", alt) 2558 c.urlParams_.Set("prettyPrint", "false") 2559 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 2560 urls += "?" + c.urlParams_.Encode() 2561 req, err := http.NewRequest("PATCH", urls, body) 2562 if err != nil { 2563 return nil, err 2564 } 2565 req.Header = reqHeaders 2566 googleapi.Expand(req.URL, map[string]string{ 2567 "name": c.name, 2568 }) 2569 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2570 } 2571 2572 // Do executes the "accesscontextmanager.accessPolicies.accessLevels.patch" call. 2573 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2574 // status code is an error. Response headers are in either 2575 // *Operation.ServerResponse.Header or (if a response was returned at 2576 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2577 // to check whether the returned error was because 2578 // http.StatusNotModified was returned. 2579 func (c *AccessPoliciesAccessLevelsPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2580 gensupport.SetOptions(c.urlParams_, opts...) 2581 res, err := c.doRequest("json") 2582 if res != nil && res.StatusCode == http.StatusNotModified { 2583 if res.Body != nil { 2584 res.Body.Close() 2585 } 2586 return nil, gensupport.WrapError(&googleapi.Error{ 2587 Code: res.StatusCode, 2588 Header: res.Header, 2589 }) 2590 } 2591 if err != nil { 2592 return nil, err 2593 } 2594 defer googleapi.CloseBody(res) 2595 if err := googleapi.CheckResponse(res); err != nil { 2596 return nil, gensupport.WrapError(err) 2597 } 2598 ret := &Operation{ 2599 ServerResponse: googleapi.ServerResponse{ 2600 Header: res.Header, 2601 HTTPStatusCode: res.StatusCode, 2602 }, 2603 } 2604 target := &ret 2605 if err := gensupport.DecodeResponse(target, res); err != nil { 2606 return nil, err 2607 } 2608 return ret, nil 2609 // { 2610 // "description": "Update an Access Level. The longrunning operation from this RPC will have a successful status once the changes to the Access Level have propagated to long-lasting storage. Access Levels containing errors will result in an error response for the first error encountered.", 2611 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/accessLevels/{accessLevelsId}", 2612 // "httpMethod": "PATCH", 2613 // "id": "accesscontextmanager.accessPolicies.accessLevels.patch", 2614 // "parameterOrder": [ 2615 // "name" 2616 // ], 2617 // "parameters": { 2618 // "name": { 2619 // "description": "Resource name for the `AccessLevel`. Format: `accessPolicies/{access_policy}/accessLevels/{access_level}`. The `access_level` component must begin with a letter, followed by alphanumeric characters or `_`. Its maximum length is 50 characters. After you create an `AccessLevel`, you cannot change its `name`.", 2620 // "location": "path", 2621 // "pattern": "^accessPolicies/[^/]+/accessLevels/[^/]+$", 2622 // "required": true, 2623 // "type": "string" 2624 // }, 2625 // "updateMask": { 2626 // "description": "Required. Mask to control which fields get updated. Must be non-empty.", 2627 // "format": "google-fieldmask", 2628 // "location": "query", 2629 // "type": "string" 2630 // } 2631 // }, 2632 // "path": "v1beta/{+name}", 2633 // "request": { 2634 // "$ref": "AccessLevel" 2635 // }, 2636 // "response": { 2637 // "$ref": "Operation" 2638 // }, 2639 // "scopes": [ 2640 // "https://www.googleapis.com/auth/cloud-platform" 2641 // ] 2642 // } 2643 2644 } 2645 2646 // method id "accesscontextmanager.accessPolicies.servicePerimeters.create": 2647 2648 type AccessPoliciesServicePerimetersCreateCall struct { 2649 s *Service 2650 parent string 2651 serviceperimeter *ServicePerimeter 2652 urlParams_ gensupport.URLParams 2653 ctx_ context.Context 2654 header_ http.Header 2655 } 2656 2657 // Create: Create a Service Perimeter. The longrunning operation from 2658 // this RPC will have a successful status once the Service Perimeter has 2659 // propagated to long-lasting storage. Service Perimeters containing 2660 // errors will result in an error response for the first error 2661 // encountered. 2662 // 2663 // - parent: Resource name for the access policy which owns this Service 2664 // Perimeter. Format: `accessPolicies/{policy_id}`. 2665 func (r *AccessPoliciesServicePerimetersService) Create(parent string, serviceperimeter *ServicePerimeter) *AccessPoliciesServicePerimetersCreateCall { 2666 c := &AccessPoliciesServicePerimetersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2667 c.parent = parent 2668 c.serviceperimeter = serviceperimeter 2669 return c 2670 } 2671 2672 // Fields allows partial responses to be retrieved. See 2673 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2674 // for more information. 2675 func (c *AccessPoliciesServicePerimetersCreateCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersCreateCall { 2676 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2677 return c 2678 } 2679 2680 // Context sets the context to be used in this call's Do method. Any 2681 // pending HTTP request will be aborted if the provided context is 2682 // canceled. 2683 func (c *AccessPoliciesServicePerimetersCreateCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersCreateCall { 2684 c.ctx_ = ctx 2685 return c 2686 } 2687 2688 // Header returns an http.Header that can be modified by the caller to 2689 // add HTTP headers to the request. 2690 func (c *AccessPoliciesServicePerimetersCreateCall) Header() http.Header { 2691 if c.header_ == nil { 2692 c.header_ = make(http.Header) 2693 } 2694 return c.header_ 2695 } 2696 2697 func (c *AccessPoliciesServicePerimetersCreateCall) doRequest(alt string) (*http.Response, error) { 2698 reqHeaders := make(http.Header) 2699 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2700 for k, v := range c.header_ { 2701 reqHeaders[k] = v 2702 } 2703 reqHeaders.Set("User-Agent", c.s.userAgent()) 2704 var body io.Reader = nil 2705 body, err := googleapi.WithoutDataWrapper.JSONReader(c.serviceperimeter) 2706 if err != nil { 2707 return nil, err 2708 } 2709 reqHeaders.Set("Content-Type", "application/json") 2710 c.urlParams_.Set("alt", alt) 2711 c.urlParams_.Set("prettyPrint", "false") 2712 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/servicePerimeters") 2713 urls += "?" + c.urlParams_.Encode() 2714 req, err := http.NewRequest("POST", urls, body) 2715 if err != nil { 2716 return nil, err 2717 } 2718 req.Header = reqHeaders 2719 googleapi.Expand(req.URL, map[string]string{ 2720 "parent": c.parent, 2721 }) 2722 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2723 } 2724 2725 // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.create" call. 2726 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2727 // status code is an error. Response headers are in either 2728 // *Operation.ServerResponse.Header or (if a response was returned at 2729 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2730 // to check whether the returned error was because 2731 // http.StatusNotModified was returned. 2732 func (c *AccessPoliciesServicePerimetersCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2733 gensupport.SetOptions(c.urlParams_, opts...) 2734 res, err := c.doRequest("json") 2735 if res != nil && res.StatusCode == http.StatusNotModified { 2736 if res.Body != nil { 2737 res.Body.Close() 2738 } 2739 return nil, gensupport.WrapError(&googleapi.Error{ 2740 Code: res.StatusCode, 2741 Header: res.Header, 2742 }) 2743 } 2744 if err != nil { 2745 return nil, err 2746 } 2747 defer googleapi.CloseBody(res) 2748 if err := googleapi.CheckResponse(res); err != nil { 2749 return nil, gensupport.WrapError(err) 2750 } 2751 ret := &Operation{ 2752 ServerResponse: googleapi.ServerResponse{ 2753 Header: res.Header, 2754 HTTPStatusCode: res.StatusCode, 2755 }, 2756 } 2757 target := &ret 2758 if err := gensupport.DecodeResponse(target, res); err != nil { 2759 return nil, err 2760 } 2761 return ret, nil 2762 // { 2763 // "description": "Create a Service Perimeter. The longrunning operation from this RPC will have a successful status once the Service Perimeter has propagated to long-lasting storage. Service Perimeters containing errors will result in an error response for the first error encountered.", 2764 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/servicePerimeters", 2765 // "httpMethod": "POST", 2766 // "id": "accesscontextmanager.accessPolicies.servicePerimeters.create", 2767 // "parameterOrder": [ 2768 // "parent" 2769 // ], 2770 // "parameters": { 2771 // "parent": { 2772 // "description": "Required. Resource name for the access policy which owns this Service Perimeter. Format: `accessPolicies/{policy_id}`", 2773 // "location": "path", 2774 // "pattern": "^accessPolicies/[^/]+$", 2775 // "required": true, 2776 // "type": "string" 2777 // } 2778 // }, 2779 // "path": "v1beta/{+parent}/servicePerimeters", 2780 // "request": { 2781 // "$ref": "ServicePerimeter" 2782 // }, 2783 // "response": { 2784 // "$ref": "Operation" 2785 // }, 2786 // "scopes": [ 2787 // "https://www.googleapis.com/auth/cloud-platform" 2788 // ] 2789 // } 2790 2791 } 2792 2793 // method id "accesscontextmanager.accessPolicies.servicePerimeters.delete": 2794 2795 type AccessPoliciesServicePerimetersDeleteCall struct { 2796 s *Service 2797 name string 2798 urlParams_ gensupport.URLParams 2799 ctx_ context.Context 2800 header_ http.Header 2801 } 2802 2803 // Delete: Delete a Service Perimeter by resource name. The longrunning 2804 // operation from this RPC will have a successful status once the 2805 // Service Perimeter has been removed from long-lasting storage. 2806 // 2807 // - name: Resource name for the Service Perimeter. Format: 2808 // `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id} 2809 // `. 2810 func (r *AccessPoliciesServicePerimetersService) Delete(name string) *AccessPoliciesServicePerimetersDeleteCall { 2811 c := &AccessPoliciesServicePerimetersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2812 c.name = name 2813 return c 2814 } 2815 2816 // Fields allows partial responses to be retrieved. See 2817 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2818 // for more information. 2819 func (c *AccessPoliciesServicePerimetersDeleteCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersDeleteCall { 2820 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2821 return c 2822 } 2823 2824 // Context sets the context to be used in this call's Do method. Any 2825 // pending HTTP request will be aborted if the provided context is 2826 // canceled. 2827 func (c *AccessPoliciesServicePerimetersDeleteCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersDeleteCall { 2828 c.ctx_ = ctx 2829 return c 2830 } 2831 2832 // Header returns an http.Header that can be modified by the caller to 2833 // add HTTP headers to the request. 2834 func (c *AccessPoliciesServicePerimetersDeleteCall) Header() http.Header { 2835 if c.header_ == nil { 2836 c.header_ = make(http.Header) 2837 } 2838 return c.header_ 2839 } 2840 2841 func (c *AccessPoliciesServicePerimetersDeleteCall) doRequest(alt string) (*http.Response, error) { 2842 reqHeaders := make(http.Header) 2843 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2844 for k, v := range c.header_ { 2845 reqHeaders[k] = v 2846 } 2847 reqHeaders.Set("User-Agent", c.s.userAgent()) 2848 var body io.Reader = nil 2849 c.urlParams_.Set("alt", alt) 2850 c.urlParams_.Set("prettyPrint", "false") 2851 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 2852 urls += "?" + c.urlParams_.Encode() 2853 req, err := http.NewRequest("DELETE", urls, body) 2854 if err != nil { 2855 return nil, err 2856 } 2857 req.Header = reqHeaders 2858 googleapi.Expand(req.URL, map[string]string{ 2859 "name": c.name, 2860 }) 2861 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2862 } 2863 2864 // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.delete" call. 2865 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2866 // status code is an error. Response headers are in either 2867 // *Operation.ServerResponse.Header or (if a response was returned at 2868 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2869 // to check whether the returned error was because 2870 // http.StatusNotModified was returned. 2871 func (c *AccessPoliciesServicePerimetersDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2872 gensupport.SetOptions(c.urlParams_, opts...) 2873 res, err := c.doRequest("json") 2874 if res != nil && res.StatusCode == http.StatusNotModified { 2875 if res.Body != nil { 2876 res.Body.Close() 2877 } 2878 return nil, gensupport.WrapError(&googleapi.Error{ 2879 Code: res.StatusCode, 2880 Header: res.Header, 2881 }) 2882 } 2883 if err != nil { 2884 return nil, err 2885 } 2886 defer googleapi.CloseBody(res) 2887 if err := googleapi.CheckResponse(res); err != nil { 2888 return nil, gensupport.WrapError(err) 2889 } 2890 ret := &Operation{ 2891 ServerResponse: googleapi.ServerResponse{ 2892 Header: res.Header, 2893 HTTPStatusCode: res.StatusCode, 2894 }, 2895 } 2896 target := &ret 2897 if err := gensupport.DecodeResponse(target, res); err != nil { 2898 return nil, err 2899 } 2900 return ret, nil 2901 // { 2902 // "description": "Delete a Service Perimeter by resource name. The longrunning operation from this RPC will have a successful status once the Service Perimeter has been removed from long-lasting storage.", 2903 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/servicePerimeters/{servicePerimetersId}", 2904 // "httpMethod": "DELETE", 2905 // "id": "accesscontextmanager.accessPolicies.servicePerimeters.delete", 2906 // "parameterOrder": [ 2907 // "name" 2908 // ], 2909 // "parameters": { 2910 // "name": { 2911 // "description": "Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`", 2912 // "location": "path", 2913 // "pattern": "^accessPolicies/[^/]+/servicePerimeters/[^/]+$", 2914 // "required": true, 2915 // "type": "string" 2916 // } 2917 // }, 2918 // "path": "v1beta/{+name}", 2919 // "response": { 2920 // "$ref": "Operation" 2921 // }, 2922 // "scopes": [ 2923 // "https://www.googleapis.com/auth/cloud-platform" 2924 // ] 2925 // } 2926 2927 } 2928 2929 // method id "accesscontextmanager.accessPolicies.servicePerimeters.get": 2930 2931 type AccessPoliciesServicePerimetersGetCall struct { 2932 s *Service 2933 name string 2934 urlParams_ gensupport.URLParams 2935 ifNoneMatch_ string 2936 ctx_ context.Context 2937 header_ http.Header 2938 } 2939 2940 // Get: Get a Service Perimeter by resource name. 2941 // 2942 // - name: Resource name for the Service Perimeter. Format: 2943 // `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id 2944 // }`. 2945 func (r *AccessPoliciesServicePerimetersService) Get(name string) *AccessPoliciesServicePerimetersGetCall { 2946 c := &AccessPoliciesServicePerimetersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2947 c.name = name 2948 return c 2949 } 2950 2951 // Fields allows partial responses to be retrieved. See 2952 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2953 // for more information. 2954 func (c *AccessPoliciesServicePerimetersGetCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersGetCall { 2955 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2956 return c 2957 } 2958 2959 // IfNoneMatch sets the optional parameter which makes the operation 2960 // fail if the object's ETag matches the given value. This is useful for 2961 // getting updates only after the object has changed since the last 2962 // request. Use googleapi.IsNotModified to check whether the response 2963 // error from Do is the result of In-None-Match. 2964 func (c *AccessPoliciesServicePerimetersGetCall) IfNoneMatch(entityTag string) *AccessPoliciesServicePerimetersGetCall { 2965 c.ifNoneMatch_ = entityTag 2966 return c 2967 } 2968 2969 // Context sets the context to be used in this call's Do method. Any 2970 // pending HTTP request will be aborted if the provided context is 2971 // canceled. 2972 func (c *AccessPoliciesServicePerimetersGetCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersGetCall { 2973 c.ctx_ = ctx 2974 return c 2975 } 2976 2977 // Header returns an http.Header that can be modified by the caller to 2978 // add HTTP headers to the request. 2979 func (c *AccessPoliciesServicePerimetersGetCall) Header() http.Header { 2980 if c.header_ == nil { 2981 c.header_ = make(http.Header) 2982 } 2983 return c.header_ 2984 } 2985 2986 func (c *AccessPoliciesServicePerimetersGetCall) doRequest(alt string) (*http.Response, error) { 2987 reqHeaders := make(http.Header) 2988 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2989 for k, v := range c.header_ { 2990 reqHeaders[k] = v 2991 } 2992 reqHeaders.Set("User-Agent", c.s.userAgent()) 2993 if c.ifNoneMatch_ != "" { 2994 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2995 } 2996 var body io.Reader = nil 2997 c.urlParams_.Set("alt", alt) 2998 c.urlParams_.Set("prettyPrint", "false") 2999 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 3000 urls += "?" + c.urlParams_.Encode() 3001 req, err := http.NewRequest("GET", urls, body) 3002 if err != nil { 3003 return nil, err 3004 } 3005 req.Header = reqHeaders 3006 googleapi.Expand(req.URL, map[string]string{ 3007 "name": c.name, 3008 }) 3009 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3010 } 3011 3012 // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.get" call. 3013 // Exactly one of *ServicePerimeter or error will be non-nil. Any 3014 // non-2xx status code is an error. Response headers are in either 3015 // *ServicePerimeter.ServerResponse.Header or (if a response was 3016 // returned at all) in error.(*googleapi.Error).Header. Use 3017 // googleapi.IsNotModified to check whether the returned error was 3018 // because http.StatusNotModified was returned. 3019 func (c *AccessPoliciesServicePerimetersGetCall) Do(opts ...googleapi.CallOption) (*ServicePerimeter, error) { 3020 gensupport.SetOptions(c.urlParams_, opts...) 3021 res, err := c.doRequest("json") 3022 if res != nil && res.StatusCode == http.StatusNotModified { 3023 if res.Body != nil { 3024 res.Body.Close() 3025 } 3026 return nil, gensupport.WrapError(&googleapi.Error{ 3027 Code: res.StatusCode, 3028 Header: res.Header, 3029 }) 3030 } 3031 if err != nil { 3032 return nil, err 3033 } 3034 defer googleapi.CloseBody(res) 3035 if err := googleapi.CheckResponse(res); err != nil { 3036 return nil, gensupport.WrapError(err) 3037 } 3038 ret := &ServicePerimeter{ 3039 ServerResponse: googleapi.ServerResponse{ 3040 Header: res.Header, 3041 HTTPStatusCode: res.StatusCode, 3042 }, 3043 } 3044 target := &ret 3045 if err := gensupport.DecodeResponse(target, res); err != nil { 3046 return nil, err 3047 } 3048 return ret, nil 3049 // { 3050 // "description": "Get a Service Perimeter by resource name.", 3051 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/servicePerimeters/{servicePerimetersId}", 3052 // "httpMethod": "GET", 3053 // "id": "accesscontextmanager.accessPolicies.servicePerimeters.get", 3054 // "parameterOrder": [ 3055 // "name" 3056 // ], 3057 // "parameters": { 3058 // "name": { 3059 // "description": "Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`", 3060 // "location": "path", 3061 // "pattern": "^accessPolicies/[^/]+/servicePerimeters/[^/]+$", 3062 // "required": true, 3063 // "type": "string" 3064 // } 3065 // }, 3066 // "path": "v1beta/{+name}", 3067 // "response": { 3068 // "$ref": "ServicePerimeter" 3069 // }, 3070 // "scopes": [ 3071 // "https://www.googleapis.com/auth/cloud-platform" 3072 // ] 3073 // } 3074 3075 } 3076 3077 // method id "accesscontextmanager.accessPolicies.servicePerimeters.list": 3078 3079 type AccessPoliciesServicePerimetersListCall struct { 3080 s *Service 3081 parent string 3082 urlParams_ gensupport.URLParams 3083 ifNoneMatch_ string 3084 ctx_ context.Context 3085 header_ http.Header 3086 } 3087 3088 // List: List all Service Perimeters for an access policy. 3089 // 3090 // - parent: Resource name for the access policy to list Service 3091 // Perimeters from. Format: `accessPolicies/{policy_id}`. 3092 func (r *AccessPoliciesServicePerimetersService) List(parent string) *AccessPoliciesServicePerimetersListCall { 3093 c := &AccessPoliciesServicePerimetersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3094 c.parent = parent 3095 return c 3096 } 3097 3098 // PageSize sets the optional parameter "pageSize": Number of Service 3099 // Perimeters to include in the list. Default 100. 3100 func (c *AccessPoliciesServicePerimetersListCall) PageSize(pageSize int64) *AccessPoliciesServicePerimetersListCall { 3101 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3102 return c 3103 } 3104 3105 // PageToken sets the optional parameter "pageToken": Next page token 3106 // for the next batch of Service Perimeter instances. Defaults to the 3107 // first page of results. 3108 func (c *AccessPoliciesServicePerimetersListCall) PageToken(pageToken string) *AccessPoliciesServicePerimetersListCall { 3109 c.urlParams_.Set("pageToken", pageToken) 3110 return c 3111 } 3112 3113 // Fields allows partial responses to be retrieved. See 3114 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3115 // for more information. 3116 func (c *AccessPoliciesServicePerimetersListCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersListCall { 3117 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3118 return c 3119 } 3120 3121 // IfNoneMatch sets the optional parameter which makes the operation 3122 // fail if the object's ETag matches the given value. This is useful for 3123 // getting updates only after the object has changed since the last 3124 // request. Use googleapi.IsNotModified to check whether the response 3125 // error from Do is the result of In-None-Match. 3126 func (c *AccessPoliciesServicePerimetersListCall) IfNoneMatch(entityTag string) *AccessPoliciesServicePerimetersListCall { 3127 c.ifNoneMatch_ = entityTag 3128 return c 3129 } 3130 3131 // Context sets the context to be used in this call's Do method. Any 3132 // pending HTTP request will be aborted if the provided context is 3133 // canceled. 3134 func (c *AccessPoliciesServicePerimetersListCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersListCall { 3135 c.ctx_ = ctx 3136 return c 3137 } 3138 3139 // Header returns an http.Header that can be modified by the caller to 3140 // add HTTP headers to the request. 3141 func (c *AccessPoliciesServicePerimetersListCall) Header() http.Header { 3142 if c.header_ == nil { 3143 c.header_ = make(http.Header) 3144 } 3145 return c.header_ 3146 } 3147 3148 func (c *AccessPoliciesServicePerimetersListCall) doRequest(alt string) (*http.Response, error) { 3149 reqHeaders := make(http.Header) 3150 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3151 for k, v := range c.header_ { 3152 reqHeaders[k] = v 3153 } 3154 reqHeaders.Set("User-Agent", c.s.userAgent()) 3155 if c.ifNoneMatch_ != "" { 3156 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3157 } 3158 var body io.Reader = nil 3159 c.urlParams_.Set("alt", alt) 3160 c.urlParams_.Set("prettyPrint", "false") 3161 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/servicePerimeters") 3162 urls += "?" + c.urlParams_.Encode() 3163 req, err := http.NewRequest("GET", urls, body) 3164 if err != nil { 3165 return nil, err 3166 } 3167 req.Header = reqHeaders 3168 googleapi.Expand(req.URL, map[string]string{ 3169 "parent": c.parent, 3170 }) 3171 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3172 } 3173 3174 // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.list" call. 3175 // Exactly one of *ListServicePerimetersResponse or error will be 3176 // non-nil. Any non-2xx status code is an error. Response headers are in 3177 // either *ListServicePerimetersResponse.ServerResponse.Header or (if a 3178 // response was returned at all) in error.(*googleapi.Error).Header. Use 3179 // googleapi.IsNotModified to check whether the returned error was 3180 // because http.StatusNotModified was returned. 3181 func (c *AccessPoliciesServicePerimetersListCall) Do(opts ...googleapi.CallOption) (*ListServicePerimetersResponse, error) { 3182 gensupport.SetOptions(c.urlParams_, opts...) 3183 res, err := c.doRequest("json") 3184 if res != nil && res.StatusCode == http.StatusNotModified { 3185 if res.Body != nil { 3186 res.Body.Close() 3187 } 3188 return nil, gensupport.WrapError(&googleapi.Error{ 3189 Code: res.StatusCode, 3190 Header: res.Header, 3191 }) 3192 } 3193 if err != nil { 3194 return nil, err 3195 } 3196 defer googleapi.CloseBody(res) 3197 if err := googleapi.CheckResponse(res); err != nil { 3198 return nil, gensupport.WrapError(err) 3199 } 3200 ret := &ListServicePerimetersResponse{ 3201 ServerResponse: googleapi.ServerResponse{ 3202 Header: res.Header, 3203 HTTPStatusCode: res.StatusCode, 3204 }, 3205 } 3206 target := &ret 3207 if err := gensupport.DecodeResponse(target, res); err != nil { 3208 return nil, err 3209 } 3210 return ret, nil 3211 // { 3212 // "description": "List all Service Perimeters for an access policy.", 3213 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/servicePerimeters", 3214 // "httpMethod": "GET", 3215 // "id": "accesscontextmanager.accessPolicies.servicePerimeters.list", 3216 // "parameterOrder": [ 3217 // "parent" 3218 // ], 3219 // "parameters": { 3220 // "pageSize": { 3221 // "description": "Number of Service Perimeters to include in the list. Default 100.", 3222 // "format": "int32", 3223 // "location": "query", 3224 // "type": "integer" 3225 // }, 3226 // "pageToken": { 3227 // "description": "Next page token for the next batch of Service Perimeter instances. Defaults to the first page of results.", 3228 // "location": "query", 3229 // "type": "string" 3230 // }, 3231 // "parent": { 3232 // "description": "Required. Resource name for the access policy to list Service Perimeters from. Format: `accessPolicies/{policy_id}`", 3233 // "location": "path", 3234 // "pattern": "^accessPolicies/[^/]+$", 3235 // "required": true, 3236 // "type": "string" 3237 // } 3238 // }, 3239 // "path": "v1beta/{+parent}/servicePerimeters", 3240 // "response": { 3241 // "$ref": "ListServicePerimetersResponse" 3242 // }, 3243 // "scopes": [ 3244 // "https://www.googleapis.com/auth/cloud-platform" 3245 // ] 3246 // } 3247 3248 } 3249 3250 // Pages invokes f for each page of results. 3251 // A non-nil error returned from f will halt the iteration. 3252 // The provided context supersedes any context provided to the Context method. 3253 func (c *AccessPoliciesServicePerimetersListCall) Pages(ctx context.Context, f func(*ListServicePerimetersResponse) error) error { 3254 c.ctx_ = ctx 3255 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3256 for { 3257 x, err := c.Do() 3258 if err != nil { 3259 return err 3260 } 3261 if err := f(x); err != nil { 3262 return err 3263 } 3264 if x.NextPageToken == "" { 3265 return nil 3266 } 3267 c.PageToken(x.NextPageToken) 3268 } 3269 } 3270 3271 // method id "accesscontextmanager.accessPolicies.servicePerimeters.patch": 3272 3273 type AccessPoliciesServicePerimetersPatchCall struct { 3274 s *Service 3275 name string 3276 serviceperimeter *ServicePerimeter 3277 urlParams_ gensupport.URLParams 3278 ctx_ context.Context 3279 header_ http.Header 3280 } 3281 3282 // Patch: Update a Service Perimeter. The longrunning operation from 3283 // this RPC will have a successful status once the changes to the 3284 // Service Perimeter have propagated to long-lasting storage. Service 3285 // Perimeter containing errors will result in an error response for the 3286 // first error encountered. 3287 // 3288 // - name: Resource name for the `ServicePerimeter`. Format: 3289 // `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter 3290 // }`. The `service_perimeter` component must begin with a letter, 3291 // followed by alphanumeric characters or `_`. After you create a 3292 // `ServicePerimeter`, you cannot change its `name`. 3293 func (r *AccessPoliciesServicePerimetersService) Patch(name string, serviceperimeter *ServicePerimeter) *AccessPoliciesServicePerimetersPatchCall { 3294 c := &AccessPoliciesServicePerimetersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3295 c.name = name 3296 c.serviceperimeter = serviceperimeter 3297 return c 3298 } 3299 3300 // UpdateMask sets the optional parameter "updateMask": Required. Mask 3301 // to control which fields get updated. Must be non-empty. 3302 func (c *AccessPoliciesServicePerimetersPatchCall) UpdateMask(updateMask string) *AccessPoliciesServicePerimetersPatchCall { 3303 c.urlParams_.Set("updateMask", updateMask) 3304 return c 3305 } 3306 3307 // Fields allows partial responses to be retrieved. See 3308 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3309 // for more information. 3310 func (c *AccessPoliciesServicePerimetersPatchCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersPatchCall { 3311 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3312 return c 3313 } 3314 3315 // Context sets the context to be used in this call's Do method. Any 3316 // pending HTTP request will be aborted if the provided context is 3317 // canceled. 3318 func (c *AccessPoliciesServicePerimetersPatchCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersPatchCall { 3319 c.ctx_ = ctx 3320 return c 3321 } 3322 3323 // Header returns an http.Header that can be modified by the caller to 3324 // add HTTP headers to the request. 3325 func (c *AccessPoliciesServicePerimetersPatchCall) Header() http.Header { 3326 if c.header_ == nil { 3327 c.header_ = make(http.Header) 3328 } 3329 return c.header_ 3330 } 3331 3332 func (c *AccessPoliciesServicePerimetersPatchCall) doRequest(alt string) (*http.Response, error) { 3333 reqHeaders := make(http.Header) 3334 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3335 for k, v := range c.header_ { 3336 reqHeaders[k] = v 3337 } 3338 reqHeaders.Set("User-Agent", c.s.userAgent()) 3339 var body io.Reader = nil 3340 body, err := googleapi.WithoutDataWrapper.JSONReader(c.serviceperimeter) 3341 if err != nil { 3342 return nil, err 3343 } 3344 reqHeaders.Set("Content-Type", "application/json") 3345 c.urlParams_.Set("alt", alt) 3346 c.urlParams_.Set("prettyPrint", "false") 3347 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 3348 urls += "?" + c.urlParams_.Encode() 3349 req, err := http.NewRequest("PATCH", urls, body) 3350 if err != nil { 3351 return nil, err 3352 } 3353 req.Header = reqHeaders 3354 googleapi.Expand(req.URL, map[string]string{ 3355 "name": c.name, 3356 }) 3357 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3358 } 3359 3360 // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.patch" call. 3361 // Exactly one of *Operation or error will be non-nil. Any non-2xx 3362 // status code is an error. Response headers are in either 3363 // *Operation.ServerResponse.Header or (if a response was returned at 3364 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3365 // to check whether the returned error was because 3366 // http.StatusNotModified was returned. 3367 func (c *AccessPoliciesServicePerimetersPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 3368 gensupport.SetOptions(c.urlParams_, opts...) 3369 res, err := c.doRequest("json") 3370 if res != nil && res.StatusCode == http.StatusNotModified { 3371 if res.Body != nil { 3372 res.Body.Close() 3373 } 3374 return nil, gensupport.WrapError(&googleapi.Error{ 3375 Code: res.StatusCode, 3376 Header: res.Header, 3377 }) 3378 } 3379 if err != nil { 3380 return nil, err 3381 } 3382 defer googleapi.CloseBody(res) 3383 if err := googleapi.CheckResponse(res); err != nil { 3384 return nil, gensupport.WrapError(err) 3385 } 3386 ret := &Operation{ 3387 ServerResponse: googleapi.ServerResponse{ 3388 Header: res.Header, 3389 HTTPStatusCode: res.StatusCode, 3390 }, 3391 } 3392 target := &ret 3393 if err := gensupport.DecodeResponse(target, res); err != nil { 3394 return nil, err 3395 } 3396 return ret, nil 3397 // { 3398 // "description": "Update a Service Perimeter. The longrunning operation from this RPC will have a successful status once the changes to the Service Perimeter have propagated to long-lasting storage. Service Perimeter containing errors will result in an error response for the first error encountered.", 3399 // "flatPath": "v1beta/accessPolicies/{accessPoliciesId}/servicePerimeters/{servicePerimetersId}", 3400 // "httpMethod": "PATCH", 3401 // "id": "accesscontextmanager.accessPolicies.servicePerimeters.patch", 3402 // "parameterOrder": [ 3403 // "name" 3404 // ], 3405 // "parameters": { 3406 // "name": { 3407 // "description": "Resource name for the `ServicePerimeter`. Format: `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The `service_perimeter` component must begin with a letter, followed by alphanumeric characters or `_`. After you create a `ServicePerimeter`, you cannot change its `name`.", 3408 // "location": "path", 3409 // "pattern": "^accessPolicies/[^/]+/servicePerimeters/[^/]+$", 3410 // "required": true, 3411 // "type": "string" 3412 // }, 3413 // "updateMask": { 3414 // "description": "Required. Mask to control which fields get updated. Must be non-empty.", 3415 // "format": "google-fieldmask", 3416 // "location": "query", 3417 // "type": "string" 3418 // } 3419 // }, 3420 // "path": "v1beta/{+name}", 3421 // "request": { 3422 // "$ref": "ServicePerimeter" 3423 // }, 3424 // "response": { 3425 // "$ref": "Operation" 3426 // }, 3427 // "scopes": [ 3428 // "https://www.googleapis.com/auth/cloud-platform" 3429 // ] 3430 // } 3431 3432 } 3433 3434 // method id "accesscontextmanager.operations.get": 3435 3436 type OperationsGetCall struct { 3437 s *Service 3438 name string 3439 urlParams_ gensupport.URLParams 3440 ifNoneMatch_ string 3441 ctx_ context.Context 3442 header_ http.Header 3443 } 3444 3445 // Get: Gets the latest state of a long-running operation. Clients can 3446 // use this method to poll the operation result at intervals as 3447 // recommended by the API service. 3448 // 3449 // - name: The name of the operation resource. 3450 func (r *OperationsService) Get(name string) *OperationsGetCall { 3451 c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3452 c.name = name 3453 return c 3454 } 3455 3456 // Fields allows partial responses to be retrieved. See 3457 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3458 // for more information. 3459 func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall { 3460 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3461 return c 3462 } 3463 3464 // IfNoneMatch sets the optional parameter which makes the operation 3465 // fail if the object's ETag matches the given value. This is useful for 3466 // getting updates only after the object has changed since the last 3467 // request. Use googleapi.IsNotModified to check whether the response 3468 // error from Do is the result of In-None-Match. 3469 func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall { 3470 c.ifNoneMatch_ = entityTag 3471 return c 3472 } 3473 3474 // Context sets the context to be used in this call's Do method. Any 3475 // pending HTTP request will be aborted if the provided context is 3476 // canceled. 3477 func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall { 3478 c.ctx_ = ctx 3479 return c 3480 } 3481 3482 // Header returns an http.Header that can be modified by the caller to 3483 // add HTTP headers to the request. 3484 func (c *OperationsGetCall) Header() http.Header { 3485 if c.header_ == nil { 3486 c.header_ = make(http.Header) 3487 } 3488 return c.header_ 3489 } 3490 3491 func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) { 3492 reqHeaders := make(http.Header) 3493 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 3494 for k, v := range c.header_ { 3495 reqHeaders[k] = v 3496 } 3497 reqHeaders.Set("User-Agent", c.s.userAgent()) 3498 if c.ifNoneMatch_ != "" { 3499 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3500 } 3501 var body io.Reader = nil 3502 c.urlParams_.Set("alt", alt) 3503 c.urlParams_.Set("prettyPrint", "false") 3504 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") 3505 urls += "?" + c.urlParams_.Encode() 3506 req, err := http.NewRequest("GET", urls, body) 3507 if err != nil { 3508 return nil, err 3509 } 3510 req.Header = reqHeaders 3511 googleapi.Expand(req.URL, map[string]string{ 3512 "name": c.name, 3513 }) 3514 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3515 } 3516 3517 // Do executes the "accesscontextmanager.operations.get" call. 3518 // Exactly one of *Operation or error will be non-nil. Any non-2xx 3519 // status code is an error. Response headers are in either 3520 // *Operation.ServerResponse.Header or (if a response was returned at 3521 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3522 // to check whether the returned error was because 3523 // http.StatusNotModified was returned. 3524 func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 3525 gensupport.SetOptions(c.urlParams_, opts...) 3526 res, err := c.doRequest("json") 3527 if res != nil && res.StatusCode == http.StatusNotModified { 3528 if res.Body != nil { 3529 res.Body.Close() 3530 } 3531 return nil, gensupport.WrapError(&googleapi.Error{ 3532 Code: res.StatusCode, 3533 Header: res.Header, 3534 }) 3535 } 3536 if err != nil { 3537 return nil, err 3538 } 3539 defer googleapi.CloseBody(res) 3540 if err := googleapi.CheckResponse(res); err != nil { 3541 return nil, gensupport.WrapError(err) 3542 } 3543 ret := &Operation{ 3544 ServerResponse: googleapi.ServerResponse{ 3545 Header: res.Header, 3546 HTTPStatusCode: res.StatusCode, 3547 }, 3548 } 3549 target := &ret 3550 if err := gensupport.DecodeResponse(target, res); err != nil { 3551 return nil, err 3552 } 3553 return ret, nil 3554 // { 3555 // "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", 3556 // "flatPath": "v1beta/operations/{operationsId}", 3557 // "httpMethod": "GET", 3558 // "id": "accesscontextmanager.operations.get", 3559 // "parameterOrder": [ 3560 // "name" 3561 // ], 3562 // "parameters": { 3563 // "name": { 3564 // "description": "The name of the operation resource.", 3565 // "location": "path", 3566 // "pattern": "^operations/.*$", 3567 // "required": true, 3568 // "type": "string" 3569 // } 3570 // }, 3571 // "path": "v1beta/{+name}", 3572 // "response": { 3573 // "$ref": "Operation" 3574 // }, 3575 // "scopes": [ 3576 // "https://www.googleapis.com/auth/cloud-platform" 3577 // ] 3578 // } 3579 3580 } 3581