1 // Copyright 2024 Google LLC. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated file. DO NOT EDIT. 6 7 // Package bigquerydatapolicy provides access to the BigQuery Data Policy API. 8 // 9 // For product documentation, see: https://cloud.google.com/bigquery/docs/column-data-masking 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/bigquerydatapolicy/v1" 27 // ... 28 // ctx := context.Background() 29 // bigquerydatapolicyService, err := bigquerydatapolicy.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 // By default, all available scopes (see "Constants") are used to authenticate. 38 // To restrict scopes, use [google.golang.org/api/option.WithScopes]: 39 // 40 // bigquerydatapolicyService, err := bigquerydatapolicy.NewService(ctx, option.WithScopes(bigquerydatapolicy.CloudPlatformScope)) 41 // 42 // To use an API key for authentication (note: some APIs do not support API 43 // keys), use [google.golang.org/api/option.WithAPIKey]: 44 // 45 // bigquerydatapolicyService, err := bigquerydatapolicy.NewService(ctx, option.WithAPIKey("AIza...")) 46 // 47 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth 48 // flow, use [google.golang.org/api/option.WithTokenSource]: 49 // 50 // config := &oauth2.Config{...} 51 // // ... 52 // token, err := config.Exchange(ctx, ...) 53 // bigquerydatapolicyService, err := bigquerydatapolicy.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 54 // 55 // See [google.golang.org/api/option.ClientOption] for details on options. 56 package bigquerydatapolicy // import "google.golang.org/api/bigquerydatapolicy/v1" 57 58 import ( 59 "bytes" 60 "context" 61 "encoding/json" 62 "errors" 63 "fmt" 64 "io" 65 "net/http" 66 "net/url" 67 "strconv" 68 "strings" 69 70 googleapi "google.golang.org/api/googleapi" 71 internal "google.golang.org/api/internal" 72 gensupport "google.golang.org/api/internal/gensupport" 73 option "google.golang.org/api/option" 74 internaloption "google.golang.org/api/option/internaloption" 75 htransport "google.golang.org/api/transport/http" 76 ) 77 78 // Always reference these packages, just in case the auto-generated code 79 // below doesn't. 80 var _ = bytes.NewBuffer 81 var _ = strconv.Itoa 82 var _ = fmt.Sprintf 83 var _ = json.NewDecoder 84 var _ = io.Copy 85 var _ = url.Parse 86 var _ = gensupport.MarshalJSON 87 var _ = googleapi.Version 88 var _ = errors.New 89 var _ = strings.Replace 90 var _ = context.Canceled 91 var _ = internaloption.WithDefaultEndpoint 92 var _ = internal.Version 93 94 const apiId = "bigquerydatapolicy:v1" 95 const apiName = "bigquerydatapolicy" 96 const apiVersion = "v1" 97 const basePath = "https://bigquerydatapolicy.googleapis.com/" 98 const basePathTemplate = "https://bigquerydatapolicy.UNIVERSE_DOMAIN/" 99 const mtlsBasePath = "https://bigquerydatapolicy.mtls.googleapis.com/" 100 101 // OAuth2 scopes used by this API. 102 const ( 103 // View and manage your data in Google BigQuery and see the email address for 104 // your Google Account 105 BigqueryScope = "https://www.googleapis.com/auth/bigquery" 106 107 // See, edit, configure, and delete your Google Cloud data and see the email 108 // address for your Google Account. 109 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 110 ) 111 112 // NewService creates a new Service. 113 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 114 scopesOption := internaloption.WithDefaultScopes( 115 "https://www.googleapis.com/auth/bigquery", 116 "https://www.googleapis.com/auth/cloud-platform", 117 ) 118 // NOTE: prepend, so we don't override user-specified scopes. 119 opts = append([]option.ClientOption{scopesOption}, opts...) 120 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 121 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) 122 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 123 opts = append(opts, internaloption.EnableNewAuthLibrary()) 124 client, endpoint, err := htransport.NewClient(ctx, opts...) 125 if err != nil { 126 return nil, err 127 } 128 s, err := New(client) 129 if err != nil { 130 return nil, err 131 } 132 if endpoint != "" { 133 s.BasePath = endpoint 134 } 135 return s, nil 136 } 137 138 // New creates a new Service. It uses the provided http.Client for requests. 139 // 140 // Deprecated: please use NewService instead. 141 // To provide a custom HTTP client, use option.WithHTTPClient. 142 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 143 func New(client *http.Client) (*Service, error) { 144 if client == nil { 145 return nil, errors.New("client is nil") 146 } 147 s := &Service{client: client, BasePath: basePath} 148 s.Projects = NewProjectsService(s) 149 return s, nil 150 } 151 152 type Service struct { 153 client *http.Client 154 BasePath string // API endpoint base URL 155 UserAgent string // optional additional User-Agent fragment 156 157 Projects *ProjectsService 158 } 159 160 func (s *Service) userAgent() string { 161 if s.UserAgent == "" { 162 return googleapi.UserAgent 163 } 164 return googleapi.UserAgent + " " + s.UserAgent 165 } 166 167 func NewProjectsService(s *Service) *ProjectsService { 168 rs := &ProjectsService{s: s} 169 rs.Locations = NewProjectsLocationsService(s) 170 return rs 171 } 172 173 type ProjectsService struct { 174 s *Service 175 176 Locations *ProjectsLocationsService 177 } 178 179 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { 180 rs := &ProjectsLocationsService{s: s} 181 rs.DataPolicies = NewProjectsLocationsDataPoliciesService(s) 182 return rs 183 } 184 185 type ProjectsLocationsService struct { 186 s *Service 187 188 DataPolicies *ProjectsLocationsDataPoliciesService 189 } 190 191 func NewProjectsLocationsDataPoliciesService(s *Service) *ProjectsLocationsDataPoliciesService { 192 rs := &ProjectsLocationsDataPoliciesService{s: s} 193 return rs 194 } 195 196 type ProjectsLocationsDataPoliciesService struct { 197 s *Service 198 } 199 200 // AuditConfig: Specifies the audit configuration for a service. The 201 // configuration determines which permission types are logged, and what 202 // identities, if any, are exempted from logging. An AuditConfig must have one 203 // or more AuditLogConfigs. If there are AuditConfigs for both `allServices` 204 // and a specific service, the union of the two AuditConfigs is used for that 205 // service: the log_types specified in each AuditConfig are enabled, and the 206 // exempted_members in each AuditLogConfig are exempted. Example Policy with 207 // multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", 208 // "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ 209 // "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": 210 // "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", 211 // "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": 212 // "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For 213 // sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ 214 // logging. It also exempts `jose@example.com` from DATA_READ logging, and 215 // `aliya@example.com` from DATA_WRITE logging. 216 type AuditConfig struct { 217 // AuditLogConfigs: The configuration for logging of each type of permission. 218 AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"` 219 // Service: Specifies a service that will be enabled for audit logging. For 220 // example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` 221 // is a special value that covers all services. 222 Service string `json:"service,omitempty"` 223 // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to 224 // unconditionally include in API requests. By default, fields with empty or 225 // default values are omitted from API requests. See 226 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 227 // details. 228 ForceSendFields []string `json:"-"` 229 // NullFields is a list of field names (e.g. "AuditLogConfigs") to include in 230 // API requests with the JSON null value. By default, fields with empty values 231 // are omitted from API requests. See 232 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 233 NullFields []string `json:"-"` 234 } 235 236 func (s *AuditConfig) MarshalJSON() ([]byte, error) { 237 type NoMethod AuditConfig 238 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 239 } 240 241 // AuditLogConfig: Provides the configuration for logging a type of 242 // permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", 243 // "exempted_members": [ "user:jose@example.com" ] }, { "log_type": 244 // "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while 245 // exempting jose@example.com from DATA_READ logging. 246 type AuditLogConfig struct { 247 // ExemptedMembers: Specifies the identities that do not cause logging for this 248 // type of permission. Follows the same format of Binding.members. 249 ExemptedMembers []string `json:"exemptedMembers,omitempty"` 250 // LogType: The log type that this config enables. 251 // 252 // Possible values: 253 // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this. 254 // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy 255 // "DATA_WRITE" - Data writes. Example: CloudSQL Users create 256 // "DATA_READ" - Data reads. Example: CloudSQL Users list 257 LogType string `json:"logType,omitempty"` 258 // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to 259 // unconditionally include in API requests. By default, fields with empty or 260 // default values are omitted from API requests. See 261 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 262 // details. 263 ForceSendFields []string `json:"-"` 264 // NullFields is a list of field names (e.g. "ExemptedMembers") to include in 265 // API requests with the JSON null value. By default, fields with empty values 266 // are omitted from API requests. See 267 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 268 NullFields []string `json:"-"` 269 } 270 271 func (s *AuditLogConfig) MarshalJSON() ([]byte, error) { 272 type NoMethod AuditLogConfig 273 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 274 } 275 276 // Binding: Associates `members`, or principals, with a `role`. 277 type Binding struct { 278 // Condition: The condition that is associated with this binding. If the 279 // condition evaluates to `true`, then this binding applies to the current 280 // request. If the condition evaluates to `false`, then this binding does not 281 // apply to the current request. However, a different role binding might grant 282 // the same role to one or more of the principals in this binding. To learn 283 // which resources support conditions in their IAM policies, see the IAM 284 // documentation 285 // (https://cloud.google.com/iam/help/conditions/resource-policies). 286 Condition *Expr `json:"condition,omitempty"` 287 // Members: Specifies the principals requesting access for a Google Cloud 288 // resource. `members` can have the following values: * `allUsers`: A special 289 // identifier that represents anyone who is on the internet; with or without a 290 // Google account. * `allAuthenticatedUsers`: A special identifier that 291 // represents anyone who is authenticated with a Google account or a service 292 // account. Does not include identities that come from external identity 293 // providers (IdPs) through identity federation. * `user:{emailid}`: An email 294 // address that represents a specific Google account. For example, 295 // `alice@example.com` . * `serviceAccount:{emailid}`: An email address that 296 // represents a Google service account. For example, 297 // `my-other-app@appspot.gserviceaccount.com`. * 298 // `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An 299 // identifier for a Kubernetes service account 300 // (https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). 301 // For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * 302 // `group:{emailid}`: An email address that represents a Google group. For 303 // example, `admins@example.com`. * `domain:{domain}`: The G Suite domain 304 // (primary) that represents all the users of that domain. For example, 305 // `google.com` or `example.com`. * 306 // `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/sub 307 // ject/{subject_attribute_value}`: A single identity in a workforce identity 308 // pool. * 309 // `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/ 310 // group/{group_id}`: All workforce identities in a group. * 311 // `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/ 312 // attribute.{attribute_name}/{attribute_value}`: All workforce identities with 313 // a specific attribute value. * 314 // `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/ 315 // *`: All identities in a workforce identity pool. * 316 // `principal://iam.googleapis.com/projects/{project_number}/locations/global/wo 317 // rkloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single 318 // identity in a workload identity pool. * 319 // `principalSet://iam.googleapis.com/projects/{project_number}/locations/global 320 // /workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool 321 // group. * 322 // `principalSet://iam.googleapis.com/projects/{project_number}/locations/global 323 // /workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value} 324 // `: All identities in a workload identity pool with a certain attribute. * 325 // `principalSet://iam.googleapis.com/projects/{project_number}/locations/global 326 // /workloadIdentityPools/{pool_id}/*`: All identities in a workload identity 327 // pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus 328 // unique identifier) representing a user that has been recently deleted. For 329 // example, `alice@example.com?uid=123456789012345678901`. If the user is 330 // recovered, this value reverts to `user:{emailid}` and the recovered user 331 // retains the role in the binding. * 332 // `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus 333 // unique identifier) representing a service account that has been recently 334 // deleted. For example, 335 // `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the 336 // service account is undeleted, this value reverts to 337 // `serviceAccount:{emailid}` and the undeleted service account retains the 338 // role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email 339 // address (plus unique identifier) representing a Google group that has been 340 // recently deleted. For example, 341 // `admins@example.com?uid=123456789012345678901`. If the group is recovered, 342 // this value reverts to `group:{emailid}` and the recovered group retains the 343 // role in the binding. * 344 // `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool 345 // _id}/subject/{subject_attribute_value}`: Deleted single identity in a 346 // workforce identity pool. For example, 347 // `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-po 348 // ol-id/subject/my-subject-attribute-value`. 349 Members []string `json:"members,omitempty"` 350 // Role: Role that is assigned to the list of `members`, or principals. For 351 // example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview 352 // of the IAM roles and permissions, see the IAM documentation 353 // (https://cloud.google.com/iam/docs/roles-overview). For a list of the 354 // available pre-defined roles, see here 355 // (https://cloud.google.com/iam/docs/understanding-roles). 356 Role string `json:"role,omitempty"` 357 // ForceSendFields is a list of field names (e.g. "Condition") to 358 // unconditionally include in API requests. By default, fields with empty or 359 // default values are omitted from API requests. See 360 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 361 // details. 362 ForceSendFields []string `json:"-"` 363 // NullFields is a list of field names (e.g. "Condition") to include in API 364 // requests with the JSON null value. By default, fields with empty values are 365 // omitted from API requests. See 366 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 367 NullFields []string `json:"-"` 368 } 369 370 func (s *Binding) MarshalJSON() ([]byte, error) { 371 type NoMethod Binding 372 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 373 } 374 375 // DataMaskingPolicy: The data masking policy that is used to specify data 376 // masking rule. 377 type DataMaskingPolicy struct { 378 // PredefinedExpression: A predefined masking expression. 379 // 380 // Possible values: 381 // "PREDEFINED_EXPRESSION_UNSPECIFIED" - Default, unspecified predefined 382 // expression. No masking will take place since no expression is specified. 383 // "SHA256" - Masking expression to replace data with SHA-256 hash. 384 // "ALWAYS_NULL" - Masking expression to replace data with NULLs. 385 // "DEFAULT_MASKING_VALUE" - Masking expression to replace data with their 386 // default masking values. The default masking values for each type listed as 387 // below: * STRING: "" * BYTES: b'' * INTEGER: 0 * FLOAT: 0.0 * NUMERIC: 0 * 388 // BOOLEAN: FALSE * TIMESTAMP: 1970-01-01 00:00:00 UTC * DATE: 1970-01-01 * 389 // TIME: 00:00:00 * DATETIME: 1970-01-01T00:00:00 * GEOGRAPHY: POINT(0 0) * 390 // BIGNUMERIC: 0 * ARRAY: [] * STRUCT: NOT_APPLICABLE * JSON: NULL 391 // "LAST_FOUR_CHARACTERS" - Masking expression shows the last four characters 392 // of text. The masking behavior is as follows: * If text length > 4 393 // characters: Replace text with XXXXX, append last four characters of original 394 // text. * If text length <= 4 characters: Apply SHA-256 hash. 395 // "FIRST_FOUR_CHARACTERS" - Masking expression shows the first four 396 // characters of text. The masking behavior is as follows: * If text length > 4 397 // characters: Replace text with XXXXX, prepend first four characters of 398 // original text. * If text length <= 4 characters: Apply SHA-256 hash. 399 // "EMAIL_MASK" - Masking expression for email addresses. The masking 400 // behavior is as follows: * Syntax-valid email address: Replace username with 401 // XXXXX. For example, cloudysanfrancisco@gmail.com becomes XXXXX@gmail.com. * 402 // Syntax-invalid email address: Apply SHA-256 hash. For more information, see 403 // Email mask. 404 // "DATE_YEAR_MASK" - Masking expression to only show the *year* of `Date`, 405 // `DateTime` and `TimeStamp`. For example, with the year 2076: * DATE : 406 // 2076-01-01 * DATETIME : 2076-01-01T00:00:00 * TIMESTAMP : 2076-01-01 407 // 00:00:00 UTC Truncation occurs according to the UTC time zone. To change 408 // this, adjust the default time zone using the `time_zone` system variable. 409 // For more information, see the System variables reference. 410 PredefinedExpression string `json:"predefinedExpression,omitempty"` 411 // Routine: The name of the BigQuery routine that contains the custom masking 412 // routine, in the format of 413 // `projects/{project_number}/datasets/{dataset_id}/routines/{routine_id}`. 414 Routine string `json:"routine,omitempty"` 415 // ForceSendFields is a list of field names (e.g. "PredefinedExpression") to 416 // unconditionally include in API requests. By default, fields with empty or 417 // default values are omitted from API requests. See 418 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 419 // details. 420 ForceSendFields []string `json:"-"` 421 // NullFields is a list of field names (e.g. "PredefinedExpression") to include 422 // in API requests with the JSON null value. By default, fields with empty 423 // values are omitted from API requests. See 424 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 425 NullFields []string `json:"-"` 426 } 427 428 func (s *DataMaskingPolicy) MarshalJSON() ([]byte, error) { 429 type NoMethod DataMaskingPolicy 430 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 431 } 432 433 // DataPolicy: Represents the label-policy binding. 434 type DataPolicy struct { 435 // DataMaskingPolicy: The data masking policy that specifies the data masking 436 // rule to use. 437 DataMaskingPolicy *DataMaskingPolicy `json:"dataMaskingPolicy,omitempty"` 438 // DataPolicyId: User-assigned (human readable) ID of the data policy that 439 // needs to be unique within a project. Used as {data_policy_id} in part of the 440 // resource name. 441 DataPolicyId string `json:"dataPolicyId,omitempty"` 442 // DataPolicyType: Type of data policy. 443 // 444 // Possible values: 445 // "DATA_POLICY_TYPE_UNSPECIFIED" - Default value for the data policy type. 446 // This should not be used. 447 // "COLUMN_LEVEL_SECURITY_POLICY" - Used to create a data policy for 448 // column-level security, without data masking. 449 // "DATA_MASKING_POLICY" - Used to create a data policy for data masking. 450 DataPolicyType string `json:"dataPolicyType,omitempty"` 451 // Name: Output only. Resource name of this data policy, in the format of 452 // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_ 453 // id}`. 454 Name string `json:"name,omitempty"` 455 // PolicyTag: Policy tag resource name, in the format of 456 // `projects/{project_number}/locations/{location_id}/taxonomies/{taxonomy_id}/p 457 // olicyTags/{policyTag_id}`. 458 PolicyTag string `json:"policyTag,omitempty"` 459 460 // ServerResponse contains the HTTP response code and headers from the server. 461 googleapi.ServerResponse `json:"-"` 462 // ForceSendFields is a list of field names (e.g. "DataMaskingPolicy") to 463 // unconditionally include in API requests. By default, fields with empty or 464 // default values are omitted from API requests. See 465 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 466 // details. 467 ForceSendFields []string `json:"-"` 468 // NullFields is a list of field names (e.g. "DataMaskingPolicy") to include in 469 // API requests with the JSON null value. By default, fields with empty values 470 // are omitted from API requests. See 471 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 472 NullFields []string `json:"-"` 473 } 474 475 func (s *DataPolicy) MarshalJSON() ([]byte, error) { 476 type NoMethod DataPolicy 477 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 478 } 479 480 // Empty: A generic empty message that you can re-use to avoid defining 481 // duplicated empty messages in your APIs. A typical example is to use it as 482 // the request or the response type of an API method. For instance: service Foo 483 // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } 484 type Empty struct { 485 // ServerResponse contains the HTTP response code and headers from the server. 486 googleapi.ServerResponse `json:"-"` 487 } 488 489 // Expr: Represents a textual expression in the Common Expression Language 490 // (CEL) syntax. CEL is a C-like expression language. The syntax and semantics 491 // of CEL are documented at https://github.com/google/cel-spec. Example 492 // (Comparison): title: "Summary size limit" description: "Determines if a 493 // summary is less than 100 chars" expression: "document.summary.size() < 100" 494 // Example (Equality): title: "Requestor is owner" description: "Determines if 495 // requestor is the document owner" expression: "document.owner == 496 // request.auth.claims.email" Example (Logic): title: "Public documents" 497 // description: "Determine whether the document should be publicly visible" 498 // expression: "document.type != 'private' && document.type != 'internal'" 499 // Example (Data Manipulation): title: "Notification string" description: 500 // "Create a notification string with a timestamp." expression: "'New message 501 // received at ' + string(document.create_time)" The exact variables and 502 // functions that may be referenced within an expression are determined by the 503 // service that evaluates it. See the service documentation for additional 504 // information. 505 type Expr struct { 506 // Description: Optional. Description of the expression. This is a longer text 507 // which describes the expression, e.g. when hovered over it in a UI. 508 Description string `json:"description,omitempty"` 509 // Expression: Textual representation of an expression in Common Expression 510 // Language syntax. 511 Expression string `json:"expression,omitempty"` 512 // Location: Optional. String indicating the location of the expression for 513 // error reporting, e.g. a file name and a position in the file. 514 Location string `json:"location,omitempty"` 515 // Title: Optional. Title for the expression, i.e. a short string describing 516 // its purpose. This can be used e.g. in UIs which allow to enter the 517 // expression. 518 Title string `json:"title,omitempty"` 519 // ForceSendFields is a list of field names (e.g. "Description") to 520 // unconditionally include in API requests. By default, fields with empty or 521 // default values are omitted from API requests. See 522 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 523 // details. 524 ForceSendFields []string `json:"-"` 525 // NullFields is a list of field names (e.g. "Description") to include in API 526 // requests with the JSON null value. By default, fields with empty values are 527 // omitted from API requests. See 528 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 529 NullFields []string `json:"-"` 530 } 531 532 func (s *Expr) MarshalJSON() ([]byte, error) { 533 type NoMethod Expr 534 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 535 } 536 537 // GetIamPolicyRequest: Request message for `GetIamPolicy` method. 538 type GetIamPolicyRequest struct { 539 // Options: OPTIONAL: A `GetPolicyOptions` object for specifying options to 540 // `GetIamPolicy`. 541 Options *GetPolicyOptions `json:"options,omitempty"` 542 // ForceSendFields is a list of field names (e.g. "Options") to unconditionally 543 // include in API requests. By default, fields with empty or default values are 544 // omitted from API requests. See 545 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 546 // details. 547 ForceSendFields []string `json:"-"` 548 // NullFields is a list of field names (e.g. "Options") to include in API 549 // requests with the JSON null value. By default, fields with empty values are 550 // omitted from API requests. See 551 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 552 NullFields []string `json:"-"` 553 } 554 555 func (s *GetIamPolicyRequest) MarshalJSON() ([]byte, error) { 556 type NoMethod GetIamPolicyRequest 557 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 558 } 559 560 // GetPolicyOptions: Encapsulates settings provided to GetIamPolicy. 561 type GetPolicyOptions struct { 562 // RequestedPolicyVersion: Optional. The maximum policy version that will be 563 // used to format the policy. Valid values are 0, 1, and 3. Requests specifying 564 // an invalid value will be rejected. Requests for policies with any 565 // conditional role bindings must specify version 3. Policies with no 566 // conditional role bindings may specify any valid value or leave the field 567 // unset. The policy in the response might use the policy version that you 568 // specified, or it might use a lower policy version. For example, if you 569 // specify version 3, but the policy has no conditional role bindings, the 570 // response uses version 1. To learn which resources support conditions in 571 // their IAM policies, see the IAM documentation 572 // (https://cloud.google.com/iam/help/conditions/resource-policies). 573 RequestedPolicyVersion int64 `json:"requestedPolicyVersion,omitempty"` 574 // ForceSendFields is a list of field names (e.g. "RequestedPolicyVersion") to 575 // unconditionally include in API requests. By default, fields with empty or 576 // default values are omitted from API requests. See 577 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 578 // details. 579 ForceSendFields []string `json:"-"` 580 // NullFields is a list of field names (e.g. "RequestedPolicyVersion") to 581 // include in API requests with the JSON null value. By default, fields with 582 // empty values are omitted from API requests. See 583 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 584 NullFields []string `json:"-"` 585 } 586 587 func (s *GetPolicyOptions) MarshalJSON() ([]byte, error) { 588 type NoMethod GetPolicyOptions 589 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 590 } 591 592 // ListDataPoliciesResponse: Response message for the ListDataPolicies method. 593 type ListDataPoliciesResponse struct { 594 // DataPolicies: Data policies that belong to the requested project. 595 DataPolicies []*DataPolicy `json:"dataPolicies,omitempty"` 596 // NextPageToken: Token used to retrieve the next page of results, or empty if 597 // there are no more results. 598 NextPageToken string `json:"nextPageToken,omitempty"` 599 600 // ServerResponse contains the HTTP response code and headers from the server. 601 googleapi.ServerResponse `json:"-"` 602 // ForceSendFields is a list of field names (e.g. "DataPolicies") to 603 // unconditionally include in API requests. By default, fields with empty or 604 // default values are omitted from API requests. See 605 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 606 // details. 607 ForceSendFields []string `json:"-"` 608 // NullFields is a list of field names (e.g. "DataPolicies") to include in API 609 // requests with the JSON null value. By default, fields with empty values are 610 // omitted from API requests. See 611 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 612 NullFields []string `json:"-"` 613 } 614 615 func (s *ListDataPoliciesResponse) MarshalJSON() ([]byte, error) { 616 type NoMethod ListDataPoliciesResponse 617 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 618 } 619 620 // Policy: An Identity and Access Management (IAM) policy, which specifies 621 // access controls for Google Cloud resources. A `Policy` is a collection of 622 // `bindings`. A `binding` binds one or more `members`, or principals, to a 623 // single `role`. Principals can be user accounts, service accounts, Google 624 // groups, and domains (such as G Suite). A `role` is a named list of 625 // permissions; each `role` can be an IAM predefined role or a user-created 626 // custom role. For some types of Google Cloud resources, a `binding` can also 627 // specify a `condition`, which is a logical expression that allows access to a 628 // resource only if the expression evaluates to `true`. A condition can add 629 // constraints based on attributes of the request, the resource, or both. To 630 // learn which resources support conditions in their IAM policies, see the IAM 631 // documentation 632 // (https://cloud.google.com/iam/help/conditions/resource-policies). **JSON 633 // example:** ``` { "bindings": [ { "role": 634 // "roles/resourcemanager.organizationAdmin", "members": [ 635 // "user:mike@example.com", "group:admins@example.com", "domain:google.com", 636 // "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": 637 // "roles/resourcemanager.organizationViewer", "members": [ 638 // "user:eve@example.com" ], "condition": { "title": "expirable access", 639 // "description": "Does not grant access after Sep 2020", "expression": 640 // "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": 641 // "BwWWja0YfJA=", "version": 3 } ``` **YAML example:** ``` bindings: - 642 // members: - user:mike@example.com - group:admins@example.com - 643 // domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com 644 // role: roles/resourcemanager.organizationAdmin - members: - 645 // user:eve@example.com role: roles/resourcemanager.organizationViewer 646 // condition: title: expirable access description: Does not grant access after 647 // Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') 648 // etag: BwWWja0YfJA= version: 3 ``` For a description of IAM and its features, 649 // see the IAM documentation (https://cloud.google.com/iam/docs/). 650 type Policy struct { 651 // AuditConfigs: Specifies cloud audit logging configuration for this policy. 652 AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"` 653 // Bindings: Associates a list of `members`, or principals, with a `role`. 654 // Optionally, may specify a `condition` that determines how and when the 655 // `bindings` are applied. Each of the `bindings` must contain at least one 656 // principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; 657 // up to 250 of these principals can be Google groups. Each occurrence of a 658 // principal counts towards these limits. For example, if the `bindings` grant 659 // 50 different roles to `user:alice@example.com`, and not to any other 660 // principal, then you can add another 1,450 principals to the `bindings` in 661 // the `Policy`. 662 Bindings []*Binding `json:"bindings,omitempty"` 663 // Etag: `etag` is used for optimistic concurrency control as a way to help 664 // prevent simultaneous updates of a policy from overwriting each other. It is 665 // strongly suggested that systems make use of the `etag` in the 666 // read-modify-write cycle to perform policy updates in order to avoid race 667 // conditions: An `etag` is returned in the response to `getIamPolicy`, and 668 // systems are expected to put that etag in the request to `setIamPolicy` to 669 // ensure that their change will be applied to the same version of the policy. 670 // **Important:** If you use IAM Conditions, you must include the `etag` field 671 // whenever you call `setIamPolicy`. If you omit this field, then IAM allows 672 // you to overwrite a version `3` policy with a version `1` policy, and all of 673 // the conditions in the version `3` policy are lost. 674 Etag string `json:"etag,omitempty"` 675 // Version: Specifies the format of the policy. Valid values are `0`, `1`, and 676 // `3`. Requests that specify an invalid value are rejected. Any operation that 677 // affects conditional role bindings must specify version `3`. This requirement 678 // applies to the following operations: * Getting a policy that includes a 679 // conditional role binding * Adding a conditional role binding to a policy * 680 // Changing a conditional role binding in a policy * Removing any role binding, 681 // with or without a condition, from a policy that includes conditions 682 // **Important:** If you use IAM Conditions, you must include the `etag` field 683 // whenever you call `setIamPolicy`. If you omit this field, then IAM allows 684 // you to overwrite a version `3` policy with a version `1` policy, and all of 685 // the conditions in the version `3` policy are lost. If a policy does not 686 // include any conditions, operations on that policy may specify any valid 687 // version or leave the field unset. To learn which resources support 688 // conditions in their IAM policies, see the IAM documentation 689 // (https://cloud.google.com/iam/help/conditions/resource-policies). 690 Version int64 `json:"version,omitempty"` 691 692 // ServerResponse contains the HTTP response code and headers from the server. 693 googleapi.ServerResponse `json:"-"` 694 // ForceSendFields is a list of field names (e.g. "AuditConfigs") to 695 // unconditionally include in API requests. By default, fields with empty or 696 // default values are omitted from API requests. See 697 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 698 // details. 699 ForceSendFields []string `json:"-"` 700 // NullFields is a list of field names (e.g. "AuditConfigs") to include in API 701 // requests with the JSON null value. By default, fields with empty values are 702 // omitted from API requests. See 703 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 704 NullFields []string `json:"-"` 705 } 706 707 func (s *Policy) MarshalJSON() ([]byte, error) { 708 type NoMethod Policy 709 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 710 } 711 712 // RenameDataPolicyRequest: Request message for the RenameDataPolicy method. 713 type RenameDataPolicyRequest struct { 714 // NewDataPolicyId: Required. The new data policy id. 715 NewDataPolicyId string `json:"newDataPolicyId,omitempty"` 716 // ForceSendFields is a list of field names (e.g. "NewDataPolicyId") to 717 // unconditionally include in API requests. By default, fields with empty or 718 // default values are omitted from API requests. See 719 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 720 // details. 721 ForceSendFields []string `json:"-"` 722 // NullFields is a list of field names (e.g. "NewDataPolicyId") to include in 723 // API requests with the JSON null value. By default, fields with empty values 724 // are omitted from API requests. See 725 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 726 NullFields []string `json:"-"` 727 } 728 729 func (s *RenameDataPolicyRequest) MarshalJSON() ([]byte, error) { 730 type NoMethod RenameDataPolicyRequest 731 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 732 } 733 734 // SetIamPolicyRequest: Request message for `SetIamPolicy` method. 735 type SetIamPolicyRequest struct { 736 // Policy: REQUIRED: The complete policy to be applied to the `resource`. The 737 // size of the policy is limited to a few 10s of KB. An empty policy is a valid 738 // policy but certain Google Cloud services (such as Projects) might reject 739 // them. 740 Policy *Policy `json:"policy,omitempty"` 741 // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the policy to 742 // modify. Only the fields in the mask will be modified. If no mask is 743 // provided, the following default mask is used: `paths: "bindings, etag" 744 UpdateMask string `json:"updateMask,omitempty"` 745 // ForceSendFields is a list of field names (e.g. "Policy") to unconditionally 746 // include in API requests. By default, fields with empty or default values are 747 // omitted from API requests. See 748 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 749 // details. 750 ForceSendFields []string `json:"-"` 751 // NullFields is a list of field names (e.g. "Policy") to include in API 752 // requests with the JSON null value. By default, fields with empty values are 753 // omitted from API requests. See 754 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 755 NullFields []string `json:"-"` 756 } 757 758 func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) { 759 type NoMethod SetIamPolicyRequest 760 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 761 } 762 763 // TestIamPermissionsRequest: Request message for `TestIamPermissions` method. 764 type TestIamPermissionsRequest struct { 765 // Permissions: The set of permissions to check for the `resource`. Permissions 766 // with wildcards (such as `*` or `storage.*`) are not allowed. For more 767 // information see IAM Overview 768 // (https://cloud.google.com/iam/docs/overview#permissions). 769 Permissions []string `json:"permissions,omitempty"` 770 // ForceSendFields is a list of field names (e.g. "Permissions") to 771 // unconditionally include in API requests. By default, fields with empty or 772 // default values are omitted from API requests. See 773 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 774 // details. 775 ForceSendFields []string `json:"-"` 776 // NullFields is a list of field names (e.g. "Permissions") to include in API 777 // requests with the JSON null value. By default, fields with empty values are 778 // omitted from API requests. See 779 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 780 NullFields []string `json:"-"` 781 } 782 783 func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) { 784 type NoMethod TestIamPermissionsRequest 785 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 786 } 787 788 // TestIamPermissionsResponse: Response message for `TestIamPermissions` 789 // method. 790 type TestIamPermissionsResponse struct { 791 // Permissions: A subset of `TestPermissionsRequest.permissions` that the 792 // caller is allowed. 793 Permissions []string `json:"permissions,omitempty"` 794 795 // ServerResponse contains the HTTP response code and headers from the server. 796 googleapi.ServerResponse `json:"-"` 797 // ForceSendFields is a list of field names (e.g. "Permissions") to 798 // unconditionally include in API requests. By default, fields with empty or 799 // default values are omitted from API requests. See 800 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 801 // details. 802 ForceSendFields []string `json:"-"` 803 // NullFields is a list of field names (e.g. "Permissions") to include in API 804 // requests with the JSON null value. By default, fields with empty values are 805 // omitted from API requests. See 806 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 807 NullFields []string `json:"-"` 808 } 809 810 func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { 811 type NoMethod TestIamPermissionsResponse 812 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 813 } 814 815 type ProjectsLocationsDataPoliciesCreateCall struct { 816 s *Service 817 parent string 818 datapolicy *DataPolicy 819 urlParams_ gensupport.URLParams 820 ctx_ context.Context 821 header_ http.Header 822 } 823 824 // Create: Creates a new data policy under a project with the given 825 // `dataPolicyId` (used as the display name), policy tag, and data policy type. 826 // 827 // - parent: Resource name of the project that the data policy will belong to. 828 // The format is `projects/{project_number}/locations/{location_id}`. 829 func (r *ProjectsLocationsDataPoliciesService) Create(parent string, datapolicy *DataPolicy) *ProjectsLocationsDataPoliciesCreateCall { 830 c := &ProjectsLocationsDataPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 831 c.parent = parent 832 c.datapolicy = datapolicy 833 return c 834 } 835 836 // Fields allows partial responses to be retrieved. See 837 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 838 // details. 839 func (c *ProjectsLocationsDataPoliciesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesCreateCall { 840 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 841 return c 842 } 843 844 // Context sets the context to be used in this call's Do method. 845 func (c *ProjectsLocationsDataPoliciesCreateCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesCreateCall { 846 c.ctx_ = ctx 847 return c 848 } 849 850 // Header returns a http.Header that can be modified by the caller to add 851 // headers to the request. 852 func (c *ProjectsLocationsDataPoliciesCreateCall) Header() http.Header { 853 if c.header_ == nil { 854 c.header_ = make(http.Header) 855 } 856 return c.header_ 857 } 858 859 func (c *ProjectsLocationsDataPoliciesCreateCall) doRequest(alt string) (*http.Response, error) { 860 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 861 var body io.Reader = nil 862 body, err := googleapi.WithoutDataWrapper.JSONReader(c.datapolicy) 863 if err != nil { 864 return nil, err 865 } 866 c.urlParams_.Set("alt", alt) 867 c.urlParams_.Set("prettyPrint", "false") 868 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/dataPolicies") 869 urls += "?" + c.urlParams_.Encode() 870 req, err := http.NewRequest("POST", urls, body) 871 if err != nil { 872 return nil, err 873 } 874 req.Header = reqHeaders 875 googleapi.Expand(req.URL, map[string]string{ 876 "parent": c.parent, 877 }) 878 return gensupport.SendRequest(c.ctx_, c.s.client, req) 879 } 880 881 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.create" call. 882 // Any non-2xx status code is an error. Response headers are in either 883 // *DataPolicy.ServerResponse.Header or (if a response was returned at all) in 884 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 885 // whether the returned error was because http.StatusNotModified was returned. 886 func (c *ProjectsLocationsDataPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*DataPolicy, error) { 887 gensupport.SetOptions(c.urlParams_, opts...) 888 res, err := c.doRequest("json") 889 if res != nil && res.StatusCode == http.StatusNotModified { 890 if res.Body != nil { 891 res.Body.Close() 892 } 893 return nil, gensupport.WrapError(&googleapi.Error{ 894 Code: res.StatusCode, 895 Header: res.Header, 896 }) 897 } 898 if err != nil { 899 return nil, err 900 } 901 defer googleapi.CloseBody(res) 902 if err := googleapi.CheckResponse(res); err != nil { 903 return nil, gensupport.WrapError(err) 904 } 905 ret := &DataPolicy{ 906 ServerResponse: googleapi.ServerResponse{ 907 Header: res.Header, 908 HTTPStatusCode: res.StatusCode, 909 }, 910 } 911 target := &ret 912 if err := gensupport.DecodeResponse(target, res); err != nil { 913 return nil, err 914 } 915 return ret, nil 916 } 917 918 type ProjectsLocationsDataPoliciesDeleteCall struct { 919 s *Service 920 name string 921 urlParams_ gensupport.URLParams 922 ctx_ context.Context 923 header_ http.Header 924 } 925 926 // Delete: Deletes the data policy specified by its resource name. 927 // 928 // - name: Resource name of the data policy to delete. Format is 929 // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_polic 930 // y_id}`. 931 func (r *ProjectsLocationsDataPoliciesService) Delete(name string) *ProjectsLocationsDataPoliciesDeleteCall { 932 c := &ProjectsLocationsDataPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 933 c.name = name 934 return c 935 } 936 937 // Fields allows partial responses to be retrieved. See 938 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 939 // details. 940 func (c *ProjectsLocationsDataPoliciesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesDeleteCall { 941 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 942 return c 943 } 944 945 // Context sets the context to be used in this call's Do method. 946 func (c *ProjectsLocationsDataPoliciesDeleteCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesDeleteCall { 947 c.ctx_ = ctx 948 return c 949 } 950 951 // Header returns a http.Header that can be modified by the caller to add 952 // headers to the request. 953 func (c *ProjectsLocationsDataPoliciesDeleteCall) Header() http.Header { 954 if c.header_ == nil { 955 c.header_ = make(http.Header) 956 } 957 return c.header_ 958 } 959 960 func (c *ProjectsLocationsDataPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) { 961 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 962 var body io.Reader = nil 963 c.urlParams_.Set("alt", alt) 964 c.urlParams_.Set("prettyPrint", "false") 965 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 966 urls += "?" + c.urlParams_.Encode() 967 req, err := http.NewRequest("DELETE", urls, body) 968 if err != nil { 969 return nil, err 970 } 971 req.Header = reqHeaders 972 googleapi.Expand(req.URL, map[string]string{ 973 "name": c.name, 974 }) 975 return gensupport.SendRequest(c.ctx_, c.s.client, req) 976 } 977 978 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.delete" call. 979 // Any non-2xx status code is an error. Response headers are in either 980 // *Empty.ServerResponse.Header or (if a response was returned at all) in 981 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 982 // whether the returned error was because http.StatusNotModified was returned. 983 func (c *ProjectsLocationsDataPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 984 gensupport.SetOptions(c.urlParams_, opts...) 985 res, err := c.doRequest("json") 986 if res != nil && res.StatusCode == http.StatusNotModified { 987 if res.Body != nil { 988 res.Body.Close() 989 } 990 return nil, gensupport.WrapError(&googleapi.Error{ 991 Code: res.StatusCode, 992 Header: res.Header, 993 }) 994 } 995 if err != nil { 996 return nil, err 997 } 998 defer googleapi.CloseBody(res) 999 if err := googleapi.CheckResponse(res); err != nil { 1000 return nil, gensupport.WrapError(err) 1001 } 1002 ret := &Empty{ 1003 ServerResponse: googleapi.ServerResponse{ 1004 Header: res.Header, 1005 HTTPStatusCode: res.StatusCode, 1006 }, 1007 } 1008 target := &ret 1009 if err := gensupport.DecodeResponse(target, res); err != nil { 1010 return nil, err 1011 } 1012 return ret, nil 1013 } 1014 1015 type ProjectsLocationsDataPoliciesGetCall struct { 1016 s *Service 1017 name string 1018 urlParams_ gensupport.URLParams 1019 ifNoneMatch_ string 1020 ctx_ context.Context 1021 header_ http.Header 1022 } 1023 1024 // Get: Gets the data policy specified by its resource name. 1025 // 1026 // - name: Resource name of the requested data policy. Format is 1027 // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_polic 1028 // y_id}`. 1029 func (r *ProjectsLocationsDataPoliciesService) Get(name string) *ProjectsLocationsDataPoliciesGetCall { 1030 c := &ProjectsLocationsDataPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1031 c.name = name 1032 return c 1033 } 1034 1035 // Fields allows partial responses to be retrieved. See 1036 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1037 // details. 1038 func (c *ProjectsLocationsDataPoliciesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesGetCall { 1039 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1040 return c 1041 } 1042 1043 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1044 // object's ETag matches the given value. This is useful for getting updates 1045 // only after the object has changed since the last request. 1046 func (c *ProjectsLocationsDataPoliciesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsDataPoliciesGetCall { 1047 c.ifNoneMatch_ = entityTag 1048 return c 1049 } 1050 1051 // Context sets the context to be used in this call's Do method. 1052 func (c *ProjectsLocationsDataPoliciesGetCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesGetCall { 1053 c.ctx_ = ctx 1054 return c 1055 } 1056 1057 // Header returns a http.Header that can be modified by the caller to add 1058 // headers to the request. 1059 func (c *ProjectsLocationsDataPoliciesGetCall) Header() http.Header { 1060 if c.header_ == nil { 1061 c.header_ = make(http.Header) 1062 } 1063 return c.header_ 1064 } 1065 1066 func (c *ProjectsLocationsDataPoliciesGetCall) doRequest(alt string) (*http.Response, error) { 1067 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1068 if c.ifNoneMatch_ != "" { 1069 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1070 } 1071 var body io.Reader = nil 1072 c.urlParams_.Set("alt", alt) 1073 c.urlParams_.Set("prettyPrint", "false") 1074 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1075 urls += "?" + c.urlParams_.Encode() 1076 req, err := http.NewRequest("GET", urls, body) 1077 if err != nil { 1078 return nil, err 1079 } 1080 req.Header = reqHeaders 1081 googleapi.Expand(req.URL, map[string]string{ 1082 "name": c.name, 1083 }) 1084 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1085 } 1086 1087 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.get" call. 1088 // Any non-2xx status code is an error. Response headers are in either 1089 // *DataPolicy.ServerResponse.Header or (if a response was returned at all) in 1090 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1091 // whether the returned error was because http.StatusNotModified was returned. 1092 func (c *ProjectsLocationsDataPoliciesGetCall) Do(opts ...googleapi.CallOption) (*DataPolicy, error) { 1093 gensupport.SetOptions(c.urlParams_, opts...) 1094 res, err := c.doRequest("json") 1095 if res != nil && res.StatusCode == http.StatusNotModified { 1096 if res.Body != nil { 1097 res.Body.Close() 1098 } 1099 return nil, gensupport.WrapError(&googleapi.Error{ 1100 Code: res.StatusCode, 1101 Header: res.Header, 1102 }) 1103 } 1104 if err != nil { 1105 return nil, err 1106 } 1107 defer googleapi.CloseBody(res) 1108 if err := googleapi.CheckResponse(res); err != nil { 1109 return nil, gensupport.WrapError(err) 1110 } 1111 ret := &DataPolicy{ 1112 ServerResponse: googleapi.ServerResponse{ 1113 Header: res.Header, 1114 HTTPStatusCode: res.StatusCode, 1115 }, 1116 } 1117 target := &ret 1118 if err := gensupport.DecodeResponse(target, res); err != nil { 1119 return nil, err 1120 } 1121 return ret, nil 1122 } 1123 1124 type ProjectsLocationsDataPoliciesGetIamPolicyCall struct { 1125 s *Service 1126 resource string 1127 getiampolicyrequest *GetIamPolicyRequest 1128 urlParams_ gensupport.URLParams 1129 ctx_ context.Context 1130 header_ http.Header 1131 } 1132 1133 // GetIamPolicy: Gets the IAM policy for the specified data policy. 1134 // 1135 // - resource: REQUIRED: The resource for which the policy is being requested. 1136 // See Resource names (https://cloud.google.com/apis/design/resource_names) 1137 // for the appropriate value for this field. 1138 func (r *ProjectsLocationsDataPoliciesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsLocationsDataPoliciesGetIamPolicyCall { 1139 c := &ProjectsLocationsDataPoliciesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1140 c.resource = resource 1141 c.getiampolicyrequest = getiampolicyrequest 1142 return c 1143 } 1144 1145 // Fields allows partial responses to be retrieved. See 1146 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1147 // details. 1148 func (c *ProjectsLocationsDataPoliciesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesGetIamPolicyCall { 1149 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1150 return c 1151 } 1152 1153 // Context sets the context to be used in this call's Do method. 1154 func (c *ProjectsLocationsDataPoliciesGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesGetIamPolicyCall { 1155 c.ctx_ = ctx 1156 return c 1157 } 1158 1159 // Header returns a http.Header that can be modified by the caller to add 1160 // headers to the request. 1161 func (c *ProjectsLocationsDataPoliciesGetIamPolicyCall) Header() http.Header { 1162 if c.header_ == nil { 1163 c.header_ = make(http.Header) 1164 } 1165 return c.header_ 1166 } 1167 1168 func (c *ProjectsLocationsDataPoliciesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 1169 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1170 var body io.Reader = nil 1171 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest) 1172 if err != nil { 1173 return nil, err 1174 } 1175 c.urlParams_.Set("alt", alt) 1176 c.urlParams_.Set("prettyPrint", "false") 1177 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy") 1178 urls += "?" + c.urlParams_.Encode() 1179 req, err := http.NewRequest("POST", urls, body) 1180 if err != nil { 1181 return nil, err 1182 } 1183 req.Header = reqHeaders 1184 googleapi.Expand(req.URL, map[string]string{ 1185 "resource": c.resource, 1186 }) 1187 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1188 } 1189 1190 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.getIamPolicy" call. 1191 // Any non-2xx status code is an error. Response headers are in either 1192 // *Policy.ServerResponse.Header or (if a response was returned at all) in 1193 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1194 // whether the returned error was because http.StatusNotModified was returned. 1195 func (c *ProjectsLocationsDataPoliciesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 1196 gensupport.SetOptions(c.urlParams_, opts...) 1197 res, err := c.doRequest("json") 1198 if res != nil && res.StatusCode == http.StatusNotModified { 1199 if res.Body != nil { 1200 res.Body.Close() 1201 } 1202 return nil, gensupport.WrapError(&googleapi.Error{ 1203 Code: res.StatusCode, 1204 Header: res.Header, 1205 }) 1206 } 1207 if err != nil { 1208 return nil, err 1209 } 1210 defer googleapi.CloseBody(res) 1211 if err := googleapi.CheckResponse(res); err != nil { 1212 return nil, gensupport.WrapError(err) 1213 } 1214 ret := &Policy{ 1215 ServerResponse: googleapi.ServerResponse{ 1216 Header: res.Header, 1217 HTTPStatusCode: res.StatusCode, 1218 }, 1219 } 1220 target := &ret 1221 if err := gensupport.DecodeResponse(target, res); err != nil { 1222 return nil, err 1223 } 1224 return ret, nil 1225 } 1226 1227 type ProjectsLocationsDataPoliciesListCall struct { 1228 s *Service 1229 parent string 1230 urlParams_ gensupport.URLParams 1231 ifNoneMatch_ string 1232 ctx_ context.Context 1233 header_ http.Header 1234 } 1235 1236 // List: List all of the data policies in the specified parent project. 1237 // 1238 // - parent: Resource name of the project for which to list data policies. 1239 // Format is `projects/{project_number}/locations/{location_id}`. 1240 func (r *ProjectsLocationsDataPoliciesService) List(parent string) *ProjectsLocationsDataPoliciesListCall { 1241 c := &ProjectsLocationsDataPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1242 c.parent = parent 1243 return c 1244 } 1245 1246 // Filter sets the optional parameter "filter": Filters the data policies by 1247 // policy tags that they are associated with. Currently filter only supports 1248 // "policy_tag" based filtering and OR based predicates. Sample filter can be 1249 // "policy_tag: projects/1/locations/us/taxonomies/2/policyTags/3". You may 1250 // also use wildcard such as "policy_tag: 1251 // projects/1/locations/us/taxonomies/2*". Please note that OR predicates 1252 // cannot be used with wildcard filters. 1253 func (c *ProjectsLocationsDataPoliciesListCall) Filter(filter string) *ProjectsLocationsDataPoliciesListCall { 1254 c.urlParams_.Set("filter", filter) 1255 return c 1256 } 1257 1258 // PageSize sets the optional parameter "pageSize": The maximum number of data 1259 // policies to return. Must be a value between 1 and 1000. If not set, defaults 1260 // to 50. 1261 func (c *ProjectsLocationsDataPoliciesListCall) PageSize(pageSize int64) *ProjectsLocationsDataPoliciesListCall { 1262 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1263 return c 1264 } 1265 1266 // PageToken sets the optional parameter "pageToken": The `nextPageToken` value 1267 // returned from a previous list request, if any. If not set, defaults to an 1268 // empty string. 1269 func (c *ProjectsLocationsDataPoliciesListCall) PageToken(pageToken string) *ProjectsLocationsDataPoliciesListCall { 1270 c.urlParams_.Set("pageToken", pageToken) 1271 return c 1272 } 1273 1274 // Fields allows partial responses to be retrieved. See 1275 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1276 // details. 1277 func (c *ProjectsLocationsDataPoliciesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesListCall { 1278 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1279 return c 1280 } 1281 1282 // IfNoneMatch sets an optional parameter which makes the operation fail if the 1283 // object's ETag matches the given value. This is useful for getting updates 1284 // only after the object has changed since the last request. 1285 func (c *ProjectsLocationsDataPoliciesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsDataPoliciesListCall { 1286 c.ifNoneMatch_ = entityTag 1287 return c 1288 } 1289 1290 // Context sets the context to be used in this call's Do method. 1291 func (c *ProjectsLocationsDataPoliciesListCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesListCall { 1292 c.ctx_ = ctx 1293 return c 1294 } 1295 1296 // Header returns a http.Header that can be modified by the caller to add 1297 // headers to the request. 1298 func (c *ProjectsLocationsDataPoliciesListCall) Header() http.Header { 1299 if c.header_ == nil { 1300 c.header_ = make(http.Header) 1301 } 1302 return c.header_ 1303 } 1304 1305 func (c *ProjectsLocationsDataPoliciesListCall) doRequest(alt string) (*http.Response, error) { 1306 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) 1307 if c.ifNoneMatch_ != "" { 1308 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1309 } 1310 var body io.Reader = nil 1311 c.urlParams_.Set("alt", alt) 1312 c.urlParams_.Set("prettyPrint", "false") 1313 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/dataPolicies") 1314 urls += "?" + c.urlParams_.Encode() 1315 req, err := http.NewRequest("GET", urls, body) 1316 if err != nil { 1317 return nil, err 1318 } 1319 req.Header = reqHeaders 1320 googleapi.Expand(req.URL, map[string]string{ 1321 "parent": c.parent, 1322 }) 1323 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1324 } 1325 1326 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.list" call. 1327 // Any non-2xx status code is an error. Response headers are in either 1328 // *ListDataPoliciesResponse.ServerResponse.Header or (if a response was 1329 // returned at all) in error.(*googleapi.Error).Header. Use 1330 // googleapi.IsNotModified to check whether the returned error was because 1331 // http.StatusNotModified was returned. 1332 func (c *ProjectsLocationsDataPoliciesListCall) Do(opts ...googleapi.CallOption) (*ListDataPoliciesResponse, error) { 1333 gensupport.SetOptions(c.urlParams_, opts...) 1334 res, err := c.doRequest("json") 1335 if res != nil && res.StatusCode == http.StatusNotModified { 1336 if res.Body != nil { 1337 res.Body.Close() 1338 } 1339 return nil, gensupport.WrapError(&googleapi.Error{ 1340 Code: res.StatusCode, 1341 Header: res.Header, 1342 }) 1343 } 1344 if err != nil { 1345 return nil, err 1346 } 1347 defer googleapi.CloseBody(res) 1348 if err := googleapi.CheckResponse(res); err != nil { 1349 return nil, gensupport.WrapError(err) 1350 } 1351 ret := &ListDataPoliciesResponse{ 1352 ServerResponse: googleapi.ServerResponse{ 1353 Header: res.Header, 1354 HTTPStatusCode: res.StatusCode, 1355 }, 1356 } 1357 target := &ret 1358 if err := gensupport.DecodeResponse(target, res); err != nil { 1359 return nil, err 1360 } 1361 return ret, nil 1362 } 1363 1364 // Pages invokes f for each page of results. 1365 // A non-nil error returned from f will halt the iteration. 1366 // The provided context supersedes any context provided to the Context method. 1367 func (c *ProjectsLocationsDataPoliciesListCall) Pages(ctx context.Context, f func(*ListDataPoliciesResponse) error) error { 1368 c.ctx_ = ctx 1369 defer c.PageToken(c.urlParams_.Get("pageToken")) 1370 for { 1371 x, err := c.Do() 1372 if err != nil { 1373 return err 1374 } 1375 if err := f(x); err != nil { 1376 return err 1377 } 1378 if x.NextPageToken == "" { 1379 return nil 1380 } 1381 c.PageToken(x.NextPageToken) 1382 } 1383 } 1384 1385 type ProjectsLocationsDataPoliciesPatchCall struct { 1386 s *Service 1387 name string 1388 datapolicy *DataPolicy 1389 urlParams_ gensupport.URLParams 1390 ctx_ context.Context 1391 header_ http.Header 1392 } 1393 1394 // Patch: Updates the metadata for an existing data policy. The target data 1395 // policy can be specified by the resource name. 1396 // 1397 // - name: Output only. Resource name of this data policy, in the format of 1398 // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_polic 1399 // y_id}`. 1400 func (r *ProjectsLocationsDataPoliciesService) Patch(name string, datapolicy *DataPolicy) *ProjectsLocationsDataPoliciesPatchCall { 1401 c := &ProjectsLocationsDataPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1402 c.name = name 1403 c.datapolicy = datapolicy 1404 return c 1405 } 1406 1407 // UpdateMask sets the optional parameter "updateMask": The update mask applies 1408 // to the resource. For the `FieldMask` definition, see 1409 // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask 1410 // If not set, defaults to all of the fields that are allowed to update. 1411 // Updates to the `name` and `dataPolicyId` fields are not allowed. 1412 func (c *ProjectsLocationsDataPoliciesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsDataPoliciesPatchCall { 1413 c.urlParams_.Set("updateMask", updateMask) 1414 return c 1415 } 1416 1417 // Fields allows partial responses to be retrieved. See 1418 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1419 // details. 1420 func (c *ProjectsLocationsDataPoliciesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesPatchCall { 1421 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1422 return c 1423 } 1424 1425 // Context sets the context to be used in this call's Do method. 1426 func (c *ProjectsLocationsDataPoliciesPatchCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesPatchCall { 1427 c.ctx_ = ctx 1428 return c 1429 } 1430 1431 // Header returns a http.Header that can be modified by the caller to add 1432 // headers to the request. 1433 func (c *ProjectsLocationsDataPoliciesPatchCall) Header() http.Header { 1434 if c.header_ == nil { 1435 c.header_ = make(http.Header) 1436 } 1437 return c.header_ 1438 } 1439 1440 func (c *ProjectsLocationsDataPoliciesPatchCall) doRequest(alt string) (*http.Response, error) { 1441 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1442 var body io.Reader = nil 1443 body, err := googleapi.WithoutDataWrapper.JSONReader(c.datapolicy) 1444 if err != nil { 1445 return nil, err 1446 } 1447 c.urlParams_.Set("alt", alt) 1448 c.urlParams_.Set("prettyPrint", "false") 1449 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1450 urls += "?" + c.urlParams_.Encode() 1451 req, err := http.NewRequest("PATCH", urls, body) 1452 if err != nil { 1453 return nil, err 1454 } 1455 req.Header = reqHeaders 1456 googleapi.Expand(req.URL, map[string]string{ 1457 "name": c.name, 1458 }) 1459 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1460 } 1461 1462 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.patch" call. 1463 // Any non-2xx status code is an error. Response headers are in either 1464 // *DataPolicy.ServerResponse.Header or (if a response was returned at all) in 1465 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1466 // whether the returned error was because http.StatusNotModified was returned. 1467 func (c *ProjectsLocationsDataPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*DataPolicy, error) { 1468 gensupport.SetOptions(c.urlParams_, opts...) 1469 res, err := c.doRequest("json") 1470 if res != nil && res.StatusCode == http.StatusNotModified { 1471 if res.Body != nil { 1472 res.Body.Close() 1473 } 1474 return nil, gensupport.WrapError(&googleapi.Error{ 1475 Code: res.StatusCode, 1476 Header: res.Header, 1477 }) 1478 } 1479 if err != nil { 1480 return nil, err 1481 } 1482 defer googleapi.CloseBody(res) 1483 if err := googleapi.CheckResponse(res); err != nil { 1484 return nil, gensupport.WrapError(err) 1485 } 1486 ret := &DataPolicy{ 1487 ServerResponse: googleapi.ServerResponse{ 1488 Header: res.Header, 1489 HTTPStatusCode: res.StatusCode, 1490 }, 1491 } 1492 target := &ret 1493 if err := gensupport.DecodeResponse(target, res); err != nil { 1494 return nil, err 1495 } 1496 return ret, nil 1497 } 1498 1499 type ProjectsLocationsDataPoliciesRenameCall struct { 1500 s *Service 1501 name string 1502 renamedatapolicyrequest *RenameDataPolicyRequest 1503 urlParams_ gensupport.URLParams 1504 ctx_ context.Context 1505 header_ http.Header 1506 } 1507 1508 // Rename: Renames the id (display name) of the specified data policy. 1509 // 1510 // - name: Resource name of the data policy to rename. The format is 1511 // `projects/{project_number}/locations/{location_id}/dataPolicies/{data_polic 1512 // y_id}`. 1513 func (r *ProjectsLocationsDataPoliciesService) Rename(name string, renamedatapolicyrequest *RenameDataPolicyRequest) *ProjectsLocationsDataPoliciesRenameCall { 1514 c := &ProjectsLocationsDataPoliciesRenameCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1515 c.name = name 1516 c.renamedatapolicyrequest = renamedatapolicyrequest 1517 return c 1518 } 1519 1520 // Fields allows partial responses to be retrieved. See 1521 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1522 // details. 1523 func (c *ProjectsLocationsDataPoliciesRenameCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesRenameCall { 1524 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1525 return c 1526 } 1527 1528 // Context sets the context to be used in this call's Do method. 1529 func (c *ProjectsLocationsDataPoliciesRenameCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesRenameCall { 1530 c.ctx_ = ctx 1531 return c 1532 } 1533 1534 // Header returns a http.Header that can be modified by the caller to add 1535 // headers to the request. 1536 func (c *ProjectsLocationsDataPoliciesRenameCall) Header() http.Header { 1537 if c.header_ == nil { 1538 c.header_ = make(http.Header) 1539 } 1540 return c.header_ 1541 } 1542 1543 func (c *ProjectsLocationsDataPoliciesRenameCall) doRequest(alt string) (*http.Response, error) { 1544 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1545 var body io.Reader = nil 1546 body, err := googleapi.WithoutDataWrapper.JSONReader(c.renamedatapolicyrequest) 1547 if err != nil { 1548 return nil, err 1549 } 1550 c.urlParams_.Set("alt", alt) 1551 c.urlParams_.Set("prettyPrint", "false") 1552 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:rename") 1553 urls += "?" + c.urlParams_.Encode() 1554 req, err := http.NewRequest("POST", urls, body) 1555 if err != nil { 1556 return nil, err 1557 } 1558 req.Header = reqHeaders 1559 googleapi.Expand(req.URL, map[string]string{ 1560 "name": c.name, 1561 }) 1562 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1563 } 1564 1565 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.rename" call. 1566 // Any non-2xx status code is an error. Response headers are in either 1567 // *DataPolicy.ServerResponse.Header or (if a response was returned at all) in 1568 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1569 // whether the returned error was because http.StatusNotModified was returned. 1570 func (c *ProjectsLocationsDataPoliciesRenameCall) Do(opts ...googleapi.CallOption) (*DataPolicy, error) { 1571 gensupport.SetOptions(c.urlParams_, opts...) 1572 res, err := c.doRequest("json") 1573 if res != nil && res.StatusCode == http.StatusNotModified { 1574 if res.Body != nil { 1575 res.Body.Close() 1576 } 1577 return nil, gensupport.WrapError(&googleapi.Error{ 1578 Code: res.StatusCode, 1579 Header: res.Header, 1580 }) 1581 } 1582 if err != nil { 1583 return nil, err 1584 } 1585 defer googleapi.CloseBody(res) 1586 if err := googleapi.CheckResponse(res); err != nil { 1587 return nil, gensupport.WrapError(err) 1588 } 1589 ret := &DataPolicy{ 1590 ServerResponse: googleapi.ServerResponse{ 1591 Header: res.Header, 1592 HTTPStatusCode: res.StatusCode, 1593 }, 1594 } 1595 target := &ret 1596 if err := gensupport.DecodeResponse(target, res); err != nil { 1597 return nil, err 1598 } 1599 return ret, nil 1600 } 1601 1602 type ProjectsLocationsDataPoliciesSetIamPolicyCall struct { 1603 s *Service 1604 resource string 1605 setiampolicyrequest *SetIamPolicyRequest 1606 urlParams_ gensupport.URLParams 1607 ctx_ context.Context 1608 header_ http.Header 1609 } 1610 1611 // SetIamPolicy: Sets the IAM policy for the specified data policy. 1612 // 1613 // - resource: REQUIRED: The resource for which the policy is being specified. 1614 // See Resource names (https://cloud.google.com/apis/design/resource_names) 1615 // for the appropriate value for this field. 1616 func (r *ProjectsLocationsDataPoliciesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsDataPoliciesSetIamPolicyCall { 1617 c := &ProjectsLocationsDataPoliciesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1618 c.resource = resource 1619 c.setiampolicyrequest = setiampolicyrequest 1620 return c 1621 } 1622 1623 // Fields allows partial responses to be retrieved. See 1624 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1625 // details. 1626 func (c *ProjectsLocationsDataPoliciesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesSetIamPolicyCall { 1627 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1628 return c 1629 } 1630 1631 // Context sets the context to be used in this call's Do method. 1632 func (c *ProjectsLocationsDataPoliciesSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesSetIamPolicyCall { 1633 c.ctx_ = ctx 1634 return c 1635 } 1636 1637 // Header returns a http.Header that can be modified by the caller to add 1638 // headers to the request. 1639 func (c *ProjectsLocationsDataPoliciesSetIamPolicyCall) Header() http.Header { 1640 if c.header_ == nil { 1641 c.header_ = make(http.Header) 1642 } 1643 return c.header_ 1644 } 1645 1646 func (c *ProjectsLocationsDataPoliciesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 1647 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1648 var body io.Reader = nil 1649 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 1650 if err != nil { 1651 return nil, err 1652 } 1653 c.urlParams_.Set("alt", alt) 1654 c.urlParams_.Set("prettyPrint", "false") 1655 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy") 1656 urls += "?" + c.urlParams_.Encode() 1657 req, err := http.NewRequest("POST", urls, body) 1658 if err != nil { 1659 return nil, err 1660 } 1661 req.Header = reqHeaders 1662 googleapi.Expand(req.URL, map[string]string{ 1663 "resource": c.resource, 1664 }) 1665 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1666 } 1667 1668 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.setIamPolicy" call. 1669 // Any non-2xx status code is an error. Response headers are in either 1670 // *Policy.ServerResponse.Header or (if a response was returned at all) in 1671 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1672 // whether the returned error was because http.StatusNotModified was returned. 1673 func (c *ProjectsLocationsDataPoliciesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 1674 gensupport.SetOptions(c.urlParams_, opts...) 1675 res, err := c.doRequest("json") 1676 if res != nil && res.StatusCode == http.StatusNotModified { 1677 if res.Body != nil { 1678 res.Body.Close() 1679 } 1680 return nil, gensupport.WrapError(&googleapi.Error{ 1681 Code: res.StatusCode, 1682 Header: res.Header, 1683 }) 1684 } 1685 if err != nil { 1686 return nil, err 1687 } 1688 defer googleapi.CloseBody(res) 1689 if err := googleapi.CheckResponse(res); err != nil { 1690 return nil, gensupport.WrapError(err) 1691 } 1692 ret := &Policy{ 1693 ServerResponse: googleapi.ServerResponse{ 1694 Header: res.Header, 1695 HTTPStatusCode: res.StatusCode, 1696 }, 1697 } 1698 target := &ret 1699 if err := gensupport.DecodeResponse(target, res); err != nil { 1700 return nil, err 1701 } 1702 return ret, nil 1703 } 1704 1705 type ProjectsLocationsDataPoliciesTestIamPermissionsCall struct { 1706 s *Service 1707 resource string 1708 testiampermissionsrequest *TestIamPermissionsRequest 1709 urlParams_ gensupport.URLParams 1710 ctx_ context.Context 1711 header_ http.Header 1712 } 1713 1714 // TestIamPermissions: Returns the caller's permission on the specified data 1715 // policy resource. 1716 // 1717 // - resource: REQUIRED: The resource for which the policy detail is being 1718 // requested. See Resource names 1719 // (https://cloud.google.com/apis/design/resource_names) for the appropriate 1720 // value for this field. 1721 func (r *ProjectsLocationsDataPoliciesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsDataPoliciesTestIamPermissionsCall { 1722 c := &ProjectsLocationsDataPoliciesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1723 c.resource = resource 1724 c.testiampermissionsrequest = testiampermissionsrequest 1725 return c 1726 } 1727 1728 // Fields allows partial responses to be retrieved. See 1729 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1730 // details. 1731 func (c *ProjectsLocationsDataPoliciesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsDataPoliciesTestIamPermissionsCall { 1732 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1733 return c 1734 } 1735 1736 // Context sets the context to be used in this call's Do method. 1737 func (c *ProjectsLocationsDataPoliciesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsDataPoliciesTestIamPermissionsCall { 1738 c.ctx_ = ctx 1739 return c 1740 } 1741 1742 // Header returns a http.Header that can be modified by the caller to add 1743 // headers to the request. 1744 func (c *ProjectsLocationsDataPoliciesTestIamPermissionsCall) Header() http.Header { 1745 if c.header_ == nil { 1746 c.header_ = make(http.Header) 1747 } 1748 return c.header_ 1749 } 1750 1751 func (c *ProjectsLocationsDataPoliciesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 1752 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1753 var body io.Reader = nil 1754 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 1755 if err != nil { 1756 return nil, err 1757 } 1758 c.urlParams_.Set("alt", alt) 1759 c.urlParams_.Set("prettyPrint", "false") 1760 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions") 1761 urls += "?" + c.urlParams_.Encode() 1762 req, err := http.NewRequest("POST", urls, body) 1763 if err != nil { 1764 return nil, err 1765 } 1766 req.Header = reqHeaders 1767 googleapi.Expand(req.URL, map[string]string{ 1768 "resource": c.resource, 1769 }) 1770 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1771 } 1772 1773 // Do executes the "bigquerydatapolicy.projects.locations.dataPolicies.testIamPermissions" call. 1774 // Any non-2xx status code is an error. Response headers are in either 1775 // *TestIamPermissionsResponse.ServerResponse.Header or (if a response was 1776 // returned at all) in error.(*googleapi.Error).Header. Use 1777 // googleapi.IsNotModified to check whether the returned error was because 1778 // http.StatusNotModified was returned. 1779 func (c *ProjectsLocationsDataPoliciesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 1780 gensupport.SetOptions(c.urlParams_, opts...) 1781 res, err := c.doRequest("json") 1782 if res != nil && res.StatusCode == http.StatusNotModified { 1783 if res.Body != nil { 1784 res.Body.Close() 1785 } 1786 return nil, gensupport.WrapError(&googleapi.Error{ 1787 Code: res.StatusCode, 1788 Header: res.Header, 1789 }) 1790 } 1791 if err != nil { 1792 return nil, err 1793 } 1794 defer googleapi.CloseBody(res) 1795 if err := googleapi.CheckResponse(res); err != nil { 1796 return nil, gensupport.WrapError(err) 1797 } 1798 ret := &TestIamPermissionsResponse{ 1799 ServerResponse: googleapi.ServerResponse{ 1800 Header: res.Header, 1801 HTTPStatusCode: res.StatusCode, 1802 }, 1803 } 1804 target := &ret 1805 if err := gensupport.DecodeResponse(target, res); err != nil { 1806 return nil, err 1807 } 1808 return ret, nil 1809 } 1810