...

Source file src/google.golang.org/api/sourcerepo/v1/sourcerepo-gen.go

Documentation: google.golang.org/api/sourcerepo/v1

     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 sourcerepo provides access to the Cloud Source Repositories API.
     8  //
     9  // For product documentation, see: https://cloud.google.com/source-repositories/docs/apis
    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/sourcerepo/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	sourcerepoService, err := sourcerepo.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  //	sourcerepoService, err := sourcerepo.NewService(ctx, option.WithScopes(sourcerepo.SourceReadWriteScope))
    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  //	sourcerepoService, err := sourcerepo.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  //	sourcerepoService, err := sourcerepo.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package sourcerepo // import "google.golang.org/api/sourcerepo/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 = "sourcerepo:v1"
    95  const apiName = "sourcerepo"
    96  const apiVersion = "v1"
    97  const basePath = "https://sourcerepo.googleapis.com/"
    98  const basePathTemplate = "https://sourcerepo.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://sourcerepo.mtls.googleapis.com/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// See, edit, configure, and delete your Google Cloud data and see the email
   104  	// address for your Google Account.
   105  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
   106  
   107  	// Manage your source code repositories
   108  	SourceFullControlScope = "https://www.googleapis.com/auth/source.full_control"
   109  
   110  	// View the contents of your source code repositories
   111  	SourceReadOnlyScope = "https://www.googleapis.com/auth/source.read_only"
   112  
   113  	// Manage the contents of your source code repositories
   114  	SourceReadWriteScope = "https://www.googleapis.com/auth/source.read_write"
   115  )
   116  
   117  // NewService creates a new Service.
   118  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   119  	scopesOption := internaloption.WithDefaultScopes(
   120  		"https://www.googleapis.com/auth/cloud-platform",
   121  		"https://www.googleapis.com/auth/source.full_control",
   122  		"https://www.googleapis.com/auth/source.read_only",
   123  		"https://www.googleapis.com/auth/source.read_write",
   124  	)
   125  	// NOTE: prepend, so we don't override user-specified scopes.
   126  	opts = append([]option.ClientOption{scopesOption}, opts...)
   127  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   128  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   129  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   130  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   131  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   132  	if err != nil {
   133  		return nil, err
   134  	}
   135  	s, err := New(client)
   136  	if err != nil {
   137  		return nil, err
   138  	}
   139  	if endpoint != "" {
   140  		s.BasePath = endpoint
   141  	}
   142  	return s, nil
   143  }
   144  
   145  // New creates a new Service. It uses the provided http.Client for requests.
   146  //
   147  // Deprecated: please use NewService instead.
   148  // To provide a custom HTTP client, use option.WithHTTPClient.
   149  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   150  func New(client *http.Client) (*Service, error) {
   151  	if client == nil {
   152  		return nil, errors.New("client is nil")
   153  	}
   154  	s := &Service{client: client, BasePath: basePath}
   155  	s.Projects = NewProjectsService(s)
   156  	return s, nil
   157  }
   158  
   159  type Service struct {
   160  	client    *http.Client
   161  	BasePath  string // API endpoint base URL
   162  	UserAgent string // optional additional User-Agent fragment
   163  
   164  	Projects *ProjectsService
   165  }
   166  
   167  func (s *Service) userAgent() string {
   168  	if s.UserAgent == "" {
   169  		return googleapi.UserAgent
   170  	}
   171  	return googleapi.UserAgent + " " + s.UserAgent
   172  }
   173  
   174  func NewProjectsService(s *Service) *ProjectsService {
   175  	rs := &ProjectsService{s: s}
   176  	rs.Repos = NewProjectsReposService(s)
   177  	return rs
   178  }
   179  
   180  type ProjectsService struct {
   181  	s *Service
   182  
   183  	Repos *ProjectsReposService
   184  }
   185  
   186  func NewProjectsReposService(s *Service) *ProjectsReposService {
   187  	rs := &ProjectsReposService{s: s}
   188  	return rs
   189  }
   190  
   191  type ProjectsReposService struct {
   192  	s *Service
   193  }
   194  
   195  // AuditConfig: Specifies the audit configuration for a service. The
   196  // configuration determines which permission types are logged, and what
   197  // identities, if any, are exempted from logging. An AuditConfig must have one
   198  // or more AuditLogConfigs. If there are AuditConfigs for both `allServices`
   199  // and a specific service, the union of the two AuditConfigs is used for that
   200  // service: the log_types specified in each AuditConfig are enabled, and the
   201  // exempted_members in each AuditLogConfig are exempted. Example Policy with
   202  // multiple AuditConfigs: { "audit_configs": [ { "service": "allServices",
   203  // "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [
   204  // "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type":
   205  // "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com",
   206  // "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type":
   207  // "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For
   208  // sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ
   209  // logging. It also exempts `jose@example.com` from DATA_READ logging, and
   210  // `aliya@example.com` from DATA_WRITE logging.
   211  type AuditConfig struct {
   212  	// AuditLogConfigs: The configuration for logging of each type of permission.
   213  	AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
   214  	// Service: Specifies a service that will be enabled for audit logging. For
   215  	// example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices`
   216  	// is a special value that covers all services.
   217  	Service string `json:"service,omitempty"`
   218  	// ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
   219  	// unconditionally include in API requests. By default, fields with empty or
   220  	// default values are omitted from API requests. See
   221  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   222  	// details.
   223  	ForceSendFields []string `json:"-"`
   224  	// NullFields is a list of field names (e.g. "AuditLogConfigs") to include in
   225  	// API requests with the JSON null value. By default, fields with empty values
   226  	// are omitted from API requests. See
   227  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   228  	NullFields []string `json:"-"`
   229  }
   230  
   231  func (s *AuditConfig) MarshalJSON() ([]byte, error) {
   232  	type NoMethod AuditConfig
   233  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   234  }
   235  
   236  // AuditLogConfig: Provides the configuration for logging a type of
   237  // permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ",
   238  // "exempted_members": [ "user:jose@example.com" ] }, { "log_type":
   239  // "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while
   240  // exempting jose@example.com from DATA_READ logging.
   241  type AuditLogConfig struct {
   242  	// ExemptedMembers: Specifies the identities that do not cause logging for this
   243  	// type of permission. Follows the same format of Binding.members.
   244  	ExemptedMembers []string `json:"exemptedMembers,omitempty"`
   245  	// LogType: The log type that this config enables.
   246  	//
   247  	// Possible values:
   248  	//   "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
   249  	//   "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
   250  	//   "DATA_WRITE" - Data writes. Example: CloudSQL Users create
   251  	//   "DATA_READ" - Data reads. Example: CloudSQL Users list
   252  	LogType string `json:"logType,omitempty"`
   253  	// ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
   254  	// unconditionally include in API requests. By default, fields with empty or
   255  	// default values are omitted from API requests. See
   256  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   257  	// details.
   258  	ForceSendFields []string `json:"-"`
   259  	// NullFields is a list of field names (e.g. "ExemptedMembers") to include in
   260  	// API requests with the JSON null value. By default, fields with empty values
   261  	// are omitted from API requests. See
   262  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   263  	NullFields []string `json:"-"`
   264  }
   265  
   266  func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
   267  	type NoMethod AuditLogConfig
   268  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   269  }
   270  
   271  // Binding: Associates `members`, or principals, with a `role`.
   272  type Binding struct {
   273  	// Condition: The condition that is associated with this binding. If the
   274  	// condition evaluates to `true`, then this binding applies to the current
   275  	// request. If the condition evaluates to `false`, then this binding does not
   276  	// apply to the current request. However, a different role binding might grant
   277  	// the same role to one or more of the principals in this binding. To learn
   278  	// which resources support conditions in their IAM policies, see the IAM
   279  	// documentation
   280  	// (https://cloud.google.com/iam/help/conditions/resource-policies).
   281  	Condition *Expr `json:"condition,omitempty"`
   282  	// Members: Specifies the principals requesting access for a Google Cloud
   283  	// resource. `members` can have the following values: * `allUsers`: A special
   284  	// identifier that represents anyone who is on the internet; with or without a
   285  	// Google account. * `allAuthenticatedUsers`: A special identifier that
   286  	// represents anyone who is authenticated with a Google account or a service
   287  	// account. Does not include identities that come from external identity
   288  	// providers (IdPs) through identity federation. * `user:{emailid}`: An email
   289  	// address that represents a specific Google account. For example,
   290  	// `alice@example.com` . * `serviceAccount:{emailid}`: An email address that
   291  	// represents a Google service account. For example,
   292  	// `my-other-app@appspot.gserviceaccount.com`. *
   293  	// `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An
   294  	// identifier for a Kubernetes service account
   295  	// (https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts).
   296  	// For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. *
   297  	// `group:{emailid}`: An email address that represents a Google group. For
   298  	// example, `admins@example.com`. * `domain:{domain}`: The G Suite domain
   299  	// (primary) that represents all the users of that domain. For example,
   300  	// `google.com` or `example.com`. *
   301  	// `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/sub
   302  	// ject/{subject_attribute_value}`: A single identity in a workforce identity
   303  	// pool. *
   304  	// `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/
   305  	// group/{group_id}`: All workforce identities in a group. *
   306  	// `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/
   307  	// attribute.{attribute_name}/{attribute_value}`: All workforce identities with
   308  	// a specific attribute value. *
   309  	// `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/
   310  	// *`: All identities in a workforce identity pool. *
   311  	// `principal://iam.googleapis.com/projects/{project_number}/locations/global/wo
   312  	// rkloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single
   313  	// identity in a workload identity pool. *
   314  	// `principalSet://iam.googleapis.com/projects/{project_number}/locations/global
   315  	// /workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool
   316  	// group. *
   317  	// `principalSet://iam.googleapis.com/projects/{project_number}/locations/global
   318  	// /workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}
   319  	// `: All identities in a workload identity pool with a certain attribute. *
   320  	// `principalSet://iam.googleapis.com/projects/{project_number}/locations/global
   321  	// /workloadIdentityPools/{pool_id}/*`: All identities in a workload identity
   322  	// pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus
   323  	// unique identifier) representing a user that has been recently deleted. For
   324  	// example, `alice@example.com?uid=123456789012345678901`. If the user is
   325  	// recovered, this value reverts to `user:{emailid}` and the recovered user
   326  	// retains the role in the binding. *
   327  	// `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus
   328  	// unique identifier) representing a service account that has been recently
   329  	// deleted. For example,
   330  	// `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the
   331  	// service account is undeleted, this value reverts to
   332  	// `serviceAccount:{emailid}` and the undeleted service account retains the
   333  	// role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email
   334  	// address (plus unique identifier) representing a Google group that has been
   335  	// recently deleted. For example,
   336  	// `admins@example.com?uid=123456789012345678901`. If the group is recovered,
   337  	// this value reverts to `group:{emailid}` and the recovered group retains the
   338  	// role in the binding. *
   339  	// `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool
   340  	// _id}/subject/{subject_attribute_value}`: Deleted single identity in a
   341  	// workforce identity pool. For example,
   342  	// `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-po
   343  	// ol-id/subject/my-subject-attribute-value`.
   344  	Members []string `json:"members,omitempty"`
   345  	// Role: Role that is assigned to the list of `members`, or principals. For
   346  	// example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview
   347  	// of the IAM roles and permissions, see the IAM documentation
   348  	// (https://cloud.google.com/iam/docs/roles-overview). For a list of the
   349  	// available pre-defined roles, see here
   350  	// (https://cloud.google.com/iam/docs/understanding-roles).
   351  	Role string `json:"role,omitempty"`
   352  	// ForceSendFields is a list of field names (e.g. "Condition") to
   353  	// unconditionally include in API requests. By default, fields with empty or
   354  	// default values are omitted from API requests. See
   355  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   356  	// details.
   357  	ForceSendFields []string `json:"-"`
   358  	// NullFields is a list of field names (e.g. "Condition") to include in API
   359  	// requests with the JSON null value. By default, fields with empty values are
   360  	// omitted from API requests. See
   361  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   362  	NullFields []string `json:"-"`
   363  }
   364  
   365  func (s *Binding) MarshalJSON() ([]byte, error) {
   366  	type NoMethod Binding
   367  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   368  }
   369  
   370  // Empty: A generic empty message that you can re-use to avoid defining
   371  // duplicated empty messages in your APIs. A typical example is to use it as
   372  // the request or the response type of an API method. For instance: service Foo
   373  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   374  type Empty struct {
   375  	// ServerResponse contains the HTTP response code and headers from the server.
   376  	googleapi.ServerResponse `json:"-"`
   377  }
   378  
   379  // Expr: Represents a textual expression in the Common Expression Language
   380  // (CEL) syntax. CEL is a C-like expression language. The syntax and semantics
   381  // of CEL are documented at https://github.com/google/cel-spec. Example
   382  // (Comparison): title: "Summary size limit" description: "Determines if a
   383  // summary is less than 100 chars" expression: "document.summary.size() < 100"
   384  // Example (Equality): title: "Requestor is owner" description: "Determines if
   385  // requestor is the document owner" expression: "document.owner ==
   386  // request.auth.claims.email" Example (Logic): title: "Public documents"
   387  // description: "Determine whether the document should be publicly visible"
   388  // expression: "document.type != 'private' && document.type != 'internal'"
   389  // Example (Data Manipulation): title: "Notification string" description:
   390  // "Create a notification string with a timestamp." expression: "'New message
   391  // received at ' + string(document.create_time)" The exact variables and
   392  // functions that may be referenced within an expression are determined by the
   393  // service that evaluates it. See the service documentation for additional
   394  // information.
   395  type Expr struct {
   396  	// Description: Optional. Description of the expression. This is a longer text
   397  	// which describes the expression, e.g. when hovered over it in a UI.
   398  	Description string `json:"description,omitempty"`
   399  	// Expression: Textual representation of an expression in Common Expression
   400  	// Language syntax.
   401  	Expression string `json:"expression,omitempty"`
   402  	// Location: Optional. String indicating the location of the expression for
   403  	// error reporting, e.g. a file name and a position in the file.
   404  	Location string `json:"location,omitempty"`
   405  	// Title: Optional. Title for the expression, i.e. a short string describing
   406  	// its purpose. This can be used e.g. in UIs which allow to enter the
   407  	// expression.
   408  	Title string `json:"title,omitempty"`
   409  	// ForceSendFields is a list of field names (e.g. "Description") to
   410  	// unconditionally include in API requests. By default, fields with empty or
   411  	// default values are omitted from API requests. See
   412  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   413  	// details.
   414  	ForceSendFields []string `json:"-"`
   415  	// NullFields is a list of field names (e.g. "Description") to include in API
   416  	// requests with the JSON null value. By default, fields with empty values are
   417  	// omitted from API requests. See
   418  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   419  	NullFields []string `json:"-"`
   420  }
   421  
   422  func (s *Expr) MarshalJSON() ([]byte, error) {
   423  	type NoMethod Expr
   424  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   425  }
   426  
   427  // ListReposResponse: Response for ListRepos. The size is not set in the
   428  // returned repositories.
   429  type ListReposResponse struct {
   430  	// NextPageToken: If non-empty, additional repositories exist within the
   431  	// project. These can be retrieved by including this value in the next
   432  	// ListReposRequest's page_token field.
   433  	NextPageToken string `json:"nextPageToken,omitempty"`
   434  	// Repos: The listed repos.
   435  	Repos []*Repo `json:"repos,omitempty"`
   436  
   437  	// ServerResponse contains the HTTP response code and headers from the server.
   438  	googleapi.ServerResponse `json:"-"`
   439  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   440  	// unconditionally include in API requests. By default, fields with empty or
   441  	// default values are omitted from API requests. See
   442  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   443  	// details.
   444  	ForceSendFields []string `json:"-"`
   445  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   446  	// requests with the JSON null value. By default, fields with empty values are
   447  	// omitted from API requests. See
   448  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   449  	NullFields []string `json:"-"`
   450  }
   451  
   452  func (s *ListReposResponse) MarshalJSON() ([]byte, error) {
   453  	type NoMethod ListReposResponse
   454  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   455  }
   456  
   457  // MirrorConfig: Configuration to automatically mirror a repository from
   458  // another hosting service, for example GitHub or Bitbucket.
   459  type MirrorConfig struct {
   460  	// DeployKeyId: ID of the SSH deploy key at the other hosting service. Removing
   461  	// this key from the other service would deauthorize Google Cloud Source
   462  	// Repositories from mirroring.
   463  	DeployKeyId string `json:"deployKeyId,omitempty"`
   464  	// Url: URL of the main repository at the other hosting service.
   465  	Url string `json:"url,omitempty"`
   466  	// WebhookId: ID of the webhook listening to updates to trigger mirroring.
   467  	// Removing this webhook from the other hosting service will stop Google Cloud
   468  	// Source Repositories from receiving notifications, and thereby disabling
   469  	// mirroring.
   470  	WebhookId string `json:"webhookId,omitempty"`
   471  	// ForceSendFields is a list of field names (e.g. "DeployKeyId") to
   472  	// unconditionally include in API requests. By default, fields with empty or
   473  	// default values are omitted from API requests. See
   474  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   475  	// details.
   476  	ForceSendFields []string `json:"-"`
   477  	// NullFields is a list of field names (e.g. "DeployKeyId") to include in API
   478  	// requests with the JSON null value. By default, fields with empty values are
   479  	// omitted from API requests. See
   480  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   481  	NullFields []string `json:"-"`
   482  }
   483  
   484  func (s *MirrorConfig) MarshalJSON() ([]byte, error) {
   485  	type NoMethod MirrorConfig
   486  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   487  }
   488  
   489  // Operation: This resource represents a long-running operation that is the
   490  // result of a network API call.
   491  type Operation struct {
   492  	// Done: If the value is `false`, it means the operation is still in progress.
   493  	// If `true`, the operation is completed, and either `error` or `response` is
   494  	// available.
   495  	Done bool `json:"done,omitempty"`
   496  	// Error: The error result of the operation in case of failure or cancellation.
   497  	Error *Status `json:"error,omitempty"`
   498  	// Metadata: Service-specific metadata associated with the operation. It
   499  	// typically contains progress information and common metadata such as create
   500  	// time. Some services might not provide such metadata. Any method that returns
   501  	// a long-running operation should document the metadata type, if any.
   502  	Metadata googleapi.RawMessage `json:"metadata,omitempty"`
   503  	// Name: The server-assigned name, which is only unique within the same service
   504  	// that originally returns it. If you use the default HTTP mapping, the `name`
   505  	// should be a resource name ending with `operations/{unique_id}`.
   506  	Name string `json:"name,omitempty"`
   507  	// Response: The normal, successful response of the operation. If the original
   508  	// method returns no data on success, such as `Delete`, the response is
   509  	// `google.protobuf.Empty`. If the original method is standard
   510  	// `Get`/`Create`/`Update`, the response should be the resource. For other
   511  	// methods, the response should have the type `XxxResponse`, where `Xxx` is the
   512  	// original method name. For example, if the original method name is
   513  	// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
   514  	Response googleapi.RawMessage `json:"response,omitempty"`
   515  
   516  	// ServerResponse contains the HTTP response code and headers from the server.
   517  	googleapi.ServerResponse `json:"-"`
   518  	// ForceSendFields is a list of field names (e.g. "Done") to unconditionally
   519  	// include in API requests. By default, fields with empty or default values are
   520  	// omitted from API requests. See
   521  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   522  	// details.
   523  	ForceSendFields []string `json:"-"`
   524  	// NullFields is a list of field names (e.g. "Done") to include in API requests
   525  	// with the JSON null value. By default, fields with empty values are omitted
   526  	// from API requests. See
   527  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   528  	NullFields []string `json:"-"`
   529  }
   530  
   531  func (s *Operation) MarshalJSON() ([]byte, error) {
   532  	type NoMethod Operation
   533  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   534  }
   535  
   536  // Policy: An Identity and Access Management (IAM) policy, which specifies
   537  // access controls for Google Cloud resources. A `Policy` is a collection of
   538  // `bindings`. A `binding` binds one or more `members`, or principals, to a
   539  // single `role`. Principals can be user accounts, service accounts, Google
   540  // groups, and domains (such as G Suite). A `role` is a named list of
   541  // permissions; each `role` can be an IAM predefined role or a user-created
   542  // custom role. For some types of Google Cloud resources, a `binding` can also
   543  // specify a `condition`, which is a logical expression that allows access to a
   544  // resource only if the expression evaluates to `true`. A condition can add
   545  // constraints based on attributes of the request, the resource, or both. To
   546  // learn which resources support conditions in their IAM policies, see the IAM
   547  // documentation
   548  // (https://cloud.google.com/iam/help/conditions/resource-policies). **JSON
   549  // example:** ``` { "bindings": [ { "role":
   550  // "roles/resourcemanager.organizationAdmin", "members": [
   551  // "user:mike@example.com", "group:admins@example.com", "domain:google.com",
   552  // "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role":
   553  // "roles/resourcemanager.organizationViewer", "members": [
   554  // "user:eve@example.com" ], "condition": { "title": "expirable access",
   555  // "description": "Does not grant access after Sep 2020", "expression":
   556  // "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag":
   557  // "BwWWja0YfJA=", "version": 3 } ``` **YAML example:** ``` bindings: -
   558  // members: - user:mike@example.com - group:admins@example.com -
   559  // domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com
   560  // role: roles/resourcemanager.organizationAdmin - members: -
   561  // user:eve@example.com role: roles/resourcemanager.organizationViewer
   562  // condition: title: expirable access description: Does not grant access after
   563  // Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
   564  // etag: BwWWja0YfJA= version: 3 ``` For a description of IAM and its features,
   565  // see the IAM documentation (https://cloud.google.com/iam/docs/).
   566  type Policy struct {
   567  	// AuditConfigs: Specifies cloud audit logging configuration for this policy.
   568  	AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
   569  	// Bindings: Associates a list of `members`, or principals, with a `role`.
   570  	// Optionally, may specify a `condition` that determines how and when the
   571  	// `bindings` are applied. Each of the `bindings` must contain at least one
   572  	// principal. The `bindings` in a `Policy` can refer to up to 1,500 principals;
   573  	// up to 250 of these principals can be Google groups. Each occurrence of a
   574  	// principal counts towards these limits. For example, if the `bindings` grant
   575  	// 50 different roles to `user:alice@example.com`, and not to any other
   576  	// principal, then you can add another 1,450 principals to the `bindings` in
   577  	// the `Policy`.
   578  	Bindings []*Binding `json:"bindings,omitempty"`
   579  	// Etag: `etag` is used for optimistic concurrency control as a way to help
   580  	// prevent simultaneous updates of a policy from overwriting each other. It is
   581  	// strongly suggested that systems make use of the `etag` in the
   582  	// read-modify-write cycle to perform policy updates in order to avoid race
   583  	// conditions: An `etag` is returned in the response to `getIamPolicy`, and
   584  	// systems are expected to put that etag in the request to `setIamPolicy` to
   585  	// ensure that their change will be applied to the same version of the policy.
   586  	// **Important:** If you use IAM Conditions, you must include the `etag` field
   587  	// whenever you call `setIamPolicy`. If you omit this field, then IAM allows
   588  	// you to overwrite a version `3` policy with a version `1` policy, and all of
   589  	// the conditions in the version `3` policy are lost.
   590  	Etag string `json:"etag,omitempty"`
   591  	// Version: Specifies the format of the policy. Valid values are `0`, `1`, and
   592  	// `3`. Requests that specify an invalid value are rejected. Any operation that
   593  	// affects conditional role bindings must specify version `3`. This requirement
   594  	// applies to the following operations: * Getting a policy that includes a
   595  	// conditional role binding * Adding a conditional role binding to a policy *
   596  	// Changing a conditional role binding in a policy * Removing any role binding,
   597  	// with or without a condition, from a policy that includes conditions
   598  	// **Important:** If you use IAM Conditions, you must include the `etag` field
   599  	// whenever you call `setIamPolicy`. If you omit this field, then IAM allows
   600  	// you to overwrite a version `3` policy with a version `1` policy, and all of
   601  	// the conditions in the version `3` policy are lost. If a policy does not
   602  	// include any conditions, operations on that policy may specify any valid
   603  	// version or leave the field unset. To learn which resources support
   604  	// conditions in their IAM policies, see the IAM documentation
   605  	// (https://cloud.google.com/iam/help/conditions/resource-policies).
   606  	Version int64 `json:"version,omitempty"`
   607  
   608  	// ServerResponse contains the HTTP response code and headers from the server.
   609  	googleapi.ServerResponse `json:"-"`
   610  	// ForceSendFields is a list of field names (e.g. "AuditConfigs") to
   611  	// unconditionally include in API requests. By default, fields with empty or
   612  	// default values are omitted from API requests. See
   613  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   614  	// details.
   615  	ForceSendFields []string `json:"-"`
   616  	// NullFields is a list of field names (e.g. "AuditConfigs") to include in API
   617  	// requests with the JSON null value. By default, fields with empty values are
   618  	// omitted from API requests. See
   619  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   620  	NullFields []string `json:"-"`
   621  }
   622  
   623  func (s *Policy) MarshalJSON() ([]byte, error) {
   624  	type NoMethod Policy
   625  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   626  }
   627  
   628  // ProjectConfig: Cloud Source Repositories configuration of a project.
   629  type ProjectConfig struct {
   630  	// EnablePrivateKeyCheck: Reject a Git push that contains a private key.
   631  	EnablePrivateKeyCheck bool `json:"enablePrivateKeyCheck,omitempty"`
   632  	// Name: The name of the project. Values are of the form `projects/`.
   633  	Name string `json:"name,omitempty"`
   634  	// PubsubConfigs: How this project publishes a change in the repositories
   635  	// through Cloud Pub/Sub. Keyed by the topic names.
   636  	PubsubConfigs map[string]PubsubConfig `json:"pubsubConfigs,omitempty"`
   637  
   638  	// ServerResponse contains the HTTP response code and headers from the server.
   639  	googleapi.ServerResponse `json:"-"`
   640  	// ForceSendFields is a list of field names (e.g. "EnablePrivateKeyCheck") to
   641  	// unconditionally include in API requests. By default, fields with empty or
   642  	// default values are omitted from API requests. See
   643  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   644  	// details.
   645  	ForceSendFields []string `json:"-"`
   646  	// NullFields is a list of field names (e.g. "EnablePrivateKeyCheck") to
   647  	// include in API requests with the JSON null value. By default, fields with
   648  	// empty values are omitted from API requests. See
   649  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   650  	NullFields []string `json:"-"`
   651  }
   652  
   653  func (s *ProjectConfig) MarshalJSON() ([]byte, error) {
   654  	type NoMethod ProjectConfig
   655  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   656  }
   657  
   658  // PubsubConfig: Configuration to publish a Cloud Pub/Sub message.
   659  type PubsubConfig struct {
   660  	// MessageFormat: The format of the Cloud Pub/Sub messages.
   661  	//
   662  	// Possible values:
   663  	//   "MESSAGE_FORMAT_UNSPECIFIED" - Unspecified.
   664  	//   "PROTOBUF" - The message payload is a serialized protocol buffer of
   665  	// SourceRepoEvent.
   666  	//   "JSON" - The message payload is a JSON string of SourceRepoEvent.
   667  	MessageFormat string `json:"messageFormat,omitempty"`
   668  	// ServiceAccountEmail: Email address of the service account used for
   669  	// publishing Cloud Pub/Sub messages. This service account needs to be in the
   670  	// same project as the PubsubConfig. When added, the caller needs to have
   671  	// iam.serviceAccounts.actAs permission on this service account. If
   672  	// unspecified, it defaults to the compute engine default service account.
   673  	ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"`
   674  	// Topic: A topic of Cloud Pub/Sub. Values are of the form `projects//topics/`.
   675  	// The project needs to be the same project as this config is in.
   676  	Topic string `json:"topic,omitempty"`
   677  	// ForceSendFields is a list of field names (e.g. "MessageFormat") to
   678  	// unconditionally include in API requests. By default, fields with empty or
   679  	// default values are omitted from API requests. See
   680  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   681  	// details.
   682  	ForceSendFields []string `json:"-"`
   683  	// NullFields is a list of field names (e.g. "MessageFormat") to include in API
   684  	// requests with the JSON null value. By default, fields with empty values are
   685  	// omitted from API requests. See
   686  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   687  	NullFields []string `json:"-"`
   688  }
   689  
   690  func (s *PubsubConfig) MarshalJSON() ([]byte, error) {
   691  	type NoMethod PubsubConfig
   692  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   693  }
   694  
   695  // Repo: A repository (or repo) is a Git repository storing versioned source
   696  // content.
   697  type Repo struct {
   698  	// MirrorConfig: How this repository mirrors a repository managed by another
   699  	// service. Read-only field.
   700  	MirrorConfig *MirrorConfig `json:"mirrorConfig,omitempty"`
   701  	// Name: Resource name of the repository, of the form `projects//repos/`. The
   702  	// repo name may contain slashes. eg,
   703  	// `projects/myproject/repos/name/with/slash`
   704  	Name string `json:"name,omitempty"`
   705  	// PubsubConfigs: How this repository publishes a change in the repository
   706  	// through Cloud Pub/Sub. Keyed by the topic names.
   707  	PubsubConfigs map[string]PubsubConfig `json:"pubsubConfigs,omitempty"`
   708  	// Size: The disk usage of the repo, in bytes. Read-only field. Size is only
   709  	// returned by GetRepo.
   710  	Size int64 `json:"size,omitempty,string"`
   711  	// Url: URL to clone the repository from Google Cloud Source Repositories.
   712  	// Read-only field.
   713  	Url string `json:"url,omitempty"`
   714  
   715  	// ServerResponse contains the HTTP response code and headers from the server.
   716  	googleapi.ServerResponse `json:"-"`
   717  	// ForceSendFields is a list of field names (e.g. "MirrorConfig") to
   718  	// unconditionally include in API requests. By default, fields with empty or
   719  	// default values are omitted from API requests. See
   720  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   721  	// details.
   722  	ForceSendFields []string `json:"-"`
   723  	// NullFields is a list of field names (e.g. "MirrorConfig") to include in API
   724  	// requests with the JSON null value. By default, fields with empty values are
   725  	// omitted from API requests. See
   726  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   727  	NullFields []string `json:"-"`
   728  }
   729  
   730  func (s *Repo) MarshalJSON() ([]byte, error) {
   731  	type NoMethod Repo
   732  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   733  }
   734  
   735  // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
   736  type SetIamPolicyRequest struct {
   737  	// Policy: REQUIRED: The complete policy to be applied to the `resource`. The
   738  	// size of the policy is limited to a few 10s of KB. An empty policy is a valid
   739  	// policy but certain Google Cloud services (such as Projects) might reject
   740  	// them.
   741  	Policy *Policy `json:"policy,omitempty"`
   742  	// UpdateMask: OPTIONAL: A FieldMask specifying which fields of the policy to
   743  	// modify. Only the fields in the mask will be modified. If no mask is
   744  	// provided, the following default mask is used: `paths: "bindings, etag"
   745  	UpdateMask string `json:"updateMask,omitempty"`
   746  	// ForceSendFields is a list of field names (e.g. "Policy") to unconditionally
   747  	// include in API requests. By default, fields with empty or default values are
   748  	// omitted from API requests. See
   749  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   750  	// details.
   751  	ForceSendFields []string `json:"-"`
   752  	// NullFields is a list of field names (e.g. "Policy") to include in API
   753  	// requests with the JSON null value. By default, fields with empty values are
   754  	// omitted from API requests. See
   755  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   756  	NullFields []string `json:"-"`
   757  }
   758  
   759  func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
   760  	type NoMethod SetIamPolicyRequest
   761  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   762  }
   763  
   764  // Status: The `Status` type defines a logical error model that is suitable for
   765  // different programming environments, including REST APIs and RPC APIs. It is
   766  // used by gRPC (https://github.com/grpc). Each `Status` message contains three
   767  // pieces of data: error code, error message, and error details. You can find
   768  // out more about this error model and how to work with it in the API Design
   769  // Guide (https://cloud.google.com/apis/design/errors).
   770  type Status struct {
   771  	// Code: The status code, which should be an enum value of google.rpc.Code.
   772  	Code int64 `json:"code,omitempty"`
   773  	// Details: A list of messages that carry the error details. There is a common
   774  	// set of message types for APIs to use.
   775  	Details []googleapi.RawMessage `json:"details,omitempty"`
   776  	// Message: A developer-facing error message, which should be in English. Any
   777  	// user-facing error message should be localized and sent in the
   778  	// google.rpc.Status.details field, or localized by the client.
   779  	Message string `json:"message,omitempty"`
   780  	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
   781  	// include in API requests. By default, fields with empty or default values are
   782  	// omitted from API requests. See
   783  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   784  	// details.
   785  	ForceSendFields []string `json:"-"`
   786  	// NullFields is a list of field names (e.g. "Code") to include in API requests
   787  	// with the JSON null value. By default, fields with empty values are omitted
   788  	// from API requests. See
   789  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   790  	NullFields []string `json:"-"`
   791  }
   792  
   793  func (s *Status) MarshalJSON() ([]byte, error) {
   794  	type NoMethod Status
   795  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   796  }
   797  
   798  // SyncRepoMetadata: Metadata of SyncRepo. This message is in the metadata
   799  // field of Operation.
   800  type SyncRepoMetadata struct {
   801  	// Name: The name of the repo being synchronized. Values are of the form
   802  	// `projects//repos/`.
   803  	Name string `json:"name,omitempty"`
   804  	// StartTime: The time this operation is started.
   805  	StartTime string `json:"startTime,omitempty"`
   806  	// StatusMessage: The latest status message on syncing the repository.
   807  	StatusMessage string `json:"statusMessage,omitempty"`
   808  	// UpdateTime: The time this operation's status message is updated.
   809  	UpdateTime string `json:"updateTime,omitempty"`
   810  	// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
   811  	// include in API requests. By default, fields with empty or default values are
   812  	// omitted from API requests. See
   813  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   814  	// details.
   815  	ForceSendFields []string `json:"-"`
   816  	// NullFields is a list of field names (e.g. "Name") to include in API requests
   817  	// with the JSON null value. By default, fields with empty values are omitted
   818  	// from API requests. See
   819  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   820  	NullFields []string `json:"-"`
   821  }
   822  
   823  func (s *SyncRepoMetadata) MarshalJSON() ([]byte, error) {
   824  	type NoMethod SyncRepoMetadata
   825  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   826  }
   827  
   828  // SyncRepoRequest: Request for SyncRepo.
   829  type SyncRepoRequest struct {
   830  }
   831  
   832  // TestIamPermissionsRequest: Request message for `TestIamPermissions` method.
   833  type TestIamPermissionsRequest struct {
   834  	// Permissions: The set of permissions to check for the `resource`. Permissions
   835  	// with wildcards (such as `*` or `storage.*`) are not allowed. For more
   836  	// information see IAM Overview
   837  	// (https://cloud.google.com/iam/docs/overview#permissions).
   838  	Permissions []string `json:"permissions,omitempty"`
   839  	// ForceSendFields is a list of field names (e.g. "Permissions") to
   840  	// unconditionally include in API requests. By default, fields with empty or
   841  	// default values are omitted from API requests. See
   842  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   843  	// details.
   844  	ForceSendFields []string `json:"-"`
   845  	// NullFields is a list of field names (e.g. "Permissions") to include in API
   846  	// requests with the JSON null value. By default, fields with empty values are
   847  	// omitted from API requests. See
   848  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   849  	NullFields []string `json:"-"`
   850  }
   851  
   852  func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
   853  	type NoMethod TestIamPermissionsRequest
   854  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   855  }
   856  
   857  // TestIamPermissionsResponse: Response message for `TestIamPermissions`
   858  // method.
   859  type TestIamPermissionsResponse struct {
   860  	// Permissions: A subset of `TestPermissionsRequest.permissions` that the
   861  	// caller is allowed.
   862  	Permissions []string `json:"permissions,omitempty"`
   863  
   864  	// ServerResponse contains the HTTP response code and headers from the server.
   865  	googleapi.ServerResponse `json:"-"`
   866  	// ForceSendFields is a list of field names (e.g. "Permissions") to
   867  	// unconditionally include in API requests. By default, fields with empty or
   868  	// default values are omitted from API requests. See
   869  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   870  	// details.
   871  	ForceSendFields []string `json:"-"`
   872  	// NullFields is a list of field names (e.g. "Permissions") to include in API
   873  	// requests with the JSON null value. By default, fields with empty values are
   874  	// omitted from API requests. See
   875  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   876  	NullFields []string `json:"-"`
   877  }
   878  
   879  func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
   880  	type NoMethod TestIamPermissionsResponse
   881  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   882  }
   883  
   884  // UpdateProjectConfigRequest: Request for UpdateProjectConfig.
   885  type UpdateProjectConfigRequest struct {
   886  	// ProjectConfig: The new configuration for the project.
   887  	ProjectConfig *ProjectConfig `json:"projectConfig,omitempty"`
   888  	// UpdateMask: A FieldMask specifying which fields of the project_config to
   889  	// modify. Only the fields in the mask will be modified. If no mask is
   890  	// provided, this request is no-op.
   891  	UpdateMask string `json:"updateMask,omitempty"`
   892  	// ForceSendFields is a list of field names (e.g. "ProjectConfig") to
   893  	// unconditionally include in API requests. By default, fields with empty or
   894  	// default values are omitted from API requests. See
   895  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   896  	// details.
   897  	ForceSendFields []string `json:"-"`
   898  	// NullFields is a list of field names (e.g. "ProjectConfig") to include in API
   899  	// requests with the JSON null value. By default, fields with empty values are
   900  	// omitted from API requests. See
   901  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   902  	NullFields []string `json:"-"`
   903  }
   904  
   905  func (s *UpdateProjectConfigRequest) MarshalJSON() ([]byte, error) {
   906  	type NoMethod UpdateProjectConfigRequest
   907  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   908  }
   909  
   910  // UpdateRepoRequest: Request for UpdateRepo.
   911  type UpdateRepoRequest struct {
   912  	// Repo: The new configuration for the repository.
   913  	Repo *Repo `json:"repo,omitempty"`
   914  	// UpdateMask: A FieldMask specifying which fields of the repo to modify. Only
   915  	// the fields in the mask will be modified. If no mask is provided, this
   916  	// request is no-op.
   917  	UpdateMask string `json:"updateMask,omitempty"`
   918  	// ForceSendFields is a list of field names (e.g. "Repo") to unconditionally
   919  	// include in API requests. By default, fields with empty or default values are
   920  	// omitted from API requests. See
   921  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   922  	// details.
   923  	ForceSendFields []string `json:"-"`
   924  	// NullFields is a list of field names (e.g. "Repo") to include in API requests
   925  	// with the JSON null value. By default, fields with empty values are omitted
   926  	// from API requests. See
   927  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   928  	NullFields []string `json:"-"`
   929  }
   930  
   931  func (s *UpdateRepoRequest) MarshalJSON() ([]byte, error) {
   932  	type NoMethod UpdateRepoRequest
   933  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   934  }
   935  
   936  type ProjectsGetConfigCall struct {
   937  	s            *Service
   938  	name         string
   939  	urlParams_   gensupport.URLParams
   940  	ifNoneMatch_ string
   941  	ctx_         context.Context
   942  	header_      http.Header
   943  }
   944  
   945  // GetConfig: Returns the Cloud Source Repositories configuration of the
   946  // project.
   947  //
   948  //   - name: The name of the requested project. Values are of the form
   949  //     `projects/`.
   950  func (r *ProjectsService) GetConfig(name string) *ProjectsGetConfigCall {
   951  	c := &ProjectsGetConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   952  	c.name = name
   953  	return c
   954  }
   955  
   956  // Fields allows partial responses to be retrieved. See
   957  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   958  // details.
   959  func (c *ProjectsGetConfigCall) Fields(s ...googleapi.Field) *ProjectsGetConfigCall {
   960  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   961  	return c
   962  }
   963  
   964  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   965  // object's ETag matches the given value. This is useful for getting updates
   966  // only after the object has changed since the last request.
   967  func (c *ProjectsGetConfigCall) IfNoneMatch(entityTag string) *ProjectsGetConfigCall {
   968  	c.ifNoneMatch_ = entityTag
   969  	return c
   970  }
   971  
   972  // Context sets the context to be used in this call's Do method.
   973  func (c *ProjectsGetConfigCall) Context(ctx context.Context) *ProjectsGetConfigCall {
   974  	c.ctx_ = ctx
   975  	return c
   976  }
   977  
   978  // Header returns a http.Header that can be modified by the caller to add
   979  // headers to the request.
   980  func (c *ProjectsGetConfigCall) Header() http.Header {
   981  	if c.header_ == nil {
   982  		c.header_ = make(http.Header)
   983  	}
   984  	return c.header_
   985  }
   986  
   987  func (c *ProjectsGetConfigCall) doRequest(alt string) (*http.Response, error) {
   988  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   989  	if c.ifNoneMatch_ != "" {
   990  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   991  	}
   992  	var body io.Reader = nil
   993  	c.urlParams_.Set("alt", alt)
   994  	c.urlParams_.Set("prettyPrint", "false")
   995  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/config")
   996  	urls += "?" + c.urlParams_.Encode()
   997  	req, err := http.NewRequest("GET", urls, body)
   998  	if err != nil {
   999  		return nil, err
  1000  	}
  1001  	req.Header = reqHeaders
  1002  	googleapi.Expand(req.URL, map[string]string{
  1003  		"name": c.name,
  1004  	})
  1005  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1006  }
  1007  
  1008  // Do executes the "sourcerepo.projects.getConfig" call.
  1009  // Any non-2xx status code is an error. Response headers are in either
  1010  // *ProjectConfig.ServerResponse.Header or (if a response was returned at all)
  1011  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1012  // whether the returned error was because http.StatusNotModified was returned.
  1013  func (c *ProjectsGetConfigCall) Do(opts ...googleapi.CallOption) (*ProjectConfig, error) {
  1014  	gensupport.SetOptions(c.urlParams_, opts...)
  1015  	res, err := c.doRequest("json")
  1016  	if res != nil && res.StatusCode == http.StatusNotModified {
  1017  		if res.Body != nil {
  1018  			res.Body.Close()
  1019  		}
  1020  		return nil, gensupport.WrapError(&googleapi.Error{
  1021  			Code:   res.StatusCode,
  1022  			Header: res.Header,
  1023  		})
  1024  	}
  1025  	if err != nil {
  1026  		return nil, err
  1027  	}
  1028  	defer googleapi.CloseBody(res)
  1029  	if err := googleapi.CheckResponse(res); err != nil {
  1030  		return nil, gensupport.WrapError(err)
  1031  	}
  1032  	ret := &ProjectConfig{
  1033  		ServerResponse: googleapi.ServerResponse{
  1034  			Header:         res.Header,
  1035  			HTTPStatusCode: res.StatusCode,
  1036  		},
  1037  	}
  1038  	target := &ret
  1039  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1040  		return nil, err
  1041  	}
  1042  	return ret, nil
  1043  }
  1044  
  1045  type ProjectsUpdateConfigCall struct {
  1046  	s                          *Service
  1047  	name                       string
  1048  	updateprojectconfigrequest *UpdateProjectConfigRequest
  1049  	urlParams_                 gensupport.URLParams
  1050  	ctx_                       context.Context
  1051  	header_                    http.Header
  1052  }
  1053  
  1054  // UpdateConfig: Updates the Cloud Source Repositories configuration of the
  1055  // project.
  1056  //
  1057  //   - name: The name of the requested project. Values are of the form
  1058  //     `projects/`.
  1059  func (r *ProjectsService) UpdateConfig(name string, updateprojectconfigrequest *UpdateProjectConfigRequest) *ProjectsUpdateConfigCall {
  1060  	c := &ProjectsUpdateConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1061  	c.name = name
  1062  	c.updateprojectconfigrequest = updateprojectconfigrequest
  1063  	return c
  1064  }
  1065  
  1066  // Fields allows partial responses to be retrieved. See
  1067  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1068  // details.
  1069  func (c *ProjectsUpdateConfigCall) Fields(s ...googleapi.Field) *ProjectsUpdateConfigCall {
  1070  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1071  	return c
  1072  }
  1073  
  1074  // Context sets the context to be used in this call's Do method.
  1075  func (c *ProjectsUpdateConfigCall) Context(ctx context.Context) *ProjectsUpdateConfigCall {
  1076  	c.ctx_ = ctx
  1077  	return c
  1078  }
  1079  
  1080  // Header returns a http.Header that can be modified by the caller to add
  1081  // headers to the request.
  1082  func (c *ProjectsUpdateConfigCall) Header() http.Header {
  1083  	if c.header_ == nil {
  1084  		c.header_ = make(http.Header)
  1085  	}
  1086  	return c.header_
  1087  }
  1088  
  1089  func (c *ProjectsUpdateConfigCall) doRequest(alt string) (*http.Response, error) {
  1090  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1091  	var body io.Reader = nil
  1092  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.updateprojectconfigrequest)
  1093  	if err != nil {
  1094  		return nil, err
  1095  	}
  1096  	c.urlParams_.Set("alt", alt)
  1097  	c.urlParams_.Set("prettyPrint", "false")
  1098  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/config")
  1099  	urls += "?" + c.urlParams_.Encode()
  1100  	req, err := http.NewRequest("PATCH", urls, body)
  1101  	if err != nil {
  1102  		return nil, err
  1103  	}
  1104  	req.Header = reqHeaders
  1105  	googleapi.Expand(req.URL, map[string]string{
  1106  		"name": c.name,
  1107  	})
  1108  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1109  }
  1110  
  1111  // Do executes the "sourcerepo.projects.updateConfig" call.
  1112  // Any non-2xx status code is an error. Response headers are in either
  1113  // *ProjectConfig.ServerResponse.Header or (if a response was returned at all)
  1114  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1115  // whether the returned error was because http.StatusNotModified was returned.
  1116  func (c *ProjectsUpdateConfigCall) Do(opts ...googleapi.CallOption) (*ProjectConfig, error) {
  1117  	gensupport.SetOptions(c.urlParams_, opts...)
  1118  	res, err := c.doRequest("json")
  1119  	if res != nil && res.StatusCode == http.StatusNotModified {
  1120  		if res.Body != nil {
  1121  			res.Body.Close()
  1122  		}
  1123  		return nil, gensupport.WrapError(&googleapi.Error{
  1124  			Code:   res.StatusCode,
  1125  			Header: res.Header,
  1126  		})
  1127  	}
  1128  	if err != nil {
  1129  		return nil, err
  1130  	}
  1131  	defer googleapi.CloseBody(res)
  1132  	if err := googleapi.CheckResponse(res); err != nil {
  1133  		return nil, gensupport.WrapError(err)
  1134  	}
  1135  	ret := &ProjectConfig{
  1136  		ServerResponse: googleapi.ServerResponse{
  1137  			Header:         res.Header,
  1138  			HTTPStatusCode: res.StatusCode,
  1139  		},
  1140  	}
  1141  	target := &ret
  1142  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1143  		return nil, err
  1144  	}
  1145  	return ret, nil
  1146  }
  1147  
  1148  type ProjectsReposCreateCall struct {
  1149  	s          *Service
  1150  	parent     string
  1151  	repo       *Repo
  1152  	urlParams_ gensupport.URLParams
  1153  	ctx_       context.Context
  1154  	header_    http.Header
  1155  }
  1156  
  1157  // Create: Creates a repo in the given project with the given name. If the
  1158  // named repository already exists, `CreateRepo` returns `ALREADY_EXISTS`.
  1159  //
  1160  //   - parent: The project in which to create the repo. Values are of the form
  1161  //     `projects/`.
  1162  func (r *ProjectsReposService) Create(parent string, repo *Repo) *ProjectsReposCreateCall {
  1163  	c := &ProjectsReposCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1164  	c.parent = parent
  1165  	c.repo = repo
  1166  	return c
  1167  }
  1168  
  1169  // Fields allows partial responses to be retrieved. See
  1170  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1171  // details.
  1172  func (c *ProjectsReposCreateCall) Fields(s ...googleapi.Field) *ProjectsReposCreateCall {
  1173  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1174  	return c
  1175  }
  1176  
  1177  // Context sets the context to be used in this call's Do method.
  1178  func (c *ProjectsReposCreateCall) Context(ctx context.Context) *ProjectsReposCreateCall {
  1179  	c.ctx_ = ctx
  1180  	return c
  1181  }
  1182  
  1183  // Header returns a http.Header that can be modified by the caller to add
  1184  // headers to the request.
  1185  func (c *ProjectsReposCreateCall) Header() http.Header {
  1186  	if c.header_ == nil {
  1187  		c.header_ = make(http.Header)
  1188  	}
  1189  	return c.header_
  1190  }
  1191  
  1192  func (c *ProjectsReposCreateCall) doRequest(alt string) (*http.Response, error) {
  1193  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1194  	var body io.Reader = nil
  1195  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.repo)
  1196  	if err != nil {
  1197  		return nil, err
  1198  	}
  1199  	c.urlParams_.Set("alt", alt)
  1200  	c.urlParams_.Set("prettyPrint", "false")
  1201  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/repos")
  1202  	urls += "?" + c.urlParams_.Encode()
  1203  	req, err := http.NewRequest("POST", urls, body)
  1204  	if err != nil {
  1205  		return nil, err
  1206  	}
  1207  	req.Header = reqHeaders
  1208  	googleapi.Expand(req.URL, map[string]string{
  1209  		"parent": c.parent,
  1210  	})
  1211  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1212  }
  1213  
  1214  // Do executes the "sourcerepo.projects.repos.create" call.
  1215  // Any non-2xx status code is an error. Response headers are in either
  1216  // *Repo.ServerResponse.Header or (if a response was returned at all) in
  1217  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1218  // whether the returned error was because http.StatusNotModified was returned.
  1219  func (c *ProjectsReposCreateCall) Do(opts ...googleapi.CallOption) (*Repo, error) {
  1220  	gensupport.SetOptions(c.urlParams_, opts...)
  1221  	res, err := c.doRequest("json")
  1222  	if res != nil && res.StatusCode == http.StatusNotModified {
  1223  		if res.Body != nil {
  1224  			res.Body.Close()
  1225  		}
  1226  		return nil, gensupport.WrapError(&googleapi.Error{
  1227  			Code:   res.StatusCode,
  1228  			Header: res.Header,
  1229  		})
  1230  	}
  1231  	if err != nil {
  1232  		return nil, err
  1233  	}
  1234  	defer googleapi.CloseBody(res)
  1235  	if err := googleapi.CheckResponse(res); err != nil {
  1236  		return nil, gensupport.WrapError(err)
  1237  	}
  1238  	ret := &Repo{
  1239  		ServerResponse: googleapi.ServerResponse{
  1240  			Header:         res.Header,
  1241  			HTTPStatusCode: res.StatusCode,
  1242  		},
  1243  	}
  1244  	target := &ret
  1245  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1246  		return nil, err
  1247  	}
  1248  	return ret, nil
  1249  }
  1250  
  1251  type ProjectsReposDeleteCall struct {
  1252  	s          *Service
  1253  	name       string
  1254  	urlParams_ gensupport.URLParams
  1255  	ctx_       context.Context
  1256  	header_    http.Header
  1257  }
  1258  
  1259  // Delete: Deletes a repo.
  1260  //
  1261  //   - name: The name of the repo to delete. Values are of the form
  1262  //     `projects//repos/`.
  1263  func (r *ProjectsReposService) Delete(name string) *ProjectsReposDeleteCall {
  1264  	c := &ProjectsReposDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1265  	c.name = name
  1266  	return c
  1267  }
  1268  
  1269  // Fields allows partial responses to be retrieved. See
  1270  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1271  // details.
  1272  func (c *ProjectsReposDeleteCall) Fields(s ...googleapi.Field) *ProjectsReposDeleteCall {
  1273  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1274  	return c
  1275  }
  1276  
  1277  // Context sets the context to be used in this call's Do method.
  1278  func (c *ProjectsReposDeleteCall) Context(ctx context.Context) *ProjectsReposDeleteCall {
  1279  	c.ctx_ = ctx
  1280  	return c
  1281  }
  1282  
  1283  // Header returns a http.Header that can be modified by the caller to add
  1284  // headers to the request.
  1285  func (c *ProjectsReposDeleteCall) Header() http.Header {
  1286  	if c.header_ == nil {
  1287  		c.header_ = make(http.Header)
  1288  	}
  1289  	return c.header_
  1290  }
  1291  
  1292  func (c *ProjectsReposDeleteCall) doRequest(alt string) (*http.Response, error) {
  1293  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1294  	var body io.Reader = nil
  1295  	c.urlParams_.Set("alt", alt)
  1296  	c.urlParams_.Set("prettyPrint", "false")
  1297  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1298  	urls += "?" + c.urlParams_.Encode()
  1299  	req, err := http.NewRequest("DELETE", urls, body)
  1300  	if err != nil {
  1301  		return nil, err
  1302  	}
  1303  	req.Header = reqHeaders
  1304  	googleapi.Expand(req.URL, map[string]string{
  1305  		"name": c.name,
  1306  	})
  1307  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1308  }
  1309  
  1310  // Do executes the "sourcerepo.projects.repos.delete" call.
  1311  // Any non-2xx status code is an error. Response headers are in either
  1312  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1313  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1314  // whether the returned error was because http.StatusNotModified was returned.
  1315  func (c *ProjectsReposDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1316  	gensupport.SetOptions(c.urlParams_, opts...)
  1317  	res, err := c.doRequest("json")
  1318  	if res != nil && res.StatusCode == http.StatusNotModified {
  1319  		if res.Body != nil {
  1320  			res.Body.Close()
  1321  		}
  1322  		return nil, gensupport.WrapError(&googleapi.Error{
  1323  			Code:   res.StatusCode,
  1324  			Header: res.Header,
  1325  		})
  1326  	}
  1327  	if err != nil {
  1328  		return nil, err
  1329  	}
  1330  	defer googleapi.CloseBody(res)
  1331  	if err := googleapi.CheckResponse(res); err != nil {
  1332  		return nil, gensupport.WrapError(err)
  1333  	}
  1334  	ret := &Empty{
  1335  		ServerResponse: googleapi.ServerResponse{
  1336  			Header:         res.Header,
  1337  			HTTPStatusCode: res.StatusCode,
  1338  		},
  1339  	}
  1340  	target := &ret
  1341  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1342  		return nil, err
  1343  	}
  1344  	return ret, nil
  1345  }
  1346  
  1347  type ProjectsReposGetCall struct {
  1348  	s            *Service
  1349  	name         string
  1350  	urlParams_   gensupport.URLParams
  1351  	ifNoneMatch_ string
  1352  	ctx_         context.Context
  1353  	header_      http.Header
  1354  }
  1355  
  1356  // Get: Returns information about a repo.
  1357  //
  1358  //   - name: The name of the requested repository. Values are of the form
  1359  //     `projects//repos/`.
  1360  func (r *ProjectsReposService) Get(name string) *ProjectsReposGetCall {
  1361  	c := &ProjectsReposGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1362  	c.name = name
  1363  	return c
  1364  }
  1365  
  1366  // Fields allows partial responses to be retrieved. See
  1367  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1368  // details.
  1369  func (c *ProjectsReposGetCall) Fields(s ...googleapi.Field) *ProjectsReposGetCall {
  1370  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1371  	return c
  1372  }
  1373  
  1374  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1375  // object's ETag matches the given value. This is useful for getting updates
  1376  // only after the object has changed since the last request.
  1377  func (c *ProjectsReposGetCall) IfNoneMatch(entityTag string) *ProjectsReposGetCall {
  1378  	c.ifNoneMatch_ = entityTag
  1379  	return c
  1380  }
  1381  
  1382  // Context sets the context to be used in this call's Do method.
  1383  func (c *ProjectsReposGetCall) Context(ctx context.Context) *ProjectsReposGetCall {
  1384  	c.ctx_ = ctx
  1385  	return c
  1386  }
  1387  
  1388  // Header returns a http.Header that can be modified by the caller to add
  1389  // headers to the request.
  1390  func (c *ProjectsReposGetCall) Header() http.Header {
  1391  	if c.header_ == nil {
  1392  		c.header_ = make(http.Header)
  1393  	}
  1394  	return c.header_
  1395  }
  1396  
  1397  func (c *ProjectsReposGetCall) doRequest(alt string) (*http.Response, error) {
  1398  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1399  	if c.ifNoneMatch_ != "" {
  1400  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1401  	}
  1402  	var body io.Reader = nil
  1403  	c.urlParams_.Set("alt", alt)
  1404  	c.urlParams_.Set("prettyPrint", "false")
  1405  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1406  	urls += "?" + c.urlParams_.Encode()
  1407  	req, err := http.NewRequest("GET", urls, body)
  1408  	if err != nil {
  1409  		return nil, err
  1410  	}
  1411  	req.Header = reqHeaders
  1412  	googleapi.Expand(req.URL, map[string]string{
  1413  		"name": c.name,
  1414  	})
  1415  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1416  }
  1417  
  1418  // Do executes the "sourcerepo.projects.repos.get" call.
  1419  // Any non-2xx status code is an error. Response headers are in either
  1420  // *Repo.ServerResponse.Header or (if a response was returned at all) in
  1421  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1422  // whether the returned error was because http.StatusNotModified was returned.
  1423  func (c *ProjectsReposGetCall) Do(opts ...googleapi.CallOption) (*Repo, error) {
  1424  	gensupport.SetOptions(c.urlParams_, opts...)
  1425  	res, err := c.doRequest("json")
  1426  	if res != nil && res.StatusCode == http.StatusNotModified {
  1427  		if res.Body != nil {
  1428  			res.Body.Close()
  1429  		}
  1430  		return nil, gensupport.WrapError(&googleapi.Error{
  1431  			Code:   res.StatusCode,
  1432  			Header: res.Header,
  1433  		})
  1434  	}
  1435  	if err != nil {
  1436  		return nil, err
  1437  	}
  1438  	defer googleapi.CloseBody(res)
  1439  	if err := googleapi.CheckResponse(res); err != nil {
  1440  		return nil, gensupport.WrapError(err)
  1441  	}
  1442  	ret := &Repo{
  1443  		ServerResponse: googleapi.ServerResponse{
  1444  			Header:         res.Header,
  1445  			HTTPStatusCode: res.StatusCode,
  1446  		},
  1447  	}
  1448  	target := &ret
  1449  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1450  		return nil, err
  1451  	}
  1452  	return ret, nil
  1453  }
  1454  
  1455  type ProjectsReposGetIamPolicyCall struct {
  1456  	s            *Service
  1457  	resource     string
  1458  	urlParams_   gensupport.URLParams
  1459  	ifNoneMatch_ string
  1460  	ctx_         context.Context
  1461  	header_      http.Header
  1462  }
  1463  
  1464  // GetIamPolicy: Gets the IAM policy policy for a resource. Returns an empty
  1465  // policy if the resource exists and does not have a policy set.
  1466  //
  1467  //   - resource: REQUIRED: The resource for which the policy is being requested.
  1468  //     See Resource names (https://cloud.google.com/apis/design/resource_names)
  1469  //     for the appropriate value for this field.
  1470  func (r *ProjectsReposService) GetIamPolicy(resource string) *ProjectsReposGetIamPolicyCall {
  1471  	c := &ProjectsReposGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1472  	c.resource = resource
  1473  	return c
  1474  }
  1475  
  1476  // OptionsRequestedPolicyVersion sets the optional parameter
  1477  // "options.requestedPolicyVersion": The maximum policy version that will be
  1478  // used to format the policy. Valid values are 0, 1, and 3. Requests specifying
  1479  // an invalid value will be rejected. Requests for policies with any
  1480  // conditional role bindings must specify version 3. Policies with no
  1481  // conditional role bindings may specify any valid value or leave the field
  1482  // unset. The policy in the response might use the policy version that you
  1483  // specified, or it might use a lower policy version. For example, if you
  1484  // specify version 3, but the policy has no conditional role bindings, the
  1485  // response uses version 1. To learn which resources support conditions in
  1486  // their IAM policies, see the IAM documentation
  1487  // (https://cloud.google.com/iam/help/conditions/resource-policies).
  1488  func (c *ProjectsReposGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsReposGetIamPolicyCall {
  1489  	c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
  1490  	return c
  1491  }
  1492  
  1493  // Fields allows partial responses to be retrieved. See
  1494  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1495  // details.
  1496  func (c *ProjectsReposGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsReposGetIamPolicyCall {
  1497  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1498  	return c
  1499  }
  1500  
  1501  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1502  // object's ETag matches the given value. This is useful for getting updates
  1503  // only after the object has changed since the last request.
  1504  func (c *ProjectsReposGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsReposGetIamPolicyCall {
  1505  	c.ifNoneMatch_ = entityTag
  1506  	return c
  1507  }
  1508  
  1509  // Context sets the context to be used in this call's Do method.
  1510  func (c *ProjectsReposGetIamPolicyCall) Context(ctx context.Context) *ProjectsReposGetIamPolicyCall {
  1511  	c.ctx_ = ctx
  1512  	return c
  1513  }
  1514  
  1515  // Header returns a http.Header that can be modified by the caller to add
  1516  // headers to the request.
  1517  func (c *ProjectsReposGetIamPolicyCall) Header() http.Header {
  1518  	if c.header_ == nil {
  1519  		c.header_ = make(http.Header)
  1520  	}
  1521  	return c.header_
  1522  }
  1523  
  1524  func (c *ProjectsReposGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1525  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1526  	if c.ifNoneMatch_ != "" {
  1527  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1528  	}
  1529  	var body io.Reader = nil
  1530  	c.urlParams_.Set("alt", alt)
  1531  	c.urlParams_.Set("prettyPrint", "false")
  1532  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  1533  	urls += "?" + c.urlParams_.Encode()
  1534  	req, err := http.NewRequest("GET", urls, body)
  1535  	if err != nil {
  1536  		return nil, err
  1537  	}
  1538  	req.Header = reqHeaders
  1539  	googleapi.Expand(req.URL, map[string]string{
  1540  		"resource": c.resource,
  1541  	})
  1542  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1543  }
  1544  
  1545  // Do executes the "sourcerepo.projects.repos.getIamPolicy" call.
  1546  // Any non-2xx status code is an error. Response headers are in either
  1547  // *Policy.ServerResponse.Header or (if a response was returned at all) in
  1548  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1549  // whether the returned error was because http.StatusNotModified was returned.
  1550  func (c *ProjectsReposGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1551  	gensupport.SetOptions(c.urlParams_, opts...)
  1552  	res, err := c.doRequest("json")
  1553  	if res != nil && res.StatusCode == http.StatusNotModified {
  1554  		if res.Body != nil {
  1555  			res.Body.Close()
  1556  		}
  1557  		return nil, gensupport.WrapError(&googleapi.Error{
  1558  			Code:   res.StatusCode,
  1559  			Header: res.Header,
  1560  		})
  1561  	}
  1562  	if err != nil {
  1563  		return nil, err
  1564  	}
  1565  	defer googleapi.CloseBody(res)
  1566  	if err := googleapi.CheckResponse(res); err != nil {
  1567  		return nil, gensupport.WrapError(err)
  1568  	}
  1569  	ret := &Policy{
  1570  		ServerResponse: googleapi.ServerResponse{
  1571  			Header:         res.Header,
  1572  			HTTPStatusCode: res.StatusCode,
  1573  		},
  1574  	}
  1575  	target := &ret
  1576  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1577  		return nil, err
  1578  	}
  1579  	return ret, nil
  1580  }
  1581  
  1582  type ProjectsReposListCall struct {
  1583  	s            *Service
  1584  	name         string
  1585  	urlParams_   gensupport.URLParams
  1586  	ifNoneMatch_ string
  1587  	ctx_         context.Context
  1588  	header_      http.Header
  1589  }
  1590  
  1591  // List: Returns all repos belonging to a project. The sizes of the repos are
  1592  // not set by ListRepos. To get the size of a repo, use GetRepo.
  1593  //
  1594  //   - name: The project ID whose repos should be listed. Values are of the form
  1595  //     `projects/`.
  1596  func (r *ProjectsReposService) List(name string) *ProjectsReposListCall {
  1597  	c := &ProjectsReposListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1598  	c.name = name
  1599  	return c
  1600  }
  1601  
  1602  // PageSize sets the optional parameter "pageSize": Maximum number of
  1603  // repositories to return; between 1 and 500. If not set or zero, defaults to
  1604  // 100 at the server.
  1605  func (c *ProjectsReposListCall) PageSize(pageSize int64) *ProjectsReposListCall {
  1606  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1607  	return c
  1608  }
  1609  
  1610  // PageToken sets the optional parameter "pageToken": Resume listing
  1611  // repositories where a prior ListReposResponse left off. This is an opaque
  1612  // token that must be obtained from a recent, prior ListReposResponse's
  1613  // next_page_token field.
  1614  func (c *ProjectsReposListCall) PageToken(pageToken string) *ProjectsReposListCall {
  1615  	c.urlParams_.Set("pageToken", pageToken)
  1616  	return c
  1617  }
  1618  
  1619  // Fields allows partial responses to be retrieved. See
  1620  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1621  // details.
  1622  func (c *ProjectsReposListCall) Fields(s ...googleapi.Field) *ProjectsReposListCall {
  1623  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1624  	return c
  1625  }
  1626  
  1627  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1628  // object's ETag matches the given value. This is useful for getting updates
  1629  // only after the object has changed since the last request.
  1630  func (c *ProjectsReposListCall) IfNoneMatch(entityTag string) *ProjectsReposListCall {
  1631  	c.ifNoneMatch_ = entityTag
  1632  	return c
  1633  }
  1634  
  1635  // Context sets the context to be used in this call's Do method.
  1636  func (c *ProjectsReposListCall) Context(ctx context.Context) *ProjectsReposListCall {
  1637  	c.ctx_ = ctx
  1638  	return c
  1639  }
  1640  
  1641  // Header returns a http.Header that can be modified by the caller to add
  1642  // headers to the request.
  1643  func (c *ProjectsReposListCall) Header() http.Header {
  1644  	if c.header_ == nil {
  1645  		c.header_ = make(http.Header)
  1646  	}
  1647  	return c.header_
  1648  }
  1649  
  1650  func (c *ProjectsReposListCall) doRequest(alt string) (*http.Response, error) {
  1651  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1652  	if c.ifNoneMatch_ != "" {
  1653  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1654  	}
  1655  	var body io.Reader = nil
  1656  	c.urlParams_.Set("alt", alt)
  1657  	c.urlParams_.Set("prettyPrint", "false")
  1658  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/repos")
  1659  	urls += "?" + c.urlParams_.Encode()
  1660  	req, err := http.NewRequest("GET", urls, body)
  1661  	if err != nil {
  1662  		return nil, err
  1663  	}
  1664  	req.Header = reqHeaders
  1665  	googleapi.Expand(req.URL, map[string]string{
  1666  		"name": c.name,
  1667  	})
  1668  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1669  }
  1670  
  1671  // Do executes the "sourcerepo.projects.repos.list" call.
  1672  // Any non-2xx status code is an error. Response headers are in either
  1673  // *ListReposResponse.ServerResponse.Header or (if a response was returned at
  1674  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1675  // check whether the returned error was because http.StatusNotModified was
  1676  // returned.
  1677  func (c *ProjectsReposListCall) Do(opts ...googleapi.CallOption) (*ListReposResponse, error) {
  1678  	gensupport.SetOptions(c.urlParams_, opts...)
  1679  	res, err := c.doRequest("json")
  1680  	if res != nil && res.StatusCode == http.StatusNotModified {
  1681  		if res.Body != nil {
  1682  			res.Body.Close()
  1683  		}
  1684  		return nil, gensupport.WrapError(&googleapi.Error{
  1685  			Code:   res.StatusCode,
  1686  			Header: res.Header,
  1687  		})
  1688  	}
  1689  	if err != nil {
  1690  		return nil, err
  1691  	}
  1692  	defer googleapi.CloseBody(res)
  1693  	if err := googleapi.CheckResponse(res); err != nil {
  1694  		return nil, gensupport.WrapError(err)
  1695  	}
  1696  	ret := &ListReposResponse{
  1697  		ServerResponse: googleapi.ServerResponse{
  1698  			Header:         res.Header,
  1699  			HTTPStatusCode: res.StatusCode,
  1700  		},
  1701  	}
  1702  	target := &ret
  1703  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1704  		return nil, err
  1705  	}
  1706  	return ret, nil
  1707  }
  1708  
  1709  // Pages invokes f for each page of results.
  1710  // A non-nil error returned from f will halt the iteration.
  1711  // The provided context supersedes any context provided to the Context method.
  1712  func (c *ProjectsReposListCall) Pages(ctx context.Context, f func(*ListReposResponse) error) error {
  1713  	c.ctx_ = ctx
  1714  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1715  	for {
  1716  		x, err := c.Do()
  1717  		if err != nil {
  1718  			return err
  1719  		}
  1720  		if err := f(x); err != nil {
  1721  			return err
  1722  		}
  1723  		if x.NextPageToken == "" {
  1724  			return nil
  1725  		}
  1726  		c.PageToken(x.NextPageToken)
  1727  	}
  1728  }
  1729  
  1730  type ProjectsReposPatchCall struct {
  1731  	s                 *Service
  1732  	name              string
  1733  	updatereporequest *UpdateRepoRequest
  1734  	urlParams_        gensupport.URLParams
  1735  	ctx_              context.Context
  1736  	header_           http.Header
  1737  }
  1738  
  1739  // Patch: Updates information about a repo.
  1740  //
  1741  //   - name: The name of the requested repository. Values are of the form
  1742  //     `projects//repos/`.
  1743  func (r *ProjectsReposService) Patch(name string, updatereporequest *UpdateRepoRequest) *ProjectsReposPatchCall {
  1744  	c := &ProjectsReposPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1745  	c.name = name
  1746  	c.updatereporequest = updatereporequest
  1747  	return c
  1748  }
  1749  
  1750  // Fields allows partial responses to be retrieved. See
  1751  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1752  // details.
  1753  func (c *ProjectsReposPatchCall) Fields(s ...googleapi.Field) *ProjectsReposPatchCall {
  1754  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1755  	return c
  1756  }
  1757  
  1758  // Context sets the context to be used in this call's Do method.
  1759  func (c *ProjectsReposPatchCall) Context(ctx context.Context) *ProjectsReposPatchCall {
  1760  	c.ctx_ = ctx
  1761  	return c
  1762  }
  1763  
  1764  // Header returns a http.Header that can be modified by the caller to add
  1765  // headers to the request.
  1766  func (c *ProjectsReposPatchCall) Header() http.Header {
  1767  	if c.header_ == nil {
  1768  		c.header_ = make(http.Header)
  1769  	}
  1770  	return c.header_
  1771  }
  1772  
  1773  func (c *ProjectsReposPatchCall) doRequest(alt string) (*http.Response, error) {
  1774  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1775  	var body io.Reader = nil
  1776  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatereporequest)
  1777  	if err != nil {
  1778  		return nil, err
  1779  	}
  1780  	c.urlParams_.Set("alt", alt)
  1781  	c.urlParams_.Set("prettyPrint", "false")
  1782  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1783  	urls += "?" + c.urlParams_.Encode()
  1784  	req, err := http.NewRequest("PATCH", urls, body)
  1785  	if err != nil {
  1786  		return nil, err
  1787  	}
  1788  	req.Header = reqHeaders
  1789  	googleapi.Expand(req.URL, map[string]string{
  1790  		"name": c.name,
  1791  	})
  1792  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1793  }
  1794  
  1795  // Do executes the "sourcerepo.projects.repos.patch" call.
  1796  // Any non-2xx status code is an error. Response headers are in either
  1797  // *Repo.ServerResponse.Header or (if a response was returned at all) in
  1798  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1799  // whether the returned error was because http.StatusNotModified was returned.
  1800  func (c *ProjectsReposPatchCall) Do(opts ...googleapi.CallOption) (*Repo, error) {
  1801  	gensupport.SetOptions(c.urlParams_, opts...)
  1802  	res, err := c.doRequest("json")
  1803  	if res != nil && res.StatusCode == http.StatusNotModified {
  1804  		if res.Body != nil {
  1805  			res.Body.Close()
  1806  		}
  1807  		return nil, gensupport.WrapError(&googleapi.Error{
  1808  			Code:   res.StatusCode,
  1809  			Header: res.Header,
  1810  		})
  1811  	}
  1812  	if err != nil {
  1813  		return nil, err
  1814  	}
  1815  	defer googleapi.CloseBody(res)
  1816  	if err := googleapi.CheckResponse(res); err != nil {
  1817  		return nil, gensupport.WrapError(err)
  1818  	}
  1819  	ret := &Repo{
  1820  		ServerResponse: googleapi.ServerResponse{
  1821  			Header:         res.Header,
  1822  			HTTPStatusCode: res.StatusCode,
  1823  		},
  1824  	}
  1825  	target := &ret
  1826  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1827  		return nil, err
  1828  	}
  1829  	return ret, nil
  1830  }
  1831  
  1832  type ProjectsReposSetIamPolicyCall struct {
  1833  	s                   *Service
  1834  	resource            string
  1835  	setiampolicyrequest *SetIamPolicyRequest
  1836  	urlParams_          gensupport.URLParams
  1837  	ctx_                context.Context
  1838  	header_             http.Header
  1839  }
  1840  
  1841  // SetIamPolicy: Sets the IAM policy on the specified resource. Replaces any
  1842  // existing policy.
  1843  //
  1844  //   - resource: REQUIRED: The resource for which the policy is being specified.
  1845  //     See Resource names (https://cloud.google.com/apis/design/resource_names)
  1846  //     for the appropriate value for this field.
  1847  func (r *ProjectsReposService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsReposSetIamPolicyCall {
  1848  	c := &ProjectsReposSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1849  	c.resource = resource
  1850  	c.setiampolicyrequest = setiampolicyrequest
  1851  	return c
  1852  }
  1853  
  1854  // Fields allows partial responses to be retrieved. See
  1855  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1856  // details.
  1857  func (c *ProjectsReposSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsReposSetIamPolicyCall {
  1858  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1859  	return c
  1860  }
  1861  
  1862  // Context sets the context to be used in this call's Do method.
  1863  func (c *ProjectsReposSetIamPolicyCall) Context(ctx context.Context) *ProjectsReposSetIamPolicyCall {
  1864  	c.ctx_ = ctx
  1865  	return c
  1866  }
  1867  
  1868  // Header returns a http.Header that can be modified by the caller to add
  1869  // headers to the request.
  1870  func (c *ProjectsReposSetIamPolicyCall) Header() http.Header {
  1871  	if c.header_ == nil {
  1872  		c.header_ = make(http.Header)
  1873  	}
  1874  	return c.header_
  1875  }
  1876  
  1877  func (c *ProjectsReposSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1878  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1879  	var body io.Reader = nil
  1880  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  1881  	if err != nil {
  1882  		return nil, err
  1883  	}
  1884  	c.urlParams_.Set("alt", alt)
  1885  	c.urlParams_.Set("prettyPrint", "false")
  1886  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  1887  	urls += "?" + c.urlParams_.Encode()
  1888  	req, err := http.NewRequest("POST", urls, body)
  1889  	if err != nil {
  1890  		return nil, err
  1891  	}
  1892  	req.Header = reqHeaders
  1893  	googleapi.Expand(req.URL, map[string]string{
  1894  		"resource": c.resource,
  1895  	})
  1896  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1897  }
  1898  
  1899  // Do executes the "sourcerepo.projects.repos.setIamPolicy" call.
  1900  // Any non-2xx status code is an error. Response headers are in either
  1901  // *Policy.ServerResponse.Header or (if a response was returned at all) in
  1902  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1903  // whether the returned error was because http.StatusNotModified was returned.
  1904  func (c *ProjectsReposSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1905  	gensupport.SetOptions(c.urlParams_, opts...)
  1906  	res, err := c.doRequest("json")
  1907  	if res != nil && res.StatusCode == http.StatusNotModified {
  1908  		if res.Body != nil {
  1909  			res.Body.Close()
  1910  		}
  1911  		return nil, gensupport.WrapError(&googleapi.Error{
  1912  			Code:   res.StatusCode,
  1913  			Header: res.Header,
  1914  		})
  1915  	}
  1916  	if err != nil {
  1917  		return nil, err
  1918  	}
  1919  	defer googleapi.CloseBody(res)
  1920  	if err := googleapi.CheckResponse(res); err != nil {
  1921  		return nil, gensupport.WrapError(err)
  1922  	}
  1923  	ret := &Policy{
  1924  		ServerResponse: googleapi.ServerResponse{
  1925  			Header:         res.Header,
  1926  			HTTPStatusCode: res.StatusCode,
  1927  		},
  1928  	}
  1929  	target := &ret
  1930  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1931  		return nil, err
  1932  	}
  1933  	return ret, nil
  1934  }
  1935  
  1936  type ProjectsReposSyncCall struct {
  1937  	s               *Service
  1938  	name            string
  1939  	syncreporequest *SyncRepoRequest
  1940  	urlParams_      gensupport.URLParams
  1941  	ctx_            context.Context
  1942  	header_         http.Header
  1943  }
  1944  
  1945  // Sync: Synchronize a connected repo. The response contains SyncRepoMetadata
  1946  // in the metadata field.
  1947  //
  1948  //   - name: The name of the repo to synchronize. Values are of the form
  1949  //     `projects//repos/`.
  1950  func (r *ProjectsReposService) Sync(name string, syncreporequest *SyncRepoRequest) *ProjectsReposSyncCall {
  1951  	c := &ProjectsReposSyncCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1952  	c.name = name
  1953  	c.syncreporequest = syncreporequest
  1954  	return c
  1955  }
  1956  
  1957  // Fields allows partial responses to be retrieved. See
  1958  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1959  // details.
  1960  func (c *ProjectsReposSyncCall) Fields(s ...googleapi.Field) *ProjectsReposSyncCall {
  1961  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1962  	return c
  1963  }
  1964  
  1965  // Context sets the context to be used in this call's Do method.
  1966  func (c *ProjectsReposSyncCall) Context(ctx context.Context) *ProjectsReposSyncCall {
  1967  	c.ctx_ = ctx
  1968  	return c
  1969  }
  1970  
  1971  // Header returns a http.Header that can be modified by the caller to add
  1972  // headers to the request.
  1973  func (c *ProjectsReposSyncCall) Header() http.Header {
  1974  	if c.header_ == nil {
  1975  		c.header_ = make(http.Header)
  1976  	}
  1977  	return c.header_
  1978  }
  1979  
  1980  func (c *ProjectsReposSyncCall) doRequest(alt string) (*http.Response, error) {
  1981  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1982  	var body io.Reader = nil
  1983  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.syncreporequest)
  1984  	if err != nil {
  1985  		return nil, err
  1986  	}
  1987  	c.urlParams_.Set("alt", alt)
  1988  	c.urlParams_.Set("prettyPrint", "false")
  1989  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:sync")
  1990  	urls += "?" + c.urlParams_.Encode()
  1991  	req, err := http.NewRequest("POST", urls, body)
  1992  	if err != nil {
  1993  		return nil, err
  1994  	}
  1995  	req.Header = reqHeaders
  1996  	googleapi.Expand(req.URL, map[string]string{
  1997  		"name": c.name,
  1998  	})
  1999  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2000  }
  2001  
  2002  // Do executes the "sourcerepo.projects.repos.sync" call.
  2003  // Any non-2xx status code is an error. Response headers are in either
  2004  // *Operation.ServerResponse.Header or (if a response was returned at all) in
  2005  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2006  // whether the returned error was because http.StatusNotModified was returned.
  2007  func (c *ProjectsReposSyncCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2008  	gensupport.SetOptions(c.urlParams_, opts...)
  2009  	res, err := c.doRequest("json")
  2010  	if res != nil && res.StatusCode == http.StatusNotModified {
  2011  		if res.Body != nil {
  2012  			res.Body.Close()
  2013  		}
  2014  		return nil, gensupport.WrapError(&googleapi.Error{
  2015  			Code:   res.StatusCode,
  2016  			Header: res.Header,
  2017  		})
  2018  	}
  2019  	if err != nil {
  2020  		return nil, err
  2021  	}
  2022  	defer googleapi.CloseBody(res)
  2023  	if err := googleapi.CheckResponse(res); err != nil {
  2024  		return nil, gensupport.WrapError(err)
  2025  	}
  2026  	ret := &Operation{
  2027  		ServerResponse: googleapi.ServerResponse{
  2028  			Header:         res.Header,
  2029  			HTTPStatusCode: res.StatusCode,
  2030  		},
  2031  	}
  2032  	target := &ret
  2033  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2034  		return nil, err
  2035  	}
  2036  	return ret, nil
  2037  }
  2038  
  2039  type ProjectsReposTestIamPermissionsCall struct {
  2040  	s                         *Service
  2041  	resource                  string
  2042  	testiampermissionsrequest *TestIamPermissionsRequest
  2043  	urlParams_                gensupport.URLParams
  2044  	ctx_                      context.Context
  2045  	header_                   http.Header
  2046  }
  2047  
  2048  // TestIamPermissions: Returns permissions that a caller has on the specified
  2049  // resource. If the resource does not exist, this will return an empty set of
  2050  // permissions, not a NOT_FOUND error.
  2051  //
  2052  //   - resource: REQUIRED: The resource for which the policy detail is being
  2053  //     requested. See Resource names
  2054  //     (https://cloud.google.com/apis/design/resource_names) for the appropriate
  2055  //     value for this field.
  2056  func (r *ProjectsReposService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsReposTestIamPermissionsCall {
  2057  	c := &ProjectsReposTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2058  	c.resource = resource
  2059  	c.testiampermissionsrequest = testiampermissionsrequest
  2060  	return c
  2061  }
  2062  
  2063  // Fields allows partial responses to be retrieved. See
  2064  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2065  // details.
  2066  func (c *ProjectsReposTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsReposTestIamPermissionsCall {
  2067  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2068  	return c
  2069  }
  2070  
  2071  // Context sets the context to be used in this call's Do method.
  2072  func (c *ProjectsReposTestIamPermissionsCall) Context(ctx context.Context) *ProjectsReposTestIamPermissionsCall {
  2073  	c.ctx_ = ctx
  2074  	return c
  2075  }
  2076  
  2077  // Header returns a http.Header that can be modified by the caller to add
  2078  // headers to the request.
  2079  func (c *ProjectsReposTestIamPermissionsCall) Header() http.Header {
  2080  	if c.header_ == nil {
  2081  		c.header_ = make(http.Header)
  2082  	}
  2083  	return c.header_
  2084  }
  2085  
  2086  func (c *ProjectsReposTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2087  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2088  	var body io.Reader = nil
  2089  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2090  	if err != nil {
  2091  		return nil, err
  2092  	}
  2093  	c.urlParams_.Set("alt", alt)
  2094  	c.urlParams_.Set("prettyPrint", "false")
  2095  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  2096  	urls += "?" + c.urlParams_.Encode()
  2097  	req, err := http.NewRequest("POST", urls, body)
  2098  	if err != nil {
  2099  		return nil, err
  2100  	}
  2101  	req.Header = reqHeaders
  2102  	googleapi.Expand(req.URL, map[string]string{
  2103  		"resource": c.resource,
  2104  	})
  2105  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2106  }
  2107  
  2108  // Do executes the "sourcerepo.projects.repos.testIamPermissions" call.
  2109  // Any non-2xx status code is an error. Response headers are in either
  2110  // *TestIamPermissionsResponse.ServerResponse.Header or (if a response was
  2111  // returned at all) in error.(*googleapi.Error).Header. Use
  2112  // googleapi.IsNotModified to check whether the returned error was because
  2113  // http.StatusNotModified was returned.
  2114  func (c *ProjectsReposTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2115  	gensupport.SetOptions(c.urlParams_, opts...)
  2116  	res, err := c.doRequest("json")
  2117  	if res != nil && res.StatusCode == http.StatusNotModified {
  2118  		if res.Body != nil {
  2119  			res.Body.Close()
  2120  		}
  2121  		return nil, gensupport.WrapError(&googleapi.Error{
  2122  			Code:   res.StatusCode,
  2123  			Header: res.Header,
  2124  		})
  2125  	}
  2126  	if err != nil {
  2127  		return nil, err
  2128  	}
  2129  	defer googleapi.CloseBody(res)
  2130  	if err := googleapi.CheckResponse(res); err != nil {
  2131  		return nil, gensupport.WrapError(err)
  2132  	}
  2133  	ret := &TestIamPermissionsResponse{
  2134  		ServerResponse: googleapi.ServerResponse{
  2135  			Header:         res.Header,
  2136  			HTTPStatusCode: res.StatusCode,
  2137  		},
  2138  	}
  2139  	target := &ret
  2140  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2141  		return nil, err
  2142  	}
  2143  	return ret, nil
  2144  }
  2145  

View as plain text