File manager - Edit - /home/u478019808/domains/bestandroidphones.store/public_html/static/img/logo/apitools.tar
Back
samples/bigquery_sample/bigquery_v2/bigquery_v2_messages.py 0000644 00000256710 15025176453 0020360 0 ustar 00 """Generated message classes for bigquery version v2. A data platform for customers to create, manage, share and query data. """ # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.protorpclite import messages as _messages from apitools.base.py import encoding from apitools.base.py import extra_types package = 'bigquery' class BigqueryDatasetsDeleteRequest(_messages.Message): r"""A BigqueryDatasetsDeleteRequest object. Fields: datasetId: Dataset ID of dataset being deleted deleteContents: If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False projectId: Project ID of the dataset being deleted """ datasetId = _messages.StringField(1, required=True) deleteContents = _messages.BooleanField(2) projectId = _messages.StringField(3, required=True) class BigqueryDatasetsDeleteResponse(_messages.Message): r"""An empty BigqueryDatasetsDelete response.""" class BigqueryDatasetsGetRequest(_messages.Message): r"""A BigqueryDatasetsGetRequest object. Fields: datasetId: Dataset ID of the requested dataset projectId: Project ID of the requested dataset """ datasetId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) class BigqueryDatasetsInsertRequest(_messages.Message): r"""A BigqueryDatasetsInsertRequest object. Fields: dataset: A Dataset resource to be passed as the request body. projectId: Project ID of the new dataset """ dataset = _messages.MessageField('Dataset', 1) projectId = _messages.StringField(2, required=True) class BigqueryDatasetsListRequest(_messages.Message): r"""A BigqueryDatasetsListRequest object. Fields: all: Whether to list all datasets, including hidden ones filter: An expression for filtering the results of the request by label. The syntax is "labels.[:]". Multiple filters can be ANDed together by connecting with a space. Example: "labels.department:receiving labels.active". See https://cloud.google.com/bigquery/docs/labeling- datasets#filtering_datasets_using_labels for details. maxResults: The maximum number of results to return pageToken: Page token, returned by a previous call, to request the next page of results projectId: Project ID of the datasets to be listed """ all = _messages.BooleanField(1) filter = _messages.StringField(2) maxResults = _messages.IntegerField(3, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(4) projectId = _messages.StringField(5, required=True) class BigqueryDatasetsPatchRequest(_messages.Message): r"""A BigqueryDatasetsPatchRequest object. Fields: dataset: A Dataset resource to be passed as the request body. datasetId: Dataset ID of the dataset being updated projectId: Project ID of the dataset being updated """ dataset = _messages.MessageField('Dataset', 1) datasetId = _messages.StringField(2, required=True) projectId = _messages.StringField(3, required=True) class BigqueryDatasetsUpdateRequest(_messages.Message): r"""A BigqueryDatasetsUpdateRequest object. Fields: dataset: A Dataset resource to be passed as the request body. datasetId: Dataset ID of the dataset being updated projectId: Project ID of the dataset being updated """ dataset = _messages.MessageField('Dataset', 1) datasetId = _messages.StringField(2, required=True) projectId = _messages.StringField(3, required=True) class BigqueryJobsCancelRequest(_messages.Message): r"""A BigqueryJobsCancelRequest object. Fields: jobId: [Required] Job ID of the job to cancel projectId: [Required] Project ID of the job to cancel """ jobId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) class BigqueryJobsGetQueryResultsRequest(_messages.Message): r"""A BigqueryJobsGetQueryResultsRequest object. Fields: jobId: [Required] Job ID of the query job maxResults: Maximum number of results to read pageToken: Page token, returned by a previous call, to request the next page of results projectId: [Required] Project ID of the query job startIndex: Zero-based index of the starting row timeoutMs: How long to wait for the query to complete, in milliseconds, before returning. Default is 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false """ jobId = _messages.StringField(1, required=True) maxResults = _messages.IntegerField(2, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(3) projectId = _messages.StringField(4, required=True) startIndex = _messages.IntegerField(5, variant=_messages.Variant.UINT64) timeoutMs = _messages.IntegerField(6, variant=_messages.Variant.UINT32) class BigqueryJobsGetRequest(_messages.Message): r"""A BigqueryJobsGetRequest object. Fields: jobId: [Required] Job ID of the requested job projectId: [Required] Project ID of the requested job """ jobId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) class BigqueryJobsInsertRequest(_messages.Message): r"""A BigqueryJobsInsertRequest object. Fields: job: A Job resource to be passed as the request body. projectId: Project ID of the project that will be billed for the job """ job = _messages.MessageField('Job', 1) projectId = _messages.StringField(2, required=True) class BigqueryJobsListRequest(_messages.Message): r"""A BigqueryJobsListRequest object. Enums: ProjectionValueValuesEnum: Restrict information returned to a set of selected fields StateFilterValueValuesEnum: Filter for job state Fields: allUsers: Whether to display jobs owned by all users in the project. Default false maxResults: Maximum number of results to return pageToken: Page token, returned by a previous call, to request the next page of results projectId: Project ID of the jobs to list projection: Restrict information returned to a set of selected fields stateFilter: Filter for job state """ class ProjectionValueValuesEnum(_messages.Enum): r"""Restrict information returned to a set of selected fields Values: full: Includes all job data minimal: Does not include the job configuration """ full = 0 minimal = 1 class StateFilterValueValuesEnum(_messages.Enum): r"""Filter for job state Values: done: Finished jobs pending: Pending jobs running: Running jobs """ done = 0 pending = 1 running = 2 allUsers = _messages.BooleanField(1) maxResults = _messages.IntegerField(2, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(3) projectId = _messages.StringField(4, required=True) projection = _messages.EnumField('ProjectionValueValuesEnum', 5) stateFilter = _messages.EnumField('StateFilterValueValuesEnum', 6, repeated=True) class BigqueryJobsQueryRequest(_messages.Message): r"""A BigqueryJobsQueryRequest object. Fields: projectId: Project ID of the project billed for the query queryRequest: A QueryRequest resource to be passed as the request body. """ projectId = _messages.StringField(1, required=True) queryRequest = _messages.MessageField('QueryRequest', 2) class BigqueryProjectsListRequest(_messages.Message): r"""A BigqueryProjectsListRequest object. Fields: maxResults: Maximum number of results to return pageToken: Page token, returned by a previous call, to request the next page of results """ maxResults = _messages.IntegerField(1, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(2) class BigqueryTabledataInsertAllRequest(_messages.Message): r"""A BigqueryTabledataInsertAllRequest object. Fields: datasetId: Dataset ID of the destination table. projectId: Project ID of the destination table. tableDataInsertAllRequest: A TableDataInsertAllRequest resource to be passed as the request body. tableId: Table ID of the destination table. """ datasetId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) tableDataInsertAllRequest = _messages.MessageField('TableDataInsertAllRequest', 3) tableId = _messages.StringField(4, required=True) class BigqueryTabledataListRequest(_messages.Message): r"""A BigqueryTabledataListRequest object. Fields: datasetId: Dataset ID of the table to read maxResults: Maximum number of results to return pageToken: Page token, returned by a previous call, identifying the result set projectId: Project ID of the table to read startIndex: Zero-based index of the starting row to read tableId: Table ID of the table to read """ datasetId = _messages.StringField(1, required=True) maxResults = _messages.IntegerField(2, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(3) projectId = _messages.StringField(4, required=True) startIndex = _messages.IntegerField(5, variant=_messages.Variant.UINT64) tableId = _messages.StringField(6, required=True) class BigqueryTablesDeleteRequest(_messages.Message): r"""A BigqueryTablesDeleteRequest object. Fields: datasetId: Dataset ID of the table to delete projectId: Project ID of the table to delete tableId: Table ID of the table to delete """ datasetId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) tableId = _messages.StringField(3, required=True) class BigqueryTablesDeleteResponse(_messages.Message): r"""An empty BigqueryTablesDelete response.""" class BigqueryTablesGetRequest(_messages.Message): r"""A BigqueryTablesGetRequest object. Fields: datasetId: Dataset ID of the requested table projectId: Project ID of the requested table tableId: Table ID of the requested table """ datasetId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) tableId = _messages.StringField(3, required=True) class BigqueryTablesInsertRequest(_messages.Message): r"""A BigqueryTablesInsertRequest object. Fields: datasetId: Dataset ID of the new table projectId: Project ID of the new table table: A Table resource to be passed as the request body. """ datasetId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) table = _messages.MessageField('Table', 3) class BigqueryTablesListRequest(_messages.Message): r"""A BigqueryTablesListRequest object. Fields: datasetId: Dataset ID of the tables to list maxResults: Maximum number of results to return pageToken: Page token, returned by a previous call, to request the next page of results projectId: Project ID of the tables to list """ datasetId = _messages.StringField(1, required=True) maxResults = _messages.IntegerField(2, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(3) projectId = _messages.StringField(4, required=True) class BigqueryTablesPatchRequest(_messages.Message): r"""A BigqueryTablesPatchRequest object. Fields: datasetId: Dataset ID of the table to update projectId: Project ID of the table to update table: A Table resource to be passed as the request body. tableId: Table ID of the table to update """ datasetId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) table = _messages.MessageField('Table', 3) tableId = _messages.StringField(4, required=True) class BigqueryTablesUpdateRequest(_messages.Message): r"""A BigqueryTablesUpdateRequest object. Fields: datasetId: Dataset ID of the table to update projectId: Project ID of the table to update table: A Table resource to be passed as the request body. tableId: Table ID of the table to update """ datasetId = _messages.StringField(1, required=True) projectId = _messages.StringField(2, required=True) table = _messages.MessageField('Table', 3) tableId = _messages.StringField(4, required=True) class BigtableColumn(_messages.Message): r"""A BigtableColumn object. Fields: encoding: [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels. fieldName: [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries. onlyReadLatest: [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels. qualifierEncoded: [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name. qualifierString: A string attribute. type: [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels. """ encoding = _messages.StringField(1) fieldName = _messages.StringField(2) onlyReadLatest = _messages.BooleanField(3) qualifierEncoded = _messages.BytesField(4) qualifierString = _messages.StringField(5) type = _messages.StringField(6) class BigtableColumnFamily(_messages.Message): r"""A BigtableColumnFamily object. Fields: columns: [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field. encoding: [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it. familyId: Identifier of the column family. onlyReadLatest: [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column. type: [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it. """ columns = _messages.MessageField('BigtableColumn', 1, repeated=True) encoding = _messages.StringField(2) familyId = _messages.StringField(3) onlyReadLatest = _messages.BooleanField(4) type = _messages.StringField(5) class BigtableOptions(_messages.Message): r"""A BigtableOptions object. Fields: columnFamilies: [Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable. ignoreUnspecifiedColumnFamilies: [Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false. readRowkeyAsString: [Optional] If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false. """ columnFamilies = _messages.MessageField('BigtableColumnFamily', 1, repeated=True) ignoreUnspecifiedColumnFamilies = _messages.BooleanField(2) readRowkeyAsString = _messages.BooleanField(3) class CsvOptions(_messages.Message): r"""A CsvOptions object. Fields: allowJaggedRows: [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. allowQuotedNewlines: [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false. encoding: [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties. fieldDelimiter: [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (','). quote: [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. skipLeadingRows: [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. """ allowJaggedRows = _messages.BooleanField(1) allowQuotedNewlines = _messages.BooleanField(2) encoding = _messages.StringField(3) fieldDelimiter = _messages.StringField(4) quote = _messages.StringField(5, default='"') skipLeadingRows = _messages.IntegerField(6) class Dataset(_messages.Message): r"""A Dataset object. Messages: AccessValueListEntry: A AccessValueListEntry object. LabelsValue: [Experimental] The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be <= 128 bytes in size. Fields: access: [Optional] An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER; creationTime: [Output-only] The time when this dataset was created, in milliseconds since the epoch. datasetReference: [Required] A reference that identifies the dataset. defaultTableExpirationMs: [Optional] The default lifetime of all tables in the dataset, in milliseconds. The minimum value is 3600000 milliseconds (one hour). Once this property is set, all newly-created tables in the dataset will have an expirationTime property set to the creation time plus the value in this property, and changing the value will only affect new tables, not existing ones. When the expirationTime for a given table is reached, that table will be deleted automatically. If a table's expirationTime is modified or removed before the table expires, or if you provide an explicit expirationTime when creating a table, that value takes precedence over the default expiration time indicated by this property. description: [Optional] A user-friendly description of the dataset. etag: [Output-only] A hash of the resource. friendlyName: [Optional] A descriptive name for the dataset. id: [Output-only] The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field. When creating a new dataset, leave this field blank, and instead specify the datasetId field. kind: [Output-only] The resource type. labels: [Experimental] The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be <= 128 bytes in size. lastModifiedTime: [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch. location: [Experimental] The geographic location where the dataset should reside. Possible values include EU and US. The default value is US. selfLink: [Output-only] A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource. """ class AccessValueListEntry(_messages.Message): r"""A AccessValueListEntry object. Fields: domain: [Pick one] A domain to grant access to. Any users signed in with the domain specified will be granted the specified access. Example: "example.com". groupByEmail: [Pick one] An email address of a Google Group to grant access to. role: [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER, WRITER, OWNER. specialGroup: [Pick one] A special group to grant access to. Possible values include: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users. userByEmail: [Pick one] An email address of a user to grant access to. For example: fred@example.com. view: [Pick one] A view from a different dataset to grant access to. Queries executed against that view will have read access to tables in this dataset. The role field is not required when this field is set. If that view is updated by any user, access to the view needs to be granted again via an update operation. """ domain = _messages.StringField(1) groupByEmail = _messages.StringField(2) role = _messages.StringField(3) specialGroup = _messages.StringField(4) userByEmail = _messages.StringField(5) view = _messages.MessageField('TableReference', 6) @encoding.MapUnrecognizedFields('additionalProperties') class LabelsValue(_messages.Message): r"""[Experimental] The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be <= 128 bytes in size. Messages: AdditionalProperty: An additional property for a LabelsValue object. Fields: additionalProperties: Additional properties of type LabelsValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a LabelsValue object. Fields: key: Name of the additional property. value: A string attribute. """ key = _messages.StringField(1) value = _messages.StringField(2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) access = _messages.MessageField('AccessValueListEntry', 1, repeated=True) creationTime = _messages.IntegerField(2) datasetReference = _messages.MessageField('DatasetReference', 3) defaultTableExpirationMs = _messages.IntegerField(4) description = _messages.StringField(5) etag = _messages.StringField(6) friendlyName = _messages.StringField(7) id = _messages.StringField(8) kind = _messages.StringField(9, default='bigquery#dataset') labels = _messages.MessageField('LabelsValue', 10) lastModifiedTime = _messages.IntegerField(11) location = _messages.StringField(12) selfLink = _messages.StringField(13) class DatasetList(_messages.Message): r"""A DatasetList object. Messages: DatasetsValueListEntry: A DatasetsValueListEntry object. Fields: datasets: An array of the dataset resources in the project. Each resource contains basic information. For full information about a particular dataset resource, use the Datasets: get method. This property is omitted when there are no datasets in the project. etag: A hash value of the results page. You can use this property to determine if the page has changed since the last request. kind: The list type. This property always returns the value "bigquery#datasetList". nextPageToken: A token that can be used to request the next results page. This property is omitted on the final results page. """ class DatasetsValueListEntry(_messages.Message): r"""A DatasetsValueListEntry object. Messages: LabelsValue: [Experimental] The labels associated with this dataset. You can use these to organize and group your datasets. Fields: datasetReference: The dataset reference. Use this property to access specific parts of the dataset's ID, such as project ID or dataset ID. friendlyName: A descriptive name for the dataset, if one exists. id: The fully-qualified, unique, opaque ID of the dataset. kind: The resource type. This property always returns the value "bigquery#dataset". labels: [Experimental] The labels associated with this dataset. You can use these to organize and group your datasets. """ @encoding.MapUnrecognizedFields('additionalProperties') class LabelsValue(_messages.Message): r"""[Experimental] The labels associated with this dataset. You can use these to organize and group your datasets. Messages: AdditionalProperty: An additional property for a LabelsValue object. Fields: additionalProperties: Additional properties of type LabelsValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a LabelsValue object. Fields: key: Name of the additional property. value: A string attribute. """ key = _messages.StringField(1) value = _messages.StringField(2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) datasetReference = _messages.MessageField('DatasetReference', 1) friendlyName = _messages.StringField(2) id = _messages.StringField(3) kind = _messages.StringField(4, default='bigquery#dataset') labels = _messages.MessageField('LabelsValue', 5) datasets = _messages.MessageField('DatasetsValueListEntry', 1, repeated=True) etag = _messages.StringField(2) kind = _messages.StringField(3, default='bigquery#datasetList') nextPageToken = _messages.StringField(4) class DatasetReference(_messages.Message): r"""A DatasetReference object. Fields: datasetId: [Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters. projectId: [Optional] The ID of the project containing this dataset. """ datasetId = _messages.StringField(1) projectId = _messages.StringField(2) class ErrorProto(_messages.Message): r"""A ErrorProto object. Fields: debugInfo: Debugging information. This property is internal to Google and should not be used. location: Specifies where the error occurred, if present. message: A human-readable description of the error. reason: A short error code that summarizes the error. """ debugInfo = _messages.StringField(1) location = _messages.StringField(2) message = _messages.StringField(3) reason = _messages.StringField(4) class ExplainQueryStage(_messages.Message): r"""A ExplainQueryStage object. Fields: computeRatioAvg: Relative amount of time the average shard spent on CPU- bound tasks. computeRatioMax: Relative amount of time the slowest shard spent on CPU- bound tasks. id: Unique ID for stage within plan. name: Human-readable name for stage. readRatioAvg: Relative amount of time the average shard spent reading input. readRatioMax: Relative amount of time the slowest shard spent reading input. recordsRead: Number of records read into the stage. recordsWritten: Number of records written by the stage. steps: List of operations within the stage in dependency order (approximately chronological). waitRatioAvg: Relative amount of time the average shard spent waiting to be scheduled. waitRatioMax: Relative amount of time the slowest shard spent waiting to be scheduled. writeRatioAvg: Relative amount of time the average shard spent on writing output. writeRatioMax: Relative amount of time the slowest shard spent on writing output. """ computeRatioAvg = _messages.FloatField(1) computeRatioMax = _messages.FloatField(2) id = _messages.IntegerField(3) name = _messages.StringField(4) readRatioAvg = _messages.FloatField(5) readRatioMax = _messages.FloatField(6) recordsRead = _messages.IntegerField(7) recordsWritten = _messages.IntegerField(8) steps = _messages.MessageField('ExplainQueryStep', 9, repeated=True) waitRatioAvg = _messages.FloatField(10) waitRatioMax = _messages.FloatField(11) writeRatioAvg = _messages.FloatField(12) writeRatioMax = _messages.FloatField(13) class ExplainQueryStep(_messages.Message): r"""A ExplainQueryStep object. Fields: kind: Machine-readable operation type. substeps: Human-readable stage descriptions. """ kind = _messages.StringField(1) substeps = _messages.StringField(2, repeated=True) class ExternalDataConfiguration(_messages.Message): r"""A ExternalDataConfiguration object. Fields: autodetect: [Experimental] Try to detect schema and format options automatically. Any option specified explicitly will be honored. bigtableOptions: [Optional] Additional options if sourceFormat is set to BIGTABLE. compression: [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats. csvOptions: Additional properties to set if sourceFormat is set to CSV. googleSheetsOptions: [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS. ignoreUnknownValues: [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored. maxBadRecords: [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats. schema: [Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats. sourceFormat: [Required] The data format. For CSV files, specify "CSV". For Google sheets, specify "GOOGLE_SHEETS". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro files, specify "AVRO". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". [Experimental] For Google Cloud Bigtable, specify "BIGTABLE". Please note that reading from Google Cloud Bigtable is experimental and has to be enabled for your project. Please contact Google Cloud Support to enable this for your project. sourceUris: [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified, and it must end with '.backup_info'. Also, the '*' wildcard character is not allowed. """ autodetect = _messages.BooleanField(1) bigtableOptions = _messages.MessageField('BigtableOptions', 2) compression = _messages.StringField(3) csvOptions = _messages.MessageField('CsvOptions', 4) googleSheetsOptions = _messages.MessageField('GoogleSheetsOptions', 5) ignoreUnknownValues = _messages.BooleanField(6) maxBadRecords = _messages.IntegerField(7, variant=_messages.Variant.INT32) schema = _messages.MessageField('TableSchema', 8) sourceFormat = _messages.StringField(9) sourceUris = _messages.StringField(10, repeated=True) class GetQueryResultsResponse(_messages.Message): r"""A GetQueryResultsResponse object. Fields: cacheHit: Whether the query result was fetched from the query cache. errors: [Output-only] All errors and warnings encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful. etag: A hash of this response. jobComplete: Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available. jobReference: Reference to the BigQuery Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults). kind: The resource type of the response. numDmlAffectedRows: [Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE. pageToken: A token used for paging results. rows: An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. Present only when the query completes successfully. schema: The schema of the results. Present only when the query completes successfully. totalBytesProcessed: The total number of bytes processed for this query. totalRows: The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. Present only when the query completes successfully. """ cacheHit = _messages.BooleanField(1) errors = _messages.MessageField('ErrorProto', 2, repeated=True) etag = _messages.StringField(3) jobComplete = _messages.BooleanField(4) jobReference = _messages.MessageField('JobReference', 5) kind = _messages.StringField(6, default='bigquery#getQueryResultsResponse') numDmlAffectedRows = _messages.IntegerField(7) pageToken = _messages.StringField(8) rows = _messages.MessageField('TableRow', 9, repeated=True) schema = _messages.MessageField('TableSchema', 10) totalBytesProcessed = _messages.IntegerField(11) totalRows = _messages.IntegerField(12, variant=_messages.Variant.UINT64) class GoogleSheetsOptions(_messages.Message): r"""A GoogleSheetsOptions object. Fields: skipLeadingRows: [Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema. """ skipLeadingRows = _messages.IntegerField(1) class Job(_messages.Message): r"""A Job object. Fields: configuration: [Required] Describes the job configuration. etag: [Output-only] A hash of this resource. id: [Output-only] Opaque ID field of the job jobReference: [Optional] Reference describing the unique-per-user name of the job. kind: [Output-only] The type of the resource. selfLink: [Output-only] A URL that can be used to access this resource again. statistics: [Output-only] Information about the job, including starting time and ending time of the job. status: [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete. user_email: [Output-only] Email address of the user who ran the job. """ configuration = _messages.MessageField('JobConfiguration', 1) etag = _messages.StringField(2) id = _messages.StringField(3) jobReference = _messages.MessageField('JobReference', 4) kind = _messages.StringField(5, default='bigquery#job') selfLink = _messages.StringField(6) statistics = _messages.MessageField('JobStatistics', 7) status = _messages.MessageField('JobStatus', 8) user_email = _messages.StringField(9) class JobCancelResponse(_messages.Message): r"""A JobCancelResponse object. Fields: job: The final state of the job. kind: The resource type of the response. """ job = _messages.MessageField('Job', 1) kind = _messages.StringField(2, default='bigquery#jobCancelResponse') class JobConfiguration(_messages.Message): r"""A JobConfiguration object. Fields: copy: [Pick one] Copies a table. dryRun: [Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined. extract: [Pick one] Configures an extract job. load: [Pick one] Configures a load job. query: [Pick one] Configures a query job. """ copy = _messages.MessageField('JobConfigurationTableCopy', 1) dryRun = _messages.BooleanField(2) extract = _messages.MessageField('JobConfigurationExtract', 3) load = _messages.MessageField('JobConfigurationLoad', 4) query = _messages.MessageField('JobConfigurationQuery', 5) class JobConfigurationExtract(_messages.Message): r"""A JobConfigurationExtract object. Fields: compression: [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE. destinationFormat: [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV. destinationUri: [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written. destinationUris: [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written. fieldDelimiter: [Optional] Delimiter to use between fields in the exported data. Default is ',' printHeader: [Optional] Whether to print out a header row in the results. Default is true. sourceTable: [Required] A reference to the table being exported. """ compression = _messages.StringField(1) destinationFormat = _messages.StringField(2) destinationUri = _messages.StringField(3) destinationUris = _messages.StringField(4, repeated=True) fieldDelimiter = _messages.StringField(5) printHeader = _messages.BooleanField(6, default=True) sourceTable = _messages.MessageField('TableReference', 7) class JobConfigurationLoad(_messages.Message): r"""A JobConfigurationLoad object. Fields: allowJaggedRows: [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats. allowQuotedNewlines: Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false. autodetect: [Experimental] Indicates if we should automatically infer the options and schema for CSV and JSON sources. createDisposition: [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion. destinationTable: [Required] The destination table to load the data into. encoding: [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties. fieldDelimiter: [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (','). ignoreUnknownValues: [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names maxBadRecords: [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. projectionFields: [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result. quote: [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true. schema: [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore. schemaInline: [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT". schemaInlineFormat: [Deprecated] The format of the schemaInline property. schemaUpdateOptions: [Experimental] Allows the schema of the desitination table to be updated as a side effect of the load job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable. skipLeadingRows: [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped. sourceFormat: [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO". The default value is CSV. sourceUris: [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. writeDisposition: [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion. """ allowJaggedRows = _messages.BooleanField(1) allowQuotedNewlines = _messages.BooleanField(2) autodetect = _messages.BooleanField(3) createDisposition = _messages.StringField(4) destinationTable = _messages.MessageField('TableReference', 5) encoding = _messages.StringField(6) fieldDelimiter = _messages.StringField(7) ignoreUnknownValues = _messages.BooleanField(8) maxBadRecords = _messages.IntegerField(9, variant=_messages.Variant.INT32) projectionFields = _messages.StringField(10, repeated=True) quote = _messages.StringField(11, default='"') schema = _messages.MessageField('TableSchema', 12) schemaInline = _messages.StringField(13) schemaInlineFormat = _messages.StringField(14) schemaUpdateOptions = _messages.StringField(15, repeated=True) skipLeadingRows = _messages.IntegerField(16, variant=_messages.Variant.INT32) sourceFormat = _messages.StringField(17) sourceUris = _messages.StringField(18, repeated=True) writeDisposition = _messages.StringField(19) class JobConfigurationQuery(_messages.Message): r"""A JobConfigurationQuery object. Messages: TableDefinitionsValue: [Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. Fields: allowLargeResults: If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. createDisposition: [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion. defaultDataset: [Optional] Specifies the default dataset to use for unqualified table names in the query. destinationTable: [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results. flattenResults: [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false. maximumBillingTier: [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default. maximumBytesBilled: [Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default. preserveNulls: [Deprecated] This property is deprecated. priority: [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE. query: [Required] BigQuery SQL query to execute. schemaUpdateOptions: [Experimental] Allows the schema of the desitination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable. tableDefinitions: [Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. useLegacySql: [Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false. useQueryCache: [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true. userDefinedFunctionResources: [Experimental] Describes user-defined function resources used in the query. writeDisposition: [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion. """ @encoding.MapUnrecognizedFields('additionalProperties') class TableDefinitionsValue(_messages.Message): r"""[Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. Messages: AdditionalProperty: An additional property for a TableDefinitionsValue object. Fields: additionalProperties: Additional properties of type TableDefinitionsValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a TableDefinitionsValue object. Fields: key: Name of the additional property. value: A ExternalDataConfiguration attribute. """ key = _messages.StringField(1) value = _messages.MessageField('ExternalDataConfiguration', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) allowLargeResults = _messages.BooleanField(1) createDisposition = _messages.StringField(2) defaultDataset = _messages.MessageField('DatasetReference', 3) destinationTable = _messages.MessageField('TableReference', 4) flattenResults = _messages.BooleanField(5, default=True) maximumBillingTier = _messages.IntegerField(6, variant=_messages.Variant.INT32, default=1) maximumBytesBilled = _messages.IntegerField(7) preserveNulls = _messages.BooleanField(8) priority = _messages.StringField(9) query = _messages.StringField(10) schemaUpdateOptions = _messages.StringField(11, repeated=True) tableDefinitions = _messages.MessageField('TableDefinitionsValue', 12) useLegacySql = _messages.BooleanField(13) useQueryCache = _messages.BooleanField(14, default=True) userDefinedFunctionResources = _messages.MessageField('UserDefinedFunctionResource', 15, repeated=True) writeDisposition = _messages.StringField(16) class JobConfigurationTableCopy(_messages.Message): r"""A JobConfigurationTableCopy object. Fields: createDisposition: [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion. destinationTable: [Required] The destination table sourceTable: [Pick one] Source table to copy. sourceTables: [Pick one] Source tables to copy. writeDisposition: [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion. """ createDisposition = _messages.StringField(1) destinationTable = _messages.MessageField('TableReference', 2) sourceTable = _messages.MessageField('TableReference', 3) sourceTables = _messages.MessageField('TableReference', 4, repeated=True) writeDisposition = _messages.StringField(5) class JobList(_messages.Message): r"""A JobList object. Messages: JobsValueListEntry: A JobsValueListEntry object. Fields: etag: A hash of this page of results. jobs: List of jobs that were requested. kind: The resource type of the response. nextPageToken: A token to request the next page of results. """ class JobsValueListEntry(_messages.Message): r"""A JobsValueListEntry object. Fields: configuration: [Full-projection-only] Specifies the job configuration. errorResult: A result object that will be present only if the job has failed. id: Unique opaque ID of the job. jobReference: Job reference uniquely identifying the job. kind: The resource type. state: Running state of the job. When the state is DONE, errorResult can be checked to determine whether the job succeeded or failed. statistics: [Output-only] Information about the job, including starting time and ending time of the job. status: [Full-projection-only] Describes the state of the job. user_email: [Full-projection-only] Email address of the user who ran the job. """ configuration = _messages.MessageField('JobConfiguration', 1) errorResult = _messages.MessageField('ErrorProto', 2) id = _messages.StringField(3) jobReference = _messages.MessageField('JobReference', 4) kind = _messages.StringField(5, default='bigquery#job') state = _messages.StringField(6) statistics = _messages.MessageField('JobStatistics', 7) status = _messages.MessageField('JobStatus', 8) user_email = _messages.StringField(9) etag = _messages.StringField(1) jobs = _messages.MessageField('JobsValueListEntry', 2, repeated=True) kind = _messages.StringField(3, default='bigquery#jobList') nextPageToken = _messages.StringField(4) class JobReference(_messages.Message): r"""A JobReference object. Fields: jobId: [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters. projectId: [Required] The ID of the project containing this job. """ jobId = _messages.StringField(1) projectId = _messages.StringField(2) class JobStatistics(_messages.Message): r"""A JobStatistics object. Fields: creationTime: [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs. endTime: [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state. extract: [Output-only] Statistics for an extract job. load: [Output-only] Statistics for a load job. query: [Output-only] Statistics for a query job. startTime: [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE. totalBytesProcessed: [Output-only] [Deprecated] Use the bytes processed in the query statistics instead. """ creationTime = _messages.IntegerField(1) endTime = _messages.IntegerField(2) extract = _messages.MessageField('JobStatistics4', 3) load = _messages.MessageField('JobStatistics3', 4) query = _messages.MessageField('JobStatistics2', 5) startTime = _messages.IntegerField(6) totalBytesProcessed = _messages.IntegerField(7) class JobStatistics2(_messages.Message): r"""A JobStatistics2 object. Fields: billingTier: [Output-only] Billing tier for the job. cacheHit: [Output-only] Whether the query result was fetched from the query cache. numDmlAffectedRows: [Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE. queryPlan: [Output-only, Experimental] Describes execution plan for the query. referencedTables: [Output-only, Experimental] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list. schema: [Output-only, Experimental] The schema of the results. Present only for successful dry run of non-legacy SQL queries. totalBytesBilled: [Output-only] Total bytes billed for the job. totalBytesProcessed: [Output-only] Total bytes processed for the job. """ billingTier = _messages.IntegerField(1, variant=_messages.Variant.INT32) cacheHit = _messages.BooleanField(2) numDmlAffectedRows = _messages.IntegerField(3) queryPlan = _messages.MessageField('ExplainQueryStage', 4, repeated=True) referencedTables = _messages.MessageField('TableReference', 5, repeated=True) schema = _messages.MessageField('TableSchema', 6) totalBytesBilled = _messages.IntegerField(7) totalBytesProcessed = _messages.IntegerField(8) class JobStatistics3(_messages.Message): r"""A JobStatistics3 object. Fields: inputFileBytes: [Output-only] Number of bytes of source data in a load job. inputFiles: [Output-only] Number of source files in a load job. outputBytes: [Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change. outputRows: [Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change. """ inputFileBytes = _messages.IntegerField(1) inputFiles = _messages.IntegerField(2) outputBytes = _messages.IntegerField(3) outputRows = _messages.IntegerField(4) class JobStatistics4(_messages.Message): r"""A JobStatistics4 object. Fields: destinationUriFileCounts: [Output-only] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field. """ destinationUriFileCounts = _messages.IntegerField(1, repeated=True) class JobStatus(_messages.Message): r"""A JobStatus object. Fields: errorResult: [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful. errors: [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful. state: [Output-only] Running state of the job. """ errorResult = _messages.MessageField('ErrorProto', 1) errors = _messages.MessageField('ErrorProto', 2, repeated=True) state = _messages.StringField(3) @encoding.MapUnrecognizedFields('additionalProperties') class JsonObject(_messages.Message): r"""Represents a single JSON object. Messages: AdditionalProperty: An additional property for a JsonObject object. Fields: additionalProperties: Additional properties of type JsonObject """ class AdditionalProperty(_messages.Message): r"""An additional property for a JsonObject object. Fields: key: Name of the additional property. value: A JsonValue attribute. """ key = _messages.StringField(1) value = _messages.MessageField('JsonValue', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) JsonValue = extra_types.JsonValue class ProjectList(_messages.Message): r"""A ProjectList object. Messages: ProjectsValueListEntry: A ProjectsValueListEntry object. Fields: etag: A hash of the page of results kind: The type of list. nextPageToken: A token to request the next page of results. projects: Projects to which you have at least READ access. totalItems: The total number of projects in the list. """ class ProjectsValueListEntry(_messages.Message): r"""A ProjectsValueListEntry object. Fields: friendlyName: A descriptive name for this project. id: An opaque ID of this project. kind: The resource type. numericId: The numeric ID of this project. projectReference: A unique reference to this project. """ friendlyName = _messages.StringField(1) id = _messages.StringField(2) kind = _messages.StringField(3, default='bigquery#project') numericId = _messages.IntegerField(4, variant=_messages.Variant.UINT64) projectReference = _messages.MessageField('ProjectReference', 5) etag = _messages.StringField(1) kind = _messages.StringField(2, default='bigquery#projectList') nextPageToken = _messages.StringField(3) projects = _messages.MessageField('ProjectsValueListEntry', 4, repeated=True) totalItems = _messages.IntegerField(5, variant=_messages.Variant.INT32) class ProjectReference(_messages.Message): r"""A ProjectReference object. Fields: projectId: [Required] ID of the project. Can be either the numeric ID or the assigned ID of the project. """ projectId = _messages.StringField(1) class QueryRequest(_messages.Message): r"""A QueryRequest object. Fields: defaultDataset: [Optional] Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'. dryRun: [Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false. kind: The resource type of the request. maxResults: [Optional] The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies. preserveNulls: [Deprecated] This property is deprecated. query: [Required] A query string, following the BigQuery query syntax, of the query to execute. Example: "SELECT count(f1) FROM [myProjectId:myDatasetId.myTableId]". timeoutMs: [Optional] How long to wait for the query to complete, in milliseconds, before the request times out and returns. Note that this is only a timeout for the request, not the query. If the query takes longer to run than the timeout value, the call returns without any results and with the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to complete and read the results. The default value is 10000 milliseconds (10 seconds). useLegacySql: [Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false. useQueryCache: [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. The default value is true. """ defaultDataset = _messages.MessageField('DatasetReference', 1) dryRun = _messages.BooleanField(2) kind = _messages.StringField(3, default='bigquery#queryRequest') maxResults = _messages.IntegerField(4, variant=_messages.Variant.UINT32) preserveNulls = _messages.BooleanField(5) query = _messages.StringField(6) timeoutMs = _messages.IntegerField(7, variant=_messages.Variant.UINT32) useLegacySql = _messages.BooleanField(8) useQueryCache = _messages.BooleanField(9, default=True) class QueryResponse(_messages.Message): r"""A QueryResponse object. Fields: cacheHit: Whether the query result was fetched from the query cache. errors: [Output-only] All errors and warnings encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful. jobComplete: Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available. jobReference: Reference to the Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults). kind: The resource type. numDmlAffectedRows: [Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE. pageToken: A token used for paging results. rows: An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. schema: The schema of the results. Present only when the query completes successfully. totalBytesProcessed: The total number of bytes processed for this query. If this query was a dry run, this is the number of bytes that would be processed if the query were run. totalRows: The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. """ cacheHit = _messages.BooleanField(1) errors = _messages.MessageField('ErrorProto', 2, repeated=True) jobComplete = _messages.BooleanField(3) jobReference = _messages.MessageField('JobReference', 4) kind = _messages.StringField(5, default='bigquery#queryResponse') numDmlAffectedRows = _messages.IntegerField(6) pageToken = _messages.StringField(7) rows = _messages.MessageField('TableRow', 8, repeated=True) schema = _messages.MessageField('TableSchema', 9) totalBytesProcessed = _messages.IntegerField(10) totalRows = _messages.IntegerField(11, variant=_messages.Variant.UINT64) class StandardQueryParameters(_messages.Message): r"""Query parameters accepted by all methods. Enums: AltValueValuesEnum: Data format for the response. Fields: alt: Data format for the response. fields: Selector specifying which fields to include in a partial response. key: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. oauth_token: OAuth 2.0 token for the current user. prettyPrint: Returns response with indentations and line breaks. quotaUser: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. trace: A tracing token of the form "token:<tokenid>" to include in api requests. userIp: IP address of the site where the request originates. Use this if you want to enforce per-user limits. """ class AltValueValuesEnum(_messages.Enum): r"""Data format for the response. Values: json: Responses with Content-Type of application/json """ json = 0 alt = _messages.EnumField('AltValueValuesEnum', 1, default='json') fields = _messages.StringField(2) key = _messages.StringField(3) oauth_token = _messages.StringField(4) prettyPrint = _messages.BooleanField(5, default=True) quotaUser = _messages.StringField(6) trace = _messages.StringField(7) userIp = _messages.StringField(8) class Streamingbuffer(_messages.Message): r"""A Streamingbuffer object. Fields: estimatedBytes: [Output-only] A lower-bound estimate of the number of bytes currently in the streaming buffer. estimatedRows: [Output-only] A lower-bound estimate of the number of rows currently in the streaming buffer. oldestEntryTime: [Output-only] Contains the timestamp of the oldest entry in the streaming buffer, in milliseconds since the epoch, if the streaming buffer is available. """ estimatedBytes = _messages.IntegerField(1, variant=_messages.Variant.UINT64) estimatedRows = _messages.IntegerField(2, variant=_messages.Variant.UINT64) oldestEntryTime = _messages.IntegerField(3, variant=_messages.Variant.UINT64) class Table(_messages.Message): r"""A Table object. Fields: creationTime: [Output-only] The time when this table was created, in milliseconds since the epoch. description: [Optional] A user-friendly description of this table. etag: [Output-only] A hash of this resource. expirationTime: [Optional] The time when this table expires, in milliseconds since the epoch. If not present, the table will persist indefinitely. Expired tables will be deleted and their storage reclaimed. externalDataConfiguration: [Optional] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table. friendlyName: [Optional] A descriptive name for this table. id: [Output-only] An opaque ID uniquely identifying the table. kind: [Output-only] The type of the resource. lastModifiedTime: [Output-only] The time when this table was last modified, in milliseconds since the epoch. location: [Output-only] The geographic location where the table resides. This value is inherited from the dataset. numBytes: [Output-only] The size of this table in bytes, excluding any data in the streaming buffer. numLongTermBytes: [Output-only] The number of bytes in the table that are considered "long-term storage". numRows: [Output-only] The number of rows of data in this table, excluding any data in the streaming buffer. schema: [Optional] Describes the schema of this table. selfLink: [Output-only] A URL that can be used to access this resource again. streamingBuffer: [Output-only] Contains information regarding this table's streaming buffer, if one is present. This field will be absent if the table is not being streamed to or if there is no data in the streaming buffer. tableReference: [Required] Reference describing the ID of this table. timePartitioning: [Experimental] If specified, configures time-based partitioning for this table. type: [Output-only] Describes the table type. The following values are supported: TABLE: A normal BigQuery table. VIEW: A virtual table defined by a SQL query. EXTERNAL: A table that references data stored in an external storage system, such as Google Cloud Storage. The default value is TABLE. view: [Optional] The view definition. """ creationTime = _messages.IntegerField(1) description = _messages.StringField(2) etag = _messages.StringField(3) expirationTime = _messages.IntegerField(4) externalDataConfiguration = _messages.MessageField('ExternalDataConfiguration', 5) friendlyName = _messages.StringField(6) id = _messages.StringField(7) kind = _messages.StringField(8, default='bigquery#table') lastModifiedTime = _messages.IntegerField(9, variant=_messages.Variant.UINT64) location = _messages.StringField(10) numBytes = _messages.IntegerField(11) numLongTermBytes = _messages.IntegerField(12) numRows = _messages.IntegerField(13, variant=_messages.Variant.UINT64) schema = _messages.MessageField('TableSchema', 14) selfLink = _messages.StringField(15) streamingBuffer = _messages.MessageField('Streamingbuffer', 16) tableReference = _messages.MessageField('TableReference', 17) timePartitioning = _messages.MessageField('TimePartitioning', 18) type = _messages.StringField(19) view = _messages.MessageField('ViewDefinition', 20) class TableCell(_messages.Message): r"""A TableCell object. Fields: v: A extra_types.JsonValue attribute. """ v = _messages.MessageField('extra_types.JsonValue', 1) class TableDataInsertAllRequest(_messages.Message): r"""A TableDataInsertAllRequest object. Messages: RowsValueListEntry: A RowsValueListEntry object. Fields: ignoreUnknownValues: [Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors. kind: The resource type of the response. rows: The rows to insert. skipInvalidRows: [Optional] Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist. templateSuffix: [Experimental] If specified, treats the destination table as a base template, and inserts the rows into an instance table named "{destination}{templateSuffix}". BigQuery will manage creation of the instance table, using the schema of the base template table. See https://cloud.google.com/bigquery/streaming-data-into-bigquery#template- tables for considerations when working with templates tables. """ class RowsValueListEntry(_messages.Message): r"""A RowsValueListEntry object. Fields: insertId: [Optional] A unique ID for each row. BigQuery uses this property to detect duplicate insertion requests on a best-effort basis. json: [Required] A JSON object that contains a row of data. The object's properties and values must match the destination table's schema. """ insertId = _messages.StringField(1) json = _messages.MessageField('JsonObject', 2) ignoreUnknownValues = _messages.BooleanField(1) kind = _messages.StringField(2, default='bigquery#tableDataInsertAllRequest') rows = _messages.MessageField('RowsValueListEntry', 3, repeated=True) skipInvalidRows = _messages.BooleanField(4) templateSuffix = _messages.StringField(5) class TableDataInsertAllResponse(_messages.Message): r"""A TableDataInsertAllResponse object. Messages: InsertErrorsValueListEntry: A InsertErrorsValueListEntry object. Fields: insertErrors: An array of errors for rows that were not inserted. kind: The resource type of the response. """ class InsertErrorsValueListEntry(_messages.Message): r"""A InsertErrorsValueListEntry object. Fields: errors: Error information for the row indicated by the index property. index: The index of the row that error applies to. """ errors = _messages.MessageField('ErrorProto', 1, repeated=True) index = _messages.IntegerField(2, variant=_messages.Variant.UINT32) insertErrors = _messages.MessageField('InsertErrorsValueListEntry', 1, repeated=True) kind = _messages.StringField(2, default='bigquery#tableDataInsertAllResponse') class TableDataList(_messages.Message): r"""A TableDataList object. Fields: etag: A hash of this page of results. kind: The resource type of the response. pageToken: A token used for paging results. Providing this token instead of the startIndex parameter can help you retrieve stable results when an underlying table is changing. rows: Rows of results. totalRows: The total number of rows in the complete table. """ etag = _messages.StringField(1) kind = _messages.StringField(2, default='bigquery#tableDataList') pageToken = _messages.StringField(3) rows = _messages.MessageField('TableRow', 4, repeated=True) totalRows = _messages.IntegerField(5) class TableFieldSchema(_messages.Message): r"""A TableFieldSchema object. Fields: description: [Optional] The field description. The maximum length is 16K characters. fields: [Optional] Describes the nested schema fields if the type property is set to RECORD. mode: [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE. name: [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters. type: [Required] The field data type. Possible values include STRING, BYTES, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema). """ description = _messages.StringField(1) fields = _messages.MessageField('TableFieldSchema', 2, repeated=True) mode = _messages.StringField(3) name = _messages.StringField(4) type = _messages.StringField(5) class TableList(_messages.Message): r"""A TableList object. Messages: TablesValueListEntry: A TablesValueListEntry object. Fields: etag: A hash of this page of results. kind: The type of list. nextPageToken: A token to request the next page of results. tables: Tables in the requested dataset. totalItems: The total number of tables in the dataset. """ class TablesValueListEntry(_messages.Message): r"""A TablesValueListEntry object. Fields: friendlyName: The user-friendly name for this table. id: An opaque ID of the table kind: The resource type. tableReference: A reference uniquely identifying the table. type: The type of table. Possible values are: TABLE, VIEW. """ friendlyName = _messages.StringField(1) id = _messages.StringField(2) kind = _messages.StringField(3, default='bigquery#table') tableReference = _messages.MessageField('TableReference', 4) type = _messages.StringField(5) etag = _messages.StringField(1) kind = _messages.StringField(2, default='bigquery#tableList') nextPageToken = _messages.StringField(3) tables = _messages.MessageField('TablesValueListEntry', 4, repeated=True) totalItems = _messages.IntegerField(5, variant=_messages.Variant.INT32) class TableReference(_messages.Message): r"""A TableReference object. Fields: datasetId: [Required] The ID of the dataset containing this table. projectId: [Required] The ID of the project containing this table. tableId: [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters. """ datasetId = _messages.StringField(1) projectId = _messages.StringField(2) tableId = _messages.StringField(3) class TableRow(_messages.Message): r"""A TableRow object. Fields: f: Represents a single row in the result set, consisting of one or more fields. """ f = _messages.MessageField('TableCell', 1, repeated=True) class TableSchema(_messages.Message): r"""A TableSchema object. Fields: fields: Describes the fields in a table. """ fields = _messages.MessageField('TableFieldSchema', 1, repeated=True) class TimePartitioning(_messages.Message): r"""A TimePartitioning object. Fields: expirationMs: [Optional] Number of milliseconds for which to keep the storage for a partition. type: [Required] The only type supported is DAY, which will generate one partition per day based on data loading time. """ expirationMs = _messages.IntegerField(1) type = _messages.StringField(2) class UserDefinedFunctionResource(_messages.Message): r"""A UserDefinedFunctionResource object. Fields: inlineCode: [Pick one] An inline resource that contains code for a user- defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code. resourceUri: [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path). """ inlineCode = _messages.StringField(1) resourceUri = _messages.StringField(2) class ViewDefinition(_messages.Message): r"""A ViewDefinition object. Fields: query: [Required] A query that BigQuery executes when the view is referenced. useLegacySql: [Experimental] Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql- reference/ Queries and views that reference this view must use the same flag value. userDefinedFunctionResources: [Experimental] Describes user-defined function resources used in the query. """ query = _messages.StringField(1) useLegacySql = _messages.BooleanField(2) userDefinedFunctionResources = _messages.MessageField('UserDefinedFunctionResource', 3, repeated=True) samples/bigquery_sample/bigquery_v2/bigquery_v2_client.py 0000644 00000063047 15025176453 0020026 0 ustar 00 """Generated client library for bigquery version v2.""" # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.py import base_api from samples.bigquery_sample.bigquery_v2 import bigquery_v2_messages as messages class BigqueryV2(base_api.BaseApiClient): """Generated client library for service bigquery version v2.""" MESSAGES_MODULE = messages BASE_URL = 'https://www.googleapis.com/bigquery/v2/' MTLS_BASE_URL = '' _PACKAGE = 'bigquery' _SCOPES = ['https://www.googleapis.com/auth/bigquery', 'https://www.googleapis.com/auth/bigquery.insertdata', 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/cloud-platform.read-only', 'https://www.googleapis.com/auth/devstorage.full_control', 'https://www.googleapis.com/auth/devstorage.read_only', 'https://www.googleapis.com/auth/devstorage.read_write'] _VERSION = 'v2' _CLIENT_ID = 'CLIENT_ID' _CLIENT_SECRET = 'CLIENT_SECRET' _USER_AGENT = 'x_Tw5K8nnjoRAqULM9PFAC2b' _CLIENT_CLASS_NAME = 'BigqueryV2' _URL_VERSION = 'v2' _API_KEY = None def __init__(self, url='', credentials=None, get_credentials=True, http=None, model=None, log_request=False, log_response=False, credentials_args=None, default_global_params=None, additional_http_headers=None, response_encoding=None): """Create a new bigquery handle.""" url = url or self.BASE_URL super(BigqueryV2, self).__init__( url, credentials=credentials, get_credentials=get_credentials, http=http, model=model, log_request=log_request, log_response=log_response, credentials_args=credentials_args, default_global_params=default_global_params, additional_http_headers=additional_http_headers, response_encoding=response_encoding) self.datasets = self.DatasetsService(self) self.jobs = self.JobsService(self) self.projects = self.ProjectsService(self) self.tabledata = self.TabledataService(self) self.tables = self.TablesService(self) class DatasetsService(base_api.BaseApiService): """Service class for the datasets resource.""" _NAME = 'datasets' def __init__(self, client): super(BigqueryV2.DatasetsService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name. Args: request: (BigqueryDatasetsDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (BigqueryDatasetsDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='bigquery.datasets.delete', ordered_params=['projectId', 'datasetId'], path_params=['datasetId', 'projectId'], query_params=['deleteContents'], relative_path='projects/{projectId}/datasets/{datasetId}', request_field='', request_type_name='BigqueryDatasetsDeleteRequest', response_type_name='BigqueryDatasetsDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Returns the dataset specified by datasetID. Args: request: (BigqueryDatasetsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Dataset) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.datasets.get', ordered_params=['projectId', 'datasetId'], path_params=['datasetId', 'projectId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}', request_field='', request_type_name='BigqueryDatasetsGetRequest', response_type_name='Dataset', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a new empty dataset. Args: request: (BigqueryDatasetsInsertRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Dataset) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='bigquery.datasets.insert', ordered_params=['projectId'], path_params=['projectId'], query_params=[], relative_path='projects/{projectId}/datasets', request_field='dataset', request_type_name='BigqueryDatasetsInsertRequest', response_type_name='Dataset', supports_download=False, ) def List(self, request, global_params=None): r"""Lists all datasets in the specified project to which you have been granted the READER dataset role. Args: request: (BigqueryDatasetsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (DatasetList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.datasets.list', ordered_params=['projectId'], path_params=['projectId'], query_params=['all', 'filter', 'maxResults', 'pageToken'], relative_path='projects/{projectId}/datasets', request_field='', request_type_name='BigqueryDatasetsListRequest', response_type_name='DatasetList', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics. Args: request: (BigqueryDatasetsPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Dataset) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='bigquery.datasets.patch', ordered_params=['projectId', 'datasetId'], path_params=['datasetId', 'projectId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}', request_field='dataset', request_type_name='BigqueryDatasetsPatchRequest', response_type_name='Dataset', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. Args: request: (BigqueryDatasetsUpdateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Dataset) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='bigquery.datasets.update', ordered_params=['projectId', 'datasetId'], path_params=['datasetId', 'projectId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}', request_field='dataset', request_type_name='BigqueryDatasetsUpdateRequest', response_type_name='Dataset', supports_download=False, ) class JobsService(base_api.BaseApiService): """Service class for the jobs resource.""" _NAME = 'jobs' def __init__(self, client): super(BigqueryV2.JobsService, self).__init__(client) self._upload_configs = { 'Insert': base_api.ApiUploadInfo( accept=['*/*'], max_size=None, resumable_multipart=True, resumable_path='/resumable/upload/bigquery/v2/projects/{projectId}/jobs', simple_multipart=True, simple_path='/upload/bigquery/v2/projects/{projectId}/jobs', ), } def Cancel(self, request, global_params=None): r"""Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs. Args: request: (BigqueryJobsCancelRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (JobCancelResponse) The response message. """ config = self.GetMethodConfig('Cancel') return self._RunMethod( config, request, global_params=global_params) Cancel.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='bigquery.jobs.cancel', ordered_params=['projectId', 'jobId'], path_params=['jobId', 'projectId'], query_params=[], relative_path='project/{projectId}/jobs/{jobId}/cancel', request_field='', request_type_name='BigqueryJobsCancelRequest', response_type_name='JobCancelResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role. Args: request: (BigqueryJobsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Job) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.jobs.get', ordered_params=['projectId', 'jobId'], path_params=['jobId', 'projectId'], query_params=[], relative_path='projects/{projectId}/jobs/{jobId}', request_field='', request_type_name='BigqueryJobsGetRequest', response_type_name='Job', supports_download=False, ) def GetQueryResults(self, request, global_params=None): r"""Retrieves the results of a query job. Args: request: (BigqueryJobsGetQueryResultsRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (GetQueryResultsResponse) The response message. """ config = self.GetMethodConfig('GetQueryResults') return self._RunMethod( config, request, global_params=global_params) GetQueryResults.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.jobs.getQueryResults', ordered_params=['projectId', 'jobId'], path_params=['jobId', 'projectId'], query_params=['maxResults', 'pageToken', 'startIndex', 'timeoutMs'], relative_path='projects/{projectId}/queries/{jobId}', request_field='', request_type_name='BigqueryJobsGetQueryResultsRequest', response_type_name='GetQueryResultsResponse', supports_download=False, ) def Insert(self, request, global_params=None, upload=None): r"""Starts a new asynchronous job. Requires the Can View project role. Args: request: (BigqueryJobsInsertRequest) input message global_params: (StandardQueryParameters, default: None) global arguments upload: (Upload, default: None) If present, upload this stream with the request. Returns: (Job) The response message. """ config = self.GetMethodConfig('Insert') upload_config = self.GetUploadConfig('Insert') return self._RunMethod( config, request, global_params=global_params, upload=upload, upload_config=upload_config) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='bigquery.jobs.insert', ordered_params=['projectId'], path_params=['projectId'], query_params=[], relative_path='projects/{projectId}/jobs', request_field='job', request_type_name='BigqueryJobsInsertRequest', response_type_name='Job', supports_download=False, ) def List(self, request, global_params=None): r"""Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property. Args: request: (BigqueryJobsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (JobList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.jobs.list', ordered_params=['projectId'], path_params=['projectId'], query_params=['allUsers', 'maxResults', 'pageToken', 'projection', 'stateFilter'], relative_path='projects/{projectId}/jobs', request_field='', request_type_name='BigqueryJobsListRequest', response_type_name='JobList', supports_download=False, ) def Query(self, request, global_params=None): r"""Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout. Args: request: (BigqueryJobsQueryRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (QueryResponse) The response message. """ config = self.GetMethodConfig('Query') return self._RunMethod( config, request, global_params=global_params) Query.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='bigquery.jobs.query', ordered_params=['projectId'], path_params=['projectId'], query_params=[], relative_path='projects/{projectId}/queries', request_field='queryRequest', request_type_name='BigqueryJobsQueryRequest', response_type_name='QueryResponse', supports_download=False, ) class ProjectsService(base_api.BaseApiService): """Service class for the projects resource.""" _NAME = 'projects' def __init__(self, client): super(BigqueryV2.ProjectsService, self).__init__(client) self._upload_configs = { } def List(self, request, global_params=None): r"""Lists all projects to which you have been granted any project role. Args: request: (BigqueryProjectsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ProjectList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.projects.list', ordered_params=[], path_params=[], query_params=['maxResults', 'pageToken'], relative_path='projects', request_field='', request_type_name='BigqueryProjectsListRequest', response_type_name='ProjectList', supports_download=False, ) class TabledataService(base_api.BaseApiService): """Service class for the tabledata resource.""" _NAME = 'tabledata' def __init__(self, client): super(BigqueryV2.TabledataService, self).__init__(client) self._upload_configs = { } def InsertAll(self, request, global_params=None): r"""Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role. Args: request: (BigqueryTabledataInsertAllRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TableDataInsertAllResponse) The response message. """ config = self.GetMethodConfig('InsertAll') return self._RunMethod( config, request, global_params=global_params) InsertAll.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='bigquery.tabledata.insertAll', ordered_params=['projectId', 'datasetId', 'tableId'], path_params=['datasetId', 'projectId', 'tableId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll', request_field='tableDataInsertAllRequest', request_type_name='BigqueryTabledataInsertAllRequest', response_type_name='TableDataInsertAllResponse', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves table data from a specified set of rows. Requires the READER dataset role. Args: request: (BigqueryTabledataListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TableDataList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.tabledata.list', ordered_params=['projectId', 'datasetId', 'tableId'], path_params=['datasetId', 'projectId', 'tableId'], query_params=['maxResults', 'pageToken', 'startIndex'], relative_path='projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data', request_field='', request_type_name='BigqueryTabledataListRequest', response_type_name='TableDataList', supports_download=False, ) class TablesService(base_api.BaseApiService): """Service class for the tables resource.""" _NAME = 'tables' def __init__(self, client): super(BigqueryV2.TablesService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted. Args: request: (BigqueryTablesDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (BigqueryTablesDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='bigquery.tables.delete', ordered_params=['projectId', 'datasetId', 'tableId'], path_params=['datasetId', 'projectId', 'tableId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}/tables/{tableId}', request_field='', request_type_name='BigqueryTablesDeleteRequest', response_type_name='BigqueryTablesDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table. Args: request: (BigqueryTablesGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.tables.get', ordered_params=['projectId', 'datasetId', 'tableId'], path_params=['datasetId', 'projectId', 'tableId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}/tables/{tableId}', request_field='', request_type_name='BigqueryTablesGetRequest', response_type_name='Table', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a new, empty table in the dataset. Args: request: (BigqueryTablesInsertRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='bigquery.tables.insert', ordered_params=['projectId', 'datasetId'], path_params=['datasetId', 'projectId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}/tables', request_field='table', request_type_name='BigqueryTablesInsertRequest', response_type_name='Table', supports_download=False, ) def List(self, request, global_params=None): r"""Lists all tables in the specified dataset. Requires the READER dataset role. Args: request: (BigqueryTablesListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TableList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='bigquery.tables.list', ordered_params=['projectId', 'datasetId'], path_params=['datasetId', 'projectId'], query_params=['maxResults', 'pageToken'], relative_path='projects/{projectId}/datasets/{datasetId}/tables', request_field='', request_type_name='BigqueryTablesListRequest', response_type_name='TableList', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics. Args: request: (BigqueryTablesPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='bigquery.tables.patch', ordered_params=['projectId', 'datasetId', 'tableId'], path_params=['datasetId', 'projectId', 'tableId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}/tables/{tableId}', request_field='table', request_type_name='BigqueryTablesPatchRequest', response_type_name='Table', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. Args: request: (BigqueryTablesUpdateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='bigquery.tables.update', ordered_params=['projectId', 'datasetId', 'tableId'], path_params=['datasetId', 'projectId', 'tableId'], query_params=[], relative_path='projects/{projectId}/datasets/{datasetId}/tables/{tableId}', request_field='table', request_type_name='BigqueryTablesUpdateRequest', response_type_name='Table', supports_download=False, ) samples/bigquery_sample/bigquery_v2/__init__.py 0000644 00000000207 15025176453 0015756 0 ustar 00 """Package marker file.""" from __future__ import absolute_import import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) samples/bigquery_sample/bigquery_v2.json 0000644 00000310501 15025176453 0014541 0 ustar 00 { "kind": "discovery#restDescription", "discoveryVersion": "v1", "id": "bigquery:v2", "name": "bigquery", "version": "v2", "revision": "20160819", "title": "BigQuery API", "description": "A data platform for customers to create, manage, share and query data.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "https://www.google.com/images/icons/product/search-16.gif", "x32": "https://www.google.com/images/icons/product/search-32.gif" }, "documentationLink": "https://cloud.google.com/bigquery/", "protocol": "rest", "baseUrl": "https://www.googleapis.com/bigquery/v2/", "basePath": "/bigquery/v2/", "rootUrl": "https://www.googleapis.com/", "servicePath": "bigquery/v2/", "batchPath": "batch", "parameters": { "alt": { "type": "string", "description": "Data format for the response.", "default": "json", "enum": [ "json" ], "enumDescriptions": [ "Responses with Content-Type of application/json" ], "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", "location": "query" }, "userIp": { "type": "string", "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/bigquery": { "description": "View and manage your data in Google BigQuery" }, "https://www.googleapis.com/auth/bigquery.insertdata": { "description": "Insert data into Google BigQuery" }, "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/cloud-platform.read-only": { "description": "View your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/devstorage.full_control": { "description": "Manage your data and permissions in Google Cloud Storage" }, "https://www.googleapis.com/auth/devstorage.read_only": { "description": "View your data in Google Cloud Storage" }, "https://www.googleapis.com/auth/devstorage.read_write": { "description": "Manage your data in Google Cloud Storage" } } } }, "schemas": { "BigtableColumn": { "id": "BigtableColumn", "type": "object", "properties": { "encoding": { "type": "string", "description": "[Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels." }, "fieldName": { "type": "string", "description": "[Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries." }, "onlyReadLatest": { "type": "boolean", "description": "[Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels." }, "qualifierEncoded": { "type": "string", "description": "[Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.", "format": "byte" }, "qualifierString": { "type": "string" }, "type": { "type": "string", "description": "[Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels." } } }, "BigtableColumnFamily": { "id": "BigtableColumnFamily", "type": "object", "properties": { "columns": { "type": "array", "description": "[Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field.", "items": { "$ref": "BigtableColumn" } }, "encoding": { "type": "string", "description": "[Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it." }, "familyId": { "type": "string", "description": "Identifier of the column family." }, "onlyReadLatest": { "type": "boolean", "description": "[Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column." }, "type": { "type": "string", "description": "[Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it." } } }, "BigtableOptions": { "id": "BigtableOptions", "type": "object", "properties": { "columnFamilies": { "type": "array", "description": "[Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.", "items": { "$ref": "BigtableColumnFamily" } }, "ignoreUnspecifiedColumnFamilies": { "type": "boolean", "description": "[Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false." }, "readRowkeyAsString": { "type": "boolean", "description": "[Optional] If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false." } } }, "CsvOptions": { "id": "CsvOptions", "type": "object", "properties": { "allowJaggedRows": { "type": "boolean", "description": "[Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false." }, "allowQuotedNewlines": { "type": "boolean", "description": "[Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false." }, "encoding": { "type": "string", "description": "[Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties." }, "fieldDelimiter": { "type": "string", "description": "[Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence \"\\t\" to specify a tab separator. The default value is a comma (',')." }, "quote": { "type": "string", "description": "[Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('\"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.", "default": "\"", "pattern": ".?" }, "skipLeadingRows": { "type": "string", "description": "[Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.", "format": "int64" } } }, "Dataset": { "id": "Dataset", "type": "object", "properties": { "access": { "type": "array", "description": "[Optional] An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER;", "items": { "type": "object", "properties": { "domain": { "type": "string", "description": "[Pick one] A domain to grant access to. Any users signed in with the domain specified will be granted the specified access. Example: \"example.com\"." }, "groupByEmail": { "type": "string", "description": "[Pick one] An email address of a Google Group to grant access to." }, "role": { "type": "string", "description": "[Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER, WRITER, OWNER." }, "specialGroup": { "type": "string", "description": "[Pick one] A special group to grant access to. Possible values include: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users." }, "userByEmail": { "type": "string", "description": "[Pick one] An email address of a user to grant access to. For example: fred@example.com." }, "view": { "$ref": "TableReference", "description": "[Pick one] A view from a different dataset to grant access to. Queries executed against that view will have read access to tables in this dataset. The role field is not required when this field is set. If that view is updated by any user, access to the view needs to be granted again via an update operation." } } } }, "creationTime": { "type": "string", "description": "[Output-only] The time when this dataset was created, in milliseconds since the epoch.", "format": "int64" }, "datasetReference": { "$ref": "DatasetReference", "description": "[Required] A reference that identifies the dataset." }, "defaultTableExpirationMs": { "type": "string", "description": "[Optional] The default lifetime of all tables in the dataset, in milliseconds. The minimum value is 3600000 milliseconds (one hour). Once this property is set, all newly-created tables in the dataset will have an expirationTime property set to the creation time plus the value in this property, and changing the value will only affect new tables, not existing ones. When the expirationTime for a given table is reached, that table will be deleted automatically. If a table's expirationTime is modified or removed before the table expires, or if you provide an explicit expirationTime when creating a table, that value takes precedence over the default expiration time indicated by this property.", "format": "int64" }, "description": { "type": "string", "description": "[Optional] A user-friendly description of the dataset." }, "etag": { "type": "string", "description": "[Output-only] A hash of the resource." }, "friendlyName": { "type": "string", "description": "[Optional] A descriptive name for the dataset." }, "id": { "type": "string", "description": "[Output-only] The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field. When creating a new dataset, leave this field blank, and instead specify the datasetId field." }, "kind": { "type": "string", "description": "[Output-only] The resource type.", "default": "bigquery#dataset" }, "labels": { "type": "object", "description": "[Experimental] The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. Label keys and values can be no longer than 63 characters, can only contain letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and must be unique within a dataset. Both keys and values are additionally constrained to be \u003c= 128 bytes in size.", "additionalProperties": { "type": "string" } }, "lastModifiedTime": { "type": "string", "description": "[Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.", "format": "int64" }, "location": { "type": "string", "description": "[Experimental] The geographic location where the dataset should reside. Possible values include EU and US. The default value is US." }, "selfLink": { "type": "string", "description": "[Output-only] A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource." } } }, "DatasetList": { "id": "DatasetList", "type": "object", "properties": { "datasets": { "type": "array", "description": "An array of the dataset resources in the project. Each resource contains basic information. For full information about a particular dataset resource, use the Datasets: get method. This property is omitted when there are no datasets in the project.", "items": { "type": "object", "properties": { "datasetReference": { "$ref": "DatasetReference", "description": "The dataset reference. Use this property to access specific parts of the dataset's ID, such as project ID or dataset ID." }, "friendlyName": { "type": "string", "description": "A descriptive name for the dataset, if one exists." }, "id": { "type": "string", "description": "The fully-qualified, unique, opaque ID of the dataset." }, "kind": { "type": "string", "description": "The resource type. This property always returns the value \"bigquery#dataset\".", "default": "bigquery#dataset" }, "labels": { "type": "object", "description": "[Experimental] The labels associated with this dataset. You can use these to organize and group your datasets.", "additionalProperties": { "type": "string" } } } } }, "etag": { "type": "string", "description": "A hash value of the results page. You can use this property to determine if the page has changed since the last request." }, "kind": { "type": "string", "description": "The list type. This property always returns the value \"bigquery#datasetList\".", "default": "bigquery#datasetList" }, "nextPageToken": { "type": "string", "description": "A token that can be used to request the next results page. This property is omitted on the final results page." } } }, "DatasetReference": { "id": "DatasetReference", "type": "object", "properties": { "datasetId": { "type": "string", "description": "[Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.", "annotations": { "required": [ "bigquery.datasets.update" ] } }, "projectId": { "type": "string", "description": "[Optional] The ID of the project containing this dataset.", "annotations": { "required": [ "bigquery.datasets.update" ] } } } }, "ErrorProto": { "id": "ErrorProto", "type": "object", "properties": { "debugInfo": { "type": "string", "description": "Debugging information. This property is internal to Google and should not be used." }, "location": { "type": "string", "description": "Specifies where the error occurred, if present." }, "message": { "type": "string", "description": "A human-readable description of the error." }, "reason": { "type": "string", "description": "A short error code that summarizes the error." } } }, "ExplainQueryStage": { "id": "ExplainQueryStage", "type": "object", "properties": { "computeRatioAvg": { "type": "number", "description": "Relative amount of time the average shard spent on CPU-bound tasks.", "format": "double" }, "computeRatioMax": { "type": "number", "description": "Relative amount of time the slowest shard spent on CPU-bound tasks.", "format": "double" }, "id": { "type": "string", "description": "Unique ID for stage within plan.", "format": "int64" }, "name": { "type": "string", "description": "Human-readable name for stage." }, "readRatioAvg": { "type": "number", "description": "Relative amount of time the average shard spent reading input.", "format": "double" }, "readRatioMax": { "type": "number", "description": "Relative amount of time the slowest shard spent reading input.", "format": "double" }, "recordsRead": { "type": "string", "description": "Number of records read into the stage.", "format": "int64" }, "recordsWritten": { "type": "string", "description": "Number of records written by the stage.", "format": "int64" }, "steps": { "type": "array", "description": "List of operations within the stage in dependency order (approximately chronological).", "items": { "$ref": "ExplainQueryStep" } }, "waitRatioAvg": { "type": "number", "description": "Relative amount of time the average shard spent waiting to be scheduled.", "format": "double" }, "waitRatioMax": { "type": "number", "description": "Relative amount of time the slowest shard spent waiting to be scheduled.", "format": "double" }, "writeRatioAvg": { "type": "number", "description": "Relative amount of time the average shard spent on writing output.", "format": "double" }, "writeRatioMax": { "type": "number", "description": "Relative amount of time the slowest shard spent on writing output.", "format": "double" } } }, "ExplainQueryStep": { "id": "ExplainQueryStep", "type": "object", "properties": { "kind": { "type": "string", "description": "Machine-readable operation type." }, "substeps": { "type": "array", "description": "Human-readable stage descriptions.", "items": { "type": "string" } } } }, "ExternalDataConfiguration": { "id": "ExternalDataConfiguration", "type": "object", "properties": { "autodetect": { "type": "boolean", "description": "[Experimental] Try to detect schema and format options automatically. Any option specified explicitly will be honored." }, "bigtableOptions": { "$ref": "BigtableOptions", "description": "[Optional] Additional options if sourceFormat is set to BIGTABLE." }, "compression": { "type": "string", "description": "[Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats." }, "csvOptions": { "$ref": "CsvOptions", "description": "Additional properties to set if sourceFormat is set to CSV." }, "googleSheetsOptions": { "$ref": "GoogleSheetsOptions", "description": "[Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS." }, "ignoreUnknownValues": { "type": "boolean", "description": "[Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored." }, "maxBadRecords": { "type": "integer", "description": "[Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.", "format": "int32" }, "schema": { "$ref": "TableSchema", "description": "[Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats." }, "sourceFormat": { "type": "string", "description": "[Required] The data format. For CSV files, specify \"CSV\". For Google sheets, specify \"GOOGLE_SHEETS\". For newline-delimited JSON, specify \"NEWLINE_DELIMITED_JSON\". For Avro files, specify \"AVRO\". For Google Cloud Datastore backups, specify \"DATASTORE_BACKUP\". [Experimental] For Google Cloud Bigtable, specify \"BIGTABLE\". Please note that reading from Google Cloud Bigtable is experimental and has to be enabled for your project. Please contact Google Cloud Support to enable this for your project." }, "sourceUris": { "type": "array", "description": "[Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified, and it must end with '.backup_info'. Also, the '*' wildcard character is not allowed.", "items": { "type": "string" } } } }, "GetQueryResultsResponse": { "id": "GetQueryResultsResponse", "type": "object", "properties": { "cacheHit": { "type": "boolean", "description": "Whether the query result was fetched from the query cache." }, "errors": { "type": "array", "description": "[Output-only] All errors and warnings encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.", "items": { "$ref": "ErrorProto" } }, "etag": { "type": "string", "description": "A hash of this response." }, "jobComplete": { "type": "boolean", "description": "Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available." }, "jobReference": { "$ref": "JobReference", "description": "Reference to the BigQuery Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults)." }, "kind": { "type": "string", "description": "The resource type of the response.", "default": "bigquery#getQueryResultsResponse" }, "numDmlAffectedRows": { "type": "string", "description": "[Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.", "format": "int64" }, "pageToken": { "type": "string", "description": "A token used for paging results." }, "rows": { "type": "array", "description": "An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. Present only when the query completes successfully.", "items": { "$ref": "TableRow" } }, "schema": { "$ref": "TableSchema", "description": "The schema of the results. Present only when the query completes successfully." }, "totalBytesProcessed": { "type": "string", "description": "The total number of bytes processed for this query.", "format": "int64" }, "totalRows": { "type": "string", "description": "The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. Present only when the query completes successfully.", "format": "uint64" } } }, "GoogleSheetsOptions": { "id": "GoogleSheetsOptions", "type": "object", "properties": { "skipLeadingRows": { "type": "string", "description": "[Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N \u003e 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.", "format": "int64" } } }, "Job": { "id": "Job", "type": "object", "properties": { "configuration": { "$ref": "JobConfiguration", "description": "[Required] Describes the job configuration." }, "etag": { "type": "string", "description": "[Output-only] A hash of this resource." }, "id": { "type": "string", "description": "[Output-only] Opaque ID field of the job" }, "jobReference": { "$ref": "JobReference", "description": "[Optional] Reference describing the unique-per-user name of the job." }, "kind": { "type": "string", "description": "[Output-only] The type of the resource.", "default": "bigquery#job" }, "selfLink": { "type": "string", "description": "[Output-only] A URL that can be used to access this resource again." }, "statistics": { "$ref": "JobStatistics", "description": "[Output-only] Information about the job, including starting time and ending time of the job." }, "status": { "$ref": "JobStatus", "description": "[Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete." }, "user_email": { "type": "string", "description": "[Output-only] Email address of the user who ran the job." } } }, "JobCancelResponse": { "id": "JobCancelResponse", "type": "object", "properties": { "job": { "$ref": "Job", "description": "The final state of the job." }, "kind": { "type": "string", "description": "The resource type of the response.", "default": "bigquery#jobCancelResponse" } } }, "JobConfiguration": { "id": "JobConfiguration", "type": "object", "properties": { "copy": { "$ref": "JobConfigurationTableCopy", "description": "[Pick one] Copies a table." }, "dryRun": { "type": "boolean", "description": "[Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined." }, "extract": { "$ref": "JobConfigurationExtract", "description": "[Pick one] Configures an extract job." }, "load": { "$ref": "JobConfigurationLoad", "description": "[Pick one] Configures a load job." }, "query": { "$ref": "JobConfigurationQuery", "description": "[Pick one] Configures a query job." } } }, "JobConfigurationExtract": { "id": "JobConfigurationExtract", "type": "object", "properties": { "compression": { "type": "string", "description": "[Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE." }, "destinationFormat": { "type": "string", "description": "[Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV." }, "destinationUri": { "type": "string", "description": "[Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written." }, "destinationUris": { "type": "array", "description": "[Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.", "items": { "type": "string" } }, "fieldDelimiter": { "type": "string", "description": "[Optional] Delimiter to use between fields in the exported data. Default is ','" }, "printHeader": { "type": "boolean", "description": "[Optional] Whether to print out a header row in the results. Default is true.", "default": "true" }, "sourceTable": { "$ref": "TableReference", "description": "[Required] A reference to the table being exported." } } }, "JobConfigurationLoad": { "id": "JobConfigurationLoad", "type": "object", "properties": { "allowJaggedRows": { "type": "boolean", "description": "[Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats." }, "allowQuotedNewlines": { "type": "boolean", "description": "Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false." }, "autodetect": { "type": "boolean", "description": "[Experimental] Indicates if we should automatically infer the options and schema for CSV and JSON sources." }, "createDisposition": { "type": "string", "description": "[Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion." }, "destinationTable": { "$ref": "TableReference", "description": "[Required] The destination table to load the data into." }, "encoding": { "type": "string", "description": "[Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties." }, "fieldDelimiter": { "type": "string", "description": "[Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence \"\\t\" to specify a tab separator. The default value is a comma (',')." }, "ignoreUnknownValues": { "type": "boolean", "description": "[Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names" }, "maxBadRecords": { "type": "integer", "description": "[Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.", "format": "int32" }, "projectionFields": { "type": "array", "description": "[Experimental] If sourceFormat is set to \"DATASTORE_BACKUP\", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.", "items": { "type": "string" } }, "quote": { "type": "string", "description": "[Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('\"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.", "default": "\"", "pattern": ".?" }, "schema": { "$ref": "TableSchema", "description": "[Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore." }, "schemaInline": { "type": "string", "description": "[Deprecated] The inline schema. For CSV schemas, specify as \"Field1:Type1[,Field2:Type2]*\". For example, \"foo:STRING, bar:INTEGER, baz:FLOAT\"." }, "schemaInlineFormat": { "type": "string", "description": "[Deprecated] The format of the schemaInline property." }, "schemaUpdateOptions": { "type": "array", "description": "[Experimental] Allows the schema of the desitination table to be updated as a side effect of the load job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.", "items": { "type": "string" } }, "skipLeadingRows": { "type": "integer", "description": "[Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.", "format": "int32" }, "sourceFormat": { "type": "string", "description": "[Optional] The format of the data files. For CSV files, specify \"CSV\". For datastore backups, specify \"DATASTORE_BACKUP\". For newline-delimited JSON, specify \"NEWLINE_DELIMITED_JSON\". For Avro, specify \"AVRO\". The default value is CSV." }, "sourceUris": { "type": "array", "description": "[Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.", "items": { "type": "string" } }, "writeDisposition": { "type": "string", "description": "[Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion." } } }, "JobConfigurationQuery": { "id": "JobConfigurationQuery", "type": "object", "properties": { "allowLargeResults": { "type": "boolean", "description": "If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set." }, "createDisposition": { "type": "string", "description": "[Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion." }, "defaultDataset": { "$ref": "DatasetReference", "description": "[Optional] Specifies the default dataset to use for unqualified table names in the query." }, "destinationTable": { "$ref": "TableReference", "description": "[Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results." }, "flattenResults": { "type": "boolean", "description": "[Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.", "default": "true" }, "maximumBillingTier": { "type": "integer", "description": "[Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default.", "default": "1", "format": "int32" }, "maximumBytesBilled": { "type": "string", "description": "[Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.", "format": "int64" }, "preserveNulls": { "type": "boolean", "description": "[Deprecated] This property is deprecated." }, "priority": { "type": "string", "description": "[Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE." }, "query": { "type": "string", "description": "[Required] BigQuery SQL query to execute." }, "schemaUpdateOptions": { "type": "array", "description": "[Experimental] Allows the schema of the desitination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.", "items": { "type": "string" } }, "tableDefinitions": { "type": "object", "description": "[Optional] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.", "additionalProperties": { "$ref": "ExternalDataConfiguration" } }, "useLegacySql": { "type": "boolean", "description": "[Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false." }, "useQueryCache": { "type": "boolean", "description": "[Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true.", "default": "true" }, "userDefinedFunctionResources": { "type": "array", "description": "[Experimental] Describes user-defined function resources used in the query.", "items": { "$ref": "UserDefinedFunctionResource" } }, "writeDisposition": { "type": "string", "description": "[Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion." } } }, "JobConfigurationTableCopy": { "id": "JobConfigurationTableCopy", "type": "object", "properties": { "createDisposition": { "type": "string", "description": "[Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion." }, "destinationTable": { "$ref": "TableReference", "description": "[Required] The destination table" }, "sourceTable": { "$ref": "TableReference", "description": "[Pick one] Source table to copy." }, "sourceTables": { "type": "array", "description": "[Pick one] Source tables to copy.", "items": { "$ref": "TableReference" } }, "writeDisposition": { "type": "string", "description": "[Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion." } } }, "JobList": { "id": "JobList", "type": "object", "properties": { "etag": { "type": "string", "description": "A hash of this page of results." }, "jobs": { "type": "array", "description": "List of jobs that were requested.", "items": { "type": "object", "properties": { "configuration": { "$ref": "JobConfiguration", "description": "[Full-projection-only] Specifies the job configuration." }, "errorResult": { "$ref": "ErrorProto", "description": "A result object that will be present only if the job has failed." }, "id": { "type": "string", "description": "Unique opaque ID of the job." }, "jobReference": { "$ref": "JobReference", "description": "Job reference uniquely identifying the job." }, "kind": { "type": "string", "description": "The resource type.", "default": "bigquery#job" }, "state": { "type": "string", "description": "Running state of the job. When the state is DONE, errorResult can be checked to determine whether the job succeeded or failed." }, "statistics": { "$ref": "JobStatistics", "description": "[Output-only] Information about the job, including starting time and ending time of the job." }, "status": { "$ref": "JobStatus", "description": "[Full-projection-only] Describes the state of the job." }, "user_email": { "type": "string", "description": "[Full-projection-only] Email address of the user who ran the job." } } } }, "kind": { "type": "string", "description": "The resource type of the response.", "default": "bigquery#jobList" }, "nextPageToken": { "type": "string", "description": "A token to request the next page of results." } } }, "JobReference": { "id": "JobReference", "type": "object", "properties": { "jobId": { "type": "string", "description": "[Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.", "annotations": { "required": [ "bigquery.jobs.getQueryResults" ] } }, "projectId": { "type": "string", "description": "[Required] The ID of the project containing this job.", "annotations": { "required": [ "bigquery.jobs.getQueryResults" ] } } } }, "JobStatistics": { "id": "JobStatistics", "type": "object", "properties": { "creationTime": { "type": "string", "description": "[Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.", "format": "int64" }, "endTime": { "type": "string", "description": "[Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.", "format": "int64" }, "extract": { "$ref": "JobStatistics4", "description": "[Output-only] Statistics for an extract job." }, "load": { "$ref": "JobStatistics3", "description": "[Output-only] Statistics for a load job." }, "query": { "$ref": "JobStatistics2", "description": "[Output-only] Statistics for a query job." }, "startTime": { "type": "string", "description": "[Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.", "format": "int64" }, "totalBytesProcessed": { "type": "string", "description": "[Output-only] [Deprecated] Use the bytes processed in the query statistics instead.", "format": "int64" } } }, "JobStatistics2": { "id": "JobStatistics2", "type": "object", "properties": { "billingTier": { "type": "integer", "description": "[Output-only] Billing tier for the job.", "format": "int32" }, "cacheHit": { "type": "boolean", "description": "[Output-only] Whether the query result was fetched from the query cache." }, "numDmlAffectedRows": { "type": "string", "description": "[Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.", "format": "int64" }, "queryPlan": { "type": "array", "description": "[Output-only, Experimental] Describes execution plan for the query.", "items": { "$ref": "ExplainQueryStage" } }, "referencedTables": { "type": "array", "description": "[Output-only, Experimental] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list.", "items": { "$ref": "TableReference" } }, "schema": { "$ref": "TableSchema", "description": "[Output-only, Experimental] The schema of the results. Present only for successful dry run of non-legacy SQL queries." }, "totalBytesBilled": { "type": "string", "description": "[Output-only] Total bytes billed for the job.", "format": "int64" }, "totalBytesProcessed": { "type": "string", "description": "[Output-only] Total bytes processed for the job.", "format": "int64" } } }, "JobStatistics3": { "id": "JobStatistics3", "type": "object", "properties": { "inputFileBytes": { "type": "string", "description": "[Output-only] Number of bytes of source data in a load job.", "format": "int64" }, "inputFiles": { "type": "string", "description": "[Output-only] Number of source files in a load job.", "format": "int64" }, "outputBytes": { "type": "string", "description": "[Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.", "format": "int64" }, "outputRows": { "type": "string", "description": "[Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.", "format": "int64" } } }, "JobStatistics4": { "id": "JobStatistics4", "type": "object", "properties": { "destinationUriFileCounts": { "type": "array", "description": "[Output-only] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field.", "items": { "type": "string", "format": "int64" } } } }, "JobStatus": { "id": "JobStatus", "type": "object", "properties": { "errorResult": { "$ref": "ErrorProto", "description": "[Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful." }, "errors": { "type": "array", "description": "[Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.", "items": { "$ref": "ErrorProto" } }, "state": { "type": "string", "description": "[Output-only] Running state of the job." } } }, "JsonObject": { "id": "JsonObject", "type": "object", "description": "Represents a single JSON object.", "additionalProperties": { "$ref": "JsonValue" } }, "JsonValue": { "id": "JsonValue", "type": "any" }, "ProjectList": { "id": "ProjectList", "type": "object", "properties": { "etag": { "type": "string", "description": "A hash of the page of results" }, "kind": { "type": "string", "description": "The type of list.", "default": "bigquery#projectList" }, "nextPageToken": { "type": "string", "description": "A token to request the next page of results." }, "projects": { "type": "array", "description": "Projects to which you have at least READ access.", "items": { "type": "object", "properties": { "friendlyName": { "type": "string", "description": "A descriptive name for this project." }, "id": { "type": "string", "description": "An opaque ID of this project." }, "kind": { "type": "string", "description": "The resource type.", "default": "bigquery#project" }, "numericId": { "type": "string", "description": "The numeric ID of this project.", "format": "uint64" }, "projectReference": { "$ref": "ProjectReference", "description": "A unique reference to this project." } } } }, "totalItems": { "type": "integer", "description": "The total number of projects in the list.", "format": "int32" } } }, "ProjectReference": { "id": "ProjectReference", "type": "object", "properties": { "projectId": { "type": "string", "description": "[Required] ID of the project. Can be either the numeric ID or the assigned ID of the project." } } }, "QueryRequest": { "id": "QueryRequest", "type": "object", "properties": { "defaultDataset": { "$ref": "DatasetReference", "description": "[Optional] Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'." }, "dryRun": { "type": "boolean", "description": "[Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false." }, "kind": { "type": "string", "description": "The resource type of the request.", "default": "bigquery#queryRequest" }, "maxResults": { "type": "integer", "description": "[Optional] The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies.", "format": "uint32" }, "preserveNulls": { "type": "boolean", "description": "[Deprecated] This property is deprecated." }, "query": { "type": "string", "description": "[Required] A query string, following the BigQuery query syntax, of the query to execute. Example: \"SELECT count(f1) FROM [myProjectId:myDatasetId.myTableId]\".", "annotations": { "required": [ "bigquery.jobs.query" ] } }, "timeoutMs": { "type": "integer", "description": "[Optional] How long to wait for the query to complete, in milliseconds, before the request times out and returns. Note that this is only a timeout for the request, not the query. If the query takes longer to run than the timeout value, the call returns without any results and with the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to complete and read the results. The default value is 10000 milliseconds (10 seconds).", "format": "uint32" }, "useLegacySql": { "type": "boolean", "description": "[Experimental] Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the values of allowLargeResults and flattenResults are ignored; query will be run as if allowLargeResults is true and flattenResults is false." }, "useQueryCache": { "type": "boolean", "description": "[Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. The default value is true.", "default": "true" } } }, "QueryResponse": { "id": "QueryResponse", "type": "object", "properties": { "cacheHit": { "type": "boolean", "description": "Whether the query result was fetched from the query cache." }, "errors": { "type": "array", "description": "[Output-only] All errors and warnings encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.", "items": { "$ref": "ErrorProto" } }, "jobComplete": { "type": "boolean", "description": "Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available." }, "jobReference": { "$ref": "JobReference", "description": "Reference to the Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults)." }, "kind": { "type": "string", "description": "The resource type.", "default": "bigquery#queryResponse" }, "numDmlAffectedRows": { "type": "string", "description": "[Output-only, Experimental] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.", "format": "int64" }, "pageToken": { "type": "string", "description": "A token used for paging results." }, "rows": { "type": "array", "description": "An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above.", "items": { "$ref": "TableRow" } }, "schema": { "$ref": "TableSchema", "description": "The schema of the results. Present only when the query completes successfully." }, "totalBytesProcessed": { "type": "string", "description": "The total number of bytes processed for this query. If this query was a dry run, this is the number of bytes that would be processed if the query were run.", "format": "int64" }, "totalRows": { "type": "string", "description": "The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results.", "format": "uint64" } } }, "Streamingbuffer": { "id": "Streamingbuffer", "type": "object", "properties": { "estimatedBytes": { "type": "string", "description": "[Output-only] A lower-bound estimate of the number of bytes currently in the streaming buffer.", "format": "uint64" }, "estimatedRows": { "type": "string", "description": "[Output-only] A lower-bound estimate of the number of rows currently in the streaming buffer.", "format": "uint64" }, "oldestEntryTime": { "type": "string", "description": "[Output-only] Contains the timestamp of the oldest entry in the streaming buffer, in milliseconds since the epoch, if the streaming buffer is available.", "format": "uint64" } } }, "Table": { "id": "Table", "type": "object", "properties": { "creationTime": { "type": "string", "description": "[Output-only] The time when this table was created, in milliseconds since the epoch.", "format": "int64" }, "description": { "type": "string", "description": "[Optional] A user-friendly description of this table." }, "etag": { "type": "string", "description": "[Output-only] A hash of this resource." }, "expirationTime": { "type": "string", "description": "[Optional] The time when this table expires, in milliseconds since the epoch. If not present, the table will persist indefinitely. Expired tables will be deleted and their storage reclaimed.", "format": "int64" }, "externalDataConfiguration": { "$ref": "ExternalDataConfiguration", "description": "[Optional] Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table." }, "friendlyName": { "type": "string", "description": "[Optional] A descriptive name for this table." }, "id": { "type": "string", "description": "[Output-only] An opaque ID uniquely identifying the table." }, "kind": { "type": "string", "description": "[Output-only] The type of the resource.", "default": "bigquery#table" }, "lastModifiedTime": { "type": "string", "description": "[Output-only] The time when this table was last modified, in milliseconds since the epoch.", "format": "uint64" }, "location": { "type": "string", "description": "[Output-only] The geographic location where the table resides. This value is inherited from the dataset." }, "numBytes": { "type": "string", "description": "[Output-only] The size of this table in bytes, excluding any data in the streaming buffer.", "format": "int64" }, "numLongTermBytes": { "type": "string", "description": "[Output-only] The number of bytes in the table that are considered \"long-term storage\".", "format": "int64" }, "numRows": { "type": "string", "description": "[Output-only] The number of rows of data in this table, excluding any data in the streaming buffer.", "format": "uint64" }, "schema": { "$ref": "TableSchema", "description": "[Optional] Describes the schema of this table." }, "selfLink": { "type": "string", "description": "[Output-only] A URL that can be used to access this resource again." }, "streamingBuffer": { "$ref": "Streamingbuffer", "description": "[Output-only] Contains information regarding this table's streaming buffer, if one is present. This field will be absent if the table is not being streamed to or if there is no data in the streaming buffer." }, "tableReference": { "$ref": "TableReference", "description": "[Required] Reference describing the ID of this table." }, "timePartitioning": { "$ref": "TimePartitioning", "description": "[Experimental] If specified, configures time-based partitioning for this table." }, "type": { "type": "string", "description": "[Output-only] Describes the table type. The following values are supported: TABLE: A normal BigQuery table. VIEW: A virtual table defined by a SQL query. EXTERNAL: A table that references data stored in an external storage system, such as Google Cloud Storage. The default value is TABLE." }, "view": { "$ref": "ViewDefinition", "description": "[Optional] The view definition." } } }, "TableCell": { "id": "TableCell", "type": "object", "properties": { "v": { "type": "any" } } }, "TableDataInsertAllRequest": { "id": "TableDataInsertAllRequest", "type": "object", "properties": { "ignoreUnknownValues": { "type": "boolean", "description": "[Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors." }, "kind": { "type": "string", "description": "The resource type of the response.", "default": "bigquery#tableDataInsertAllRequest" }, "rows": { "type": "array", "description": "The rows to insert.", "items": { "type": "object", "properties": { "insertId": { "type": "string", "description": "[Optional] A unique ID for each row. BigQuery uses this property to detect duplicate insertion requests on a best-effort basis." }, "json": { "$ref": "JsonObject", "description": "[Required] A JSON object that contains a row of data. The object's properties and values must match the destination table's schema." } } } }, "skipInvalidRows": { "type": "boolean", "description": "[Optional] Insert all valid rows of a request, even if invalid rows exist. The default value is false, which causes the entire request to fail if any invalid rows exist." }, "templateSuffix": { "type": "string", "description": "[Experimental] If specified, treats the destination table as a base template, and inserts the rows into an instance table named \"{destination}{templateSuffix}\". BigQuery will manage creation of the instance table, using the schema of the base template table. See https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates tables." } } }, "TableDataInsertAllResponse": { "id": "TableDataInsertAllResponse", "type": "object", "properties": { "insertErrors": { "type": "array", "description": "An array of errors for rows that were not inserted.", "items": { "type": "object", "properties": { "errors": { "type": "array", "description": "Error information for the row indicated by the index property.", "items": { "$ref": "ErrorProto" } }, "index": { "type": "integer", "description": "The index of the row that error applies to.", "format": "uint32" } } } }, "kind": { "type": "string", "description": "The resource type of the response.", "default": "bigquery#tableDataInsertAllResponse" } } }, "TableDataList": { "id": "TableDataList", "type": "object", "properties": { "etag": { "type": "string", "description": "A hash of this page of results." }, "kind": { "type": "string", "description": "The resource type of the response.", "default": "bigquery#tableDataList" }, "pageToken": { "type": "string", "description": "A token used for paging results. Providing this token instead of the startIndex parameter can help you retrieve stable results when an underlying table is changing." }, "rows": { "type": "array", "description": "Rows of results.", "items": { "$ref": "TableRow" } }, "totalRows": { "type": "string", "description": "The total number of rows in the complete table.", "format": "int64" } } }, "TableFieldSchema": { "id": "TableFieldSchema", "type": "object", "properties": { "description": { "type": "string", "description": "[Optional] The field description. The maximum length is 16K characters." }, "fields": { "type": "array", "description": "[Optional] Describes the nested schema fields if the type property is set to RECORD.", "items": { "$ref": "TableFieldSchema" } }, "mode": { "type": "string", "description": "[Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE." }, "name": { "type": "string", "description": "[Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters." }, "type": { "type": "string", "description": "[Required] The field data type. Possible values include STRING, BYTES, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema)." } } }, "TableList": { "id": "TableList", "type": "object", "properties": { "etag": { "type": "string", "description": "A hash of this page of results." }, "kind": { "type": "string", "description": "The type of list.", "default": "bigquery#tableList" }, "nextPageToken": { "type": "string", "description": "A token to request the next page of results." }, "tables": { "type": "array", "description": "Tables in the requested dataset.", "items": { "type": "object", "properties": { "friendlyName": { "type": "string", "description": "The user-friendly name for this table." }, "id": { "type": "string", "description": "An opaque ID of the table" }, "kind": { "type": "string", "description": "The resource type.", "default": "bigquery#table" }, "tableReference": { "$ref": "TableReference", "description": "A reference uniquely identifying the table." }, "type": { "type": "string", "description": "The type of table. Possible values are: TABLE, VIEW." } } } }, "totalItems": { "type": "integer", "description": "The total number of tables in the dataset.", "format": "int32" } } }, "TableReference": { "id": "TableReference", "type": "object", "properties": { "datasetId": { "type": "string", "description": "[Required] The ID of the dataset containing this table.", "annotations": { "required": [ "bigquery.tables.update" ] } }, "projectId": { "type": "string", "description": "[Required] The ID of the project containing this table.", "annotations": { "required": [ "bigquery.tables.update" ] } }, "tableId": { "type": "string", "description": "[Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.", "annotations": { "required": [ "bigquery.tables.update" ] } } } }, "TableRow": { "id": "TableRow", "type": "object", "properties": { "f": { "type": "array", "description": "Represents a single row in the result set, consisting of one or more fields.", "items": { "$ref": "TableCell" } } } }, "TableSchema": { "id": "TableSchema", "type": "object", "properties": { "fields": { "type": "array", "description": "Describes the fields in a table.", "items": { "$ref": "TableFieldSchema" } } } }, "TimePartitioning": { "id": "TimePartitioning", "type": "object", "properties": { "expirationMs": { "type": "string", "description": "[Optional] Number of milliseconds for which to keep the storage for a partition.", "format": "int64" }, "type": { "type": "string", "description": "[Required] The only type supported is DAY, which will generate one partition per day based on data loading time." } } }, "UserDefinedFunctionResource": { "id": "UserDefinedFunctionResource", "type": "object", "properties": { "inlineCode": { "type": "string", "description": "[Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code." }, "resourceUri": { "type": "string", "description": "[Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path)." } } }, "ViewDefinition": { "id": "ViewDefinition", "type": "object", "properties": { "query": { "type": "string", "description": "[Required] A query that BigQuery executes when the view is referenced." }, "useLegacySql": { "type": "boolean", "description": "[Experimental] Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value." }, "userDefinedFunctionResources": { "type": "array", "description": "[Experimental] Describes user-defined function resources used in the query.", "items": { "$ref": "UserDefinedFunctionResource" } } } } }, "resources": { "datasets": { "methods": { "delete": { "id": "bigquery.datasets.delete", "path": "projects/{projectId}/datasets/{datasetId}", "httpMethod": "DELETE", "description": "Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of dataset being deleted", "required": true, "location": "path" }, "deleteContents": { "type": "boolean", "description": "If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False", "location": "query" }, "projectId": { "type": "string", "description": "Project ID of the dataset being deleted", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId" ], "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] }, "get": { "id": "bigquery.datasets.get", "path": "projects/{projectId}/datasets/{datasetId}", "httpMethod": "GET", "description": "Returns the dataset specified by datasetID.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the requested dataset", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the requested dataset", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId" ], "response": { "$ref": "Dataset" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "insert": { "id": "bigquery.datasets.insert", "path": "projects/{projectId}/datasets", "httpMethod": "POST", "description": "Creates a new empty dataset.", "parameters": { "projectId": { "type": "string", "description": "Project ID of the new dataset", "required": true, "location": "path" } }, "parameterOrder": [ "projectId" ], "request": { "$ref": "Dataset" }, "response": { "$ref": "Dataset" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] }, "list": { "id": "bigquery.datasets.list", "path": "projects/{projectId}/datasets", "httpMethod": "GET", "description": "Lists all datasets in the specified project to which you have been granted the READER dataset role.", "parameters": { "all": { "type": "boolean", "description": "Whether to list all datasets, including hidden ones", "location": "query" }, "filter": { "type": "string", "description": "An expression for filtering the results of the request by label. The syntax is \"labels.[:]\". Multiple filters can be ANDed together by connecting with a space. Example: \"labels.department:receiving labels.active\". See https://cloud.google.com/bigquery/docs/labeling-datasets#filtering_datasets_using_labels for details.", "location": "query" }, "maxResults": { "type": "integer", "description": "The maximum number of results to return", "format": "uint32", "location": "query" }, "pageToken": { "type": "string", "description": "Page token, returned by a previous call, to request the next page of results", "location": "query" }, "projectId": { "type": "string", "description": "Project ID of the datasets to be listed", "required": true, "location": "path" } }, "parameterOrder": [ "projectId" ], "response": { "$ref": "DatasetList" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "patch": { "id": "bigquery.datasets.patch", "path": "projects/{projectId}/datasets/{datasetId}", "httpMethod": "PATCH", "description": "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the dataset being updated", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the dataset being updated", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId" ], "request": { "$ref": "Dataset" }, "response": { "$ref": "Dataset" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] }, "update": { "id": "bigquery.datasets.update", "path": "projects/{projectId}/datasets/{datasetId}", "httpMethod": "PUT", "description": "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the dataset being updated", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the dataset being updated", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId" ], "request": { "$ref": "Dataset" }, "response": { "$ref": "Dataset" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] } } }, "jobs": { "methods": { "cancel": { "id": "bigquery.jobs.cancel", "path": "project/{projectId}/jobs/{jobId}/cancel", "httpMethod": "POST", "description": "Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.", "parameters": { "jobId": { "type": "string", "description": "[Required] Job ID of the job to cancel", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "[Required] Project ID of the job to cancel", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "jobId" ], "response": { "$ref": "JobCancelResponse" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] }, "get": { "id": "bigquery.jobs.get", "path": "projects/{projectId}/jobs/{jobId}", "httpMethod": "GET", "description": "Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.", "parameters": { "jobId": { "type": "string", "description": "[Required] Job ID of the requested job", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "[Required] Project ID of the requested job", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "jobId" ], "response": { "$ref": "Job" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "getQueryResults": { "id": "bigquery.jobs.getQueryResults", "path": "projects/{projectId}/queries/{jobId}", "httpMethod": "GET", "description": "Retrieves the results of a query job.", "parameters": { "jobId": { "type": "string", "description": "[Required] Job ID of the query job", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Maximum number of results to read", "format": "uint32", "location": "query" }, "pageToken": { "type": "string", "description": "Page token, returned by a previous call, to request the next page of results", "location": "query" }, "projectId": { "type": "string", "description": "[Required] Project ID of the query job", "required": true, "location": "path" }, "startIndex": { "type": "string", "description": "Zero-based index of the starting row", "format": "uint64", "location": "query" }, "timeoutMs": { "type": "integer", "description": "How long to wait for the query to complete, in milliseconds, before returning. Default is 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false", "format": "uint32", "location": "query" } }, "parameterOrder": [ "projectId", "jobId" ], "response": { "$ref": "GetQueryResultsResponse" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "insert": { "id": "bigquery.jobs.insert", "path": "projects/{projectId}/jobs", "httpMethod": "POST", "description": "Starts a new asynchronous job. Requires the Can View project role.", "parameters": { "projectId": { "type": "string", "description": "Project ID of the project that will be billed for the job", "required": true, "location": "path" } }, "parameterOrder": [ "projectId" ], "request": { "$ref": "Job" }, "response": { "$ref": "Job" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ], "supportsMediaUpload": true, "mediaUpload": { "accept": [ "*/*" ], "protocols": { "simple": { "multipart": true, "path": "/upload/bigquery/v2/projects/{projectId}/jobs" }, "resumable": { "multipart": true, "path": "/resumable/upload/bigquery/v2/projects/{projectId}/jobs" } } } }, "list": { "id": "bigquery.jobs.list", "path": "projects/{projectId}/jobs", "httpMethod": "GET", "description": "Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.", "parameters": { "allUsers": { "type": "boolean", "description": "Whether to display jobs owned by all users in the project. Default false", "location": "query" }, "maxResults": { "type": "integer", "description": "Maximum number of results to return", "format": "uint32", "location": "query" }, "pageToken": { "type": "string", "description": "Page token, returned by a previous call, to request the next page of results", "location": "query" }, "projectId": { "type": "string", "description": "Project ID of the jobs to list", "required": true, "location": "path" }, "projection": { "type": "string", "description": "Restrict information returned to a set of selected fields", "enum": [ "full", "minimal" ], "enumDescriptions": [ "Includes all job data", "Does not include the job configuration" ], "location": "query" }, "stateFilter": { "type": "string", "description": "Filter for job state", "enum": [ "done", "pending", "running" ], "enumDescriptions": [ "Finished jobs", "Pending jobs", "Running jobs" ], "repeated": true, "location": "query" } }, "parameterOrder": [ "projectId" ], "response": { "$ref": "JobList" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "query": { "id": "bigquery.jobs.query", "path": "projects/{projectId}/queries", "httpMethod": "POST", "description": "Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.", "parameters": { "projectId": { "type": "string", "description": "Project ID of the project billed for the query", "required": true, "location": "path" } }, "parameterOrder": [ "projectId" ], "request": { "$ref": "QueryRequest" }, "response": { "$ref": "QueryResponse" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] } } }, "projects": { "methods": { "list": { "id": "bigquery.projects.list", "path": "projects", "httpMethod": "GET", "description": "Lists all projects to which you have been granted any project role.", "parameters": { "maxResults": { "type": "integer", "description": "Maximum number of results to return", "format": "uint32", "location": "query" }, "pageToken": { "type": "string", "description": "Page token, returned by a previous call, to request the next page of results", "location": "query" } }, "response": { "$ref": "ProjectList" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] } } }, "tabledata": { "methods": { "insertAll": { "id": "bigquery.tabledata.insertAll", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll", "httpMethod": "POST", "description": "Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the destination table.", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the destination table.", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table ID of the destination table.", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId", "tableId" ], "request": { "$ref": "TableDataInsertAllRequest" }, "response": { "$ref": "TableDataInsertAllResponse" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/bigquery.insertdata", "https://www.googleapis.com/auth/cloud-platform" ] }, "list": { "id": "bigquery.tabledata.list", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data", "httpMethod": "GET", "description": "Retrieves table data from a specified set of rows. Requires the READER dataset role.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the table to read", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Maximum number of results to return", "format": "uint32", "location": "query" }, "pageToken": { "type": "string", "description": "Page token, returned by a previous call, identifying the result set", "location": "query" }, "projectId": { "type": "string", "description": "Project ID of the table to read", "required": true, "location": "path" }, "startIndex": { "type": "string", "description": "Zero-based index of the starting row to read", "format": "uint64", "location": "query" }, "tableId": { "type": "string", "description": "Table ID of the table to read", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId", "tableId" ], "response": { "$ref": "TableDataList" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] } } }, "tables": { "methods": { "delete": { "id": "bigquery.tables.delete", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "httpMethod": "DELETE", "description": "Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the table to delete", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the table to delete", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table ID of the table to delete", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId", "tableId" ], "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] }, "get": { "id": "bigquery.tables.get", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "httpMethod": "GET", "description": "Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the requested table", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the requested table", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table ID of the requested table", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId", "tableId" ], "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "insert": { "id": "bigquery.tables.insert", "path": "projects/{projectId}/datasets/{datasetId}/tables", "httpMethod": "POST", "description": "Creates a new, empty table in the dataset.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the new table", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the new table", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId" ], "request": { "$ref": "Table" }, "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] }, "list": { "id": "bigquery.tables.list", "path": "projects/{projectId}/datasets/{datasetId}/tables", "httpMethod": "GET", "description": "Lists all tables in the specified dataset. Requires the READER dataset role.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the tables to list", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Maximum number of results to return", "format": "uint32", "location": "query" }, "pageToken": { "type": "string", "description": "Page token, returned by a previous call, to request the next page of results", "location": "query" }, "projectId": { "type": "string", "description": "Project ID of the tables to list", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId" ], "response": { "$ref": "TableList" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only" ] }, "patch": { "id": "bigquery.tables.patch", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "httpMethod": "PATCH", "description": "Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the table to update", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the table to update", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table ID of the table to update", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId", "tableId" ], "request": { "$ref": "Table" }, "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] }, "update": { "id": "bigquery.tables.update", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "httpMethod": "PUT", "description": "Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource.", "parameters": { "datasetId": { "type": "string", "description": "Dataset ID of the table to update", "required": true, "location": "path" }, "projectId": { "type": "string", "description": "Project ID of the table to update", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table ID of the table to update", "required": true, "location": "path" } }, "parameterOrder": [ "projectId", "datasetId", "tableId" ], "request": { "$ref": "Table" }, "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform" ] } } } } } samples/storage_sample/storage_v1.json 0000644 00000342163 15025176453 0014203 0 ustar 00 { "kind": "discovery#restDescription", "discoveryVersion": "v1", "id": "storage:v1", "name": "storage", "version": "v1", "revision": "20160525", "title": "Cloud Storage JSON API", "description": "Stores and retrieves potentially large, immutable data objects.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "https://www.google.com/images/icons/product/cloud_storage-16.png", "x32": "https://www.google.com/images/icons/product/cloud_storage-32.png" }, "documentationLink": "https://developers.google.com/storage/docs/json_api/", "labels": [ "graduated" ], "protocol": "rest", "baseUrl": "https://www.googleapis.com/storage/v1/", "basePath": "/storage/v1/", "rootUrl": "https://www.googleapis.com/", "mtlsRootUrl": "https://www.mtls.googleapis.com/", "servicePath": "storage/v1/", "batchPath": "batch/storage/v1", "parameters": { "alt": { "type": "string", "description": "Data format for the response.", "default": "json", "enum": [ "json" ], "enumDescriptions": [ "Responses with Content-Type of application/json" ], "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", "location": "query" }, "userIp": { "type": "string", "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/cloud-platform.read-only": { "description": "View your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/devstorage.full_control": { "description": "Manage your data and permissions in Google Cloud Storage" }, "https://www.googleapis.com/auth/devstorage.read_only": { "description": "View your data in Google Cloud Storage" }, "https://www.googleapis.com/auth/devstorage.read_write": { "description": "Manage your data in Google Cloud Storage" } } } }, "schemas": { "Bucket": { "id": "Bucket", "type": "object", "description": "A bucket.", "properties": { "acl": { "type": "array", "description": "Access controls on the bucket.", "items": { "$ref": "BucketAccessControl" }, "annotations": { "required": [ "storage.buckets.update" ] } }, "cors": { "type": "array", "description": "The bucket's Cross-Origin Resource Sharing (CORS) configuration.", "items": { "type": "object", "properties": { "maxAgeSeconds": { "type": "integer", "description": "The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses.", "format": "int32" }, "method": { "type": "array", "description": "The list of HTTP methods on which to include CORS response headers, (GET, OPTIONS, POST, etc) Note: \"*\" is permitted in the list of methods, and means \"any method\".", "items": { "type": "string" } }, "origin": { "type": "array", "description": "The list of Origins eligible to receive CORS response headers. Note: \"*\" is permitted in the list of origins, and means \"any Origin\".", "items": { "type": "string" } }, "responseHeader": { "type": "array", "description": "The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains.", "items": { "type": "string" } } } } }, "defaultObjectAcl": { "type": "array", "description": "Default access controls to apply to new objects when no ACL is provided.", "items": { "$ref": "ObjectAccessControl" } }, "etag": { "type": "string", "description": "HTTP 1.1 Entity tag for the bucket." }, "id": { "type": "string", "description": "The ID of the bucket." }, "kind": { "type": "string", "description": "The kind of item this is. For buckets, this is always storage#bucket.", "default": "storage#bucket" }, "lifecycle": { "type": "object", "description": "The bucket's lifecycle configuration. See lifecycle management for more information.", "properties": { "rule": { "type": "array", "description": "A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken.", "items": { "type": "object", "properties": { "action": { "type": "object", "description": "The action to take.", "properties": { "type": { "type": "string", "description": "Type of the action. Currently, only Delete is supported." } } }, "condition": { "type": "object", "description": "The condition(s) under which the action will be taken.", "properties": { "age": { "type": "integer", "description": "Age of an object (in days). This condition is satisfied when an object reaches the specified age.", "format": "int32" }, "createdBefore": { "type": "string", "description": "A date in RFC 3339 format with only the date part (for instance, \"2013-01-15\"). This condition is satisfied when an object is created before midnight of the specified date in UTC.", "format": "date" }, "isLive": { "type": "boolean", "description": "Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects." }, "numNewerVersions": { "type": "integer", "description": "Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object.", "format": "int32" } } } } } } } }, "location": { "type": "string", "description": "The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer's guide for the authoritative list." }, "logging": { "type": "object", "description": "The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs.", "properties": { "logBucket": { "type": "string", "description": "The destination bucket where the current bucket's logs should be placed." }, "logObjectPrefix": { "type": "string", "description": "A prefix for log object names." } } }, "metageneration": { "type": "string", "description": "The metadata generation of this bucket.", "format": "int64" }, "name": { "type": "string", "description": "The name of the bucket.", "annotations": { "required": [ "storage.buckets.insert" ] } }, "owner": { "type": "object", "description": "The owner of the bucket. This is always the project team's owner group.", "properties": { "entity": { "type": "string", "description": "The entity, in the form project-owner-projectId." }, "entityId": { "type": "string", "description": "The ID for the entity." } } }, "projectNumber": { "type": "string", "description": "The project number of the project the bucket belongs to.", "format": "uint64" }, "selfLink": { "type": "string", "description": "The URI of this bucket." }, "storageClass": { "type": "string", "description": "The bucket's storage class. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include STANDARD, NEARLINE and DURABLE_REDUCED_AVAILABILITY. Defaults to STANDARD. For more information, see storage classes." }, "timeCreated": { "type": "string", "description": "The creation time of the bucket in RFC 3339 format.", "format": "date-time" }, "updated": { "type": "string", "description": "The modification time of the bucket in RFC 3339 format.", "format": "date-time" }, "versioning": { "type": "object", "description": "The bucket's versioning configuration.", "properties": { "enabled": { "type": "boolean", "description": "While set to true, versioning is fully enabled for this bucket." } } }, "website": { "type": "object", "description": "The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information.", "properties": { "mainPageSuffix": { "type": "string", "description": "If the requested object path is missing, the service will ensure the path has a trailing '/', append this suffix, and attempt to retrieve the resulting object. This allows the creation of index.html objects to represent directory pages." }, "notFoundPage": { "type": "string", "description": "If the requested object path is missing, and any mainPageSuffix object is missing, if applicable, the service will return the named object from this bucket as the content for a 404 Not Found result." } } } } }, "BucketAccessControl": { "id": "BucketAccessControl", "type": "object", "description": "An access-control entry.", "properties": { "bucket": { "type": "string", "description": "The name of the bucket." }, "domain": { "type": "string", "description": "The domain associated with the entity, if any." }, "email": { "type": "string", "description": "The email address associated with the entity, if any." }, "entity": { "type": "string", "description": "The entity holding the permission, in one of the following forms: \n- user-userId \n- user-email \n- group-groupId \n- group-email \n- domain-domain \n- project-team-projectId \n- allUsers \n- allAuthenticatedUsers Examples: \n- The user liz@example.com would be user-liz@example.com. \n- The group example@googlegroups.com would be group-example@googlegroups.com. \n- To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com.", "annotations": { "required": [ "storage.bucketAccessControls.insert" ] } }, "entityId": { "type": "string", "description": "The ID for the entity, if any." }, "etag": { "type": "string", "description": "HTTP 1.1 Entity tag for the access-control entry." }, "id": { "type": "string", "description": "The ID of the access-control entry." }, "kind": { "type": "string", "description": "The kind of item this is. For bucket access control entries, this is always storage#bucketAccessControl.", "default": "storage#bucketAccessControl" }, "projectTeam": { "type": "object", "description": "The project team associated with the entity, if any.", "properties": { "projectNumber": { "type": "string", "description": "The project number." }, "team": { "type": "string", "description": "The team. Can be owners, editors, or viewers." } } }, "role": { "type": "string", "description": "The access permission for the entity. Can be READER, WRITER, or OWNER.", "annotations": { "required": [ "storage.bucketAccessControls.insert" ] } }, "selfLink": { "type": "string", "description": "The link to this access-control entry." } } }, "BucketAccessControls": { "id": "BucketAccessControls", "type": "object", "description": "An access-control list.", "properties": { "items": { "type": "array", "description": "The list of items.", "items": { "$ref": "BucketAccessControl" } }, "kind": { "type": "string", "description": "The kind of item this is. For lists of bucket access control entries, this is always storage#bucketAccessControls.", "default": "storage#bucketAccessControls" } } }, "Buckets": { "id": "Buckets", "type": "object", "description": "A list of buckets.", "properties": { "items": { "type": "array", "description": "The list of items.", "items": { "$ref": "Bucket" } }, "kind": { "type": "string", "description": "The kind of item this is. For lists of buckets, this is always storage#buckets.", "default": "storage#buckets" }, "nextPageToken": { "type": "string", "description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results." } } }, "Channel": { "id": "Channel", "type": "object", "description": "An notification channel used to watch for resource changes.", "properties": { "address": { "type": "string", "description": "The address where notifications are delivered for this channel." }, "expiration": { "type": "string", "description": "Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.", "format": "int64" }, "id": { "type": "string", "description": "A UUID or similar unique string that identifies this channel." }, "kind": { "type": "string", "description": "Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string \"api#channel\".", "default": "api#channel" }, "params": { "type": "object", "description": "Additional parameters controlling delivery channel behavior. Optional.", "additionalProperties": { "type": "string", "description": "Declares a new parameter by name." } }, "payload": { "type": "boolean", "description": "A Boolean value to indicate whether payload is wanted. Optional." }, "resourceId": { "type": "string", "description": "An opaque ID that identifies the resource being watched on this channel. Stable across different API versions." }, "resourceUri": { "type": "string", "description": "A version-specific identifier for the watched resource." }, "token": { "type": "string", "description": "An arbitrary string delivered to the target address with each notification delivered over this channel. Optional." }, "type": { "type": "string", "description": "The type of delivery mechanism used for this channel." } } }, "ComposeRequest": { "id": "ComposeRequest", "type": "object", "description": "A Compose request.", "properties": { "destination": { "$ref": "Object", "description": "Properties of the resulting object." }, "kind": { "type": "string", "description": "The kind of item this is.", "default": "storage#composeRequest" }, "sourceObjects": { "type": "array", "description": "The list of source objects that will be concatenated into a single object.", "items": { "type": "object", "properties": { "generation": { "type": "string", "description": "The generation of this object to use as the source.", "format": "int64" }, "name": { "type": "string", "description": "The source object's name. The source object's bucket is implicitly the destination bucket.", "annotations": { "required": [ "storage.objects.compose" ] } }, "objectPreconditions": { "type": "object", "description": "Conditions that must be met for this operation to execute.", "properties": { "ifGenerationMatch": { "type": "string", "description": "Only perform the composition if the generation of the source object that would be used matches this value. If this value and a generation are both specified, they must be the same value or the call will fail.", "format": "int64" } } } } }, "annotations": { "required": [ "storage.objects.compose" ] } } } }, "Notification": { "id": "Notification", "type": "object", "description": "A subscription to receive Google PubSub notifications.", "properties": { "bucket": { "type": "string", "description": "The name of the bucket this subscription is particular to.", "annotations": { "required": [ "storage.notifications.insert" ] } }, "custom_attributes": { "type": "object", "description": "An optional list of additional attributes to attach to each Cloud PubSub message published for this notification subscription.", "additionalProperties": { "type": "string" } }, "etag": { "type": "string", "description": "HTTP 1.1 Entity tag for this subscription notification." }, "event_types": { "type": "array", "description": "If present, only send notifications about listed event types. If empty, sent notifications for all event types.", "items": { "type": "string" } }, "id": { "type": "string", "description": "The ID of the notification." }, "kind": { "type": "string", "description": "The kind of item this is. For notifications, this is always storage#notification.", "default": "storage#notification" }, "object_metadata_format": { "type": "string", "description": "If payload_content is OBJECT_METADATA, controls the format of that metadata. Otherwise, must not be set.", "default": "JSON_API_V1" }, "object_name_prefix": { "type": "string", "description": "If present, only apply this notification configuration to object names that begin with this prefix." }, "payload_content": { "type": "string", "description": "The desired content of the Payload. Defaults to OBJECT_METADATA.", "default": "OBJECT_METADATA" }, "selfLink": { "type": "string", "description": "The canonical URL of this notification." }, "topic": { "type": "string", "description": "The Cloud PubSub topic to which this subscription publishes. Formatted as: '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topic}'", "annotations": { "required": [ "storage.notifications.insert" ] } } } }, "Notifications": { "id": "Notifications", "type": "object", "description": "A list of notification subscriptions.", "properties": { "items": { "type": "array", "description": "The list of items.", "items": { "$ref": "Notification" } }, "kind": { "type": "string", "description": "The kind of item this is. For lists of notifications, this is always storage#notifications.", "default": "storage#notifications" } } }, "Object": { "id": "Object", "type": "object", "description": "An object.", "properties": { "acl": { "type": "array", "description": "Access controls on the object.", "items": { "$ref": "ObjectAccessControl" }, "annotations": { "required": [ "storage.objects.update" ] } }, "bucket": { "type": "string", "description": "The name of the bucket containing this object." }, "cacheControl": { "type": "string", "description": "Cache-Control directive for the object data." }, "componentCount": { "type": "integer", "description": "Number of underlying components that make up this object. Components are accumulated by compose operations.", "format": "int32" }, "contentDisposition": { "type": "string", "description": "Content-Disposition of the object data." }, "contentEncoding": { "type": "string", "description": "Content-Encoding of the object data." }, "contentLanguage": { "type": "string", "description": "Content-Language of the object data." }, "contentType": { "type": "string", "description": "Content-Type of the object data. If contentType is not specified, object downloads will be served as application/octet-stream." }, "crc32c": { "type": "string", "description": "CRC32c checksum, as described in RFC 4960, Appendix B; encoded using base64 in big-endian byte order. For more information about using the CRC32c checksum, see Hashes and ETags: Best Practices." }, "customerEncryption": { "type": "object", "description": "Metadata of customer-supplied encryption key, if the object is encrypted by such a key.", "properties": { "encryptionAlgorithm": { "type": "string", "description": "The encryption algorithm." }, "keySha256": { "type": "string", "description": "SHA256 hash value of the encryption key." } } }, "etag": { "type": "string", "description": "HTTP 1.1 Entity tag for the object." }, "generation": { "type": "string", "description": "The content generation of this object. Used for object versioning.", "format": "int64" }, "id": { "type": "string", "description": "The ID of the object." }, "kind": { "type": "string", "description": "The kind of item this is. For objects, this is always storage#object.", "default": "storage#object" }, "md5Hash": { "type": "string", "description": "MD5 hash of the data; encoded using base64. For more information about using the MD5 hash, see Hashes and ETags: Best Practices." }, "mediaLink": { "type": "string", "description": "Media download link." }, "metadata": { "type": "object", "description": "User-provided metadata, in key/value pairs.", "additionalProperties": { "type": "string", "description": "An individual metadata entry." } }, "metageneration": { "type": "string", "description": "The version of the metadata for this object at this generation. Used for preconditions and for detecting changes in metadata. A metageneration number is only meaningful in the context of a particular generation of a particular object.", "format": "int64" }, "name": { "type": "string", "description": "The name of this object. Required if not specified by URL parameter." }, "owner": { "type": "object", "description": "The owner of the object. This will always be the uploader of the object.", "properties": { "entity": { "type": "string", "description": "The entity, in the form user-userId." }, "entityId": { "type": "string", "description": "The ID for the entity." } } }, "selfLink": { "type": "string", "description": "The link to this object." }, "size": { "type": "string", "description": "Content-Length of the data in bytes.", "format": "uint64" }, "storageClass": { "type": "string", "description": "Storage class of the object." }, "timeCreated": { "type": "string", "description": "The creation time of the object in RFC 3339 format.", "format": "date-time" }, "timeDeleted": { "type": "string", "description": "The deletion time of the object in RFC 3339 format. Will be returned if and only if this version of the object has been deleted.", "format": "date-time" }, "updated": { "type": "string", "description": "The modification time of the object metadata in RFC 3339 format.", "format": "date-time" } } }, "ObjectAccessControl": { "id": "ObjectAccessControl", "type": "object", "description": "An access-control entry.", "properties": { "bucket": { "type": "string", "description": "The name of the bucket." }, "domain": { "type": "string", "description": "The domain associated with the entity, if any." }, "email": { "type": "string", "description": "The email address associated with the entity, if any." }, "entity": { "type": "string", "description": "The entity holding the permission, in one of the following forms: \n- user-userId \n- user-email \n- group-groupId \n- group-email \n- domain-domain \n- project-team-projectId \n- allUsers \n- allAuthenticatedUsers Examples: \n- The user liz@example.com would be user-liz@example.com. \n- The group example@googlegroups.com would be group-example@googlegroups.com. \n- To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com." }, "entityId": { "type": "string", "description": "The ID for the entity, if any." }, "etag": { "type": "string", "description": "HTTP 1.1 Entity tag for the access-control entry." }, "generation": { "type": "string", "description": "The content generation of the object.", "format": "int64" }, "id": { "type": "string", "description": "The ID of the access-control entry." }, "kind": { "type": "string", "description": "The kind of item this is. For object access control entries, this is always storage#objectAccessControl.", "default": "storage#objectAccessControl" }, "object": { "type": "string", "description": "The name of the object." }, "projectTeam": { "type": "object", "description": "The project team associated with the entity, if any.", "properties": { "projectNumber": { "type": "string", "description": "The project number." }, "team": { "type": "string", "description": "The team. Can be owners, editors, or viewers." } } }, "role": { "type": "string", "description": "The access permission for the entity. Can be READER or OWNER." }, "selfLink": { "type": "string", "description": "The link to this access-control entry." } } }, "ObjectAccessControls": { "id": "ObjectAccessControls", "type": "object", "description": "An access-control list.", "properties": { "items": { "type": "array", "description": "The list of items.", "items": { "type": "any" } }, "kind": { "type": "string", "description": "The kind of item this is. For lists of object access control entries, this is always storage#objectAccessControls.", "default": "storage#objectAccessControls" } } }, "Objects": { "id": "Objects", "type": "object", "description": "A list of objects.", "properties": { "items": { "type": "array", "description": "The list of items.", "items": { "$ref": "Object" } }, "kind": { "type": "string", "description": "The kind of item this is. For lists of objects, this is always storage#objects.", "default": "storage#objects" }, "nextPageToken": { "type": "string", "description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results." }, "prefixes": { "type": "array", "description": "The list of prefixes of objects matching-but-not-listed up to and including the requested delimiter.", "items": { "type": "string" } } } }, "Policy": { "id": "Policy", "type": "object", "description": "A bucket/object IAM policy.", "properties": { "bindings": { "type": "array", "description": "An association between a role, which comes with a set of permissions, and members who may assume that role.", "items": { "type": "object", "properties": { "members": { "type": "array", "description": "A collection of identifiers for members who may assume the provided role. Recognized identifiers are as follows: \n- allUsers — A special identifier that represents anyone on the internet; with or without a Google account. \n- allAuthenticatedUsers — A special identifier that represents anyone who is authenticated with a Google account or a service account. \n- user:emailid — An email address that represents a specific account. For example, user:alice@gmail.com or user:joe@example.com. \n- serviceAccount:emailid — An email address that represents a service account. For example, serviceAccount:my-other-app@appspot.gserviceaccount.com . \n- group:emailid — An email address that represents a Google group. For example, group:admins@example.com. \n- domain:domain — A Google Apps domain name that represents all the users of that domain. For example, domain:google.com or domain:example.com. \n- projectOwner:projectid — Owners of the given project. For example, projectOwner:my-example-project \n- projectEditor:projectid — Editors of the given project. For example, projectEditor:my-example-project \n- projectViewer:projectid — Viewers of the given project. For example, projectViewer:my-example-project", "items": { "type": "string" }, "annotations": { "required": [ "storage.buckets.setIamPolicy", "storage.objects.setIamPolicy" ] } }, "role": { "type": "string", "description": "The role to which members belong. Two types of roles are supported: new IAM roles, which grant permissions that do not map directly to those provided by ACLs, and legacy IAM roles, which do map directly to ACL permissions. All roles are of the format roles/storage.specificRole.\nThe new IAM roles are: \n- roles/storage.admin — Full control of Google Cloud Storage resources. \n- roles/storage.objectViewer — Read-Only access to Google Cloud Storage objects. \n- roles/storage.objectCreator — Access to create objects in Google Cloud Storage. \n- roles/storage.objectAdmin — Full control of Google Cloud Storage objects. The legacy IAM roles are: \n- roles/storage.legacyObjectReader — Read-only access to objects without listing. Equivalent to an ACL entry on an object with the READER role. \n- roles/storage.legacyObjectOwner — Read/write access to existing objects without listing. Equivalent to an ACL entry on an object with the OWNER role. \n- roles/storage.legacyBucketReader — Read access to buckets with object listing. Equivalent to an ACL entry on a bucket with the READER role. \n- roles/storage.legacyBucketWriter — Read access to buckets with object listing/creation/deletion. Equivalent to an ACL entry on a bucket with the WRITER role. \n- roles/storage.legacyBucketOwner — Read and write access to existing buckets with object listing/creation/deletion. Equivalent to an ACL entry on a bucket with the OWNER role.", "annotations": { "required": [ "storage.buckets.setIamPolicy", "storage.objects.setIamPolicy" ] } } } }, "annotations": { "required": [ "storage.buckets.setIamPolicy", "storage.objects.setIamPolicy" ] } }, "etag": { "type": "string", "description": "HTTP 1.1 Entity tag for the policy.", "format": "byte" }, "kind": { "type": "string", "description": "The kind of item this is. For policies, this is always storage#policy. This field is ignored on input.", "default": "storage#policy" }, "resourceId": { "type": "string", "description": "The ID of the resource to which this policy belongs. Will be of the form buckets/bucket for buckets, and buckets/bucket/objects/object for objects. A specific generation may be specified by appending #generationNumber to the end of the object name, e.g. buckets/my-bucket/objects/data.txt#17. The current generation can be denoted with #0. This field is ignored on input." } } }, "RewriteResponse": { "id": "RewriteResponse", "type": "object", "description": "A rewrite response.", "properties": { "done": { "type": "boolean", "description": "true if the copy is finished; otherwise, false if the copy is in progress. This property is always present in the response." }, "kind": { "type": "string", "description": "The kind of item this is.", "default": "storage#rewriteResponse" }, "objectSize": { "type": "string", "description": "The total size of the object being copied in bytes. This property is always present in the response.", "format": "uint64" }, "resource": { "$ref": "Object", "description": "A resource containing the metadata for the copied-to object. This property is present in the response only when copying completes." }, "rewriteToken": { "type": "string", "description": "A token to use in subsequent requests to continue copying data. This token is present in the response only when there is more data to copy." }, "totalBytesRewritten": { "type": "string", "description": "The total bytes written so far, which can be used to provide a waiting user with a progress indicator. This property is always present in the response.", "format": "uint64" } } }, "TestIamPermissionsResponse": { "id": "TestIamPermissionsResponse", "type": "object", "description": "A storage.(buckets|objects).testIamPermissions response.", "properties": { "kind": { "type": "string", "description": "The kind of item this is.", "default": "storage#testIamPermissionsResponse" }, "permissions": { "type": "array", "description": "The permissions held by the caller. Permissions are always of the format storage.resource.capability, where resource is one of buckets or objects. The supported permissions are as follows: \n- storage.buckets.delete — Delete bucket. \n- storage.buckets.get — Read bucket metadata. \n- storage.buckets.getIamPolicy — Read bucket IAM policy. \n- storage.buckets.create — Create bucket. \n- storage.buckets.list — List buckets. \n- storage.buckets.setIamPolicy — Update bucket IAM policy. \n- storage.buckets.update — Update bucket metadata. \n- storage.objects.delete — Delete object. \n- storage.objects.get — Read object data and metadata. \n- storage.objects.getIamPolicy — Read object IAM policy. \n- storage.objects.create — Create object. \n- storage.objects.list — List objects. \n- storage.objects.setIamPolicy — Update object IAM policy. \n- storage.objects.update — Update object metadata.", "items": { "type": "string" } } } } }, "resources": { "bucketAccessControls": { "methods": { "delete": { "id": "storage.bucketAccessControls.delete", "path": "b/{bucket}/acl/{entity}", "httpMethod": "DELETE", "description": "Permanently deletes the ACL entry for the specified entity on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "entity" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "get": { "id": "storage.bucketAccessControls.get", "path": "b/{bucket}/acl/{entity}", "httpMethod": "GET", "description": "Returns the ACL entry for the specified entity on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "entity" ], "response": { "$ref": "BucketAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "insert": { "id": "storage.bucketAccessControls.insert", "path": "b/{bucket}/acl", "httpMethod": "POST", "description": "Creates a new ACL entry on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket" ], "request": { "$ref": "BucketAccessControl" }, "response": { "$ref": "BucketAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "list": { "id": "storage.bucketAccessControls.list", "path": "b/{bucket}/acl", "httpMethod": "GET", "description": "Retrieves ACL entries on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket" ], "response": { "$ref": "BucketAccessControls" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "patch": { "id": "storage.bucketAccessControls.patch", "path": "b/{bucket}/acl/{entity}", "httpMethod": "PATCH", "description": "Updates an ACL entry on the specified bucket. This method supports patch semantics.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "entity" ], "request": { "$ref": "BucketAccessControl" }, "response": { "$ref": "BucketAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "update": { "id": "storage.bucketAccessControls.update", "path": "b/{bucket}/acl/{entity}", "httpMethod": "PUT", "description": "Updates an ACL entry on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "entity" ], "request": { "$ref": "BucketAccessControl" }, "response": { "$ref": "BucketAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] } } }, "buckets": { "methods": { "delete": { "id": "storage.buckets.delete", "path": "b/{bucket}", "httpMethod": "DELETE", "description": "Permanently deletes an empty bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "ifMetagenerationMatch": { "type": "string", "description": "If set, only deletes the bucket if its metageneration matches this value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "If set, only deletes the bucket if its metageneration does not match this value.", "format": "int64", "location": "query" } }, "parameterOrder": [ "bucket" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "get": { "id": "storage.buckets.get", "path": "b/{bucket}", "httpMethod": "GET", "description": "Returns metadata for the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit owner, acl and defaultObjectAcl properties." ], "location": "query" } }, "parameterOrder": [ "bucket" ], "response": { "$ref": "Bucket" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "getIamPolicy": { "id": "storage.buckets.getIamPolicy", "path": "b/{bucket}/iam", "httpMethod": "GET", "description": "Returns an IAM policy for the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket" ], "response": { "$ref": "Policy" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "insert": { "id": "storage.buckets.insert", "path": "b", "httpMethod": "POST", "description": "Creates a new bucket.", "parameters": { "predefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to this bucket.", "enum": [ "authenticatedRead", "private", "projectPrivate", "publicRead", "publicReadWrite" ], "enumDescriptions": [ "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.", "Project team owners get OWNER access.", "Project team members get access according to their roles.", "Project team owners get OWNER access, and allUsers get READER access.", "Project team owners get OWNER access, and allUsers get WRITER access." ], "location": "query" }, "predefinedDefaultObjectAcl": { "type": "string", "description": "Apply a predefined set of default object access controls to this bucket.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "project": { "type": "string", "description": "A valid API project identifier.", "required": true, "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit owner, acl and defaultObjectAcl properties." ], "location": "query" } }, "parameterOrder": [ "project" ], "request": { "$ref": "Bucket" }, "response": { "$ref": "Bucket" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "list": { "id": "storage.buckets.list", "path": "b", "httpMethod": "GET", "description": "Retrieves a list of buckets for a given project.", "parameters": { "maxResults": { "type": "integer", "description": "Maximum number of buckets to return.", "format": "uint32", "minimum": "0", "location": "query" }, "pageToken": { "type": "string", "description": "A previously-returned page token representing part of the larger set of results to view.", "location": "query" }, "prefix": { "type": "string", "description": "Filter results to buckets whose names begin with this prefix.", "location": "query" }, "project": { "type": "string", "description": "A valid API project identifier.", "required": true, "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit owner, acl and defaultObjectAcl properties." ], "location": "query" } }, "parameterOrder": [ "project" ], "response": { "$ref": "Buckets" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "patch": { "id": "storage.buckets.patch", "path": "b/{bucket}", "httpMethod": "PATCH", "description": "Updates a bucket. This method supports patch semantics.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "predefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to this bucket.", "enum": [ "authenticatedRead", "private", "projectPrivate", "publicRead", "publicReadWrite" ], "enumDescriptions": [ "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.", "Project team owners get OWNER access.", "Project team members get access according to their roles.", "Project team owners get OWNER access, and allUsers get READER access.", "Project team owners get OWNER access, and allUsers get WRITER access." ], "location": "query" }, "predefinedDefaultObjectAcl": { "type": "string", "description": "Apply a predefined set of default object access controls to this bucket.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to full.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit owner, acl and defaultObjectAcl properties." ], "location": "query" } }, "parameterOrder": [ "bucket" ], "request": { "$ref": "Bucket" }, "response": { "$ref": "Bucket" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "setIamPolicy": { "id": "storage.buckets.setIamPolicy", "path": "b/{bucket}/iam", "httpMethod": "PUT", "description": "Updates an IAM policy for the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket" ], "request": { "$ref": "Policy" }, "response": { "$ref": "Policy" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "testIamPermissions": { "id": "storage.buckets.testIamPermissions", "path": "b/{bucket}/iam/testPermissions", "httpMethod": "GET", "description": "Tests a set of permissions on the given bucket to see which, if any, are held by the caller.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "permissions": { "type": "string", "description": "Permissions to test.", "required": true, "repeated": true, "location": "query" } }, "parameterOrder": [ "bucket", "permissions" ], "response": { "$ref": "TestIamPermissionsResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "update": { "id": "storage.buckets.update", "path": "b/{bucket}", "httpMethod": "PUT", "description": "Updates a bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "predefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to this bucket.", "enum": [ "authenticatedRead", "private", "projectPrivate", "publicRead", "publicReadWrite" ], "enumDescriptions": [ "Project team owners get OWNER access, and allAuthenticatedUsers get READER access.", "Project team owners get OWNER access.", "Project team members get access according to their roles.", "Project team owners get OWNER access, and allUsers get READER access.", "Project team owners get OWNER access, and allUsers get WRITER access." ], "location": "query" }, "predefinedDefaultObjectAcl": { "type": "string", "description": "Apply a predefined set of default object access controls to this bucket.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to full.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit owner, acl and defaultObjectAcl properties." ], "location": "query" } }, "parameterOrder": [ "bucket" ], "request": { "$ref": "Bucket" }, "response": { "$ref": "Bucket" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] } } }, "channels": { "methods": { "stop": { "id": "storage.channels.stop", "path": "channels/stop", "httpMethod": "POST", "description": "Stop watching resources through this channel", "request": { "$ref": "Channel", "parameterName": "resource" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] } } }, "defaultObjectAccessControls": { "methods": { "delete": { "id": "storage.defaultObjectAccessControls.delete", "path": "b/{bucket}/defaultObjectAcl/{entity}", "httpMethod": "DELETE", "description": "Permanently deletes the default object ACL entry for the specified entity on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "entity" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "get": { "id": "storage.defaultObjectAccessControls.get", "path": "b/{bucket}/defaultObjectAcl/{entity}", "httpMethod": "GET", "description": "Returns the default object ACL entry for the specified entity on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "entity" ], "response": { "$ref": "ObjectAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "insert": { "id": "storage.defaultObjectAccessControls.insert", "path": "b/{bucket}/defaultObjectAcl", "httpMethod": "POST", "description": "Creates a new default object ACL entry on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket" ], "request": { "$ref": "ObjectAccessControl" }, "response": { "$ref": "ObjectAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "list": { "id": "storage.defaultObjectAccessControls.list", "path": "b/{bucket}/defaultObjectAcl", "httpMethod": "GET", "description": "Retrieves default object ACL entries on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "ifMetagenerationMatch": { "type": "string", "description": "If present, only return default ACL listing if the bucket's current metageneration matches this value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "If present, only return default ACL listing if the bucket's current metageneration does not match the given value.", "format": "int64", "location": "query" } }, "parameterOrder": [ "bucket" ], "response": { "$ref": "ObjectAccessControls" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "patch": { "id": "storage.defaultObjectAccessControls.patch", "path": "b/{bucket}/defaultObjectAcl/{entity}", "httpMethod": "PATCH", "description": "Updates a default object ACL entry on the specified bucket. This method supports patch semantics.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "entity" ], "request": { "$ref": "ObjectAccessControl" }, "response": { "$ref": "ObjectAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "update": { "id": "storage.defaultObjectAccessControls.update", "path": "b/{bucket}/defaultObjectAcl/{entity}", "httpMethod": "PUT", "description": "Updates a default object ACL entry on the specified bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "entity" ], "request": { "$ref": "ObjectAccessControl" }, "response": { "$ref": "ObjectAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] } } }, "notifications": { "methods": { "delete": { "id": "storage.notifications.delete", "path": "notifications/{notification}", "httpMethod": "DELETE", "description": "Permanently deletes a notification subscription.", "parameters": { "notification": { "type": "string", "description": "ID of the notification to delete.", "required": true, "location": "path" } }, "parameterOrder": [ "notification" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "get": { "id": "storage.notifications.get", "path": "notifications/{notification}", "httpMethod": "GET", "description": "View a notification configuration.", "parameters": { "notification": { "type": "string", "description": "Notification ID", "required": true, "location": "path" } }, "parameterOrder": [ "notification" ], "response": { "$ref": "Notification" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "insert": { "id": "storage.notifications.insert", "path": "notifications", "httpMethod": "POST", "description": "Creates a notification subscription for a given bucket.", "request": { "$ref": "Notification" }, "response": { "$ref": "Notification" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "list": { "id": "storage.notifications.list", "path": "notifications", "httpMethod": "GET", "description": "Retrieves a list of notification subscriptions for a given bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of a GCS bucket.", "required": true, "location": "query" } }, "parameterOrder": [ "bucket" ], "response": { "$ref": "Notifications" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] } } }, "objectAccessControls": { "methods": { "delete": { "id": "storage.objectAccessControls.delete", "path": "b/{bucket}/o/{object}/acl/{entity}", "httpMethod": "DELETE", "description": "Permanently deletes the ACL entry for the specified entity on the specified object.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object", "entity" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "get": { "id": "storage.objectAccessControls.get", "path": "b/{bucket}/o/{object}/acl/{entity}", "httpMethod": "GET", "description": "Returns the ACL entry for the specified entity on the specified object.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object", "entity" ], "response": { "$ref": "ObjectAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "insert": { "id": "storage.objectAccessControls.insert", "path": "b/{bucket}/o/{object}/acl", "httpMethod": "POST", "description": "Creates a new ACL entry on the specified object.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object" ], "request": { "$ref": "ObjectAccessControl" }, "response": { "$ref": "ObjectAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "list": { "id": "storage.objectAccessControls.list", "path": "b/{bucket}/o/{object}/acl", "httpMethod": "GET", "description": "Retrieves ACL entries on the specified object.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object" ], "response": { "$ref": "ObjectAccessControls" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "patch": { "id": "storage.objectAccessControls.patch", "path": "b/{bucket}/o/{object}/acl/{entity}", "httpMethod": "PATCH", "description": "Updates an ACL entry on the specified object. This method supports patch semantics.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object", "entity" ], "request": { "$ref": "ObjectAccessControl" }, "response": { "$ref": "ObjectAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "update": { "id": "storage.objectAccessControls.update", "path": "b/{bucket}/o/{object}/acl/{entity}", "httpMethod": "PUT", "description": "Updates an ACL entry on the specified object.", "parameters": { "bucket": { "type": "string", "description": "Name of a bucket.", "required": true, "location": "path" }, "entity": { "type": "string", "description": "The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object", "entity" ], "request": { "$ref": "ObjectAccessControl" }, "response": { "$ref": "ObjectAccessControl" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] } } }, "objects": { "methods": { "compose": { "id": "storage.objects.compose", "path": "b/{destinationBucket}/o/{destinationObject}/compose", "httpMethod": "POST", "description": "Concatenates a list of existing objects into a new object in the same bucket.", "parameters": { "destinationBucket": { "type": "string", "description": "Name of the bucket in which to store the new object.", "required": true, "location": "path" }, "destinationObject": { "type": "string", "description": "Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" }, "destinationPredefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to the destination object.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "ifGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", "format": "int64", "location": "query" } }, "parameterOrder": [ "destinationBucket", "destinationObject" ], "request": { "$ref": "ComposeRequest" }, "response": { "$ref": "Object" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ], "supportsMediaDownload": true }, "copy": { "id": "storage.objects.copy", "path": "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}", "httpMethod": "POST", "description": "Copies a source object to a destination object. Optionally overrides metadata.", "parameters": { "destinationBucket": { "type": "string", "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" }, "destinationObject": { "type": "string", "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.", "required": true, "location": "path" }, "destinationPredefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to the destination object.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "ifGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.", "format": "int64", "location": "query" }, "ifGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.", "format": "int64", "location": "query" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "ifSourceGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the source object's generation matches the given value.", "format": "int64", "location": "query" }, "ifSourceGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the source object's generation does not match the given value.", "format": "int64", "location": "query" }, "ifSourceMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifSourceMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit the owner, acl property." ], "location": "query" }, "sourceBucket": { "type": "string", "description": "Name of the bucket in which to find the source object.", "required": true, "location": "path" }, "sourceGeneration": { "type": "string", "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "sourceObject": { "type": "string", "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "sourceBucket", "sourceObject", "destinationBucket", "destinationObject" ], "request": { "$ref": "Object" }, "response": { "$ref": "Object" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ], "supportsMediaDownload": true }, "delete": { "id": "storage.objects.delete", "path": "b/{bucket}/o/{object}", "httpMethod": "DELETE", "description": "Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which the object resides.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "ifGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation matches the given value.", "format": "int64", "location": "query" }, "ifGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation does not match the given value.", "format": "int64", "location": "query" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "get": { "id": "storage.objects.get", "path": "b/{bucket}/o/{object}", "httpMethod": "GET", "description": "Retrieves an object or its metadata.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which the object resides.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "ifGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's generation matches the given value.", "format": "int64", "location": "query" }, "ifGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's generation does not match the given value.", "format": "int64", "location": "query" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit the owner, acl property." ], "location": "query" } }, "parameterOrder": [ "bucket", "object" ], "response": { "$ref": "Object" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ], "supportsMediaDownload": true }, "getIamPolicy": { "id": "storage.objects.getIamPolicy", "path": "b/{bucket}/o/{object}/iam", "httpMethod": "GET", "description": "Returns an IAM policy for the specified object.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which the object resides.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object" ], "response": { "$ref": "Policy" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "insert": { "id": "storage.objects.insert", "path": "b/{bucket}/o", "httpMethod": "POST", "description": "Stores a new object and metadata.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.", "required": true, "location": "path" }, "contentEncoding": { "type": "string", "description": "If set, sets the contentEncoding property of the final object to this value. Setting this parameter is equivalent to setting the contentEncoding metadata property. This can be useful when uploading an object with uploadType=media to indicate the encoding of the content being uploaded.", "location": "query" }, "ifGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation matches the given value.", "format": "int64", "location": "query" }, "ifGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation does not match the given value.", "format": "int64", "location": "query" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "name": { "type": "string", "description": "Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "location": "query" }, "predefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to this object.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit the owner, acl property." ], "location": "query" } }, "parameterOrder": [ "bucket" ], "request": { "$ref": "Object" }, "response": { "$ref": "Object" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ], "supportsMediaDownload": true, "supportsMediaUpload": true, "mediaUpload": { "accept": [ "*/*" ], "protocols": { "simple": { "multipart": true, "path": "/upload/storage/v1/b/{bucket}/o" }, "resumable": { "multipart": true, "path": "/resumable/upload/storage/v1/b/{bucket}/o" } } } }, "list": { "id": "storage.objects.list", "path": "b/{bucket}/o", "httpMethod": "GET", "description": "Retrieves a list of objects matching the criteria.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which to look for objects.", "required": true, "location": "path" }, "delimiter": { "type": "string", "description": "Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.", "location": "query" }, "maxResults": { "type": "integer", "description": "Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested. The default value of this parameter is 1,000 items.", "format": "uint32", "minimum": "0", "location": "query" }, "pageToken": { "type": "string", "description": "A previously-returned page token representing part of the larger set of results to view.", "location": "query" }, "prefix": { "type": "string", "description": "Filter results to objects whose names begin with this prefix.", "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit the owner, acl property." ], "location": "query" }, "versions": { "type": "boolean", "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.", "location": "query" } }, "parameterOrder": [ "bucket" ], "response": { "$ref": "Objects" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ], "supportsSubscription": true }, "patch": { "id": "storage.objects.patch", "path": "b/{bucket}/o/{object}", "httpMethod": "PATCH", "description": "Updates an object's metadata. This method supports patch semantics.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which the object resides.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "ifGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation matches the given value.", "format": "int64", "location": "query" }, "ifGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation does not match the given value.", "format": "int64", "location": "query" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" }, "predefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to this object.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to full.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit the owner, acl property." ], "location": "query" } }, "parameterOrder": [ "bucket", "object" ], "request": { "$ref": "Object" }, "response": { "$ref": "Object" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ] }, "rewrite": { "id": "storage.objects.rewrite", "path": "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}", "httpMethod": "POST", "description": "Rewrites a source object to a destination object. Optionally overrides metadata.", "parameters": { "destinationBucket": { "type": "string", "description": "Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.", "required": true, "location": "path" }, "destinationObject": { "type": "string", "description": "Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" }, "destinationPredefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to the destination object.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "ifGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the destination object's current generation matches the given value.", "format": "int64", "location": "query" }, "ifGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the destination object's current generation does not match the given value.", "format": "int64", "location": "query" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the destination object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the destination object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "ifSourceGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the source object's generation matches the given value.", "format": "int64", "location": "query" }, "ifSourceGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the source object's generation does not match the given value.", "format": "int64", "location": "query" }, "ifSourceMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the source object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifSourceMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the source object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "maxBytesRewrittenPerCall": { "type": "string", "description": "The maximum number of bytes that will be rewritten per rewrite request. Most callers shouldn't need to specify this parameter - it is primarily in place to support testing. If specified the value must be an integral multiple of 1 MiB (1048576). Also, this only applies to requests where the source and destination span locations and/or storage classes. Finally, this value must not change across rewrite calls else you'll get an error that the rewriteToken is invalid.", "format": "int64", "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit the owner, acl property." ], "location": "query" }, "rewriteToken": { "type": "string", "description": "Include this field (from the previous rewrite response) on each rewrite request after the first one, until the rewrite response 'done' flag is true. Calls that provide a rewriteToken can omit all other request fields, but if included those fields must match the values provided in the first rewrite request.", "location": "query" }, "sourceBucket": { "type": "string", "description": "Name of the bucket in which to find the source object.", "required": true, "location": "path" }, "sourceGeneration": { "type": "string", "description": "If present, selects a specific revision of the source object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "sourceObject": { "type": "string", "description": "Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "sourceBucket", "sourceObject", "destinationBucket", "destinationObject" ], "request": { "$ref": "Object" }, "response": { "$ref": "RewriteResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "setIamPolicy": { "id": "storage.objects.setIamPolicy", "path": "b/{bucket}/o/{object}/iam", "httpMethod": "PUT", "description": "Updates an IAM policy for the specified object.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which the object resides.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" } }, "parameterOrder": [ "bucket", "object" ], "request": { "$ref": "Policy" }, "response": { "$ref": "Policy" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "testIamPermissions": { "id": "storage.objects.testIamPermissions", "path": "b/{bucket}/o/{object}/iam/testPermissions", "httpMethod": "GET", "description": "Tests a set of permissions on the given object to see which, if any, are held by the caller.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which the object resides.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" }, "permissions": { "type": "string", "description": "Permissions to test.", "required": true, "repeated": true, "location": "query" } }, "parameterOrder": [ "bucket", "object", "permissions" ], "response": { "$ref": "TestIamPermissionsResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ] }, "update": { "id": "storage.objects.update", "path": "b/{bucket}/o/{object}", "httpMethod": "PUT", "description": "Updates an object's metadata.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which the object resides.", "required": true, "location": "path" }, "generation": { "type": "string", "description": "If present, selects a specific revision of this object (as opposed to the latest version, the default).", "format": "int64", "location": "query" }, "ifGenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation matches the given value.", "format": "int64", "location": "query" }, "ifGenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current generation does not match the given value.", "format": "int64", "location": "query" }, "ifMetagenerationMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration matches the given value.", "format": "int64", "location": "query" }, "ifMetagenerationNotMatch": { "type": "string", "description": "Makes the operation conditional on whether the object's current metageneration does not match the given value.", "format": "int64", "location": "query" }, "object": { "type": "string", "description": "Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.", "required": true, "location": "path" }, "predefinedAcl": { "type": "string", "description": "Apply a predefined set of access controls to this object.", "enum": [ "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" ], "enumDescriptions": [ "Object owner gets OWNER access, and allAuthenticatedUsers get READER access.", "Object owner gets OWNER access, and project team owners get OWNER access.", "Object owner gets OWNER access, and project team owners get READER access.", "Object owner gets OWNER access.", "Object owner gets OWNER access, and project team members get access according to their roles.", "Object owner gets OWNER access, and allUsers get READER access." ], "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to full.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit the owner, acl property." ], "location": "query" } }, "parameterOrder": [ "bucket", "object" ], "request": { "$ref": "Object" }, "response": { "$ref": "Object" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control" ], "supportsMediaDownload": true }, "watchAll": { "id": "storage.objects.watchAll", "path": "b/{bucket}/o/watch", "httpMethod": "POST", "description": "Watch for changes on all objects in a bucket.", "parameters": { "bucket": { "type": "string", "description": "Name of the bucket in which to look for objects.", "required": true, "location": "path" }, "delimiter": { "type": "string", "description": "Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted.", "location": "query" }, "maxResults": { "type": "integer", "description": "Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested. The default value of this parameter is 1,000 items.", "format": "uint32", "minimum": "0", "location": "query" }, "pageToken": { "type": "string", "description": "A previously-returned page token representing part of the larger set of results to view.", "location": "query" }, "prefix": { "type": "string", "description": "Filter results to objects whose names begin with this prefix.", "location": "query" }, "projection": { "type": "string", "description": "Set of properties to return. Defaults to noAcl.", "enum": [ "full", "noAcl" ], "enumDescriptions": [ "Include all properties.", "Omit the owner, acl property." ], "location": "query" }, "versions": { "type": "boolean", "description": "If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning.", "location": "query" } }, "parameterOrder": [ "bucket" ], "request": { "$ref": "Channel", "parameterName": "resource" }, "response": { "$ref": "Channel" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write" ], "supportsSubscription": true } } } } } samples/storage_sample/downloads_test.py 0000644 00000017040 15025176453 0014632 0 ustar 00 # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Integration tests for uploading and downloading to GCS. These tests exercise most of the corner cases for upload/download of files in apitools, via GCS. There are no performance tests here yet. """ import json import os import unittest import six from apitools.base.py import exceptions import storage _CLIENT = None def _GetClient(): global _CLIENT # pylint: disable=global-statement if _CLIENT is None: _CLIENT = storage.StorageV1() return _CLIENT class DownloadsTest(unittest.TestCase): _DEFAULT_BUCKET = 'apitools' _TESTDATA_PREFIX = 'testdata' def setUp(self): self.__client = _GetClient() self.__ResetDownload() def __ResetDownload(self, auto_transfer=False): self.__buffer = six.StringIO() self.__download = storage.Download.FromStream( self.__buffer, auto_transfer=auto_transfer) def __GetTestdataFileContents(self, filename): file_path = os.path.join( os.path.dirname(__file__), self._TESTDATA_PREFIX, filename) file_contents = open(file_path).read() self.assertIsNotNone( file_contents, msg=('Could not read file %s' % filename)) return file_contents @classmethod def __GetRequest(cls, filename): object_name = os.path.join(cls._TESTDATA_PREFIX, filename) return storage.StorageObjectsGetRequest( bucket=cls._DEFAULT_BUCKET, object=object_name) def __GetFile(self, request): response = self.__client.objects.Get(request, download=self.__download) self.assertIsNone(response, msg=( 'Unexpected nonempty response for file download: %s' % response)) def __GetAndStream(self, request): self.__GetFile(request) self.__download.StreamInChunks() def testZeroBytes(self): request = self.__GetRequest('zero_byte_file') self.__GetAndStream(request) self.assertEqual(0, self.__buffer.tell()) def testObjectDoesNotExist(self): self.__ResetDownload(auto_transfer=True) with self.assertRaises(exceptions.HttpError): self.__GetFile(self.__GetRequest('nonexistent_file')) def testAutoTransfer(self): self.__ResetDownload(auto_transfer=True) self.__GetFile(self.__GetRequest('fifteen_byte_file')) file_contents = self.__GetTestdataFileContents('fifteen_byte_file') self.assertEqual(15, self.__buffer.tell()) self.__buffer.seek(0) self.assertEqual(file_contents, self.__buffer.read()) def testFilenameWithSpaces(self): self.__ResetDownload(auto_transfer=True) self.__GetFile(self.__GetRequest('filename with spaces')) # NOTE(craigcitro): We add _ here to make this play nice with blaze. file_contents = self.__GetTestdataFileContents('filename_with_spaces') self.assertEqual(15, self.__buffer.tell()) self.__buffer.seek(0) self.assertEqual(file_contents, self.__buffer.read()) def testGetRange(self): # TODO(craigcitro): Test about a thousand more corner cases. file_contents = self.__GetTestdataFileContents('fifteen_byte_file') self.__GetFile(self.__GetRequest('fifteen_byte_file')) self.__download.GetRange(5, 10) self.assertEqual(6, self.__buffer.tell()) self.__buffer.seek(0) self.assertEqual(file_contents[5:11], self.__buffer.read()) def testGetRangeWithNegativeStart(self): file_contents = self.__GetTestdataFileContents('fifteen_byte_file') self.__GetFile(self.__GetRequest('fifteen_byte_file')) self.__download.GetRange(-3) self.assertEqual(3, self.__buffer.tell()) self.__buffer.seek(0) self.assertEqual(file_contents[-3:], self.__buffer.read()) def testGetRangeWithPositiveStart(self): file_contents = self.__GetTestdataFileContents('fifteen_byte_file') self.__GetFile(self.__GetRequest('fifteen_byte_file')) self.__download.GetRange(2) self.assertEqual(13, self.__buffer.tell()) self.__buffer.seek(0) self.assertEqual(file_contents[2:15], self.__buffer.read()) def testSmallChunksizes(self): file_contents = self.__GetTestdataFileContents('fifteen_byte_file') request = self.__GetRequest('fifteen_byte_file') for chunksize in (2, 3, 15, 100): self.__ResetDownload() self.__download.chunksize = chunksize self.__GetAndStream(request) self.assertEqual(15, self.__buffer.tell()) self.__buffer.seek(0) self.assertEqual(file_contents, self.__buffer.read(15)) def testLargeFileChunksizes(self): request = self.__GetRequest('thirty_meg_file') for chunksize in (1048576, 40 * 1048576): self.__ResetDownload() self.__download.chunksize = chunksize self.__GetAndStream(request) self.__buffer.seek(0) def testAutoGzipObject(self): # TODO(craigcitro): Move this to a new object once we have a more # permanent one, see: http://b/12250275 request = storage.StorageObjectsGetRequest( bucket='ottenl-gzip', object='50K.txt') # First, try without auto-transfer. self.__GetFile(request) self.assertEqual(0, self.__buffer.tell()) self.__download.StreamInChunks() self.assertEqual(50000, self.__buffer.tell()) # Next, try with auto-transfer. self.__ResetDownload(auto_transfer=True) self.__GetFile(request) self.assertEqual(50000, self.__buffer.tell()) def testSmallGzipObject(self): request = self.__GetRequest('zero-gzipd.html') self.__GetFile(request) self.assertEqual(0, self.__buffer.tell()) additional_headers = {'accept-encoding': 'gzip, deflate'} self.__download.StreamInChunks(additional_headers=additional_headers) self.assertEqual(0, self.__buffer.tell()) def testSerializedDownload(self): def _ProgressCallback(unused_response, download_object): print('Progress %s' % download_object.progress) file_contents = self.__GetTestdataFileContents('fifteen_byte_file') object_name = os.path.join(self._TESTDATA_PREFIX, 'fifteen_byte_file') request = storage.StorageObjectsGetRequest( bucket=self._DEFAULT_BUCKET, object=object_name) response = self.__client.objects.Get(request) # pylint: disable=attribute-defined-outside-init self.__buffer = six.StringIO() download_data = json.dumps({ 'auto_transfer': False, 'progress': 0, 'total_size': response.size, 'url': response.mediaLink, }) self.__download = storage.Download.FromData( self.__buffer, download_data, http=self.__client.http) self.__download.StreamInChunks(callback=_ProgressCallback) self.assertEqual(15, self.__buffer.tell()) self.__buffer.seek(0) self.assertEqual(file_contents, self.__buffer.read(15)) if __name__ == '__main__': unittest.main() samples/storage_sample/storage_v1/storage_v1_client.py 0000644 00000144072 15025176453 0017271 0 ustar 00 """Generated client library for storage version v1.""" # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.py import base_api from samples.storage_sample.storage_v1 import storage_v1_messages as messages class StorageV1(base_api.BaseApiClient): """Generated client library for service storage version v1.""" MESSAGES_MODULE = messages BASE_URL = 'https://www.googleapis.com/storage/v1/' MTLS_BASE_URL = 'https://www.mtls.googleapis.com/storage/v1/' _PACKAGE = 'storage' _SCOPES = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/cloud-platform.read-only', 'https://www.googleapis.com/auth/devstorage.full_control', 'https://www.googleapis.com/auth/devstorage.read_only', 'https://www.googleapis.com/auth/devstorage.read_write'] _VERSION = 'v1' _CLIENT_ID = 'CLIENT_ID' _CLIENT_SECRET = 'CLIENT_SECRET' _USER_AGENT = 'x_Tw5K8nnjoRAqULM9PFAC2b' _CLIENT_CLASS_NAME = 'StorageV1' _URL_VERSION = 'v1' _API_KEY = None def __init__(self, url='', credentials=None, get_credentials=True, http=None, model=None, log_request=False, log_response=False, credentials_args=None, default_global_params=None, additional_http_headers=None, response_encoding=None): """Create a new storage handle.""" url = url or self.BASE_URL super(StorageV1, self).__init__( url, credentials=credentials, get_credentials=get_credentials, http=http, model=model, log_request=log_request, log_response=log_response, credentials_args=credentials_args, default_global_params=default_global_params, additional_http_headers=additional_http_headers, response_encoding=response_encoding) self.bucketAccessControls = self.BucketAccessControlsService(self) self.buckets = self.BucketsService(self) self.channels = self.ChannelsService(self) self.defaultObjectAccessControls = self.DefaultObjectAccessControlsService(self) self.notifications = self.NotificationsService(self) self.objectAccessControls = self.ObjectAccessControlsService(self) self.objects = self.ObjectsService(self) class BucketAccessControlsService(base_api.BaseApiService): """Service class for the bucketAccessControls resource.""" _NAME = 'bucketAccessControls' def __init__(self, client): super(StorageV1.BucketAccessControlsService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Permanently deletes the ACL entry for the specified entity on the specified bucket. Args: request: (StorageBucketAccessControlsDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StorageBucketAccessControlsDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='storage.bucketAccessControls.delete', ordered_params=['bucket', 'entity'], path_params=['bucket', 'entity'], query_params=[], relative_path='b/{bucket}/acl/{entity}', request_field='', request_type_name='StorageBucketAccessControlsDeleteRequest', response_type_name='StorageBucketAccessControlsDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Returns the ACL entry for the specified entity on the specified bucket. Args: request: (StorageBucketAccessControlsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (BucketAccessControl) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.bucketAccessControls.get', ordered_params=['bucket', 'entity'], path_params=['bucket', 'entity'], query_params=[], relative_path='b/{bucket}/acl/{entity}', request_field='', request_type_name='StorageBucketAccessControlsGetRequest', response_type_name='BucketAccessControl', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a new ACL entry on the specified bucket. Args: request: (BucketAccessControl) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (BucketAccessControl) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.bucketAccessControls.insert', ordered_params=['bucket'], path_params=['bucket'], query_params=[], relative_path='b/{bucket}/acl', request_field='<request>', request_type_name='BucketAccessControl', response_type_name='BucketAccessControl', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves ACL entries on the specified bucket. Args: request: (StorageBucketAccessControlsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (BucketAccessControls) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.bucketAccessControls.list', ordered_params=['bucket'], path_params=['bucket'], query_params=[], relative_path='b/{bucket}/acl', request_field='', request_type_name='StorageBucketAccessControlsListRequest', response_type_name='BucketAccessControls', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates an ACL entry on the specified bucket. This method supports patch semantics. Args: request: (BucketAccessControl) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (BucketAccessControl) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='storage.bucketAccessControls.patch', ordered_params=['bucket', 'entity'], path_params=['bucket', 'entity'], query_params=[], relative_path='b/{bucket}/acl/{entity}', request_field='<request>', request_type_name='BucketAccessControl', response_type_name='BucketAccessControl', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates an ACL entry on the specified bucket. Args: request: (BucketAccessControl) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (BucketAccessControl) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='storage.bucketAccessControls.update', ordered_params=['bucket', 'entity'], path_params=['bucket', 'entity'], query_params=[], relative_path='b/{bucket}/acl/{entity}', request_field='<request>', request_type_name='BucketAccessControl', response_type_name='BucketAccessControl', supports_download=False, ) class BucketsService(base_api.BaseApiService): """Service class for the buckets resource.""" _NAME = 'buckets' def __init__(self, client): super(StorageV1.BucketsService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Permanently deletes an empty bucket. Args: request: (StorageBucketsDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StorageBucketsDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='storage.buckets.delete', ordered_params=['bucket'], path_params=['bucket'], query_params=['ifMetagenerationMatch', 'ifMetagenerationNotMatch'], relative_path='b/{bucket}', request_field='', request_type_name='StorageBucketsDeleteRequest', response_type_name='StorageBucketsDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Returns metadata for the specified bucket. Args: request: (StorageBucketsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Bucket) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.buckets.get', ordered_params=['bucket'], path_params=['bucket'], query_params=['ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'projection'], relative_path='b/{bucket}', request_field='', request_type_name='StorageBucketsGetRequest', response_type_name='Bucket', supports_download=False, ) def GetIamPolicy(self, request, global_params=None): r"""Returns an IAM policy for the specified bucket. Args: request: (StorageBucketsGetIamPolicyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Policy) The response message. """ config = self.GetMethodConfig('GetIamPolicy') return self._RunMethod( config, request, global_params=global_params) GetIamPolicy.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.buckets.getIamPolicy', ordered_params=['bucket'], path_params=['bucket'], query_params=[], relative_path='b/{bucket}/iam', request_field='', request_type_name='StorageBucketsGetIamPolicyRequest', response_type_name='Policy', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a new bucket. Args: request: (StorageBucketsInsertRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Bucket) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.buckets.insert', ordered_params=['project'], path_params=[], query_params=['predefinedAcl', 'predefinedDefaultObjectAcl', 'project', 'projection'], relative_path='b', request_field='bucket', request_type_name='StorageBucketsInsertRequest', response_type_name='Bucket', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves a list of buckets for a given project. Args: request: (StorageBucketsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Buckets) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.buckets.list', ordered_params=['project'], path_params=[], query_params=['maxResults', 'pageToken', 'prefix', 'project', 'projection'], relative_path='b', request_field='', request_type_name='StorageBucketsListRequest', response_type_name='Buckets', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates a bucket. This method supports patch semantics. Args: request: (StorageBucketsPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Bucket) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='storage.buckets.patch', ordered_params=['bucket'], path_params=['bucket'], query_params=['ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'predefinedAcl', 'predefinedDefaultObjectAcl', 'projection'], relative_path='b/{bucket}', request_field='bucketResource', request_type_name='StorageBucketsPatchRequest', response_type_name='Bucket', supports_download=False, ) def SetIamPolicy(self, request, global_params=None): r"""Updates an IAM policy for the specified bucket. Args: request: (StorageBucketsSetIamPolicyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Policy) The response message. """ config = self.GetMethodConfig('SetIamPolicy') return self._RunMethod( config, request, global_params=global_params) SetIamPolicy.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='storage.buckets.setIamPolicy', ordered_params=['bucket'], path_params=['bucket'], query_params=[], relative_path='b/{bucket}/iam', request_field='policy', request_type_name='StorageBucketsSetIamPolicyRequest', response_type_name='Policy', supports_download=False, ) def TestIamPermissions(self, request, global_params=None): r"""Tests a set of permissions on the given bucket to see which, if any, are held by the caller. Args: request: (StorageBucketsTestIamPermissionsRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TestIamPermissionsResponse) The response message. """ config = self.GetMethodConfig('TestIamPermissions') return self._RunMethod( config, request, global_params=global_params) TestIamPermissions.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.buckets.testIamPermissions', ordered_params=['bucket', 'permissions'], path_params=['bucket'], query_params=['permissions'], relative_path='b/{bucket}/iam/testPermissions', request_field='', request_type_name='StorageBucketsTestIamPermissionsRequest', response_type_name='TestIamPermissionsResponse', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates a bucket. Args: request: (StorageBucketsUpdateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Bucket) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='storage.buckets.update', ordered_params=['bucket'], path_params=['bucket'], query_params=['ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'predefinedAcl', 'predefinedDefaultObjectAcl', 'projection'], relative_path='b/{bucket}', request_field='bucketResource', request_type_name='StorageBucketsUpdateRequest', response_type_name='Bucket', supports_download=False, ) class ChannelsService(base_api.BaseApiService): """Service class for the channels resource.""" _NAME = 'channels' def __init__(self, client): super(StorageV1.ChannelsService, self).__init__(client) self._upload_configs = { } def Stop(self, request, global_params=None): r"""Stop watching resources through this channel. Args: request: (Channel) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StorageChannelsStopResponse) The response message. """ config = self.GetMethodConfig('Stop') return self._RunMethod( config, request, global_params=global_params) Stop.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.channels.stop', ordered_params=[], path_params=[], query_params=[], relative_path='channels/stop', request_field='<request>', request_type_name='Channel', response_type_name='StorageChannelsStopResponse', supports_download=False, ) class DefaultObjectAccessControlsService(base_api.BaseApiService): """Service class for the defaultObjectAccessControls resource.""" _NAME = 'defaultObjectAccessControls' def __init__(self, client): super(StorageV1.DefaultObjectAccessControlsService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Permanently deletes the default object ACL entry for the specified entity on the specified bucket. Args: request: (StorageDefaultObjectAccessControlsDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StorageDefaultObjectAccessControlsDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='storage.defaultObjectAccessControls.delete', ordered_params=['bucket', 'entity'], path_params=['bucket', 'entity'], query_params=[], relative_path='b/{bucket}/defaultObjectAcl/{entity}', request_field='', request_type_name='StorageDefaultObjectAccessControlsDeleteRequest', response_type_name='StorageDefaultObjectAccessControlsDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Returns the default object ACL entry for the specified entity on the specified bucket. Args: request: (StorageDefaultObjectAccessControlsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControl) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.defaultObjectAccessControls.get', ordered_params=['bucket', 'entity'], path_params=['bucket', 'entity'], query_params=[], relative_path='b/{bucket}/defaultObjectAcl/{entity}', request_field='', request_type_name='StorageDefaultObjectAccessControlsGetRequest', response_type_name='ObjectAccessControl', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a new default object ACL entry on the specified bucket. Args: request: (ObjectAccessControl) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControl) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.defaultObjectAccessControls.insert', ordered_params=['bucket'], path_params=['bucket'], query_params=[], relative_path='b/{bucket}/defaultObjectAcl', request_field='<request>', request_type_name='ObjectAccessControl', response_type_name='ObjectAccessControl', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves default object ACL entries on the specified bucket. Args: request: (StorageDefaultObjectAccessControlsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControls) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.defaultObjectAccessControls.list', ordered_params=['bucket'], path_params=['bucket'], query_params=['ifMetagenerationMatch', 'ifMetagenerationNotMatch'], relative_path='b/{bucket}/defaultObjectAcl', request_field='', request_type_name='StorageDefaultObjectAccessControlsListRequest', response_type_name='ObjectAccessControls', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates a default object ACL entry on the specified bucket. This method supports patch semantics. Args: request: (ObjectAccessControl) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControl) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='storage.defaultObjectAccessControls.patch', ordered_params=['bucket', 'entity'], path_params=['bucket', 'entity'], query_params=[], relative_path='b/{bucket}/defaultObjectAcl/{entity}', request_field='<request>', request_type_name='ObjectAccessControl', response_type_name='ObjectAccessControl', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates a default object ACL entry on the specified bucket. Args: request: (ObjectAccessControl) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControl) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='storage.defaultObjectAccessControls.update', ordered_params=['bucket', 'entity'], path_params=['bucket', 'entity'], query_params=[], relative_path='b/{bucket}/defaultObjectAcl/{entity}', request_field='<request>', request_type_name='ObjectAccessControl', response_type_name='ObjectAccessControl', supports_download=False, ) class NotificationsService(base_api.BaseApiService): """Service class for the notifications resource.""" _NAME = 'notifications' def __init__(self, client): super(StorageV1.NotificationsService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Permanently deletes a notification subscription. Args: request: (StorageNotificationsDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StorageNotificationsDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='storage.notifications.delete', ordered_params=['notification'], path_params=['notification'], query_params=[], relative_path='notifications/{notification}', request_field='', request_type_name='StorageNotificationsDeleteRequest', response_type_name='StorageNotificationsDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""View a notification configuration. Args: request: (StorageNotificationsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Notification) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.notifications.get', ordered_params=['notification'], path_params=['notification'], query_params=[], relative_path='notifications/{notification}', request_field='', request_type_name='StorageNotificationsGetRequest', response_type_name='Notification', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a notification subscription for a given bucket. Args: request: (Notification) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Notification) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.notifications.insert', ordered_params=[], path_params=[], query_params=[], relative_path='notifications', request_field='<request>', request_type_name='Notification', response_type_name='Notification', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves a list of notification subscriptions for a given bucket. Args: request: (StorageNotificationsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Notifications) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.notifications.list', ordered_params=['bucket'], path_params=[], query_params=['bucket'], relative_path='notifications', request_field='', request_type_name='StorageNotificationsListRequest', response_type_name='Notifications', supports_download=False, ) class ObjectAccessControlsService(base_api.BaseApiService): """Service class for the objectAccessControls resource.""" _NAME = 'objectAccessControls' def __init__(self, client): super(StorageV1.ObjectAccessControlsService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Permanently deletes the ACL entry for the specified entity on the specified object. Args: request: (StorageObjectAccessControlsDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StorageObjectAccessControlsDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='storage.objectAccessControls.delete', ordered_params=['bucket', 'object', 'entity'], path_params=['bucket', 'entity', 'object'], query_params=['generation'], relative_path='b/{bucket}/o/{object}/acl/{entity}', request_field='', request_type_name='StorageObjectAccessControlsDeleteRequest', response_type_name='StorageObjectAccessControlsDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Returns the ACL entry for the specified entity on the specified object. Args: request: (StorageObjectAccessControlsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControl) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.objectAccessControls.get', ordered_params=['bucket', 'object', 'entity'], path_params=['bucket', 'entity', 'object'], query_params=['generation'], relative_path='b/{bucket}/o/{object}/acl/{entity}', request_field='', request_type_name='StorageObjectAccessControlsGetRequest', response_type_name='ObjectAccessControl', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a new ACL entry on the specified object. Args: request: (StorageObjectAccessControlsInsertRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControl) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.objectAccessControls.insert', ordered_params=['bucket', 'object'], path_params=['bucket', 'object'], query_params=['generation'], relative_path='b/{bucket}/o/{object}/acl', request_field='objectAccessControl', request_type_name='StorageObjectAccessControlsInsertRequest', response_type_name='ObjectAccessControl', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves ACL entries on the specified object. Args: request: (StorageObjectAccessControlsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControls) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.objectAccessControls.list', ordered_params=['bucket', 'object'], path_params=['bucket', 'object'], query_params=['generation'], relative_path='b/{bucket}/o/{object}/acl', request_field='', request_type_name='StorageObjectAccessControlsListRequest', response_type_name='ObjectAccessControls', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates an ACL entry on the specified object. This method supports patch semantics. Args: request: (StorageObjectAccessControlsPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControl) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='storage.objectAccessControls.patch', ordered_params=['bucket', 'object', 'entity'], path_params=['bucket', 'entity', 'object'], query_params=['generation'], relative_path='b/{bucket}/o/{object}/acl/{entity}', request_field='objectAccessControl', request_type_name='StorageObjectAccessControlsPatchRequest', response_type_name='ObjectAccessControl', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates an ACL entry on the specified object. Args: request: (StorageObjectAccessControlsUpdateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ObjectAccessControl) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='storage.objectAccessControls.update', ordered_params=['bucket', 'object', 'entity'], path_params=['bucket', 'entity', 'object'], query_params=['generation'], relative_path='b/{bucket}/o/{object}/acl/{entity}', request_field='objectAccessControl', request_type_name='StorageObjectAccessControlsUpdateRequest', response_type_name='ObjectAccessControl', supports_download=False, ) class ObjectsService(base_api.BaseApiService): """Service class for the objects resource.""" _NAME = 'objects' def __init__(self, client): super(StorageV1.ObjectsService, self).__init__(client) self._upload_configs = { 'Insert': base_api.ApiUploadInfo( accept=['*/*'], max_size=None, resumable_multipart=True, resumable_path='/resumable/upload/storage/v1/b/{bucket}/o', simple_multipart=True, simple_path='/upload/storage/v1/b/{bucket}/o', ), } def Compose(self, request, global_params=None, download=None): r"""Concatenates a list of existing objects into a new object in the same bucket. Args: request: (StorageObjectsComposeRequest) input message global_params: (StandardQueryParameters, default: None) global arguments download: (Download, default: None) If present, download data from the request via this stream. Returns: (Object) The response message. """ config = self.GetMethodConfig('Compose') return self._RunMethod( config, request, global_params=global_params, download=download) Compose.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.objects.compose', ordered_params=['destinationBucket', 'destinationObject'], path_params=['destinationBucket', 'destinationObject'], query_params=['destinationPredefinedAcl', 'ifGenerationMatch', 'ifMetagenerationMatch'], relative_path='b/{destinationBucket}/o/{destinationObject}/compose', request_field='composeRequest', request_type_name='StorageObjectsComposeRequest', response_type_name='Object', supports_download=True, ) def Copy(self, request, global_params=None, download=None): r"""Copies a source object to a destination object. Optionally overrides metadata. Args: request: (StorageObjectsCopyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments download: (Download, default: None) If present, download data from the request via this stream. Returns: (Object) The response message. """ config = self.GetMethodConfig('Copy') return self._RunMethod( config, request, global_params=global_params, download=download) Copy.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.objects.copy', ordered_params=['sourceBucket', 'sourceObject', 'destinationBucket', 'destinationObject'], path_params=['destinationBucket', 'destinationObject', 'sourceBucket', 'sourceObject'], query_params=['destinationPredefinedAcl', 'ifGenerationMatch', 'ifGenerationNotMatch', 'ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'ifSourceGenerationMatch', 'ifSourceGenerationNotMatch', 'ifSourceMetagenerationMatch', 'ifSourceMetagenerationNotMatch', 'projection', 'sourceGeneration'], relative_path='b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}', request_field='object', request_type_name='StorageObjectsCopyRequest', response_type_name='Object', supports_download=True, ) def Delete(self, request, global_params=None): r"""Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used. Args: request: (StorageObjectsDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StorageObjectsDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='storage.objects.delete', ordered_params=['bucket', 'object'], path_params=['bucket', 'object'], query_params=['generation', 'ifGenerationMatch', 'ifGenerationNotMatch', 'ifMetagenerationMatch', 'ifMetagenerationNotMatch'], relative_path='b/{bucket}/o/{object}', request_field='', request_type_name='StorageObjectsDeleteRequest', response_type_name='StorageObjectsDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None, download=None): r"""Retrieves an object or its metadata. Args: request: (StorageObjectsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments download: (Download, default: None) If present, download data from the request via this stream. Returns: (Object) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params, download=download) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.objects.get', ordered_params=['bucket', 'object'], path_params=['bucket', 'object'], query_params=['generation', 'ifGenerationMatch', 'ifGenerationNotMatch', 'ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'projection'], relative_path='b/{bucket}/o/{object}', request_field='', request_type_name='StorageObjectsGetRequest', response_type_name='Object', supports_download=True, ) def GetIamPolicy(self, request, global_params=None): r"""Returns an IAM policy for the specified object. Args: request: (StorageObjectsGetIamPolicyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Policy) The response message. """ config = self.GetMethodConfig('GetIamPolicy') return self._RunMethod( config, request, global_params=global_params) GetIamPolicy.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.objects.getIamPolicy', ordered_params=['bucket', 'object'], path_params=['bucket', 'object'], query_params=['generation'], relative_path='b/{bucket}/o/{object}/iam', request_field='', request_type_name='StorageObjectsGetIamPolicyRequest', response_type_name='Policy', supports_download=False, ) def Insert(self, request, global_params=None, upload=None, download=None): r"""Stores a new object and metadata. Args: request: (StorageObjectsInsertRequest) input message global_params: (StandardQueryParameters, default: None) global arguments upload: (Upload, default: None) If present, upload this stream with the request. download: (Download, default: None) If present, download data from the request via this stream. Returns: (Object) The response message. """ config = self.GetMethodConfig('Insert') upload_config = self.GetUploadConfig('Insert') return self._RunMethod( config, request, global_params=global_params, upload=upload, upload_config=upload_config, download=download) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.objects.insert', ordered_params=['bucket'], path_params=['bucket'], query_params=['contentEncoding', 'ifGenerationMatch', 'ifGenerationNotMatch', 'ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'name', 'predefinedAcl', 'projection'], relative_path='b/{bucket}/o', request_field='object', request_type_name='StorageObjectsInsertRequest', response_type_name='Object', supports_download=True, ) def List(self, request, global_params=None): r"""Retrieves a list of objects matching the criteria. Args: request: (StorageObjectsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Objects) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.objects.list', ordered_params=['bucket'], path_params=['bucket'], query_params=['delimiter', 'maxResults', 'pageToken', 'prefix', 'projection', 'versions'], relative_path='b/{bucket}/o', request_field='', request_type_name='StorageObjectsListRequest', response_type_name='Objects', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates an object's metadata. This method supports patch semantics. Args: request: (StorageObjectsPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Object) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='storage.objects.patch', ordered_params=['bucket', 'object'], path_params=['bucket', 'object'], query_params=['generation', 'ifGenerationMatch', 'ifGenerationNotMatch', 'ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'predefinedAcl', 'projection'], relative_path='b/{bucket}/o/{object}', request_field='objectResource', request_type_name='StorageObjectsPatchRequest', response_type_name='Object', supports_download=False, ) def Rewrite(self, request, global_params=None): r"""Rewrites a source object to a destination object. Optionally overrides metadata. Args: request: (StorageObjectsRewriteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (RewriteResponse) The response message. """ config = self.GetMethodConfig('Rewrite') return self._RunMethod( config, request, global_params=global_params) Rewrite.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.objects.rewrite', ordered_params=['sourceBucket', 'sourceObject', 'destinationBucket', 'destinationObject'], path_params=['destinationBucket', 'destinationObject', 'sourceBucket', 'sourceObject'], query_params=['destinationPredefinedAcl', 'ifGenerationMatch', 'ifGenerationNotMatch', 'ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'ifSourceGenerationMatch', 'ifSourceGenerationNotMatch', 'ifSourceMetagenerationMatch', 'ifSourceMetagenerationNotMatch', 'maxBytesRewrittenPerCall', 'projection', 'rewriteToken', 'sourceGeneration'], relative_path='b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}', request_field='object', request_type_name='StorageObjectsRewriteRequest', response_type_name='RewriteResponse', supports_download=False, ) def SetIamPolicy(self, request, global_params=None): r"""Updates an IAM policy for the specified object. Args: request: (StorageObjectsSetIamPolicyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Policy) The response message. """ config = self.GetMethodConfig('SetIamPolicy') return self._RunMethod( config, request, global_params=global_params) SetIamPolicy.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='storage.objects.setIamPolicy', ordered_params=['bucket', 'object'], path_params=['bucket', 'object'], query_params=['generation'], relative_path='b/{bucket}/o/{object}/iam', request_field='policy', request_type_name='StorageObjectsSetIamPolicyRequest', response_type_name='Policy', supports_download=False, ) def TestIamPermissions(self, request, global_params=None): r"""Tests a set of permissions on the given object to see which, if any, are held by the caller. Args: request: (StorageObjectsTestIamPermissionsRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TestIamPermissionsResponse) The response message. """ config = self.GetMethodConfig('TestIamPermissions') return self._RunMethod( config, request, global_params=global_params) TestIamPermissions.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='storage.objects.testIamPermissions', ordered_params=['bucket', 'object', 'permissions'], path_params=['bucket', 'object'], query_params=['generation', 'permissions'], relative_path='b/{bucket}/o/{object}/iam/testPermissions', request_field='', request_type_name='StorageObjectsTestIamPermissionsRequest', response_type_name='TestIamPermissionsResponse', supports_download=False, ) def Update(self, request, global_params=None, download=None): r"""Updates an object's metadata. Args: request: (StorageObjectsUpdateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments download: (Download, default: None) If present, download data from the request via this stream. Returns: (Object) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params, download=download) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='storage.objects.update', ordered_params=['bucket', 'object'], path_params=['bucket', 'object'], query_params=['generation', 'ifGenerationMatch', 'ifGenerationNotMatch', 'ifMetagenerationMatch', 'ifMetagenerationNotMatch', 'predefinedAcl', 'projection'], relative_path='b/{bucket}/o/{object}', request_field='objectResource', request_type_name='StorageObjectsUpdateRequest', response_type_name='Object', supports_download=True, ) def WatchAll(self, request, global_params=None): r"""Watch for changes on all objects in a bucket. Args: request: (StorageObjectsWatchAllRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Channel) The response message. """ config = self.GetMethodConfig('WatchAll') return self._RunMethod( config, request, global_params=global_params) WatchAll.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='storage.objects.watchAll', ordered_params=['bucket'], path_params=['bucket'], query_params=['delimiter', 'maxResults', 'pageToken', 'prefix', 'projection', 'versions'], relative_path='b/{bucket}/o/watch', request_field='channel', request_type_name='StorageObjectsWatchAllRequest', response_type_name='Channel', supports_download=False, ) samples/storage_sample/storage_v1/storage_v1_messages.py 0000644 00000261656 15025176453 0017632 0 ustar 00 """Generated message classes for storage version v1. Stores and retrieves potentially large, immutable data objects. """ # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.protorpclite import message_types as _message_types from apitools.base.protorpclite import messages as _messages from apitools.base.py import encoding from apitools.base.py import extra_types package = 'storage' class Bucket(_messages.Message): r"""A bucket. Messages: CorsValueListEntry: A CorsValueListEntry object. LifecycleValue: The bucket's lifecycle configuration. See lifecycle management for more information. LoggingValue: The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. OwnerValue: The owner of the bucket. This is always the project team's owner group. VersioningValue: The bucket's versioning configuration. WebsiteValue: The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. Fields: acl: Access controls on the bucket. cors: The bucket's Cross-Origin Resource Sharing (CORS) configuration. defaultObjectAcl: Default access controls to apply to new objects when no ACL is provided. etag: HTTP 1.1 Entity tag for the bucket. id: The ID of the bucket. kind: The kind of item this is. For buckets, this is always storage#bucket. lifecycle: The bucket's lifecycle configuration. See lifecycle management for more information. location: The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer's guide for the authoritative list. logging: The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. metageneration: The metadata generation of this bucket. name: The name of the bucket. owner: The owner of the bucket. This is always the project team's owner group. projectNumber: The project number of the project the bucket belongs to. selfLink: The URI of this bucket. storageClass: The bucket's storage class. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include STANDARD, NEARLINE and DURABLE_REDUCED_AVAILABILITY. Defaults to STANDARD. For more information, see storage classes. timeCreated: The creation time of the bucket in RFC 3339 format. updated: The modification time of the bucket in RFC 3339 format. versioning: The bucket's versioning configuration. website: The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. """ class CorsValueListEntry(_messages.Message): r"""A CorsValueListEntry object. Fields: maxAgeSeconds: The value, in seconds, to return in the Access-Control- Max-Age header used in preflight responses. method: The list of HTTP methods on which to include CORS response headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and means "any method". origin: The list of Origins eligible to receive CORS response headers. Note: "*" is permitted in the list of origins, and means "any Origin". responseHeader: The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. """ maxAgeSeconds = _messages.IntegerField(1, variant=_messages.Variant.INT32) method = _messages.StringField(2, repeated=True) origin = _messages.StringField(3, repeated=True) responseHeader = _messages.StringField(4, repeated=True) class LifecycleValue(_messages.Message): r"""The bucket's lifecycle configuration. See lifecycle management for more information. Messages: RuleValueListEntry: A RuleValueListEntry object. Fields: rule: A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken. """ class RuleValueListEntry(_messages.Message): r"""A RuleValueListEntry object. Messages: ActionValue: The action to take. ConditionValue: The condition(s) under which the action will be taken. Fields: action: The action to take. condition: The condition(s) under which the action will be taken. """ class ActionValue(_messages.Message): r"""The action to take. Fields: type: Type of the action. Currently, only Delete is supported. """ type = _messages.StringField(1) class ConditionValue(_messages.Message): r"""The condition(s) under which the action will be taken. Fields: age: Age of an object (in days). This condition is satisfied when an object reaches the specified age. createdBefore: A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). This condition is satisfied when an object is created before midnight of the specified date in UTC. isLive: Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects. numNewerVersions: Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object. """ age = _messages.IntegerField(1, variant=_messages.Variant.INT32) createdBefore = extra_types.DateField(2) isLive = _messages.BooleanField(3) numNewerVersions = _messages.IntegerField(4, variant=_messages.Variant.INT32) action = _messages.MessageField('ActionValue', 1) condition = _messages.MessageField('ConditionValue', 2) rule = _messages.MessageField('RuleValueListEntry', 1, repeated=True) class LoggingValue(_messages.Message): r"""The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. Fields: logBucket: The destination bucket where the current bucket's logs should be placed. logObjectPrefix: A prefix for log object names. """ logBucket = _messages.StringField(1) logObjectPrefix = _messages.StringField(2) class OwnerValue(_messages.Message): r"""The owner of the bucket. This is always the project team's owner group. Fields: entity: The entity, in the form project-owner-projectId. entityId: The ID for the entity. """ entity = _messages.StringField(1) entityId = _messages.StringField(2) class VersioningValue(_messages.Message): r"""The bucket's versioning configuration. Fields: enabled: While set to true, versioning is fully enabled for this bucket. """ enabled = _messages.BooleanField(1) class WebsiteValue(_messages.Message): r"""The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. Fields: mainPageSuffix: If the requested object path is missing, the service will ensure the path has a trailing '/', append this suffix, and attempt to retrieve the resulting object. This allows the creation of index.html objects to represent directory pages. notFoundPage: If the requested object path is missing, and any mainPageSuffix object is missing, if applicable, the service will return the named object from this bucket as the content for a 404 Not Found result. """ mainPageSuffix = _messages.StringField(1) notFoundPage = _messages.StringField(2) acl = _messages.MessageField('BucketAccessControl', 1, repeated=True) cors = _messages.MessageField('CorsValueListEntry', 2, repeated=True) defaultObjectAcl = _messages.MessageField('ObjectAccessControl', 3, repeated=True) etag = _messages.StringField(4) id = _messages.StringField(5) kind = _messages.StringField(6, default='storage#bucket') lifecycle = _messages.MessageField('LifecycleValue', 7) location = _messages.StringField(8) logging = _messages.MessageField('LoggingValue', 9) metageneration = _messages.IntegerField(10) name = _messages.StringField(11) owner = _messages.MessageField('OwnerValue', 12) projectNumber = _messages.IntegerField(13, variant=_messages.Variant.UINT64) selfLink = _messages.StringField(14) storageClass = _messages.StringField(15) timeCreated = _message_types.DateTimeField(16) updated = _message_types.DateTimeField(17) versioning = _messages.MessageField('VersioningValue', 18) website = _messages.MessageField('WebsiteValue', 19) class BucketAccessControl(_messages.Message): r"""An access-control entry. Messages: ProjectTeamValue: The project team associated with the entity, if any. Fields: bucket: The name of the bucket. domain: The domain associated with the entity, if any. email: The email address associated with the entity, if any. entity: The entity holding the permission, in one of the following forms: - user-userId - user-email - group-groupId - group-email - domain- domain - project-team-projectId - allUsers - allAuthenticatedUsers Examples: - The user liz@example.com would be user-liz@example.com. - The group example@googlegroups.com would be group- example@googlegroups.com. - To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com. entityId: The ID for the entity, if any. etag: HTTP 1.1 Entity tag for the access-control entry. id: The ID of the access-control entry. kind: The kind of item this is. For bucket access control entries, this is always storage#bucketAccessControl. projectTeam: The project team associated with the entity, if any. role: The access permission for the entity. Can be READER, WRITER, or OWNER. selfLink: The link to this access-control entry. """ class ProjectTeamValue(_messages.Message): r"""The project team associated with the entity, if any. Fields: projectNumber: The project number. team: The team. Can be owners, editors, or viewers. """ projectNumber = _messages.StringField(1) team = _messages.StringField(2) bucket = _messages.StringField(1) domain = _messages.StringField(2) email = _messages.StringField(3) entity = _messages.StringField(4) entityId = _messages.StringField(5) etag = _messages.StringField(6) id = _messages.StringField(7) kind = _messages.StringField(8, default='storage#bucketAccessControl') projectTeam = _messages.MessageField('ProjectTeamValue', 9) role = _messages.StringField(10) selfLink = _messages.StringField(11) class BucketAccessControls(_messages.Message): r"""An access-control list. Fields: items: The list of items. kind: The kind of item this is. For lists of bucket access control entries, this is always storage#bucketAccessControls. """ items = _messages.MessageField('BucketAccessControl', 1, repeated=True) kind = _messages.StringField(2, default='storage#bucketAccessControls') class Buckets(_messages.Message): r"""A list of buckets. Fields: items: The list of items. kind: The kind of item this is. For lists of buckets, this is always storage#buckets. nextPageToken: The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results. """ items = _messages.MessageField('Bucket', 1, repeated=True) kind = _messages.StringField(2, default='storage#buckets') nextPageToken = _messages.StringField(3) class Channel(_messages.Message): r"""An notification channel used to watch for resource changes. Messages: ParamsValue: Additional parameters controlling delivery channel behavior. Optional. Fields: address: The address where notifications are delivered for this channel. expiration: Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional. id: A UUID or similar unique string that identifies this channel. kind: Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string "api#channel". params: Additional parameters controlling delivery channel behavior. Optional. payload: A Boolean value to indicate whether payload is wanted. Optional. resourceId: An opaque ID that identifies the resource being watched on this channel. Stable across different API versions. resourceUri: A version-specific identifier for the watched resource. token: An arbitrary string delivered to the target address with each notification delivered over this channel. Optional. type: The type of delivery mechanism used for this channel. """ @encoding.MapUnrecognizedFields('additionalProperties') class ParamsValue(_messages.Message): r"""Additional parameters controlling delivery channel behavior. Optional. Messages: AdditionalProperty: An additional property for a ParamsValue object. Fields: additionalProperties: Declares a new parameter by name. """ class AdditionalProperty(_messages.Message): r"""An additional property for a ParamsValue object. Fields: key: Name of the additional property. value: A string attribute. """ key = _messages.StringField(1) value = _messages.StringField(2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) address = _messages.StringField(1) expiration = _messages.IntegerField(2) id = _messages.StringField(3) kind = _messages.StringField(4, default='api#channel') params = _messages.MessageField('ParamsValue', 5) payload = _messages.BooleanField(6) resourceId = _messages.StringField(7) resourceUri = _messages.StringField(8) token = _messages.StringField(9) type = _messages.StringField(10) class ComposeRequest(_messages.Message): r"""A Compose request. Messages: SourceObjectsValueListEntry: A SourceObjectsValueListEntry object. Fields: destination: Properties of the resulting object. kind: The kind of item this is. sourceObjects: The list of source objects that will be concatenated into a single object. """ class SourceObjectsValueListEntry(_messages.Message): r"""A SourceObjectsValueListEntry object. Messages: ObjectPreconditionsValue: Conditions that must be met for this operation to execute. Fields: generation: The generation of this object to use as the source. name: The source object's name. The source object's bucket is implicitly the destination bucket. objectPreconditions: Conditions that must be met for this operation to execute. """ class ObjectPreconditionsValue(_messages.Message): r"""Conditions that must be met for this operation to execute. Fields: ifGenerationMatch: Only perform the composition if the generation of the source object that would be used matches this value. If this value and a generation are both specified, they must be the same value or the call will fail. """ ifGenerationMatch = _messages.IntegerField(1) generation = _messages.IntegerField(1) name = _messages.StringField(2) objectPreconditions = _messages.MessageField('ObjectPreconditionsValue', 3) destination = _messages.MessageField('Object', 1) kind = _messages.StringField(2, default='storage#composeRequest') sourceObjects = _messages.MessageField('SourceObjectsValueListEntry', 3, repeated=True) class Notification(_messages.Message): r"""A subscription to receive Google PubSub notifications. Messages: CustomAttributesValue: An optional list of additional attributes to attach to each Cloud PubSub message published for this notification subscription. Fields: bucket: The name of the bucket this subscription is particular to. custom_attributes: An optional list of additional attributes to attach to each Cloud PubSub message published for this notification subscription. etag: HTTP 1.1 Entity tag for this subscription notification. event_types: If present, only send notifications about listed event types. If empty, sent notifications for all event types. id: The ID of the notification. kind: The kind of item this is. For notifications, this is always storage#notification. object_metadata_format: If payload_content is OBJECT_METADATA, controls the format of that metadata. Otherwise, must not be set. object_name_prefix: If present, only apply this notification configuration to object names that begin with this prefix. payload_content: The desired content of the Payload. Defaults to OBJECT_METADATA. selfLink: The canonical URL of this notification. topic: The Cloud PubSub topic to which this subscription publishes. Formatted as: '//pubsub.googleapis.com/projects/{project- identifier}/topics/{my-topic}' """ @encoding.MapUnrecognizedFields('additionalProperties') class CustomAttributesValue(_messages.Message): r"""An optional list of additional attributes to attach to each Cloud PubSub message published for this notification subscription. Messages: AdditionalProperty: An additional property for a CustomAttributesValue object. Fields: additionalProperties: Additional properties of type CustomAttributesValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a CustomAttributesValue object. Fields: key: Name of the additional property. value: A string attribute. """ key = _messages.StringField(1) value = _messages.StringField(2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) bucket = _messages.StringField(1) custom_attributes = _messages.MessageField('CustomAttributesValue', 2) etag = _messages.StringField(3) event_types = _messages.StringField(4, repeated=True) id = _messages.StringField(5) kind = _messages.StringField(6, default='storage#notification') object_metadata_format = _messages.StringField(7, default='JSON_API_V1') object_name_prefix = _messages.StringField(8) payload_content = _messages.StringField(9, default='OBJECT_METADATA') selfLink = _messages.StringField(10) topic = _messages.StringField(11) class Notifications(_messages.Message): r"""A list of notification subscriptions. Fields: items: The list of items. kind: The kind of item this is. For lists of notifications, this is always storage#notifications. """ items = _messages.MessageField('Notification', 1, repeated=True) kind = _messages.StringField(2, default='storage#notifications') class Object(_messages.Message): r"""An object. Messages: CustomerEncryptionValue: Metadata of customer-supplied encryption key, if the object is encrypted by such a key. MetadataValue: User-provided metadata, in key/value pairs. OwnerValue: The owner of the object. This will always be the uploader of the object. Fields: acl: Access controls on the object. bucket: The name of the bucket containing this object. cacheControl: Cache-Control directive for the object data. componentCount: Number of underlying components that make up this object. Components are accumulated by compose operations. contentDisposition: Content-Disposition of the object data. contentEncoding: Content-Encoding of the object data. contentLanguage: Content-Language of the object data. contentType: Content-Type of the object data. If contentType is not specified, object downloads will be served as application/octet-stream. crc32c: CRC32c checksum, as described in RFC 4960, Appendix B; encoded using base64 in big-endian byte order. For more information about using the CRC32c checksum, see Hashes and ETags: Best Practices. customerEncryption: Metadata of customer-supplied encryption key, if the object is encrypted by such a key. etag: HTTP 1.1 Entity tag for the object. generation: The content generation of this object. Used for object versioning. id: The ID of the object. kind: The kind of item this is. For objects, this is always storage#object. md5Hash: MD5 hash of the data; encoded using base64. For more information about using the MD5 hash, see Hashes and ETags: Best Practices. mediaLink: Media download link. metadata: User-provided metadata, in key/value pairs. metageneration: The version of the metadata for this object at this generation. Used for preconditions and for detecting changes in metadata. A metageneration number is only meaningful in the context of a particular generation of a particular object. name: The name of this object. Required if not specified by URL parameter. owner: The owner of the object. This will always be the uploader of the object. selfLink: The link to this object. size: Content-Length of the data in bytes. storageClass: Storage class of the object. timeCreated: The creation time of the object in RFC 3339 format. timeDeleted: The deletion time of the object in RFC 3339 format. Will be returned if and only if this version of the object has been deleted. updated: The modification time of the object metadata in RFC 3339 format. """ class CustomerEncryptionValue(_messages.Message): r"""Metadata of customer-supplied encryption key, if the object is encrypted by such a key. Fields: encryptionAlgorithm: The encryption algorithm. keySha256: SHA256 hash value of the encryption key. """ encryptionAlgorithm = _messages.StringField(1) keySha256 = _messages.StringField(2) @encoding.MapUnrecognizedFields('additionalProperties') class MetadataValue(_messages.Message): r"""User-provided metadata, in key/value pairs. Messages: AdditionalProperty: An additional property for a MetadataValue object. Fields: additionalProperties: An individual metadata entry. """ class AdditionalProperty(_messages.Message): r"""An additional property for a MetadataValue object. Fields: key: Name of the additional property. value: A string attribute. """ key = _messages.StringField(1) value = _messages.StringField(2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) class OwnerValue(_messages.Message): r"""The owner of the object. This will always be the uploader of the object. Fields: entity: The entity, in the form user-userId. entityId: The ID for the entity. """ entity = _messages.StringField(1) entityId = _messages.StringField(2) acl = _messages.MessageField('ObjectAccessControl', 1, repeated=True) bucket = _messages.StringField(2) cacheControl = _messages.StringField(3) componentCount = _messages.IntegerField(4, variant=_messages.Variant.INT32) contentDisposition = _messages.StringField(5) contentEncoding = _messages.StringField(6) contentLanguage = _messages.StringField(7) contentType = _messages.StringField(8) crc32c = _messages.StringField(9) customerEncryption = _messages.MessageField('CustomerEncryptionValue', 10) etag = _messages.StringField(11) generation = _messages.IntegerField(12) id = _messages.StringField(13) kind = _messages.StringField(14, default='storage#object') md5Hash = _messages.StringField(15) mediaLink = _messages.StringField(16) metadata = _messages.MessageField('MetadataValue', 17) metageneration = _messages.IntegerField(18) name = _messages.StringField(19) owner = _messages.MessageField('OwnerValue', 20) selfLink = _messages.StringField(21) size = _messages.IntegerField(22, variant=_messages.Variant.UINT64) storageClass = _messages.StringField(23) timeCreated = _message_types.DateTimeField(24) timeDeleted = _message_types.DateTimeField(25) updated = _message_types.DateTimeField(26) class ObjectAccessControl(_messages.Message): r"""An access-control entry. Messages: ProjectTeamValue: The project team associated with the entity, if any. Fields: bucket: The name of the bucket. domain: The domain associated with the entity, if any. email: The email address associated with the entity, if any. entity: The entity holding the permission, in one of the following forms: - user-userId - user-email - group-groupId - group-email - domain- domain - project-team-projectId - allUsers - allAuthenticatedUsers Examples: - The user liz@example.com would be user-liz@example.com. - The group example@googlegroups.com would be group- example@googlegroups.com. - To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com. entityId: The ID for the entity, if any. etag: HTTP 1.1 Entity tag for the access-control entry. generation: The content generation of the object. id: The ID of the access-control entry. kind: The kind of item this is. For object access control entries, this is always storage#objectAccessControl. object: The name of the object. projectTeam: The project team associated with the entity, if any. role: The access permission for the entity. Can be READER or OWNER. selfLink: The link to this access-control entry. """ class ProjectTeamValue(_messages.Message): r"""The project team associated with the entity, if any. Fields: projectNumber: The project number. team: The team. Can be owners, editors, or viewers. """ projectNumber = _messages.StringField(1) team = _messages.StringField(2) bucket = _messages.StringField(1) domain = _messages.StringField(2) email = _messages.StringField(3) entity = _messages.StringField(4) entityId = _messages.StringField(5) etag = _messages.StringField(6) generation = _messages.IntegerField(7) id = _messages.StringField(8) kind = _messages.StringField(9, default='storage#objectAccessControl') object = _messages.StringField(10) projectTeam = _messages.MessageField('ProjectTeamValue', 11) role = _messages.StringField(12) selfLink = _messages.StringField(13) class ObjectAccessControls(_messages.Message): r"""An access-control list. Fields: items: The list of items. kind: The kind of item this is. For lists of object access control entries, this is always storage#objectAccessControls. """ items = _messages.MessageField('extra_types.JsonValue', 1, repeated=True) kind = _messages.StringField(2, default='storage#objectAccessControls') class Objects(_messages.Message): r"""A list of objects. Fields: items: The list of items. kind: The kind of item this is. For lists of objects, this is always storage#objects. nextPageToken: The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results. prefixes: The list of prefixes of objects matching-but-not-listed up to and including the requested delimiter. """ items = _messages.MessageField('Object', 1, repeated=True) kind = _messages.StringField(2, default='storage#objects') nextPageToken = _messages.StringField(3) prefixes = _messages.StringField(4, repeated=True) class Policy(_messages.Message): r"""A bucket/object IAM policy. Messages: BindingsValueListEntry: A BindingsValueListEntry object. Fields: bindings: An association between a role, which comes with a set of permissions, and members who may assume that role. etag: HTTP 1.1 Entity tag for the policy. kind: The kind of item this is. For policies, this is always storage#policy. This field is ignored on input. resourceId: The ID of the resource to which this policy belongs. Will be of the form buckets/bucket for buckets, and buckets/bucket/objects/object for objects. A specific generation may be specified by appending #generationNumber to the end of the object name, e.g. buckets/my-bucket/objects/data.txt#17. The current generation can be denoted with #0. This field is ignored on input. """ class BindingsValueListEntry(_messages.Message): r"""A BindingsValueListEntry object. Fields: members: A collection of identifiers for members who may assume the provided role. Recognized identifiers are as follows: - allUsers - A special identifier that represents anyone on the internet; with or without a Google account. - allAuthenticatedUsers - A special identifier that represents anyone who is authenticated with a Google account or a service account. - user:emailid - An email address that represents a specific account. For example, user:alice@gmail.com or user:joe@example.com. - serviceAccount:emailid - An email address that represents a service account. For example, serviceAccount:my- other-app@appspot.gserviceaccount.com . - group:emailid - An email address that represents a Google group. For example, group:admins@example.com. - domain:domain - A Google Apps domain name that represents all the users of that domain. For example, domain:google.com or domain:example.com. - projectOwner:projectid - Owners of the given project. For example, projectOwner:my-example- project - projectEditor:projectid - Editors of the given project. For example, projectEditor:my-example-project - projectViewer:projectid - Viewers of the given project. For example, projectViewer:my-example-project role: The role to which members belong. Two types of roles are supported: new IAM roles, which grant permissions that do not map directly to those provided by ACLs, and legacy IAM roles, which do map directly to ACL permissions. All roles are of the format roles/storage.specificRole. The new IAM roles are: - roles/storage.admin - Full control of Google Cloud Storage resources. - roles/storage.objectViewer - Read-Only access to Google Cloud Storage objects. - roles/storage.objectCreator - Access to create objects in Google Cloud Storage. - roles/storage.objectAdmin - Full control of Google Cloud Storage objects. The legacy IAM roles are: - roles/storage.legacyObjectReader - Read-only access to objects without listing. Equivalent to an ACL entry on an object with the READER role. - roles/storage.legacyObjectOwner - Read/write access to existing objects without listing. Equivalent to an ACL entry on an object with the OWNER role. - roles/storage.legacyBucketReader - Read access to buckets with object listing. Equivalent to an ACL entry on a bucket with the READER role. - roles/storage.legacyBucketWriter - Read access to buckets with object listing/creation/deletion. Equivalent to an ACL entry on a bucket with the WRITER role. - roles/storage.legacyBucketOwner - Read and write access to existing buckets with object listing/creation/deletion. Equivalent to an ACL entry on a bucket with the OWNER role. """ members = _messages.StringField(1, repeated=True) role = _messages.StringField(2) bindings = _messages.MessageField('BindingsValueListEntry', 1, repeated=True) etag = _messages.BytesField(2) kind = _messages.StringField(3, default='storage#policy') resourceId = _messages.StringField(4) class RewriteResponse(_messages.Message): r"""A rewrite response. Fields: done: true if the copy is finished; otherwise, false if the copy is in progress. This property is always present in the response. kind: The kind of item this is. objectSize: The total size of the object being copied in bytes. This property is always present in the response. resource: A resource containing the metadata for the copied-to object. This property is present in the response only when copying completes. rewriteToken: A token to use in subsequent requests to continue copying data. This token is present in the response only when there is more data to copy. totalBytesRewritten: The total bytes written so far, which can be used to provide a waiting user with a progress indicator. This property is always present in the response. """ done = _messages.BooleanField(1) kind = _messages.StringField(2, default='storage#rewriteResponse') objectSize = _messages.IntegerField(3, variant=_messages.Variant.UINT64) resource = _messages.MessageField('Object', 4) rewriteToken = _messages.StringField(5) totalBytesRewritten = _messages.IntegerField(6, variant=_messages.Variant.UINT64) class StandardQueryParameters(_messages.Message): r"""Query parameters accepted by all methods. Enums: AltValueValuesEnum: Data format for the response. Fields: alt: Data format for the response. fields: Selector specifying which fields to include in a partial response. key: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. oauth_token: OAuth 2.0 token for the current user. prettyPrint: Returns response with indentations and line breaks. quotaUser: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. trace: A tracing token of the form "token:<tokenid>" to include in api requests. userIp: IP address of the site where the request originates. Use this if you want to enforce per-user limits. """ class AltValueValuesEnum(_messages.Enum): r"""Data format for the response. Values: json: Responses with Content-Type of application/json """ json = 0 alt = _messages.EnumField('AltValueValuesEnum', 1, default='json') fields = _messages.StringField(2) key = _messages.StringField(3) oauth_token = _messages.StringField(4) prettyPrint = _messages.BooleanField(5, default=True) quotaUser = _messages.StringField(6) trace = _messages.StringField(7) userIp = _messages.StringField(8) class StorageBucketAccessControlsDeleteRequest(_messages.Message): r"""A StorageBucketAccessControlsDeleteRequest object. Fields: bucket: Name of a bucket. entity: The entity holding the permission. Can be user-userId, user- emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. """ bucket = _messages.StringField(1, required=True) entity = _messages.StringField(2, required=True) class StorageBucketAccessControlsDeleteResponse(_messages.Message): r"""An empty StorageBucketAccessControlsDelete response.""" class StorageBucketAccessControlsGetRequest(_messages.Message): r"""A StorageBucketAccessControlsGetRequest object. Fields: bucket: Name of a bucket. entity: The entity holding the permission. Can be user-userId, user- emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. """ bucket = _messages.StringField(1, required=True) entity = _messages.StringField(2, required=True) class StorageBucketAccessControlsListRequest(_messages.Message): r"""A StorageBucketAccessControlsListRequest object. Fields: bucket: Name of a bucket. """ bucket = _messages.StringField(1, required=True) class StorageBucketsDeleteRequest(_messages.Message): r"""A StorageBucketsDeleteRequest object. Fields: bucket: Name of a bucket. ifMetagenerationMatch: If set, only deletes the bucket if its metageneration matches this value. ifMetagenerationNotMatch: If set, only deletes the bucket if its metageneration does not match this value. """ bucket = _messages.StringField(1, required=True) ifMetagenerationMatch = _messages.IntegerField(2) ifMetagenerationNotMatch = _messages.IntegerField(3) class StorageBucketsDeleteResponse(_messages.Message): r"""An empty StorageBucketsDelete response.""" class StorageBucketsGetIamPolicyRequest(_messages.Message): r"""A StorageBucketsGetIamPolicyRequest object. Fields: bucket: Name of a bucket. """ bucket = _messages.StringField(1, required=True) class StorageBucketsGetRequest(_messages.Message): r"""A StorageBucketsGetRequest object. Enums: ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl. Fields: bucket: Name of a bucket. ifMetagenerationMatch: Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value. projection: Set of properties to return. Defaults to noAcl. """ class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl. Values: full: Include all properties. noAcl: Omit owner, acl and defaultObjectAcl properties. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) ifMetagenerationMatch = _messages.IntegerField(2) ifMetagenerationNotMatch = _messages.IntegerField(3) projection = _messages.EnumField('ProjectionValueValuesEnum', 4) class StorageBucketsInsertRequest(_messages.Message): r"""A StorageBucketsInsertRequest object. Enums: PredefinedAclValueValuesEnum: Apply a predefined set of access controls to this bucket. PredefinedDefaultObjectAclValueValuesEnum: Apply a predefined set of default object access controls to this bucket. ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full. Fields: bucket: A Bucket resource to be passed as the request body. predefinedAcl: Apply a predefined set of access controls to this bucket. predefinedDefaultObjectAcl: Apply a predefined set of default object access controls to this bucket. project: A valid API project identifier. projection: Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full. """ class PredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to this bucket. Values: authenticatedRead: Project team owners get OWNER access, and allAuthenticatedUsers get READER access. private: Project team owners get OWNER access. projectPrivate: Project team members get access according to their roles. publicRead: Project team owners get OWNER access, and allUsers get READER access. publicReadWrite: Project team owners get OWNER access, and allUsers get WRITER access. """ authenticatedRead = 0 private = 1 projectPrivate = 2 publicRead = 3 publicReadWrite = 4 class PredefinedDefaultObjectAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of default object access controls to this bucket. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full. Values: full: Include all properties. noAcl: Omit owner, acl and defaultObjectAcl properties. """ full = 0 noAcl = 1 bucket = _messages.MessageField('Bucket', 1) predefinedAcl = _messages.EnumField('PredefinedAclValueValuesEnum', 2) predefinedDefaultObjectAcl = _messages.EnumField('PredefinedDefaultObjectAclValueValuesEnum', 3) project = _messages.StringField(4, required=True) projection = _messages.EnumField('ProjectionValueValuesEnum', 5) class StorageBucketsListRequest(_messages.Message): r"""A StorageBucketsListRequest object. Enums: ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl. Fields: maxResults: Maximum number of buckets to return. pageToken: A previously-returned page token representing part of the larger set of results to view. prefix: Filter results to buckets whose names begin with this prefix. project: A valid API project identifier. projection: Set of properties to return. Defaults to noAcl. """ class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl. Values: full: Include all properties. noAcl: Omit owner, acl and defaultObjectAcl properties. """ full = 0 noAcl = 1 maxResults = _messages.IntegerField(1, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(2) prefix = _messages.StringField(3) project = _messages.StringField(4, required=True) projection = _messages.EnumField('ProjectionValueValuesEnum', 5) class StorageBucketsPatchRequest(_messages.Message): r"""A StorageBucketsPatchRequest object. Enums: PredefinedAclValueValuesEnum: Apply a predefined set of access controls to this bucket. PredefinedDefaultObjectAclValueValuesEnum: Apply a predefined set of default object access controls to this bucket. ProjectionValueValuesEnum: Set of properties to return. Defaults to full. Fields: bucket: Name of a bucket. bucketResource: A Bucket resource to be passed as the request body. ifMetagenerationMatch: Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value. predefinedAcl: Apply a predefined set of access controls to this bucket. predefinedDefaultObjectAcl: Apply a predefined set of default object access controls to this bucket. projection: Set of properties to return. Defaults to full. """ class PredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to this bucket. Values: authenticatedRead: Project team owners get OWNER access, and allAuthenticatedUsers get READER access. private: Project team owners get OWNER access. projectPrivate: Project team members get access according to their roles. publicRead: Project team owners get OWNER access, and allUsers get READER access. publicReadWrite: Project team owners get OWNER access, and allUsers get WRITER access. """ authenticatedRead = 0 private = 1 projectPrivate = 2 publicRead = 3 publicReadWrite = 4 class PredefinedDefaultObjectAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of default object access controls to this bucket. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to full. Values: full: Include all properties. noAcl: Omit owner, acl and defaultObjectAcl properties. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) bucketResource = _messages.MessageField('Bucket', 2) ifMetagenerationMatch = _messages.IntegerField(3) ifMetagenerationNotMatch = _messages.IntegerField(4) predefinedAcl = _messages.EnumField('PredefinedAclValueValuesEnum', 5) predefinedDefaultObjectAcl = _messages.EnumField('PredefinedDefaultObjectAclValueValuesEnum', 6) projection = _messages.EnumField('ProjectionValueValuesEnum', 7) class StorageBucketsSetIamPolicyRequest(_messages.Message): r"""A StorageBucketsSetIamPolicyRequest object. Fields: bucket: Name of a bucket. policy: A Policy resource to be passed as the request body. """ bucket = _messages.StringField(1, required=True) policy = _messages.MessageField('Policy', 2) class StorageBucketsTestIamPermissionsRequest(_messages.Message): r"""A StorageBucketsTestIamPermissionsRequest object. Fields: bucket: Name of a bucket. permissions: Permissions to test. """ bucket = _messages.StringField(1, required=True) permissions = _messages.StringField(2, required=True) class StorageBucketsUpdateRequest(_messages.Message): r"""A StorageBucketsUpdateRequest object. Enums: PredefinedAclValueValuesEnum: Apply a predefined set of access controls to this bucket. PredefinedDefaultObjectAclValueValuesEnum: Apply a predefined set of default object access controls to this bucket. ProjectionValueValuesEnum: Set of properties to return. Defaults to full. Fields: bucket: Name of a bucket. bucketResource: A Bucket resource to be passed as the request body. ifMetagenerationMatch: Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value. predefinedAcl: Apply a predefined set of access controls to this bucket. predefinedDefaultObjectAcl: Apply a predefined set of default object access controls to this bucket. projection: Set of properties to return. Defaults to full. """ class PredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to this bucket. Values: authenticatedRead: Project team owners get OWNER access, and allAuthenticatedUsers get READER access. private: Project team owners get OWNER access. projectPrivate: Project team members get access according to their roles. publicRead: Project team owners get OWNER access, and allUsers get READER access. publicReadWrite: Project team owners get OWNER access, and allUsers get WRITER access. """ authenticatedRead = 0 private = 1 projectPrivate = 2 publicRead = 3 publicReadWrite = 4 class PredefinedDefaultObjectAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of default object access controls to this bucket. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to full. Values: full: Include all properties. noAcl: Omit owner, acl and defaultObjectAcl properties. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) bucketResource = _messages.MessageField('Bucket', 2) ifMetagenerationMatch = _messages.IntegerField(3) ifMetagenerationNotMatch = _messages.IntegerField(4) predefinedAcl = _messages.EnumField('PredefinedAclValueValuesEnum', 5) predefinedDefaultObjectAcl = _messages.EnumField('PredefinedDefaultObjectAclValueValuesEnum', 6) projection = _messages.EnumField('ProjectionValueValuesEnum', 7) class StorageChannelsStopResponse(_messages.Message): r"""An empty StorageChannelsStop response.""" class StorageDefaultObjectAccessControlsDeleteRequest(_messages.Message): r"""A StorageDefaultObjectAccessControlsDeleteRequest object. Fields: bucket: Name of a bucket. entity: The entity holding the permission. Can be user-userId, user- emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. """ bucket = _messages.StringField(1, required=True) entity = _messages.StringField(2, required=True) class StorageDefaultObjectAccessControlsDeleteResponse(_messages.Message): r"""An empty StorageDefaultObjectAccessControlsDelete response.""" class StorageDefaultObjectAccessControlsGetRequest(_messages.Message): r"""A StorageDefaultObjectAccessControlsGetRequest object. Fields: bucket: Name of a bucket. entity: The entity holding the permission. Can be user-userId, user- emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. """ bucket = _messages.StringField(1, required=True) entity = _messages.StringField(2, required=True) class StorageDefaultObjectAccessControlsListRequest(_messages.Message): r"""A StorageDefaultObjectAccessControlsListRequest object. Fields: bucket: Name of a bucket. ifMetagenerationMatch: If present, only return default ACL listing if the bucket's current metageneration matches this value. ifMetagenerationNotMatch: If present, only return default ACL listing if the bucket's current metageneration does not match the given value. """ bucket = _messages.StringField(1, required=True) ifMetagenerationMatch = _messages.IntegerField(2) ifMetagenerationNotMatch = _messages.IntegerField(3) class StorageNotificationsDeleteRequest(_messages.Message): r"""A StorageNotificationsDeleteRequest object. Fields: notification: ID of the notification to delete. """ notification = _messages.StringField(1, required=True) class StorageNotificationsDeleteResponse(_messages.Message): r"""An empty StorageNotificationsDelete response.""" class StorageNotificationsGetRequest(_messages.Message): r"""A StorageNotificationsGetRequest object. Fields: notification: Notification ID """ notification = _messages.StringField(1, required=True) class StorageNotificationsListRequest(_messages.Message): r"""A StorageNotificationsListRequest object. Fields: bucket: Name of a GCS bucket. """ bucket = _messages.StringField(1, required=True) class StorageObjectAccessControlsDeleteRequest(_messages.Message): r"""A StorageObjectAccessControlsDeleteRequest object. Fields: bucket: Name of a bucket. entity: The entity holding the permission. Can be user-userId, user- emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. """ bucket = _messages.StringField(1, required=True) entity = _messages.StringField(2, required=True) generation = _messages.IntegerField(3) object = _messages.StringField(4, required=True) class StorageObjectAccessControlsDeleteResponse(_messages.Message): r"""An empty StorageObjectAccessControlsDelete response.""" class StorageObjectAccessControlsGetRequest(_messages.Message): r"""A StorageObjectAccessControlsGetRequest object. Fields: bucket: Name of a bucket. entity: The entity holding the permission. Can be user-userId, user- emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. """ bucket = _messages.StringField(1, required=True) entity = _messages.StringField(2, required=True) generation = _messages.IntegerField(3) object = _messages.StringField(4, required=True) class StorageObjectAccessControlsInsertRequest(_messages.Message): r"""A StorageObjectAccessControlsInsertRequest object. Fields: bucket: Name of a bucket. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. objectAccessControl: A ObjectAccessControl resource to be passed as the request body. """ bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) object = _messages.StringField(3, required=True) objectAccessControl = _messages.MessageField('ObjectAccessControl', 4) class StorageObjectAccessControlsListRequest(_messages.Message): r"""A StorageObjectAccessControlsListRequest object. Fields: bucket: Name of a bucket. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. """ bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) object = _messages.StringField(3, required=True) class StorageObjectAccessControlsPatchRequest(_messages.Message): r"""A StorageObjectAccessControlsPatchRequest object. Fields: bucket: Name of a bucket. entity: The entity holding the permission. Can be user-userId, user- emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. objectAccessControl: A ObjectAccessControl resource to be passed as the request body. """ bucket = _messages.StringField(1, required=True) entity = _messages.StringField(2, required=True) generation = _messages.IntegerField(3) object = _messages.StringField(4, required=True) objectAccessControl = _messages.MessageField('ObjectAccessControl', 5) class StorageObjectAccessControlsUpdateRequest(_messages.Message): r"""A StorageObjectAccessControlsUpdateRequest object. Fields: bucket: Name of a bucket. entity: The entity holding the permission. Can be user-userId, user- emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. objectAccessControl: A ObjectAccessControl resource to be passed as the request body. """ bucket = _messages.StringField(1, required=True) entity = _messages.StringField(2, required=True) generation = _messages.IntegerField(3) object = _messages.StringField(4, required=True) objectAccessControl = _messages.MessageField('ObjectAccessControl', 5) class StorageObjectsComposeRequest(_messages.Message): r"""A StorageObjectsComposeRequest object. Enums: DestinationPredefinedAclValueValuesEnum: Apply a predefined set of access controls to the destination object. Fields: composeRequest: A ComposeRequest resource to be passed as the request body. destinationBucket: Name of the bucket in which to store the new object. destinationObject: Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. destinationPredefinedAcl: Apply a predefined set of access controls to the destination object. ifGenerationMatch: Makes the operation conditional on whether the object's current generation matches the given value. ifMetagenerationMatch: Makes the operation conditional on whether the object's current metageneration matches the given value. """ class DestinationPredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to the destination object. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 composeRequest = _messages.MessageField('ComposeRequest', 1) destinationBucket = _messages.StringField(2, required=True) destinationObject = _messages.StringField(3, required=True) destinationPredefinedAcl = _messages.EnumField('DestinationPredefinedAclValueValuesEnum', 4) ifGenerationMatch = _messages.IntegerField(5) ifMetagenerationMatch = _messages.IntegerField(6) class StorageObjectsCopyRequest(_messages.Message): r"""A StorageObjectsCopyRequest object. Enums: DestinationPredefinedAclValueValuesEnum: Apply a predefined set of access controls to the destination object. ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. Fields: destinationBucket: Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. destinationObject: Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. destinationPredefinedAcl: Apply a predefined set of access controls to the destination object. ifGenerationMatch: Makes the operation conditional on whether the destination object's current generation matches the given value. ifGenerationNotMatch: Makes the operation conditional on whether the destination object's current generation does not match the given value. ifMetagenerationMatch: Makes the operation conditional on whether the destination object's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the operation conditional on whether the destination object's current metageneration does not match the given value. ifSourceGenerationMatch: Makes the operation conditional on whether the source object's generation matches the given value. ifSourceGenerationNotMatch: Makes the operation conditional on whether the source object's generation does not match the given value. ifSourceMetagenerationMatch: Makes the operation conditional on whether the source object's current metageneration matches the given value. ifSourceMetagenerationNotMatch: Makes the operation conditional on whether the source object's current metageneration does not match the given value. object: A Object resource to be passed as the request body. projection: Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. sourceBucket: Name of the bucket in which to find the source object. sourceGeneration: If present, selects a specific revision of the source object (as opposed to the latest version, the default). sourceObject: Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. """ class DestinationPredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to the destination object. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. Values: full: Include all properties. noAcl: Omit the owner, acl property. """ full = 0 noAcl = 1 destinationBucket = _messages.StringField(1, required=True) destinationObject = _messages.StringField(2, required=True) destinationPredefinedAcl = _messages.EnumField('DestinationPredefinedAclValueValuesEnum', 3) ifGenerationMatch = _messages.IntegerField(4) ifGenerationNotMatch = _messages.IntegerField(5) ifMetagenerationMatch = _messages.IntegerField(6) ifMetagenerationNotMatch = _messages.IntegerField(7) ifSourceGenerationMatch = _messages.IntegerField(8) ifSourceGenerationNotMatch = _messages.IntegerField(9) ifSourceMetagenerationMatch = _messages.IntegerField(10) ifSourceMetagenerationNotMatch = _messages.IntegerField(11) object = _messages.MessageField('Object', 12) projection = _messages.EnumField('ProjectionValueValuesEnum', 13) sourceBucket = _messages.StringField(14, required=True) sourceGeneration = _messages.IntegerField(15) sourceObject = _messages.StringField(16, required=True) class StorageObjectsDeleteRequest(_messages.Message): r"""A StorageObjectsDeleteRequest object. Fields: bucket: Name of the bucket in which the object resides. generation: If present, permanently deletes a specific revision of this object (as opposed to the latest version, the default). ifGenerationMatch: Makes the operation conditional on whether the object's current generation matches the given value. ifGenerationNotMatch: Makes the operation conditional on whether the object's current generation does not match the given value. ifMetagenerationMatch: Makes the operation conditional on whether the object's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the operation conditional on whether the object's current metageneration does not match the given value. object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. """ bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) ifGenerationMatch = _messages.IntegerField(3) ifGenerationNotMatch = _messages.IntegerField(4) ifMetagenerationMatch = _messages.IntegerField(5) ifMetagenerationNotMatch = _messages.IntegerField(6) object = _messages.StringField(7, required=True) class StorageObjectsDeleteResponse(_messages.Message): r"""An empty StorageObjectsDelete response.""" class StorageObjectsGetIamPolicyRequest(_messages.Message): r"""A StorageObjectsGetIamPolicyRequest object. Fields: bucket: Name of the bucket in which the object resides. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. """ bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) object = _messages.StringField(3, required=True) class StorageObjectsGetRequest(_messages.Message): r"""A StorageObjectsGetRequest object. Enums: ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl. Fields: bucket: Name of the bucket in which the object resides. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). ifGenerationMatch: Makes the operation conditional on whether the object's generation matches the given value. ifGenerationNotMatch: Makes the operation conditional on whether the object's generation does not match the given value. ifMetagenerationMatch: Makes the operation conditional on whether the object's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the operation conditional on whether the object's current metageneration does not match the given value. object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. projection: Set of properties to return. Defaults to noAcl. """ class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl. Values: full: Include all properties. noAcl: Omit the owner, acl property. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) ifGenerationMatch = _messages.IntegerField(3) ifGenerationNotMatch = _messages.IntegerField(4) ifMetagenerationMatch = _messages.IntegerField(5) ifMetagenerationNotMatch = _messages.IntegerField(6) object = _messages.StringField(7, required=True) projection = _messages.EnumField('ProjectionValueValuesEnum', 8) class StorageObjectsInsertRequest(_messages.Message): r"""A StorageObjectsInsertRequest object. Enums: PredefinedAclValueValuesEnum: Apply a predefined set of access controls to this object. ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. Fields: bucket: Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any. contentEncoding: If set, sets the contentEncoding property of the final object to this value. Setting this parameter is equivalent to setting the contentEncoding metadata property. This can be useful when uploading an object with uploadType=media to indicate the encoding of the content being uploaded. ifGenerationMatch: Makes the operation conditional on whether the object's current generation matches the given value. ifGenerationNotMatch: Makes the operation conditional on whether the object's current generation does not match the given value. ifMetagenerationMatch: Makes the operation conditional on whether the object's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the operation conditional on whether the object's current metageneration does not match the given value. name: Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. object: A Object resource to be passed as the request body. predefinedAcl: Apply a predefined set of access controls to this object. projection: Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. """ class PredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to this object. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. Values: full: Include all properties. noAcl: Omit the owner, acl property. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) contentEncoding = _messages.StringField(2) ifGenerationMatch = _messages.IntegerField(3) ifGenerationNotMatch = _messages.IntegerField(4) ifMetagenerationMatch = _messages.IntegerField(5) ifMetagenerationNotMatch = _messages.IntegerField(6) name = _messages.StringField(7) object = _messages.MessageField('Object', 8) predefinedAcl = _messages.EnumField('PredefinedAclValueValuesEnum', 9) projection = _messages.EnumField('ProjectionValueValuesEnum', 10) class StorageObjectsListRequest(_messages.Message): r"""A StorageObjectsListRequest object. Enums: ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl. Fields: bucket: Name of the bucket in which to look for objects. delimiter: Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted. maxResults: Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested. The default value of this parameter is 1,000 items. pageToken: A previously-returned page token representing part of the larger set of results to view. prefix: Filter results to objects whose names begin with this prefix. projection: Set of properties to return. Defaults to noAcl. versions: If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning. """ class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl. Values: full: Include all properties. noAcl: Omit the owner, acl property. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) delimiter = _messages.StringField(2) maxResults = _messages.IntegerField(3, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(4) prefix = _messages.StringField(5) projection = _messages.EnumField('ProjectionValueValuesEnum', 6) versions = _messages.BooleanField(7) class StorageObjectsPatchRequest(_messages.Message): r"""A StorageObjectsPatchRequest object. Enums: PredefinedAclValueValuesEnum: Apply a predefined set of access controls to this object. ProjectionValueValuesEnum: Set of properties to return. Defaults to full. Fields: bucket: Name of the bucket in which the object resides. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). ifGenerationMatch: Makes the operation conditional on whether the object's current generation matches the given value. ifGenerationNotMatch: Makes the operation conditional on whether the object's current generation does not match the given value. ifMetagenerationMatch: Makes the operation conditional on whether the object's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the operation conditional on whether the object's current metageneration does not match the given value. object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. objectResource: A Object resource to be passed as the request body. predefinedAcl: Apply a predefined set of access controls to this object. projection: Set of properties to return. Defaults to full. """ class PredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to this object. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to full. Values: full: Include all properties. noAcl: Omit the owner, acl property. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) ifGenerationMatch = _messages.IntegerField(3) ifGenerationNotMatch = _messages.IntegerField(4) ifMetagenerationMatch = _messages.IntegerField(5) ifMetagenerationNotMatch = _messages.IntegerField(6) object = _messages.StringField(7, required=True) objectResource = _messages.MessageField('Object', 8) predefinedAcl = _messages.EnumField('PredefinedAclValueValuesEnum', 9) projection = _messages.EnumField('ProjectionValueValuesEnum', 10) class StorageObjectsRewriteRequest(_messages.Message): r"""A StorageObjectsRewriteRequest object. Enums: DestinationPredefinedAclValueValuesEnum: Apply a predefined set of access controls to the destination object. ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. Fields: destinationBucket: Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any. destinationObject: Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. destinationPredefinedAcl: Apply a predefined set of access controls to the destination object. ifGenerationMatch: Makes the operation conditional on whether the destination object's current generation matches the given value. ifGenerationNotMatch: Makes the operation conditional on whether the destination object's current generation does not match the given value. ifMetagenerationMatch: Makes the operation conditional on whether the destination object's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the operation conditional on whether the destination object's current metageneration does not match the given value. ifSourceGenerationMatch: Makes the operation conditional on whether the source object's generation matches the given value. ifSourceGenerationNotMatch: Makes the operation conditional on whether the source object's generation does not match the given value. ifSourceMetagenerationMatch: Makes the operation conditional on whether the source object's current metageneration matches the given value. ifSourceMetagenerationNotMatch: Makes the operation conditional on whether the source object's current metageneration does not match the given value. maxBytesRewrittenPerCall: The maximum number of bytes that will be rewritten per rewrite request. Most callers shouldn't need to specify this parameter - it is primarily in place to support testing. If specified the value must be an integral multiple of 1 MiB (1048576). Also, this only applies to requests where the source and destination span locations and/or storage classes. Finally, this value must not change across rewrite calls else you'll get an error that the rewriteToken is invalid. object: A Object resource to be passed as the request body. projection: Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. rewriteToken: Include this field (from the previous rewrite response) on each rewrite request after the first one, until the rewrite response 'done' flag is true. Calls that provide a rewriteToken can omit all other request fields, but if included those fields must match the values provided in the first rewrite request. sourceBucket: Name of the bucket in which to find the source object. sourceGeneration: If present, selects a specific revision of the source object (as opposed to the latest version, the default). sourceObject: Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. """ class DestinationPredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to the destination object. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl, unless the object resource specifies the acl property, when it defaults to full. Values: full: Include all properties. noAcl: Omit the owner, acl property. """ full = 0 noAcl = 1 destinationBucket = _messages.StringField(1, required=True) destinationObject = _messages.StringField(2, required=True) destinationPredefinedAcl = _messages.EnumField('DestinationPredefinedAclValueValuesEnum', 3) ifGenerationMatch = _messages.IntegerField(4) ifGenerationNotMatch = _messages.IntegerField(5) ifMetagenerationMatch = _messages.IntegerField(6) ifMetagenerationNotMatch = _messages.IntegerField(7) ifSourceGenerationMatch = _messages.IntegerField(8) ifSourceGenerationNotMatch = _messages.IntegerField(9) ifSourceMetagenerationMatch = _messages.IntegerField(10) ifSourceMetagenerationNotMatch = _messages.IntegerField(11) maxBytesRewrittenPerCall = _messages.IntegerField(12) object = _messages.MessageField('Object', 13) projection = _messages.EnumField('ProjectionValueValuesEnum', 14) rewriteToken = _messages.StringField(15) sourceBucket = _messages.StringField(16, required=True) sourceGeneration = _messages.IntegerField(17) sourceObject = _messages.StringField(18, required=True) class StorageObjectsSetIamPolicyRequest(_messages.Message): r"""A StorageObjectsSetIamPolicyRequest object. Fields: bucket: Name of the bucket in which the object resides. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. policy: A Policy resource to be passed as the request body. """ bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) object = _messages.StringField(3, required=True) policy = _messages.MessageField('Policy', 4) class StorageObjectsTestIamPermissionsRequest(_messages.Message): r"""A StorageObjectsTestIamPermissionsRequest object. Fields: bucket: Name of the bucket in which the object resides. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. permissions: Permissions to test. """ bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) object = _messages.StringField(3, required=True) permissions = _messages.StringField(4, required=True) class StorageObjectsUpdateRequest(_messages.Message): r"""A StorageObjectsUpdateRequest object. Enums: PredefinedAclValueValuesEnum: Apply a predefined set of access controls to this object. ProjectionValueValuesEnum: Set of properties to return. Defaults to full. Fields: bucket: Name of the bucket in which the object resides. generation: If present, selects a specific revision of this object (as opposed to the latest version, the default). ifGenerationMatch: Makes the operation conditional on whether the object's current generation matches the given value. ifGenerationNotMatch: Makes the operation conditional on whether the object's current generation does not match the given value. ifMetagenerationMatch: Makes the operation conditional on whether the object's current metageneration matches the given value. ifMetagenerationNotMatch: Makes the operation conditional on whether the object's current metageneration does not match the given value. object: Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts. objectResource: A Object resource to be passed as the request body. predefinedAcl: Apply a predefined set of access controls to this object. projection: Set of properties to return. Defaults to full. """ class PredefinedAclValueValuesEnum(_messages.Enum): r"""Apply a predefined set of access controls to this object. Values: authenticatedRead: Object owner gets OWNER access, and allAuthenticatedUsers get READER access. bucketOwnerFullControl: Object owner gets OWNER access, and project team owners get OWNER access. bucketOwnerRead: Object owner gets OWNER access, and project team owners get READER access. private: Object owner gets OWNER access. projectPrivate: Object owner gets OWNER access, and project team members get access according to their roles. publicRead: Object owner gets OWNER access, and allUsers get READER access. """ authenticatedRead = 0 bucketOwnerFullControl = 1 bucketOwnerRead = 2 private = 3 projectPrivate = 4 publicRead = 5 class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to full. Values: full: Include all properties. noAcl: Omit the owner, acl property. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) generation = _messages.IntegerField(2) ifGenerationMatch = _messages.IntegerField(3) ifGenerationNotMatch = _messages.IntegerField(4) ifMetagenerationMatch = _messages.IntegerField(5) ifMetagenerationNotMatch = _messages.IntegerField(6) object = _messages.StringField(7, required=True) objectResource = _messages.MessageField('Object', 8) predefinedAcl = _messages.EnumField('PredefinedAclValueValuesEnum', 9) projection = _messages.EnumField('ProjectionValueValuesEnum', 10) class StorageObjectsWatchAllRequest(_messages.Message): r"""A StorageObjectsWatchAllRequest object. Enums: ProjectionValueValuesEnum: Set of properties to return. Defaults to noAcl. Fields: bucket: Name of the bucket in which to look for objects. channel: A Channel resource to be passed as the request body. delimiter: Returns results in a directory-like mode. items will contain only objects whose names, aside from the prefix, do not contain delimiter. Objects whose names, aside from the prefix, contain delimiter will have their name, truncated after the delimiter, returned in prefixes. Duplicate prefixes are omitted. maxResults: Maximum number of items plus prefixes to return. As duplicate prefixes are omitted, fewer total results may be returned than requested. The default value of this parameter is 1,000 items. pageToken: A previously-returned page token representing part of the larger set of results to view. prefix: Filter results to objects whose names begin with this prefix. projection: Set of properties to return. Defaults to noAcl. versions: If true, lists all versions of an object as distinct results. The default is false. For more information, see Object Versioning. """ class ProjectionValueValuesEnum(_messages.Enum): r"""Set of properties to return. Defaults to noAcl. Values: full: Include all properties. noAcl: Omit the owner, acl property. """ full = 0 noAcl = 1 bucket = _messages.StringField(1, required=True) channel = _messages.MessageField('Channel', 2) delimiter = _messages.StringField(3) maxResults = _messages.IntegerField(4, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(5) prefix = _messages.StringField(6) projection = _messages.EnumField('ProjectionValueValuesEnum', 7) versions = _messages.BooleanField(8) class TestIamPermissionsResponse(_messages.Message): r"""A storage.(buckets|objects).testIamPermissions response. Fields: kind: The kind of item this is. permissions: The permissions held by the caller. Permissions are always of the format storage.resource.capability, where resource is one of buckets or objects. The supported permissions are as follows: - storage.buckets.delete - Delete bucket. - storage.buckets.get - Read bucket metadata. - storage.buckets.getIamPolicy - Read bucket IAM policy. - storage.buckets.create - Create bucket. - storage.buckets.list - List buckets. - storage.buckets.setIamPolicy - Update bucket IAM policy. - storage.buckets.update - Update bucket metadata. - storage.objects.delete - Delete object. - storage.objects.get - Read object data and metadata. - storage.objects.getIamPolicy - Read object IAM policy. - storage.objects.create - Create object. - storage.objects.list - List objects. - storage.objects.setIamPolicy - Update object IAM policy. - storage.objects.update - Update object metadata. """ kind = _messages.StringField(1, default='storage#testIamPermissionsResponse') permissions = _messages.StringField(2, repeated=True) samples/storage_sample/storage_v1/__init__.py 0000644 00000000207 15025176453 0015407 0 ustar 00 """Package marker file.""" from __future__ import absolute_import import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) samples/storage_sample/uploads_test.py 0000644 00000014573 15025176453 0014317 0 ustar 00 # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Integration tests for uploading and downloading to GCS. These tests exercise most of the corner cases for upload/download of files in apitools, via GCS. There are no performance tests here yet. """ import json import os import random import string import unittest import six from apitools.base.py import transfer import storage _CLIENT = None def _GetClient(): global _CLIENT # pylint: disable=global-statement if _CLIENT is None: _CLIENT = storage.StorageV1() return _CLIENT class UploadsTest(unittest.TestCase): _DEFAULT_BUCKET = 'apitools' _TESTDATA_PREFIX = 'uploads' def setUp(self): self.__client = _GetClient() self.__files = [] self.__content = '' self.__buffer = None self.__upload = None def tearDown(self): self.__DeleteFiles() def __ResetUpload(self, size, auto_transfer=True): self.__content = ''.join( random.choice(string.ascii_letters) for _ in range(size)) self.__buffer = six.StringIO(self.__content) self.__upload = storage.Upload.FromStream( self.__buffer, 'text/plain', auto_transfer=auto_transfer) def __DeleteFiles(self): for filename in self.__files: self.__DeleteFile(filename) def __DeleteFile(self, filename): object_name = os.path.join(self._TESTDATA_PREFIX, filename) req = storage.StorageObjectsDeleteRequest( bucket=self._DEFAULT_BUCKET, object=object_name) self.__client.objects.Delete(req) def __InsertRequest(self, filename): object_name = os.path.join(self._TESTDATA_PREFIX, filename) return storage.StorageObjectsInsertRequest( name=object_name, bucket=self._DEFAULT_BUCKET) def __GetRequest(self, filename): object_name = os.path.join(self._TESTDATA_PREFIX, filename) return storage.StorageObjectsGetRequest( object=object_name, bucket=self._DEFAULT_BUCKET) def __InsertFile(self, filename, request=None): if request is None: request = self.__InsertRequest(filename) response = self.__client.objects.Insert(request, upload=self.__upload) self.assertIsNotNone(response) self.__files.append(filename) return response def testZeroBytes(self): filename = 'zero_byte_file' self.__ResetUpload(0) response = self.__InsertFile(filename) self.assertEqual(0, response.size) def testSimpleUpload(self): filename = 'fifteen_byte_file' self.__ResetUpload(15) response = self.__InsertFile(filename) self.assertEqual(15, response.size) def testMultipartUpload(self): filename = 'fifteen_byte_file' self.__ResetUpload(15) request = self.__InsertRequest(filename) request.object = storage.Object(contentLanguage='en') response = self.__InsertFile(filename, request=request) self.assertEqual(15, response.size) self.assertEqual('en', response.contentLanguage) def testAutoUpload(self): filename = 'ten_meg_file' size = 10 << 20 self.__ResetUpload(size) request = self.__InsertRequest(filename) response = self.__InsertFile(filename, request=request) self.assertEqual(size, response.size) def testStreamMedia(self): filename = 'ten_meg_file' size = 10 << 20 self.__ResetUpload(size, auto_transfer=False) self.__upload.strategy = 'resumable' self.__upload.total_size = size request = self.__InsertRequest(filename) initial_response = self.__client.objects.Insert( request, upload=self.__upload) self.assertIsNotNone(initial_response) self.assertEqual(0, self.__buffer.tell()) self.__upload.StreamMedia() self.assertEqual(size, self.__buffer.tell()) def testBreakAndResumeUpload(self): filename = ('ten_meg_file_' + ''.join(random.sample(string.ascii_letters, 5))) size = 10 << 20 self.__ResetUpload(size, auto_transfer=False) self.__upload.strategy = 'resumable' self.__upload.total_size = size # Start the upload request = self.__InsertRequest(filename) initial_response = self.__client.objects.Insert( request, upload=self.__upload) self.assertIsNotNone(initial_response) self.assertEqual(0, self.__buffer.tell()) # Pretend the process died, and resume with a new attempt at the # same upload. upload_data = json.dumps(self.__upload.serialization_data) second_upload_attempt = transfer.Upload.FromData( self.__buffer, upload_data, self.__upload.http) second_upload_attempt._Upload__SendChunk(0) self.assertEqual(second_upload_attempt.chunksize, self.__buffer.tell()) # Simulate a third try, and stream from there. final_upload_attempt = transfer.Upload.FromData( self.__buffer, upload_data, self.__upload.http) final_upload_attempt.StreamInChunks() self.assertEqual(size, self.__buffer.tell()) # Verify the upload object_info = self.__client.objects.Get(self.__GetRequest(filename)) self.assertEqual(size, object_info.size) # Confirm that a new attempt successfully does nothing. completed_upload_attempt = transfer.Upload.FromData( self.__buffer, upload_data, self.__upload.http) self.assertTrue(completed_upload_attempt.complete) completed_upload_attempt.StreamInChunks() # Verify the upload didn't pick up extra bytes. object_info = self.__client.objects.Get(self.__GetRequest(filename)) self.assertEqual(size, object_info.size) # TODO(craigcitro): Add tests for callbacks (especially around # finish callback). if __name__ == '__main__': unittest.main() samples/storage_sample/testdata/fifteen_byte_file 0000644 00000000017 15025176453 0016421 0 ustar 00 a ab abc abcde samples/storage_sample/testdata/filename_with_spaces 0000644 00000000017 15025176453 0017130 0 ustar 00 a ab abc abcde samples/storage_sample/generate_clients.sh 0000644 00000001251 15025176453 0015073 0 ustar 00 #!/bin/bash # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. gen_client --discovery_url=storage.v1 --overwrite --outdir=storage --root_package=. client samples/fusiontables_sample/fusiontables_v1.json 0000644 00000144572 15025176453 0016273 0 ustar 00 { "kind": "discovery#restDescription", "etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/-xDlQ3Z80n_rfxYaz7dDf-mP00c\"", "discoveryVersion": "v1", "id": "fusiontables:v1", "name": "fusiontables", "version": "v1", "revision": "20160526", "title": "Fusion Tables API", "description": "API for working with Fusion Tables data.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "http://www.google.com/images/icons/product/search-16.gif", "x32": "http://www.google.com/images/icons/product/search-32.gif" }, "documentationLink": "https://developers.google.com/fusiontables", "protocol": "rest", "baseUrl": "https://www.googleapis.com/fusiontables/v1/", "basePath": "/fusiontables/v1/", "rootUrl": "https://www.googleapis.com/", "servicePath": "fusiontables/v1/", "batchPath": "batch", "parameters": { "alt": { "type": "string", "description": "Data format for the response.", "default": "json", "enum": [ "csv", "json" ], "enumDescriptions": [ "Responses with Content-Type of text/csv", "Responses with Content-Type of application/json" ], "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", "location": "query" }, "userIp": { "type": "string", "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/fusiontables": { "description": "Manage your Fusion Tables" }, "https://www.googleapis.com/auth/fusiontables.readonly": { "description": "View your Fusion Tables" } } } }, "schemas": { "Bucket": { "id": "Bucket", "type": "object", "description": "Specifies the minimum and maximum values, the color, opacity, icon and weight of a bucket within a StyleSetting.", "properties": { "color": { "type": "string", "description": "Color of line or the interior of a polygon in #RRGGBB format." }, "icon": { "type": "string", "description": "Icon name used for a point." }, "max": { "type": "number", "description": "Maximum value in the selected column for a row to be styled according to the bucket color, opacity, icon, or weight.", "format": "double" }, "min": { "type": "number", "description": "Minimum value in the selected column for a row to be styled according to the bucket color, opacity, icon, or weight.", "format": "double" }, "opacity": { "type": "number", "description": "Opacity of the color: 0.0 (transparent) to 1.0 (opaque).", "format": "double" }, "weight": { "type": "integer", "description": "Width of a line (in pixels).", "format": "int32" } } }, "Column": { "id": "Column", "type": "object", "description": "Specifies the id, name and type of a column in a table.", "properties": { "baseColumn": { "type": "object", "description": "Optional identifier of the base column. If present, this column is derived from the specified base column.", "properties": { "columnId": { "type": "integer", "description": "The id of the column in the base table from which this column is derived.", "format": "int32" }, "tableIndex": { "type": "integer", "description": "Offset to the entry in the list of base tables in the table definition.", "format": "int32" } } }, "columnId": { "type": "integer", "description": "Identifier for the column.", "format": "int32" }, "description": { "type": "string", "description": "Optional column description." }, "graph_predicate": { "type": "string", "description": "Optional column predicate. Used to map table to graph data model (subject,predicate,object) See http://www.w3.org/TR/2014/REC-rdf11-concepts-20140225/#data-model" }, "kind": { "type": "string", "description": "Type name: a template for an individual column.", "default": "fusiontables#column" }, "name": { "type": "string", "description": "Required name of the column.", "annotations": { "required": [ "fusiontables.column.insert" ] } }, "type": { "type": "string", "description": "Required type of the column.", "annotations": { "required": [ "fusiontables.column.insert" ] } } } }, "ColumnList": { "id": "ColumnList", "type": "object", "description": "Represents a list of columns in a table.", "properties": { "items": { "type": "array", "description": "List of all requested columns.", "items": { "$ref": "Column" } }, "kind": { "type": "string", "description": "Type name: a list of all columns.", "default": "fusiontables#columnList" }, "nextPageToken": { "type": "string", "description": "Token used to access the next page of this result. No token is displayed if there are no more pages left." }, "totalItems": { "type": "integer", "description": "Total number of columns for the table.", "format": "int32" } } }, "Geometry": { "id": "Geometry", "type": "object", "description": "Represents a Geometry object.", "properties": { "geometries": { "type": "array", "description": "The list of geometries in this geometry collection.", "items": { "type": "any" } }, "geometry": { "type": "any" }, "type": { "type": "string", "description": "Type: A collection of geometries.", "default": "GeometryCollection" } } }, "Import": { "id": "Import", "type": "object", "description": "Represents an import request.", "properties": { "kind": { "type": "string", "description": "Type name: a template for an import request.", "default": "fusiontables#import" }, "numRowsReceived": { "type": "string", "description": "The number of rows received from the import request.", "format": "int64" } } }, "Line": { "id": "Line", "type": "object", "description": "Represents a line geometry.", "properties": { "coordinates": { "type": "array", "description": "The coordinates that define the line.", "items": { "type": "array", "items": { "type": "number", "format": "double" } } }, "type": { "type": "string", "description": "Type: A line geometry.", "default": "LineString" } } }, "LineStyle": { "id": "LineStyle", "type": "object", "description": "Represents a LineStyle within a StyleSetting", "properties": { "strokeColor": { "type": "string", "description": "Color of the line in #RRGGBB format." }, "strokeColorStyler": { "$ref": "StyleFunction", "description": "Column-value, gradient or buckets styler that is used to determine the line color and opacity." }, "strokeOpacity": { "type": "number", "description": "Opacity of the line : 0.0 (transparent) to 1.0 (opaque).", "format": "double" }, "strokeWeight": { "type": "integer", "description": "Width of the line in pixels.", "format": "int32" }, "strokeWeightStyler": { "$ref": "StyleFunction", "description": "Column-value or bucket styler that is used to determine the width of the line." } } }, "Point": { "id": "Point", "type": "object", "description": "Represents a point object.", "properties": { "coordinates": { "type": "array", "description": "The coordinates that define the point.", "items": { "type": "number", "format": "double" } }, "type": { "type": "string", "description": "Point: A point geometry.", "default": "Point" } } }, "PointStyle": { "id": "PointStyle", "type": "object", "description": "Represents a PointStyle within a StyleSetting", "properties": { "iconName": { "type": "string", "description": "Name of the icon. Use values defined in http://www.google.com/fusiontables/DataSource?dsrcid=308519" }, "iconStyler": { "$ref": "StyleFunction", "description": "Column or a bucket value from which the icon name is to be determined." } } }, "Polygon": { "id": "Polygon", "type": "object", "description": "Represents a polygon object.", "properties": { "coordinates": { "type": "array", "description": "The coordinates that define the polygon.", "items": { "type": "array", "items": { "type": "array", "items": { "type": "number", "format": "double" } } } }, "type": { "type": "string", "description": "Type: A polygon geometry.", "default": "Polygon" } } }, "PolygonStyle": { "id": "PolygonStyle", "type": "object", "description": "Represents a PolygonStyle within a StyleSetting", "properties": { "fillColor": { "type": "string", "description": "Color of the interior of the polygon in #RRGGBB format." }, "fillColorStyler": { "$ref": "StyleFunction", "description": "Column-value, gradient, or bucket styler that is used to determine the interior color and opacity of the polygon." }, "fillOpacity": { "type": "number", "description": "Opacity of the interior of the polygon: 0.0 (transparent) to 1.0 (opaque).", "format": "double" }, "strokeColor": { "type": "string", "description": "Color of the polygon border in #RRGGBB format." }, "strokeColorStyler": { "$ref": "StyleFunction", "description": "Column-value, gradient or buckets styler that is used to determine the border color and opacity." }, "strokeOpacity": { "type": "number", "description": "Opacity of the polygon border: 0.0 (transparent) to 1.0 (opaque).", "format": "double" }, "strokeWeight": { "type": "integer", "description": "Width of the polyon border in pixels.", "format": "int32" }, "strokeWeightStyler": { "$ref": "StyleFunction", "description": "Column-value or bucket styler that is used to determine the width of the polygon border." } } }, "Sqlresponse": { "id": "Sqlresponse", "type": "object", "description": "Represents a response to an sql statement.", "properties": { "columns": { "type": "array", "description": "Columns in the table.", "items": { "type": "string" } }, "kind": { "type": "string", "description": "Type name: a template for an individual table.", "default": "fusiontables#sqlresponse" }, "rows": { "type": "array", "description": "The rows in the table. For each cell we print out whatever cell value (e.g., numeric, string) exists. Thus it is important that each cell contains only one value.", "items": { "type": "array", "items": { "type": "any" } } } } }, "StyleFunction": { "id": "StyleFunction", "type": "object", "description": "Represents a StyleFunction within a StyleSetting", "properties": { "buckets": { "type": "array", "description": "Bucket function that assigns a style based on the range a column value falls into.", "items": { "$ref": "Bucket" } }, "columnName": { "type": "string", "description": "Name of the column whose value is used in the style.", "annotations": { "required": [ "fusiontables.style.insert" ] } }, "gradient": { "type": "object", "description": "Gradient function that interpolates a range of colors based on column value.", "properties": { "colors": { "type": "array", "description": "Array with two or more colors.", "items": { "type": "object", "properties": { "color": { "type": "string", "description": "Color in #RRGGBB format." }, "opacity": { "type": "number", "description": "Opacity of the color: 0.0 (transparent) to 1.0 (opaque).", "format": "double" } } } }, "max": { "type": "number", "description": "Higher-end of the interpolation range: rows with this value will be assigned to colors[n-1].", "format": "double" }, "min": { "type": "number", "description": "Lower-end of the interpolation range: rows with this value will be assigned to colors[0].", "format": "double" } } }, "kind": { "type": "string", "description": "Stylers can be one of three kinds: \"fusiontables#fromColumn\" if the column value is to be used as is, i.e., the column values can have colors in #RRGGBBAA format or integer line widths or icon names; \"fusiontables#gradient\" if the styling of the row is to be based on applying the gradient function on the column value; or \"fusiontables#buckets\" if the styling is to based on the bucket into which the the column value falls." } } }, "StyleSetting": { "id": "StyleSetting", "type": "object", "description": "Represents a complete StyleSettings object. The primary key is a combination of the tableId and a styleId.", "properties": { "kind": { "type": "string", "description": "Type name: an individual style setting. A StyleSetting contains the style defintions for points, lines, and polygons in a table. Since a table can have any one or all of them, a style definition can have point, line and polygon style definitions.", "default": "fusiontables#styleSetting" }, "markerOptions": { "$ref": "PointStyle", "description": "Style definition for points in the table." }, "name": { "type": "string", "description": "Optional name for the style setting." }, "polygonOptions": { "$ref": "PolygonStyle", "description": "Style definition for polygons in the table." }, "polylineOptions": { "$ref": "LineStyle", "description": "Style definition for lines in the table." }, "styleId": { "type": "integer", "description": "Identifier for the style setting (unique only within tables).", "format": "int32" }, "tableId": { "type": "string", "description": "Identifier for the table." } } }, "StyleSettingList": { "id": "StyleSettingList", "type": "object", "description": "Represents a list of styles for a given table.", "properties": { "items": { "type": "array", "description": "All requested style settings.", "items": { "$ref": "StyleSetting" } }, "kind": { "type": "string", "description": "Type name: in this case, a list of style settings.", "default": "fusiontables#styleSettingList" }, "nextPageToken": { "type": "string", "description": "Token used to access the next page of this result. No token is displayed if there are no more pages left." }, "totalItems": { "type": "integer", "description": "Total number of styles for the table.", "format": "int32" } } }, "Table": { "id": "Table", "type": "object", "description": "Represents a table. Specifies the name, whether it is exportable, description, attribution, and attribution link.", "properties": { "attribution": { "type": "string", "description": "Optional attribution assigned to the table." }, "attributionLink": { "type": "string", "description": "Optional link for attribution." }, "baseTableIds": { "type": "array", "description": "Optional base table identifier if this table is a view or merged table.", "items": { "type": "string" } }, "columns": { "type": "array", "description": "Columns in the table.", "items": { "$ref": "Column" }, "annotations": { "required": [ "fusiontables.table.insert", "fusiontables.table.update" ] } }, "description": { "type": "string", "description": "Optional description assigned to the table." }, "isExportable": { "type": "boolean", "description": "Variable for whether table is exportable.", "annotations": { "required": [ "fusiontables.table.insert", "fusiontables.table.update" ] } }, "kind": { "type": "string", "description": "Type name: a template for an individual table.", "default": "fusiontables#table" }, "name": { "type": "string", "description": "Name assigned to a table.", "annotations": { "required": [ "fusiontables.table.insert", "fusiontables.table.update" ] } }, "sql": { "type": "string", "description": "Optional sql that encodes the table definition for derived tables." }, "tableId": { "type": "string", "description": "Encrypted unique alphanumeric identifier for the table." } } }, "TableList": { "id": "TableList", "type": "object", "description": "Represents a list of tables.", "properties": { "items": { "type": "array", "description": "List of all requested tables.", "items": { "$ref": "Table" } }, "kind": { "type": "string", "description": "Type name: a list of all tables.", "default": "fusiontables#tableList" }, "nextPageToken": { "type": "string", "description": "Token used to access the next page of this result. No token is displayed if there are no more pages left." } } }, "Task": { "id": "Task", "type": "object", "description": "Specifies the identifier, name, and type of a task in a table.", "properties": { "kind": { "type": "string", "description": "Type of the resource. This is always \"fusiontables#task\".", "default": "fusiontables#task" }, "progress": { "type": "string", "description": "An indication of task progress." }, "started": { "type": "boolean", "description": "false while the table is busy with some other task. true if this background task is currently running." }, "taskId": { "type": "string", "description": "Identifier for the task.", "format": "int64" }, "type": { "type": "string", "description": "Type of background task. One of DELETE_ROWS Deletes one or more rows from the table. ADD_ROWS \"Adds one or more rows to a table. Includes importing data into a new table and importing more rows into an existing table. ADD_COLUMN Adds a new column to the table. CHANGE_TYPE Changes the type of a column." } } }, "TaskList": { "id": "TaskList", "type": "object", "description": "Represents a list of tasks for a table.", "properties": { "items": { "type": "array", "description": "List of all requested tasks.", "items": { "$ref": "Task" } }, "kind": { "type": "string", "description": "Type of the resource. This is always \"fusiontables#taskList\".", "default": "fusiontables#taskList" }, "nextPageToken": { "type": "string", "description": "Token used to access the next page of this result. No token is displayed if there are no more pages left." }, "totalItems": { "type": "integer", "description": "Total number of tasks for the table.", "format": "int32" } } }, "Template": { "id": "Template", "type": "object", "description": "Represents the contents of InfoWindow templates.", "properties": { "automaticColumnNames": { "type": "array", "description": "List of columns from which the template is to be automatically constructed. Only one of body or automaticColumns can be specified.", "items": { "type": "string" } }, "body": { "type": "string", "description": "Body of the template. It contains HTML with {column_name} to insert values from a particular column. The body is sanitized to remove certain tags, e.g., script. Only one of body or automaticColumns can be specified." }, "kind": { "type": "string", "description": "Type name: a template for the info window contents. The template can either include an HTML body or a list of columns from which the template is computed automatically.", "default": "fusiontables#template" }, "name": { "type": "string", "description": "Optional name assigned to a template." }, "tableId": { "type": "string", "description": "Identifier for the table for which the template is defined." }, "templateId": { "type": "integer", "description": "Identifier for the template, unique within the context of a particular table.", "format": "int32" } } }, "TemplateList": { "id": "TemplateList", "type": "object", "description": "Represents a list of templates for a given table.", "properties": { "items": { "type": "array", "description": "List of all requested templates.", "items": { "$ref": "Template" } }, "kind": { "type": "string", "description": "Type name: a list of all templates.", "default": "fusiontables#templateList" }, "nextPageToken": { "type": "string", "description": "Token used to access the next page of this result. No token is displayed if there are no more pages left." }, "totalItems": { "type": "integer", "description": "Total number of templates for the table.", "format": "int32" } } } }, "resources": { "column": { "methods": { "delete": { "id": "fusiontables.column.delete", "path": "tables/{tableId}/columns/{columnId}", "httpMethod": "DELETE", "description": "Deletes the column.", "parameters": { "columnId": { "type": "string", "description": "Name or identifier for the column being deleted.", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table from which the column is being deleted.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "columnId" ], "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "get": { "id": "fusiontables.column.get", "path": "tables/{tableId}/columns/{columnId}", "httpMethod": "GET", "description": "Retrieves a specific column by its id.", "parameters": { "columnId": { "type": "string", "description": "Name or identifier for the column that is being requested.", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table to which the column belongs.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "columnId" ], "response": { "$ref": "Column" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "insert": { "id": "fusiontables.column.insert", "path": "tables/{tableId}/columns", "httpMethod": "POST", "description": "Adds a new column to the table.", "parameters": { "tableId": { "type": "string", "description": "Table for which a new column is being added.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "request": { "$ref": "Column" }, "response": { "$ref": "Column" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "list": { "id": "fusiontables.column.list", "path": "tables/{tableId}/columns", "httpMethod": "GET", "description": "Retrieves a list of columns.", "parameters": { "maxResults": { "type": "integer", "description": "Maximum number of columns to return. Optional. Default is 5.", "format": "uint32", "minimum": "0", "location": "query" }, "pageToken": { "type": "string", "description": "Continuation token specifying which result page to return. Optional.", "location": "query" }, "tableId": { "type": "string", "description": "Table whose columns are being listed.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "response": { "$ref": "ColumnList" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "patch": { "id": "fusiontables.column.patch", "path": "tables/{tableId}/columns/{columnId}", "httpMethod": "PATCH", "description": "Updates the name or type of an existing column. This method supports patch semantics.", "parameters": { "columnId": { "type": "string", "description": "Name or identifier for the column that is being updated.", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table for which the column is being updated.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "columnId" ], "request": { "$ref": "Column" }, "response": { "$ref": "Column" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "update": { "id": "fusiontables.column.update", "path": "tables/{tableId}/columns/{columnId}", "httpMethod": "PUT", "description": "Updates the name or type of an existing column.", "parameters": { "columnId": { "type": "string", "description": "Name or identifier for the column that is being updated.", "required": true, "location": "path" }, "tableId": { "type": "string", "description": "Table for which the column is being updated.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "columnId" ], "request": { "$ref": "Column" }, "response": { "$ref": "Column" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] } } }, "query": { "methods": { "sql": { "id": "fusiontables.query.sql", "path": "query", "httpMethod": "POST", "description": "Executes an SQL SELECT/INSERT/UPDATE/DELETE/SHOW/DESCRIBE/CREATE statement.", "parameters": { "hdrs": { "type": "boolean", "description": "Should column names be included (in the first row)?. Default is true.", "location": "query" }, "sql": { "type": "string", "description": "An SQL SELECT/SHOW/DESCRIBE/INSERT/UPDATE/DELETE/CREATE statement.", "required": true, "location": "query" }, "typed": { "type": "boolean", "description": "Should typed values be returned in the (JSON) response -- numbers for numeric values and parsed geometries for KML values? Default is true.", "location": "query" } }, "parameterOrder": [ "sql" ], "response": { "$ref": "Sqlresponse" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ], "supportsMediaDownload": true, "useMediaDownloadService": true }, "sqlGet": { "id": "fusiontables.query.sqlGet", "path": "query", "httpMethod": "GET", "description": "Executes an SQL SELECT/SHOW/DESCRIBE statement.", "parameters": { "hdrs": { "type": "boolean", "description": "Should column names be included (in the first row)?. Default is true.", "location": "query" }, "sql": { "type": "string", "description": "An SQL SELECT/SHOW/DESCRIBE statement.", "required": true, "location": "query" }, "typed": { "type": "boolean", "description": "Should typed values be returned in the (JSON) response -- numbers for numeric values and parsed geometries for KML values? Default is true.", "location": "query" } }, "parameterOrder": [ "sql" ], "response": { "$ref": "Sqlresponse" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ], "supportsMediaDownload": true, "useMediaDownloadService": true } } }, "style": { "methods": { "delete": { "id": "fusiontables.style.delete", "path": "tables/{tableId}/styles/{styleId}", "httpMethod": "DELETE", "description": "Deletes a style.", "parameters": { "styleId": { "type": "integer", "description": "Identifier (within a table) for the style being deleted", "required": true, "format": "int32", "location": "path" }, "tableId": { "type": "string", "description": "Table from which the style is being deleted", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "styleId" ], "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "get": { "id": "fusiontables.style.get", "path": "tables/{tableId}/styles/{styleId}", "httpMethod": "GET", "description": "Gets a specific style.", "parameters": { "styleId": { "type": "integer", "description": "Identifier (integer) for a specific style in a table", "required": true, "format": "int32", "location": "path" }, "tableId": { "type": "string", "description": "Table to which the requested style belongs", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "styleId" ], "response": { "$ref": "StyleSetting" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "insert": { "id": "fusiontables.style.insert", "path": "tables/{tableId}/styles", "httpMethod": "POST", "description": "Adds a new style for the table.", "parameters": { "tableId": { "type": "string", "description": "Table for which a new style is being added", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "request": { "$ref": "StyleSetting" }, "response": { "$ref": "StyleSetting" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "list": { "id": "fusiontables.style.list", "path": "tables/{tableId}/styles", "httpMethod": "GET", "description": "Retrieves a list of styles.", "parameters": { "maxResults": { "type": "integer", "description": "Maximum number of styles to return. Optional. Default is 5.", "format": "uint32", "minimum": "0", "location": "query" }, "pageToken": { "type": "string", "description": "Continuation token specifying which result page to return. Optional.", "location": "query" }, "tableId": { "type": "string", "description": "Table whose styles are being listed", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "response": { "$ref": "StyleSettingList" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "patch": { "id": "fusiontables.style.patch", "path": "tables/{tableId}/styles/{styleId}", "httpMethod": "PATCH", "description": "Updates an existing style. This method supports patch semantics.", "parameters": { "styleId": { "type": "integer", "description": "Identifier (within a table) for the style being updated.", "required": true, "format": "int32", "location": "path" }, "tableId": { "type": "string", "description": "Table whose style is being updated.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "styleId" ], "request": { "$ref": "StyleSetting" }, "response": { "$ref": "StyleSetting" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "update": { "id": "fusiontables.style.update", "path": "tables/{tableId}/styles/{styleId}", "httpMethod": "PUT", "description": "Updates an existing style.", "parameters": { "styleId": { "type": "integer", "description": "Identifier (within a table) for the style being updated.", "required": true, "format": "int32", "location": "path" }, "tableId": { "type": "string", "description": "Table whose style is being updated.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "styleId" ], "request": { "$ref": "StyleSetting" }, "response": { "$ref": "StyleSetting" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] } } }, "table": { "methods": { "copy": { "id": "fusiontables.table.copy", "path": "tables/{tableId}/copy", "httpMethod": "POST", "description": "Copies a table.", "parameters": { "copyPresentation": { "type": "boolean", "description": "Whether to also copy tabs, styles, and templates. Default is false.", "location": "query" }, "tableId": { "type": "string", "description": "ID of the table that is being copied.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "delete": { "id": "fusiontables.table.delete", "path": "tables/{tableId}", "httpMethod": "DELETE", "description": "Deletes a table.", "parameters": { "tableId": { "type": "string", "description": "ID of the table that is being deleted.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "get": { "id": "fusiontables.table.get", "path": "tables/{tableId}", "httpMethod": "GET", "description": "Retrieves a specific table by its id.", "parameters": { "tableId": { "type": "string", "description": "Identifier(ID) for the table being requested.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "importRows": { "id": "fusiontables.table.importRows", "path": "tables/{tableId}/import", "httpMethod": "POST", "description": "Import more rows into a table.", "parameters": { "delimiter": { "type": "string", "description": "The delimiter used to separate cell values. This can only consist of a single character. Default is ','.", "location": "query" }, "encoding": { "type": "string", "description": "The encoding of the content. Default is UTF-8. Use 'auto-detect' if you are unsure of the encoding.", "location": "query" }, "endLine": { "type": "integer", "description": "The index of the last line from which to start importing, exclusive. Thus, the number of imported lines is endLine - startLine. If this parameter is not provided, the file will be imported until the last line of the file. If endLine is negative, then the imported content will exclude the last endLine lines. That is, if endline is negative, no line will be imported whose index is greater than N + endLine where N is the number of lines in the file, and the number of imported lines will be N + endLine - startLine.", "format": "int32", "location": "query" }, "isStrict": { "type": "boolean", "description": "Whether the CSV must have the same number of values for each row. If false, rows with fewer values will be padded with empty values. Default is true.", "location": "query" }, "startLine": { "type": "integer", "description": "The index of the first line from which to start importing, inclusive. Default is 0.", "format": "int32", "location": "query" }, "tableId": { "type": "string", "description": "The table into which new rows are being imported.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "response": { "$ref": "Import" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ], "supportsMediaUpload": true, "mediaUpload": { "accept": [ "application/octet-stream" ], "maxSize": "250MB", "protocols": { "simple": { "multipart": true, "path": "/upload/fusiontables/v1/tables/{tableId}/import" }, "resumable": { "multipart": true, "path": "/resumable/upload/fusiontables/v1/tables/{tableId}/import" } } } }, "importTable": { "id": "fusiontables.table.importTable", "path": "tables/import", "httpMethod": "POST", "description": "Import a new table.", "parameters": { "delimiter": { "type": "string", "description": "The delimiter used to separate cell values. This can only consist of a single character. Default is ','.", "location": "query" }, "encoding": { "type": "string", "description": "The encoding of the content. Default is UTF-8. Use 'auto-detect' if you are unsure of the encoding.", "location": "query" }, "name": { "type": "string", "description": "The name to be assigned to the new table.", "required": true, "location": "query" } }, "parameterOrder": [ "name" ], "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ], "supportsMediaUpload": true, "mediaUpload": { "accept": [ "application/octet-stream" ], "maxSize": "250MB", "protocols": { "simple": { "multipart": true, "path": "/upload/fusiontables/v1/tables/import" }, "resumable": { "multipart": true, "path": "/resumable/upload/fusiontables/v1/tables/import" } } } }, "insert": { "id": "fusiontables.table.insert", "path": "tables", "httpMethod": "POST", "description": "Creates a new table.", "request": { "$ref": "Table" }, "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "list": { "id": "fusiontables.table.list", "path": "tables", "httpMethod": "GET", "description": "Retrieves a list of tables a user owns.", "parameters": { "maxResults": { "type": "integer", "description": "Maximum number of styles to return. Optional. Default is 5.", "format": "uint32", "minimum": "0", "location": "query" }, "pageToken": { "type": "string", "description": "Continuation token specifying which result page to return. Optional.", "location": "query" } }, "response": { "$ref": "TableList" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "patch": { "id": "fusiontables.table.patch", "path": "tables/{tableId}", "httpMethod": "PATCH", "description": "Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated. This method supports patch semantics.", "parameters": { "replaceViewDefinition": { "type": "boolean", "description": "Should the view definition also be updated? The specified view definition replaces the existing one. Only a view can be updated with a new definition.", "location": "query" }, "tableId": { "type": "string", "description": "ID of the table that is being updated.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "request": { "$ref": "Table" }, "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "update": { "id": "fusiontables.table.update", "path": "tables/{tableId}", "httpMethod": "PUT", "description": "Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated.", "parameters": { "replaceViewDefinition": { "type": "boolean", "description": "Should the view definition also be updated? The specified view definition replaces the existing one. Only a view can be updated with a new definition.", "location": "query" }, "tableId": { "type": "string", "description": "ID of the table that is being updated.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "request": { "$ref": "Table" }, "response": { "$ref": "Table" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] } } }, "task": { "methods": { "delete": { "id": "fusiontables.task.delete", "path": "tables/{tableId}/tasks/{taskId}", "httpMethod": "DELETE", "description": "Deletes the task, unless already started.", "parameters": { "tableId": { "type": "string", "description": "Table from which the task is being deleted.", "required": true, "location": "path" }, "taskId": { "type": "string", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "taskId" ], "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "get": { "id": "fusiontables.task.get", "path": "tables/{tableId}/tasks/{taskId}", "httpMethod": "GET", "description": "Retrieves a specific task by its id.", "parameters": { "tableId": { "type": "string", "description": "Table to which the task belongs.", "required": true, "location": "path" }, "taskId": { "type": "string", "required": true, "location": "path" } }, "parameterOrder": [ "tableId", "taskId" ], "response": { "$ref": "Task" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "list": { "id": "fusiontables.task.list", "path": "tables/{tableId}/tasks", "httpMethod": "GET", "description": "Retrieves a list of tasks.", "parameters": { "maxResults": { "type": "integer", "description": "Maximum number of columns to return. Optional. Default is 5.", "format": "uint32", "minimum": "0", "location": "query" }, "pageToken": { "type": "string", "location": "query" }, "startIndex": { "type": "integer", "format": "uint32", "location": "query" }, "tableId": { "type": "string", "description": "Table whose tasks are being listed.", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "response": { "$ref": "TaskList" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] } } }, "template": { "methods": { "delete": { "id": "fusiontables.template.delete", "path": "tables/{tableId}/templates/{templateId}", "httpMethod": "DELETE", "description": "Deletes a template", "parameters": { "tableId": { "type": "string", "description": "Table from which the template is being deleted", "required": true, "location": "path" }, "templateId": { "type": "integer", "description": "Identifier for the template which is being deleted", "required": true, "format": "int32", "location": "path" } }, "parameterOrder": [ "tableId", "templateId" ], "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "get": { "id": "fusiontables.template.get", "path": "tables/{tableId}/templates/{templateId}", "httpMethod": "GET", "description": "Retrieves a specific template by its id", "parameters": { "tableId": { "type": "string", "description": "Table to which the template belongs", "required": true, "location": "path" }, "templateId": { "type": "integer", "description": "Identifier for the template that is being requested", "required": true, "format": "int32", "location": "path" } }, "parameterOrder": [ "tableId", "templateId" ], "response": { "$ref": "Template" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "insert": { "id": "fusiontables.template.insert", "path": "tables/{tableId}/templates", "httpMethod": "POST", "description": "Creates a new template for the table.", "parameters": { "tableId": { "type": "string", "description": "Table for which a new template is being created", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "request": { "$ref": "Template" }, "response": { "$ref": "Template" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "list": { "id": "fusiontables.template.list", "path": "tables/{tableId}/templates", "httpMethod": "GET", "description": "Retrieves a list of templates.", "parameters": { "maxResults": { "type": "integer", "description": "Maximum number of templates to return. Optional. Default is 5.", "format": "uint32", "minimum": "0", "location": "query" }, "pageToken": { "type": "string", "description": "Continuation token specifying which results page to return. Optional.", "location": "query" }, "tableId": { "type": "string", "description": "Identifier for the table whose templates are being requested", "required": true, "location": "path" } }, "parameterOrder": [ "tableId" ], "response": { "$ref": "TemplateList" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables", "https://www.googleapis.com/auth/fusiontables.readonly" ] }, "patch": { "id": "fusiontables.template.patch", "path": "tables/{tableId}/templates/{templateId}", "httpMethod": "PATCH", "description": "Updates an existing template. This method supports patch semantics.", "parameters": { "tableId": { "type": "string", "description": "Table to which the updated template belongs", "required": true, "location": "path" }, "templateId": { "type": "integer", "description": "Identifier for the template that is being updated", "required": true, "format": "int32", "location": "path" } }, "parameterOrder": [ "tableId", "templateId" ], "request": { "$ref": "Template" }, "response": { "$ref": "Template" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] }, "update": { "id": "fusiontables.template.update", "path": "tables/{tableId}/templates/{templateId}", "httpMethod": "PUT", "description": "Updates an existing template", "parameters": { "tableId": { "type": "string", "description": "Table to which the updated template belongs", "required": true, "location": "path" }, "templateId": { "type": "integer", "description": "Identifier for the template that is being updated", "required": true, "format": "int32", "location": "path" } }, "parameterOrder": [ "tableId", "templateId" ], "request": { "$ref": "Template" }, "response": { "$ref": "Template" }, "scopes": [ "https://www.googleapis.com/auth/fusiontables" ] } } } } } samples/fusiontables_sample/__init__.py 0000644 00000001077 15025176453 0014375 0 ustar 00 # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. samples/fusiontables_sample/fusiontables_v1/fusiontables_v1_client.py 0000644 00000103257 15025176453 0022407 0 ustar 00 """Generated client library for fusiontables version v1.""" # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.py import base_api from samples.fusiontables_sample.fusiontables_v1 import fusiontables_v1_messages as messages class FusiontablesV1(base_api.BaseApiClient): """Generated client library for service fusiontables version v1.""" MESSAGES_MODULE = messages BASE_URL = 'https://www.googleapis.com/fusiontables/v1/' MTLS_BASE_URL = '' _PACKAGE = 'fusiontables' _SCOPES = ['https://www.googleapis.com/auth/fusiontables', 'https://www.googleapis.com/auth/fusiontables.readonly'] _VERSION = 'v1' _CLIENT_ID = 'CLIENT_ID' _CLIENT_SECRET = 'CLIENT_SECRET' _USER_AGENT = 'x_Tw5K8nnjoRAqULM9PFAC2b' _CLIENT_CLASS_NAME = 'FusiontablesV1' _URL_VERSION = 'v1' _API_KEY = None def __init__(self, url='', credentials=None, get_credentials=True, http=None, model=None, log_request=False, log_response=False, credentials_args=None, default_global_params=None, additional_http_headers=None, response_encoding=None): """Create a new fusiontables handle.""" url = url or self.BASE_URL super(FusiontablesV1, self).__init__( url, credentials=credentials, get_credentials=get_credentials, http=http, model=model, log_request=log_request, log_response=log_response, credentials_args=credentials_args, default_global_params=default_global_params, additional_http_headers=additional_http_headers, response_encoding=response_encoding) self.column = self.ColumnService(self) self.query = self.QueryService(self) self.style = self.StyleService(self) self.table = self.TableService(self) self.task = self.TaskService(self) self.template = self.TemplateService(self) class ColumnService(base_api.BaseApiService): """Service class for the column resource.""" _NAME = 'column' def __init__(self, client): super(FusiontablesV1.ColumnService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Deletes the column. Args: request: (FusiontablesColumnDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (FusiontablesColumnDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='fusiontables.column.delete', ordered_params=['tableId', 'columnId'], path_params=['columnId', 'tableId'], query_params=[], relative_path='tables/{tableId}/columns/{columnId}', request_field='', request_type_name='FusiontablesColumnDeleteRequest', response_type_name='FusiontablesColumnDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Retrieves a specific column by its id. Args: request: (FusiontablesColumnGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Column) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.column.get', ordered_params=['tableId', 'columnId'], path_params=['columnId', 'tableId'], query_params=[], relative_path='tables/{tableId}/columns/{columnId}', request_field='', request_type_name='FusiontablesColumnGetRequest', response_type_name='Column', supports_download=False, ) def Insert(self, request, global_params=None): r"""Adds a new column to the table. Args: request: (FusiontablesColumnInsertRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Column) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='fusiontables.column.insert', ordered_params=['tableId'], path_params=['tableId'], query_params=[], relative_path='tables/{tableId}/columns', request_field='column', request_type_name='FusiontablesColumnInsertRequest', response_type_name='Column', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves a list of columns. Args: request: (FusiontablesColumnListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ColumnList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.column.list', ordered_params=['tableId'], path_params=['tableId'], query_params=['maxResults', 'pageToken'], relative_path='tables/{tableId}/columns', request_field='', request_type_name='FusiontablesColumnListRequest', response_type_name='ColumnList', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates the name or type of an existing column. This method supports patch semantics. Args: request: (FusiontablesColumnPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Column) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='fusiontables.column.patch', ordered_params=['tableId', 'columnId'], path_params=['columnId', 'tableId'], query_params=[], relative_path='tables/{tableId}/columns/{columnId}', request_field='column', request_type_name='FusiontablesColumnPatchRequest', response_type_name='Column', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates the name or type of an existing column. Args: request: (FusiontablesColumnUpdateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Column) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='fusiontables.column.update', ordered_params=['tableId', 'columnId'], path_params=['columnId', 'tableId'], query_params=[], relative_path='tables/{tableId}/columns/{columnId}', request_field='column', request_type_name='FusiontablesColumnUpdateRequest', response_type_name='Column', supports_download=False, ) class QueryService(base_api.BaseApiService): """Service class for the query resource.""" _NAME = 'query' def __init__(self, client): super(FusiontablesV1.QueryService, self).__init__(client) self._upload_configs = { } def Sql(self, request, global_params=None, download=None): r"""Executes an SQL SELECT/INSERT/UPDATE/DELETE/SHOW/DESCRIBE/CREATE statement. Args: request: (FusiontablesQuerySqlRequest) input message global_params: (StandardQueryParameters, default: None) global arguments download: (Download, default: None) If present, download data from the request via this stream. Returns: (Sqlresponse) The response message. """ config = self.GetMethodConfig('Sql') return self._RunMethod( config, request, global_params=global_params, download=download) Sql.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='fusiontables.query.sql', ordered_params=['sql'], path_params=[], query_params=['hdrs', 'sql', 'typed'], relative_path='query', request_field='', request_type_name='FusiontablesQuerySqlRequest', response_type_name='Sqlresponse', supports_download=True, ) def SqlGet(self, request, global_params=None, download=None): r"""Executes an SQL SELECT/SHOW/DESCRIBE statement. Args: request: (FusiontablesQuerySqlGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments download: (Download, default: None) If present, download data from the request via this stream. Returns: (Sqlresponse) The response message. """ config = self.GetMethodConfig('SqlGet') return self._RunMethod( config, request, global_params=global_params, download=download) SqlGet.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.query.sqlGet', ordered_params=['sql'], path_params=[], query_params=['hdrs', 'sql', 'typed'], relative_path='query', request_field='', request_type_name='FusiontablesQuerySqlGetRequest', response_type_name='Sqlresponse', supports_download=True, ) class StyleService(base_api.BaseApiService): """Service class for the style resource.""" _NAME = 'style' def __init__(self, client): super(FusiontablesV1.StyleService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Deletes a style. Args: request: (FusiontablesStyleDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (FusiontablesStyleDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='fusiontables.style.delete', ordered_params=['tableId', 'styleId'], path_params=['styleId', 'tableId'], query_params=[], relative_path='tables/{tableId}/styles/{styleId}', request_field='', request_type_name='FusiontablesStyleDeleteRequest', response_type_name='FusiontablesStyleDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Gets a specific style. Args: request: (FusiontablesStyleGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StyleSetting) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.style.get', ordered_params=['tableId', 'styleId'], path_params=['styleId', 'tableId'], query_params=[], relative_path='tables/{tableId}/styles/{styleId}', request_field='', request_type_name='FusiontablesStyleGetRequest', response_type_name='StyleSetting', supports_download=False, ) def Insert(self, request, global_params=None): r"""Adds a new style for the table. Args: request: (StyleSetting) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StyleSetting) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='fusiontables.style.insert', ordered_params=['tableId'], path_params=['tableId'], query_params=[], relative_path='tables/{tableId}/styles', request_field='<request>', request_type_name='StyleSetting', response_type_name='StyleSetting', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves a list of styles. Args: request: (FusiontablesStyleListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StyleSettingList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.style.list', ordered_params=['tableId'], path_params=['tableId'], query_params=['maxResults', 'pageToken'], relative_path='tables/{tableId}/styles', request_field='', request_type_name='FusiontablesStyleListRequest', response_type_name='StyleSettingList', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates an existing style. This method supports patch semantics. Args: request: (StyleSetting) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StyleSetting) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='fusiontables.style.patch', ordered_params=['tableId', 'styleId'], path_params=['styleId', 'tableId'], query_params=[], relative_path='tables/{tableId}/styles/{styleId}', request_field='<request>', request_type_name='StyleSetting', response_type_name='StyleSetting', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates an existing style. Args: request: (StyleSetting) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (StyleSetting) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='fusiontables.style.update', ordered_params=['tableId', 'styleId'], path_params=['styleId', 'tableId'], query_params=[], relative_path='tables/{tableId}/styles/{styleId}', request_field='<request>', request_type_name='StyleSetting', response_type_name='StyleSetting', supports_download=False, ) class TableService(base_api.BaseApiService): """Service class for the table resource.""" _NAME = 'table' def __init__(self, client): super(FusiontablesV1.TableService, self).__init__(client) self._upload_configs = { 'ImportRows': base_api.ApiUploadInfo( accept=['application/octet-stream'], max_size=262144000, resumable_multipart=True, resumable_path='/resumable/upload/fusiontables/v1/tables/{tableId}/import', simple_multipart=True, simple_path='/upload/fusiontables/v1/tables/{tableId}/import', ), 'ImportTable': base_api.ApiUploadInfo( accept=['application/octet-stream'], max_size=262144000, resumable_multipart=True, resumable_path='/resumable/upload/fusiontables/v1/tables/import', simple_multipart=True, simple_path='/upload/fusiontables/v1/tables/import', ), } def Copy(self, request, global_params=None): r"""Copies a table. Args: request: (FusiontablesTableCopyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Copy') return self._RunMethod( config, request, global_params=global_params) Copy.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='fusiontables.table.copy', ordered_params=['tableId'], path_params=['tableId'], query_params=['copyPresentation'], relative_path='tables/{tableId}/copy', request_field='', request_type_name='FusiontablesTableCopyRequest', response_type_name='Table', supports_download=False, ) def Delete(self, request, global_params=None): r"""Deletes a table. Args: request: (FusiontablesTableDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (FusiontablesTableDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='fusiontables.table.delete', ordered_params=['tableId'], path_params=['tableId'], query_params=[], relative_path='tables/{tableId}', request_field='', request_type_name='FusiontablesTableDeleteRequest', response_type_name='FusiontablesTableDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Retrieves a specific table by its id. Args: request: (FusiontablesTableGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.table.get', ordered_params=['tableId'], path_params=['tableId'], query_params=[], relative_path='tables/{tableId}', request_field='', request_type_name='FusiontablesTableGetRequest', response_type_name='Table', supports_download=False, ) def ImportRows(self, request, global_params=None, upload=None): r"""Import more rows into a table. Args: request: (FusiontablesTableImportRowsRequest) input message global_params: (StandardQueryParameters, default: None) global arguments upload: (Upload, default: None) If present, upload this stream with the request. Returns: (Import) The response message. """ config = self.GetMethodConfig('ImportRows') upload_config = self.GetUploadConfig('ImportRows') return self._RunMethod( config, request, global_params=global_params, upload=upload, upload_config=upload_config) ImportRows.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='fusiontables.table.importRows', ordered_params=['tableId'], path_params=['tableId'], query_params=['delimiter', 'encoding', 'endLine', 'isStrict', 'startLine'], relative_path='tables/{tableId}/import', request_field='', request_type_name='FusiontablesTableImportRowsRequest', response_type_name='Import', supports_download=False, ) def ImportTable(self, request, global_params=None, upload=None): r"""Import a new table. Args: request: (FusiontablesTableImportTableRequest) input message global_params: (StandardQueryParameters, default: None) global arguments upload: (Upload, default: None) If present, upload this stream with the request. Returns: (Table) The response message. """ config = self.GetMethodConfig('ImportTable') upload_config = self.GetUploadConfig('ImportTable') return self._RunMethod( config, request, global_params=global_params, upload=upload, upload_config=upload_config) ImportTable.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='fusiontables.table.importTable', ordered_params=['name'], path_params=[], query_params=['delimiter', 'encoding', 'name'], relative_path='tables/import', request_field='', request_type_name='FusiontablesTableImportTableRequest', response_type_name='Table', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a new table. Args: request: (Table) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='fusiontables.table.insert', ordered_params=[], path_params=[], query_params=[], relative_path='tables', request_field='<request>', request_type_name='Table', response_type_name='Table', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves a list of tables a user owns. Args: request: (FusiontablesTableListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TableList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.table.list', ordered_params=[], path_params=[], query_params=['maxResults', 'pageToken'], relative_path='tables', request_field='', request_type_name='FusiontablesTableListRequest', response_type_name='TableList', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated. This method supports patch semantics. Args: request: (FusiontablesTablePatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='fusiontables.table.patch', ordered_params=['tableId'], path_params=['tableId'], query_params=['replaceViewDefinition'], relative_path='tables/{tableId}', request_field='table', request_type_name='FusiontablesTablePatchRequest', response_type_name='Table', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated. Args: request: (FusiontablesTableUpdateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Table) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='fusiontables.table.update', ordered_params=['tableId'], path_params=['tableId'], query_params=['replaceViewDefinition'], relative_path='tables/{tableId}', request_field='table', request_type_name='FusiontablesTableUpdateRequest', response_type_name='Table', supports_download=False, ) class TaskService(base_api.BaseApiService): """Service class for the task resource.""" _NAME = 'task' def __init__(self, client): super(FusiontablesV1.TaskService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Deletes the task, unless already started. Args: request: (FusiontablesTaskDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (FusiontablesTaskDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='fusiontables.task.delete', ordered_params=['tableId', 'taskId'], path_params=['tableId', 'taskId'], query_params=[], relative_path='tables/{tableId}/tasks/{taskId}', request_field='', request_type_name='FusiontablesTaskDeleteRequest', response_type_name='FusiontablesTaskDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Retrieves a specific task by its id. Args: request: (FusiontablesTaskGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Task) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.task.get', ordered_params=['tableId', 'taskId'], path_params=['tableId', 'taskId'], query_params=[], relative_path='tables/{tableId}/tasks/{taskId}', request_field='', request_type_name='FusiontablesTaskGetRequest', response_type_name='Task', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves a list of tasks. Args: request: (FusiontablesTaskListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TaskList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.task.list', ordered_params=['tableId'], path_params=['tableId'], query_params=['maxResults', 'pageToken', 'startIndex'], relative_path='tables/{tableId}/tasks', request_field='', request_type_name='FusiontablesTaskListRequest', response_type_name='TaskList', supports_download=False, ) class TemplateService(base_api.BaseApiService): """Service class for the template resource.""" _NAME = 'template' def __init__(self, client): super(FusiontablesV1.TemplateService, self).__init__(client) self._upload_configs = { } def Delete(self, request, global_params=None): r"""Deletes a template. Args: request: (FusiontablesTemplateDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (FusiontablesTemplateDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='fusiontables.template.delete', ordered_params=['tableId', 'templateId'], path_params=['tableId', 'templateId'], query_params=[], relative_path='tables/{tableId}/templates/{templateId}', request_field='', request_type_name='FusiontablesTemplateDeleteRequest', response_type_name='FusiontablesTemplateDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Retrieves a specific template by its id. Args: request: (FusiontablesTemplateGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Template) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.template.get', ordered_params=['tableId', 'templateId'], path_params=['tableId', 'templateId'], query_params=[], relative_path='tables/{tableId}/templates/{templateId}', request_field='', request_type_name='FusiontablesTemplateGetRequest', response_type_name='Template', supports_download=False, ) def Insert(self, request, global_params=None): r"""Creates a new template for the table. Args: request: (Template) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Template) The response message. """ config = self.GetMethodConfig('Insert') return self._RunMethod( config, request, global_params=global_params) Insert.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='fusiontables.template.insert', ordered_params=['tableId'], path_params=['tableId'], query_params=[], relative_path='tables/{tableId}/templates', request_field='<request>', request_type_name='Template', response_type_name='Template', supports_download=False, ) def List(self, request, global_params=None): r"""Retrieves a list of templates. Args: request: (FusiontablesTemplateListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TemplateList) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='fusiontables.template.list', ordered_params=['tableId'], path_params=['tableId'], query_params=['maxResults', 'pageToken'], relative_path='tables/{tableId}/templates', request_field='', request_type_name='FusiontablesTemplateListRequest', response_type_name='TemplateList', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates an existing template. This method supports patch semantics. Args: request: (Template) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Template) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='fusiontables.template.patch', ordered_params=['tableId', 'templateId'], path_params=['tableId', 'templateId'], query_params=[], relative_path='tables/{tableId}/templates/{templateId}', request_field='<request>', request_type_name='Template', response_type_name='Template', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates an existing template. Args: request: (Template) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Template) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='fusiontables.template.update', ordered_params=['tableId', 'templateId'], path_params=['tableId', 'templateId'], query_params=[], relative_path='tables/{tableId}/templates/{templateId}', request_field='<request>', request_type_name='Template', response_type_name='Template', supports_download=False, ) samples/fusiontables_sample/fusiontables_v1/fusiontables_v1_messages.py 0000644 00000100004 15025176453 0022723 0 ustar 00 """Generated message classes for fusiontables version v1. API for working with Fusion Tables data. """ # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.protorpclite import messages as _messages from apitools.base.py import extra_types package = 'fusiontables' class Bucket(_messages.Message): r"""Specifies the minimum and maximum values, the color, opacity, icon and weight of a bucket within a StyleSetting. Fields: color: Color of line or the interior of a polygon in #RRGGBB format. icon: Icon name used for a point. max: Maximum value in the selected column for a row to be styled according to the bucket color, opacity, icon, or weight. min: Minimum value in the selected column for a row to be styled according to the bucket color, opacity, icon, or weight. opacity: Opacity of the color: 0.0 (transparent) to 1.0 (opaque). weight: Width of a line (in pixels). """ color = _messages.StringField(1) icon = _messages.StringField(2) max = _messages.FloatField(3) min = _messages.FloatField(4) opacity = _messages.FloatField(5) weight = _messages.IntegerField(6, variant=_messages.Variant.INT32) class Column(_messages.Message): r"""Specifies the id, name and type of a column in a table. Messages: BaseColumnValue: Optional identifier of the base column. If present, this column is derived from the specified base column. Fields: baseColumn: Optional identifier of the base column. If present, this column is derived from the specified base column. columnId: Identifier for the column. description: Optional column description. graph_predicate: Optional column predicate. Used to map table to graph data model (subject,predicate,object) See http://www.w3.org/TR/2014/REC- rdf11-concepts-20140225/#data-model kind: Type name: a template for an individual column. name: Required name of the column. type: Required type of the column. """ class BaseColumnValue(_messages.Message): r"""Optional identifier of the base column. If present, this column is derived from the specified base column. Fields: columnId: The id of the column in the base table from which this column is derived. tableIndex: Offset to the entry in the list of base tables in the table definition. """ columnId = _messages.IntegerField(1, variant=_messages.Variant.INT32) tableIndex = _messages.IntegerField(2, variant=_messages.Variant.INT32) baseColumn = _messages.MessageField('BaseColumnValue', 1) columnId = _messages.IntegerField(2, variant=_messages.Variant.INT32) description = _messages.StringField(3) graph_predicate = _messages.StringField(4) kind = _messages.StringField(5, default='fusiontables#column') name = _messages.StringField(6) type = _messages.StringField(7) class ColumnList(_messages.Message): r"""Represents a list of columns in a table. Fields: items: List of all requested columns. kind: Type name: a list of all columns. nextPageToken: Token used to access the next page of this result. No token is displayed if there are no more pages left. totalItems: Total number of columns for the table. """ items = _messages.MessageField('Column', 1, repeated=True) kind = _messages.StringField(2, default='fusiontables#columnList') nextPageToken = _messages.StringField(3) totalItems = _messages.IntegerField(4, variant=_messages.Variant.INT32) class FusiontablesColumnDeleteRequest(_messages.Message): r"""A FusiontablesColumnDeleteRequest object. Fields: columnId: Name or identifier for the column being deleted. tableId: Table from which the column is being deleted. """ columnId = _messages.StringField(1, required=True) tableId = _messages.StringField(2, required=True) class FusiontablesColumnDeleteResponse(_messages.Message): r"""An empty FusiontablesColumnDelete response.""" class FusiontablesColumnGetRequest(_messages.Message): r"""A FusiontablesColumnGetRequest object. Fields: columnId: Name or identifier for the column that is being requested. tableId: Table to which the column belongs. """ columnId = _messages.StringField(1, required=True) tableId = _messages.StringField(2, required=True) class FusiontablesColumnInsertRequest(_messages.Message): r"""A FusiontablesColumnInsertRequest object. Fields: column: A Column resource to be passed as the request body. tableId: Table for which a new column is being added. """ column = _messages.MessageField('Column', 1) tableId = _messages.StringField(2, required=True) class FusiontablesColumnListRequest(_messages.Message): r"""A FusiontablesColumnListRequest object. Fields: maxResults: Maximum number of columns to return. Optional. Default is 5. pageToken: Continuation token specifying which result page to return. Optional. tableId: Table whose columns are being listed. """ maxResults = _messages.IntegerField(1, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(2) tableId = _messages.StringField(3, required=True) class FusiontablesColumnPatchRequest(_messages.Message): r"""A FusiontablesColumnPatchRequest object. Fields: column: A Column resource to be passed as the request body. columnId: Name or identifier for the column that is being updated. tableId: Table for which the column is being updated. """ column = _messages.MessageField('Column', 1) columnId = _messages.StringField(2, required=True) tableId = _messages.StringField(3, required=True) class FusiontablesColumnUpdateRequest(_messages.Message): r"""A FusiontablesColumnUpdateRequest object. Fields: column: A Column resource to be passed as the request body. columnId: Name or identifier for the column that is being updated. tableId: Table for which the column is being updated. """ column = _messages.MessageField('Column', 1) columnId = _messages.StringField(2, required=True) tableId = _messages.StringField(3, required=True) class FusiontablesQuerySqlGetRequest(_messages.Message): r"""A FusiontablesQuerySqlGetRequest object. Fields: hdrs: Should column names be included (in the first row)?. Default is true. sql: An SQL SELECT/SHOW/DESCRIBE statement. typed: Should typed values be returned in the (JSON) response -- numbers for numeric values and parsed geometries for KML values? Default is true. """ hdrs = _messages.BooleanField(1) sql = _messages.StringField(2, required=True) typed = _messages.BooleanField(3) class FusiontablesQuerySqlRequest(_messages.Message): r"""A FusiontablesQuerySqlRequest object. Fields: hdrs: Should column names be included (in the first row)?. Default is true. sql: An SQL SELECT/SHOW/DESCRIBE/INSERT/UPDATE/DELETE/CREATE statement. typed: Should typed values be returned in the (JSON) response -- numbers for numeric values and parsed geometries for KML values? Default is true. """ hdrs = _messages.BooleanField(1) sql = _messages.StringField(2, required=True) typed = _messages.BooleanField(3) class FusiontablesStyleDeleteRequest(_messages.Message): r"""A FusiontablesStyleDeleteRequest object. Fields: styleId: Identifier (within a table) for the style being deleted tableId: Table from which the style is being deleted """ styleId = _messages.IntegerField(1, required=True, variant=_messages.Variant.INT32) tableId = _messages.StringField(2, required=True) class FusiontablesStyleDeleteResponse(_messages.Message): r"""An empty FusiontablesStyleDelete response.""" class FusiontablesStyleGetRequest(_messages.Message): r"""A FusiontablesStyleGetRequest object. Fields: styleId: Identifier (integer) for a specific style in a table tableId: Table to which the requested style belongs """ styleId = _messages.IntegerField(1, required=True, variant=_messages.Variant.INT32) tableId = _messages.StringField(2, required=True) class FusiontablesStyleListRequest(_messages.Message): r"""A FusiontablesStyleListRequest object. Fields: maxResults: Maximum number of styles to return. Optional. Default is 5. pageToken: Continuation token specifying which result page to return. Optional. tableId: Table whose styles are being listed """ maxResults = _messages.IntegerField(1, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(2) tableId = _messages.StringField(3, required=True) class FusiontablesTableCopyRequest(_messages.Message): r"""A FusiontablesTableCopyRequest object. Fields: copyPresentation: Whether to also copy tabs, styles, and templates. Default is false. tableId: ID of the table that is being copied. """ copyPresentation = _messages.BooleanField(1) tableId = _messages.StringField(2, required=True) class FusiontablesTableDeleteRequest(_messages.Message): r"""A FusiontablesTableDeleteRequest object. Fields: tableId: ID of the table that is being deleted. """ tableId = _messages.StringField(1, required=True) class FusiontablesTableDeleteResponse(_messages.Message): r"""An empty FusiontablesTableDelete response.""" class FusiontablesTableGetRequest(_messages.Message): r"""A FusiontablesTableGetRequest object. Fields: tableId: Identifier(ID) for the table being requested. """ tableId = _messages.StringField(1, required=True) class FusiontablesTableImportRowsRequest(_messages.Message): r"""A FusiontablesTableImportRowsRequest object. Fields: delimiter: The delimiter used to separate cell values. This can only consist of a single character. Default is ','. encoding: The encoding of the content. Default is UTF-8. Use 'auto-detect' if you are unsure of the encoding. endLine: The index of the last line from which to start importing, exclusive. Thus, the number of imported lines is endLine - startLine. If this parameter is not provided, the file will be imported until the last line of the file. If endLine is negative, then the imported content will exclude the last endLine lines. That is, if endline is negative, no line will be imported whose index is greater than N + endLine where N is the number of lines in the file, and the number of imported lines will be N + endLine - startLine. isStrict: Whether the CSV must have the same number of values for each row. If false, rows with fewer values will be padded with empty values. Default is true. startLine: The index of the first line from which to start importing, inclusive. Default is 0. tableId: The table into which new rows are being imported. """ delimiter = _messages.StringField(1) encoding = _messages.StringField(2) endLine = _messages.IntegerField(3, variant=_messages.Variant.INT32) isStrict = _messages.BooleanField(4) startLine = _messages.IntegerField(5, variant=_messages.Variant.INT32) tableId = _messages.StringField(6, required=True) class FusiontablesTableImportTableRequest(_messages.Message): r"""A FusiontablesTableImportTableRequest object. Fields: delimiter: The delimiter used to separate cell values. This can only consist of a single character. Default is ','. encoding: The encoding of the content. Default is UTF-8. Use 'auto-detect' if you are unsure of the encoding. name: The name to be assigned to the new table. """ delimiter = _messages.StringField(1) encoding = _messages.StringField(2) name = _messages.StringField(3, required=True) class FusiontablesTableListRequest(_messages.Message): r"""A FusiontablesTableListRequest object. Fields: maxResults: Maximum number of styles to return. Optional. Default is 5. pageToken: Continuation token specifying which result page to return. Optional. """ maxResults = _messages.IntegerField(1, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(2) class FusiontablesTablePatchRequest(_messages.Message): r"""A FusiontablesTablePatchRequest object. Fields: replaceViewDefinition: Should the view definition also be updated? The specified view definition replaces the existing one. Only a view can be updated with a new definition. table: A Table resource to be passed as the request body. tableId: ID of the table that is being updated. """ replaceViewDefinition = _messages.BooleanField(1) table = _messages.MessageField('Table', 2) tableId = _messages.StringField(3, required=True) class FusiontablesTableUpdateRequest(_messages.Message): r"""A FusiontablesTableUpdateRequest object. Fields: replaceViewDefinition: Should the view definition also be updated? The specified view definition replaces the existing one. Only a view can be updated with a new definition. table: A Table resource to be passed as the request body. tableId: ID of the table that is being updated. """ replaceViewDefinition = _messages.BooleanField(1) table = _messages.MessageField('Table', 2) tableId = _messages.StringField(3, required=True) class FusiontablesTaskDeleteRequest(_messages.Message): r"""A FusiontablesTaskDeleteRequest object. Fields: tableId: Table from which the task is being deleted. taskId: A string attribute. """ tableId = _messages.StringField(1, required=True) taskId = _messages.StringField(2, required=True) class FusiontablesTaskDeleteResponse(_messages.Message): r"""An empty FusiontablesTaskDelete response.""" class FusiontablesTaskGetRequest(_messages.Message): r"""A FusiontablesTaskGetRequest object. Fields: tableId: Table to which the task belongs. taskId: A string attribute. """ tableId = _messages.StringField(1, required=True) taskId = _messages.StringField(2, required=True) class FusiontablesTaskListRequest(_messages.Message): r"""A FusiontablesTaskListRequest object. Fields: maxResults: Maximum number of columns to return. Optional. Default is 5. pageToken: A string attribute. startIndex: A integer attribute. tableId: Table whose tasks are being listed. """ maxResults = _messages.IntegerField(1, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(2) startIndex = _messages.IntegerField(3, variant=_messages.Variant.UINT32) tableId = _messages.StringField(4, required=True) class FusiontablesTemplateDeleteRequest(_messages.Message): r"""A FusiontablesTemplateDeleteRequest object. Fields: tableId: Table from which the template is being deleted templateId: Identifier for the template which is being deleted """ tableId = _messages.StringField(1, required=True) templateId = _messages.IntegerField(2, required=True, variant=_messages.Variant.INT32) class FusiontablesTemplateDeleteResponse(_messages.Message): r"""An empty FusiontablesTemplateDelete response.""" class FusiontablesTemplateGetRequest(_messages.Message): r"""A FusiontablesTemplateGetRequest object. Fields: tableId: Table to which the template belongs templateId: Identifier for the template that is being requested """ tableId = _messages.StringField(1, required=True) templateId = _messages.IntegerField(2, required=True, variant=_messages.Variant.INT32) class FusiontablesTemplateListRequest(_messages.Message): r"""A FusiontablesTemplateListRequest object. Fields: maxResults: Maximum number of templates to return. Optional. Default is 5. pageToken: Continuation token specifying which results page to return. Optional. tableId: Identifier for the table whose templates are being requested """ maxResults = _messages.IntegerField(1, variant=_messages.Variant.UINT32) pageToken = _messages.StringField(2) tableId = _messages.StringField(3, required=True) class Geometry(_messages.Message): r"""Represents a Geometry object. Fields: geometries: The list of geometries in this geometry collection. geometry: A extra_types.JsonValue attribute. type: Type: A collection of geometries. """ geometries = _messages.MessageField('extra_types.JsonValue', 1, repeated=True) geometry = _messages.MessageField('extra_types.JsonValue', 2) type = _messages.StringField(3, default='GeometryCollection') class Import(_messages.Message): r"""Represents an import request. Fields: kind: Type name: a template for an import request. numRowsReceived: The number of rows received from the import request. """ kind = _messages.StringField(1, default='fusiontables#import') numRowsReceived = _messages.IntegerField(2) class Line(_messages.Message): r"""Represents a line geometry. Messages: CoordinatesValueListEntry: Single entry in a CoordinatesValue. Fields: coordinates: The coordinates that define the line. type: Type: A line geometry. """ class CoordinatesValueListEntry(_messages.Message): r"""Single entry in a CoordinatesValue. Fields: entry: A number attribute. """ entry = _messages.FloatField(1, repeated=True) coordinates = _messages.MessageField('CoordinatesValueListEntry', 1, repeated=True) type = _messages.StringField(2, default='LineString') class LineStyle(_messages.Message): r"""Represents a LineStyle within a StyleSetting Fields: strokeColor: Color of the line in #RRGGBB format. strokeColorStyler: Column-value, gradient or buckets styler that is used to determine the line color and opacity. strokeOpacity: Opacity of the line : 0.0 (transparent) to 1.0 (opaque). strokeWeight: Width of the line in pixels. strokeWeightStyler: Column-value or bucket styler that is used to determine the width of the line. """ strokeColor = _messages.StringField(1) strokeColorStyler = _messages.MessageField('StyleFunction', 2) strokeOpacity = _messages.FloatField(3) strokeWeight = _messages.IntegerField(4, variant=_messages.Variant.INT32) strokeWeightStyler = _messages.MessageField('StyleFunction', 5) class Point(_messages.Message): r"""Represents a point object. Fields: coordinates: The coordinates that define the point. type: Point: A point geometry. """ coordinates = _messages.FloatField(1, repeated=True) type = _messages.StringField(2, default='Point') class PointStyle(_messages.Message): r"""Represents a PointStyle within a StyleSetting Fields: iconName: Name of the icon. Use values defined in http://www.google.com/fusiontables/DataSource?dsrcid=308519 iconStyler: Column or a bucket value from which the icon name is to be determined. """ iconName = _messages.StringField(1) iconStyler = _messages.MessageField('StyleFunction', 2) class Polygon(_messages.Message): r"""Represents a polygon object. Messages: CoordinatesValueListEntry: Single entry in a CoordinatesValue. Fields: coordinates: The coordinates that define the polygon. type: Type: A polygon geometry. """ class CoordinatesValueListEntry(_messages.Message): r"""Single entry in a CoordinatesValue. Messages: EntryValueListEntry: Single entry in a EntryValue. Fields: entry: A EntryValueListEntry attribute. """ class EntryValueListEntry(_messages.Message): r"""Single entry in a EntryValue. Fields: entry: A number attribute. """ entry = _messages.FloatField(1, repeated=True) entry = _messages.MessageField('EntryValueListEntry', 1, repeated=True) coordinates = _messages.MessageField('CoordinatesValueListEntry', 1, repeated=True) type = _messages.StringField(2, default='Polygon') class PolygonStyle(_messages.Message): r"""Represents a PolygonStyle within a StyleSetting Fields: fillColor: Color of the interior of the polygon in #RRGGBB format. fillColorStyler: Column-value, gradient, or bucket styler that is used to determine the interior color and opacity of the polygon. fillOpacity: Opacity of the interior of the polygon: 0.0 (transparent) to 1.0 (opaque). strokeColor: Color of the polygon border in #RRGGBB format. strokeColorStyler: Column-value, gradient or buckets styler that is used to determine the border color and opacity. strokeOpacity: Opacity of the polygon border: 0.0 (transparent) to 1.0 (opaque). strokeWeight: Width of the polyon border in pixels. strokeWeightStyler: Column-value or bucket styler that is used to determine the width of the polygon border. """ fillColor = _messages.StringField(1) fillColorStyler = _messages.MessageField('StyleFunction', 2) fillOpacity = _messages.FloatField(3) strokeColor = _messages.StringField(4) strokeColorStyler = _messages.MessageField('StyleFunction', 5) strokeOpacity = _messages.FloatField(6) strokeWeight = _messages.IntegerField(7, variant=_messages.Variant.INT32) strokeWeightStyler = _messages.MessageField('StyleFunction', 8) class Sqlresponse(_messages.Message): r"""Represents a response to an sql statement. Messages: RowsValueListEntry: Single entry in a RowsValue. Fields: columns: Columns in the table. kind: Type name: a template for an individual table. rows: The rows in the table. For each cell we print out whatever cell value (e.g., numeric, string) exists. Thus it is important that each cell contains only one value. """ class RowsValueListEntry(_messages.Message): r"""Single entry in a RowsValue. Fields: entry: A extra_types.JsonValue attribute. """ entry = _messages.MessageField('extra_types.JsonValue', 1, repeated=True) columns = _messages.StringField(1, repeated=True) kind = _messages.StringField(2, default='fusiontables#sqlresponse') rows = _messages.MessageField('RowsValueListEntry', 3, repeated=True) class StandardQueryParameters(_messages.Message): r"""Query parameters accepted by all methods. Enums: AltValueValuesEnum: Data format for the response. Fields: alt: Data format for the response. fields: Selector specifying which fields to include in a partial response. key: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. oauth_token: OAuth 2.0 token for the current user. prettyPrint: Returns response with indentations and line breaks. quotaUser: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. trace: A tracing token of the form "token:<tokenid>" to include in api requests. userIp: IP address of the site where the request originates. Use this if you want to enforce per-user limits. """ class AltValueValuesEnum(_messages.Enum): r"""Data format for the response. Values: csv: Responses with Content-Type of text/csv json: Responses with Content-Type of application/json """ csv = 0 json = 1 alt = _messages.EnumField('AltValueValuesEnum', 1, default='json') fields = _messages.StringField(2) key = _messages.StringField(3) oauth_token = _messages.StringField(4) prettyPrint = _messages.BooleanField(5, default=True) quotaUser = _messages.StringField(6) trace = _messages.StringField(7) userIp = _messages.StringField(8) class StyleFunction(_messages.Message): r"""Represents a StyleFunction within a StyleSetting Messages: GradientValue: Gradient function that interpolates a range of colors based on column value. Fields: buckets: Bucket function that assigns a style based on the range a column value falls into. columnName: Name of the column whose value is used in the style. gradient: Gradient function that interpolates a range of colors based on column value. kind: Stylers can be one of three kinds: "fusiontables#fromColumn" if the column value is to be used as is, i.e., the column values can have colors in #RRGGBBAA format or integer line widths or icon names; "fusiontables#gradient" if the styling of the row is to be based on applying the gradient function on the column value; or "fusiontables#buckets" if the styling is to based on the bucket into which the the column value falls. """ class GradientValue(_messages.Message): r"""Gradient function that interpolates a range of colors based on column value. Messages: ColorsValueListEntry: A ColorsValueListEntry object. Fields: colors: Array with two or more colors. max: Higher-end of the interpolation range: rows with this value will be assigned to colors[n-1]. min: Lower-end of the interpolation range: rows with this value will be assigned to colors[0]. """ class ColorsValueListEntry(_messages.Message): r"""A ColorsValueListEntry object. Fields: color: Color in #RRGGBB format. opacity: Opacity of the color: 0.0 (transparent) to 1.0 (opaque). """ color = _messages.StringField(1) opacity = _messages.FloatField(2) colors = _messages.MessageField('ColorsValueListEntry', 1, repeated=True) max = _messages.FloatField(2) min = _messages.FloatField(3) buckets = _messages.MessageField('Bucket', 1, repeated=True) columnName = _messages.StringField(2) gradient = _messages.MessageField('GradientValue', 3) kind = _messages.StringField(4) class StyleSetting(_messages.Message): r"""Represents a complete StyleSettings object. The primary key is a combination of the tableId and a styleId. Fields: kind: Type name: an individual style setting. A StyleSetting contains the style defintions for points, lines, and polygons in a table. Since a table can have any one or all of them, a style definition can have point, line and polygon style definitions. markerOptions: Style definition for points in the table. name: Optional name for the style setting. polygonOptions: Style definition for polygons in the table. polylineOptions: Style definition for lines in the table. styleId: Identifier for the style setting (unique only within tables). tableId: Identifier for the table. """ kind = _messages.StringField(1, default='fusiontables#styleSetting') markerOptions = _messages.MessageField('PointStyle', 2) name = _messages.StringField(3) polygonOptions = _messages.MessageField('PolygonStyle', 4) polylineOptions = _messages.MessageField('LineStyle', 5) styleId = _messages.IntegerField(6, variant=_messages.Variant.INT32) tableId = _messages.StringField(7) class StyleSettingList(_messages.Message): r"""Represents a list of styles for a given table. Fields: items: All requested style settings. kind: Type name: in this case, a list of style settings. nextPageToken: Token used to access the next page of this result. No token is displayed if there are no more pages left. totalItems: Total number of styles for the table. """ items = _messages.MessageField('StyleSetting', 1, repeated=True) kind = _messages.StringField(2, default='fusiontables#styleSettingList') nextPageToken = _messages.StringField(3) totalItems = _messages.IntegerField(4, variant=_messages.Variant.INT32) class Table(_messages.Message): r"""Represents a table. Specifies the name, whether it is exportable, description, attribution, and attribution link. Fields: attribution: Optional attribution assigned to the table. attributionLink: Optional link for attribution. baseTableIds: Optional base table identifier if this table is a view or merged table. columns: Columns in the table. description: Optional description assigned to the table. isExportable: Variable for whether table is exportable. kind: Type name: a template for an individual table. name: Name assigned to a table. sql: Optional sql that encodes the table definition for derived tables. tableId: Encrypted unique alphanumeric identifier for the table. """ attribution = _messages.StringField(1) attributionLink = _messages.StringField(2) baseTableIds = _messages.StringField(3, repeated=True) columns = _messages.MessageField('Column', 4, repeated=True) description = _messages.StringField(5) isExportable = _messages.BooleanField(6) kind = _messages.StringField(7, default='fusiontables#table') name = _messages.StringField(8) sql = _messages.StringField(9) tableId = _messages.StringField(10) class TableList(_messages.Message): r"""Represents a list of tables. Fields: items: List of all requested tables. kind: Type name: a list of all tables. nextPageToken: Token used to access the next page of this result. No token is displayed if there are no more pages left. """ items = _messages.MessageField('Table', 1, repeated=True) kind = _messages.StringField(2, default='fusiontables#tableList') nextPageToken = _messages.StringField(3) class Task(_messages.Message): r"""Specifies the identifier, name, and type of a task in a table. Fields: kind: Type of the resource. This is always "fusiontables#task". progress: An indication of task progress. started: false while the table is busy with some other task. true if this background task is currently running. taskId: Identifier for the task. type: Type of background task. One of DELETE_ROWS Deletes one or more rows from the table. ADD_ROWS "Adds one or more rows to a table. Includes importing data into a new table and importing more rows into an existing table. ADD_COLUMN Adds a new column to the table. CHANGE_TYPE Changes the type of a column. """ kind = _messages.StringField(1, default='fusiontables#task') progress = _messages.StringField(2) started = _messages.BooleanField(3) taskId = _messages.IntegerField(4) type = _messages.StringField(5) class TaskList(_messages.Message): r"""Represents a list of tasks for a table. Fields: items: List of all requested tasks. kind: Type of the resource. This is always "fusiontables#taskList". nextPageToken: Token used to access the next page of this result. No token is displayed if there are no more pages left. totalItems: Total number of tasks for the table. """ items = _messages.MessageField('Task', 1, repeated=True) kind = _messages.StringField(2, default='fusiontables#taskList') nextPageToken = _messages.StringField(3) totalItems = _messages.IntegerField(4, variant=_messages.Variant.INT32) class Template(_messages.Message): r"""Represents the contents of InfoWindow templates. Fields: automaticColumnNames: List of columns from which the template is to be automatically constructed. Only one of body or automaticColumns can be specified. body: Body of the template. It contains HTML with {column_name} to insert values from a particular column. The body is sanitized to remove certain tags, e.g., script. Only one of body or automaticColumns can be specified. kind: Type name: a template for the info window contents. The template can either include an HTML body or a list of columns from which the template is computed automatically. name: Optional name assigned to a template. tableId: Identifier for the table for which the template is defined. templateId: Identifier for the template, unique within the context of a particular table. """ automaticColumnNames = _messages.StringField(1, repeated=True) body = _messages.StringField(2) kind = _messages.StringField(3, default='fusiontables#template') name = _messages.StringField(4) tableId = _messages.StringField(5) templateId = _messages.IntegerField(6, variant=_messages.Variant.INT32) class TemplateList(_messages.Message): r"""Represents a list of templates for a given table. Fields: items: List of all requested templates. kind: Type name: a list of all templates. nextPageToken: Token used to access the next page of this result. No token is displayed if there are no more pages left. totalItems: Total number of templates for the table. """ items = _messages.MessageField('Template', 1, repeated=True) kind = _messages.StringField(2, default='fusiontables#templateList') nextPageToken = _messages.StringField(3) totalItems = _messages.IntegerField(4, variant=_messages.Variant.INT32) samples/fusiontables_sample/fusiontables_v1/__init__.py 0000644 00000000207 15025176453 0017473 0 ustar 00 """Package marker file.""" from __future__ import absolute_import import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) samples/iam_sample/iam_v1.json 0000644 00000152123 15025176453 0012402 0 ustar 00 { "kind": "discovery#restDescription", "discoveryVersion": "v1", "id": "iam:v1", "name": "iam", "canonicalName": "iam", "version": "v1", "revision": "0", "title": "Google Identity and Access Management (IAM) API", "description": "Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "http://www.google.com/images/icons/product/search-16.gif", "x32": "http://www.google.com/images/icons/product/search-32.gif" }, "documentationLink": "https://cloud.google.com/iam/", "protocol": "rest", "rootUrl": "https://iam.googleapis.com/", "servicePath": "", "baseUrl": "https://iam.googleapis.com/", "batchPath": "batch", "version_module": "True", "parameters": { "access_token": { "type": "string", "description": "OAuth access token.", "location": "query" }, "alt": { "type": "string", "description": "Data format for response.", "default": "json", "enum": [ "json", "media", "proto" ], "enumDescriptions": [ "Responses with Content-Type of application/json", "Media download with context-dependent Content-Type", "Responses with Content-Type of application/x-protobuf" ], "location": "query" }, "bearer_token": { "type": "string", "description": "OAuth bearer token.", "location": "query" }, "callback": { "type": "string", "description": "JSONP", "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "pp": { "type": "boolean", "description": "Pretty-print response.", "default": "true", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", "location": "query" }, "upload_protocol": { "type": "string", "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", "location": "query" }, "uploadType": { "type": "string", "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", "location": "query" }, "$.xgafv": { "type": "string", "description": "V1 error format.", "enum": [ "1", "2" ], "enumDescriptions": [ "v1 error format", "v2 error format" ], "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" } } } }, "schemas": { "ListServiceAccountsResponse": { "id": "ListServiceAccountsResponse", "description": "The service account list response.", "type": "object", "properties": { "accounts": { "description": "The list of matching service accounts.", "type": "array", "items": { "$ref": "ServiceAccount" } }, "nextPageToken": { "description": "To retrieve the next page of results, set\nListServiceAccountsRequest.page_token\nto this value.", "type": "string" } } }, "ServiceAccount": { "id": "ServiceAccount", "description": "A service account in the Identity and Access Management API.\n\nTo create a service account, specify the `project_id` and the `account_id`\nfor the account. The `account_id` is unique within the project, and is used\nto generate the service account email address and a stable\n`unique_id`.\n\nAll other methods can identify the service account using the format\n`projects\/{project}\/serviceAccounts\/{account}`.\nUsing `-` as a wildcard for the project will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "type": "object", "properties": { "name": { "description": "The resource name of the service account in the following format:\n`projects\/{project}\/serviceAccounts\/{account}`.\n\nRequests using `-` as a wildcard for the project will infer the project\nfrom the `account` and the `account` value can be the `email` address or\nthe `unique_id` of the service account.\n\nIn responses the resource name will always be in the format\n`projects\/{project}\/serviceAccounts\/{email}`.", "type": "string" }, "projectId": { "description": "@OutputOnly The id of the project that owns the service account.", "type": "string" }, "uniqueId": { "description": "@OutputOnly The unique and stable id of the service account.", "type": "string" }, "email": { "description": "@OutputOnly The email address of the service account.", "type": "string" }, "displayName": { "description": "Optional. A user-specified description of the service account. Must be\nfewer than 100 UTF-8 bytes.", "type": "string" }, "etag": { "description": "Used to perform a consistent read-modify-write.", "type": "string", "format": "byte" }, "description": { "description": "Optional. A user-specified opaque description of the service account.", "type": "string" }, "oauth2ClientId": { "description": "@OutputOnly. The OAuth2 client id for the service account.\nThis is used in conjunction with the OAuth2 clientconfig API to make\nthree legged OAuth2 (3LO) flows to access the data of Google users.", "type": "string" } } }, "CreateServiceAccountRequest": { "id": "CreateServiceAccountRequest", "description": "The service account create request.", "type": "object", "properties": { "accountId": { "description": "Required. The account id that is used to generate the service account\nemail address and a stable unique id. It is unique within a project,\nmust be 1-63 characters long, and match the regular expression\n`[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.", "type": "string" }, "serviceAccount": { "description": "The ServiceAccount resource to create.\nCurrently, only the following values are user assignable:\n`display_name` .", "$ref": "ServiceAccount" } } }, "Empty": { "id": "Empty", "description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.", "type": "object", "properties": { } }, "ListServiceAccountKeysResponse": { "id": "ListServiceAccountKeysResponse", "description": "The service account keys list response.", "type": "object", "properties": { "keys": { "description": "The public keys for the service account.", "type": "array", "items": { "$ref": "ServiceAccountKey" } } } }, "ServiceAccountKey": { "id": "ServiceAccountKey", "description": "Represents a service account key.\n\nA service account has two sets of key-pairs: user-managed, and\nsystem-managed.\n\nUser-managed key-pairs can be created and deleted by users. Users are\nresponsible for rotating these keys periodically to ensure security of\ntheir service accounts. Users retain the private key of these key-pairs,\nand Google retains ONLY the public key.\n\nSystem-managed key-pairs are managed automatically by Google, and rotated\ndaily without user intervention. The private key never leaves Google's\nservers to maximize security.\n\nPublic keys for all service accounts are also published at the OAuth2\nService Account API.", "type": "object", "properties": { "name": { "description": "The resource name of the service account key in the following format\n`projects\/{project}\/serviceAccounts\/{account}\/keys\/{key}`.", "type": "string" }, "privateKeyType": { "description": "The output format for the private key.\nOnly provided in `CreateServiceAccountKey` responses, not\nin `GetServiceAccountKey` or `ListServiceAccountKey` responses.\n\nGoogle never exposes system-managed private keys, and never retains\nuser-managed private keys.", "enumDescriptions": [ "Unspecified. Equivalent to `TYPE_GOOGLE_CREDENTIALS_FILE`.", "PKCS12 format.\nThe password for the PKCS12 file is `notasecret`.\nFor more information, see https:\/\/tools.ietf.org\/html\/rfc7292.", "Google Credentials File format." ], "type": "string", "enum": [ "TYPE_UNSPECIFIED", "TYPE_PKCS12_FILE", "TYPE_GOOGLE_CREDENTIALS_FILE" ] }, "privateKeyData": { "description": "The private key data. Only provided in `CreateServiceAccountKey`\nresponses.", "type": "string", "format": "byte" }, "publicKeyData": { "description": "The public key data. Only provided in `GetServiceAccountKey` responses.", "type": "string", "format": "byte" }, "validAfterTime": { "description": "The key can be used after this timestamp.", "type": "string", "format": "google-datetime" }, "validBeforeTime": { "description": "The key can be used before this timestamp.", "type": "string", "format": "google-datetime" } } }, "CreateServiceAccountKeyRequest": { "id": "CreateServiceAccountKeyRequest", "description": "The service account key create request.", "type": "object", "properties": { "privateKeyType": { "description": "The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the\ndefault output format.", "enumDescriptions": [ "Unspecified. Equivalent to `TYPE_GOOGLE_CREDENTIALS_FILE`.", "PKCS12 format.\nThe password for the PKCS12 file is `notasecret`.\nFor more information, see https:\/\/tools.ietf.org\/html\/rfc7292.", "Google Credentials File format." ], "type": "string", "enum": [ "TYPE_UNSPECIFIED", "TYPE_PKCS12_FILE", "TYPE_GOOGLE_CREDENTIALS_FILE" ] } } }, "SignBlobRequest": { "id": "SignBlobRequest", "description": "The service account sign blob request.", "type": "object", "properties": { "bytesToSign": { "description": "The bytes to sign.", "type": "string", "format": "byte" } } }, "SignBlobResponse": { "id": "SignBlobResponse", "description": "The service account sign blob response.", "type": "object", "properties": { "keyId": { "description": "The id of the key used to sign the blob.", "type": "string" }, "signature": { "description": "The signed blob.", "type": "string", "format": "byte" } } }, "SignJwtRequest": { "id": "SignJwtRequest", "description": "The service account sign JWT request.", "type": "object", "properties": { "payload": { "description": "The JWT payload to sign, a JSON JWT Claim set.", "type": "string" } } }, "SignJwtResponse": { "id": "SignJwtResponse", "description": "The service account sign JWT response.", "type": "object", "properties": { "keyId": { "description": "The id of the key used to sign the JWT.", "type": "string" }, "signedJwt": { "description": "The signed JWT.", "type": "string" } } }, "Policy": { "id": "Policy", "description": "Defines an Identity and Access Management (IAM) policy. It is used to\nspecify access control policies for Cloud Platform resources.\n\n\nA `Policy` consists of a list of `bindings`. A `Binding` binds a list of\n`members` to a `role`, where the members can be user accounts, Google groups,\nGoogle domains, and service accounts. A `role` is a named list of permissions\ndefined by IAM.\n\n**Example**\n\n {\n \"bindings\": [\n {\n \"role\": \"roles\/owner\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-other-app@appspot.gserviceaccount.com\",\n ]\n },\n {\n \"role\": \"roles\/viewer\",\n \"members\": [\"user:sean@example.com\"]\n }\n ]\n }\n\nFor a description of IAM and its features, see the\n[IAM developer's guide](https:\/\/cloud.google.com\/iam).", "type": "object", "properties": { "version": { "description": "Version of the `Policy`. The default version is 0.", "type": "integer", "format": "int32" }, "bindings": { "description": "Associates a list of `members` to a `role`.\nMultiple `bindings` must not be specified for the same `role`.\n`bindings` with no members will result in an error.", "type": "array", "items": { "$ref": "Binding" } }, "auditConfigs": { "description": "Specifies audit logging configs for \"data access\".\n\"data access\": generally refers to data reads\/writes and admin reads.\n\"admin activity\": generally refers to admin writes.\n\nNote: `AuditConfig` doesn't apply to \"admin activity\", which always\nenables audit logging.", "type": "array", "items": { "$ref": "AuditConfig" } }, "rules": { "description": "If more than one rule is specified, the rules are applied in the following\nmanner:\n- All matching LOG rules are always applied.\n- If any DENY\/DENY_WITH_LOG rule matches, permission is denied.\n Logging will be applied if one or more matching rule requires logging.\n- Otherwise, if any ALLOW\/ALLOW_WITH_LOG rule matches, permission is\n granted.\n Logging will be applied if one or more matching rule requires logging.\n- Otherwise, if no rule applies, permission is denied.", "type": "array", "items": { "$ref": "Rule" } }, "etag": { "description": "`etag` is used for optimistic concurrency control as a way to help\nprevent simultaneous updates of a policy from overwriting each other.\nIt is strongly suggested that systems make use of the `etag` in the\nread-modify-write cycle to perform policy updates in order to avoid race\nconditions: An `etag` is returned in the response to `getIamPolicy`, and\nsystems are expected to put that etag in the request to `setIamPolicy` to\nensure that their change will be applied to the same version of the policy.\n\nIf no `etag` is provided in the call to `setIamPolicy`, then the existing\npolicy is overwritten blindly.", "type": "string", "format": "byte" }, "iamOwned": { "type": "boolean" } } }, "Binding": { "id": "Binding", "description": "Associates `members` with a `role`.", "type": "object", "properties": { "role": { "description": "Role that is assigned to `members`.\nFor example, `roles\/viewer`, `roles\/editor`, or `roles\/owner`.\nRequired", "type": "string" }, "members": { "description": "Specifies the identities requesting access for a Cloud Platform resource.\n`members` can have the following values:\n\n* `allUsers`: A special identifier that represents anyone who is\n on the internet; with or without a Google account.\n\n* `allAuthenticatedUsers`: A special identifier that represents anyone\n who is authenticated with a Google account or a service account.\n\n* `user:{emailid}`: An email address that represents a specific Google\n account. For example, `alice@gmail.com` or `joe@example.com`.\n\n* `serviceAccount:{emailid}`: An email address that represents a service\n account. For example, `my-other-app@appspot.gserviceaccount.com`.\n\n* `group:{emailid}`: An email address that represents a Google group.\n For example, `admins@example.com`.\n\n* `domain:{domain}`: A Google Apps domain name that represents all the\n users of that domain. For example, `google.com` or `example.com`.\n\n\n", "type": "array", "items": { "type": "string" } } } }, "AuditConfig": { "id": "AuditConfig", "description": "Enables \"data access\" audit logging for a service and specifies a list\nof members that are log-exempted.", "type": "object", "properties": { "service": { "description": "Specifies a service that will be enabled for \"data access\" audit\nlogging.\nFor example, `resourcemanager`, `storage`, `compute`.\n`allServices` is a special value that covers all services.", "type": "string" }, "exemptedMembers": { "description": "Specifies the identities that are exempted from \"data access\" audit\nlogging for the `service` specified above.\nFollows the same format of Binding.members.", "type": "array", "items": { "type": "string" } } } }, "Rule": { "id": "Rule", "description": "A rule to be applied in a Policy.", "type": "object", "properties": { "description": { "description": "Human-readable description of the rule.", "type": "string" }, "permissions": { "description": "A permission is a string of form '<service>.<resource type>.<verb>'\n(e.g., 'storage.buckets.list'). A value of '*' matches all permissions,\nand a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.", "type": "array", "items": { "type": "string" } }, "action": { "description": "Required", "enumDescriptions": [ "Default no action.", "Matching 'Entries' grant access.", "Matching 'Entries' grant access and the caller promises to log\nthe request per the returned log_configs.", "Matching 'Entries' deny access.", "Matching 'Entries' deny access and the caller promises to log\nthe request per the returned log_configs.", "Matching 'Entries' tell IAM.Check callers to generate logs." ], "type": "string", "enum": [ "NO_ACTION", "ALLOW", "ALLOW_WITH_LOG", "DENY", "DENY_WITH_LOG", "LOG" ] }, "in": { "description": "If one or more 'in' clauses are specified, the rule matches if\nthe PRINCIPAL\/AUTHORITY_SELECTOR is in at least one of these entries.", "type": "array", "items": { "type": "string" } }, "notIn": { "description": "If one or more 'not_in' clauses are specified, the rule matches\nif the PRINCIPAL\/AUTHORITY_SELECTOR is in none of the entries.\nThe format for in and not_in entries is the same as for members in a\nBinding (see google\/iam\/v1\/policy.proto).", "type": "array", "items": { "type": "string" } }, "conditions": { "description": "Additional restrictions that must be met", "type": "array", "items": { "$ref": "Condition" } }, "logConfig": { "description": "The config returned to callers of tech.iam.IAM.CheckPolicy for any entries\nthat match the LOG action.", "type": "array", "items": { "$ref": "LogConfig" } } } }, "Condition": { "id": "Condition", "description": "A condition to be met.", "type": "object", "properties": { "iam": { "description": "Trusted attributes supplied by the IAM system.", "enumDescriptions": [ "Default non-attribute.", "Either principal or (if present) authority", "selector\nAlways the original principal, but making clear" ], "type": "string", "enum": [ "NO_ATTR", "AUTHORITY", "ATTRIBUTION" ] }, "sys": { "description": "Trusted attributes supplied by any service that owns resources and uses\nthe IAM system for access control.", "enumDescriptions": [ "Default non-attribute type", "Region of the resource", "Service name", "Resource name", "IP address of the caller" ], "type": "string", "enum": [ "NO_ATTR", "REGION", "SERVICE", "NAME", "IP" ] }, "svc": { "description": "Trusted attributes discharged by the service.", "type": "string" }, "op": { "description": "An operator to apply the subject with.", "enumDescriptions": [ "Default no-op.", "DEPRECATED. Use IN instead.", "DEPRECATED. Use NOT_IN instead.", "Set-inclusion check.", "Set-exclusion check.", "Subject is discharged" ], "type": "string", "enum": [ "NO_OP", "EQUALS", "NOT_EQUALS", "IN", "NOT_IN", "DISCHARGED" ] }, "value": { "description": "DEPRECATED. Use 'values' instead.", "type": "string" }, "values": { "description": "The objects of the condition. This is mutually exclusive with 'value'.", "type": "array", "items": { "type": "string" } } } }, "LogConfig": { "id": "LogConfig", "description": "Specifies what kind of log the caller must write\nIncrement a streamz counter with the specified metric and field names.\n\nMetric names should start with a '\/', generally be lowercase-only,\nand end in \"_count\". Field names should not contain an initial slash.\nThe actual exported metric names will have \"\/iam\/policy\" prepended.\n\nField names correspond to IAM request parameters and field values are\ntheir respective values.\n\nAt present the only supported field names are\n - \"iam_principal\", corresponding to IAMContext.principal;\n - \"\" (empty string), resulting in one aggretated counter with no field.\n\nExamples:\n counter { metric: \"\/debug_access_count\" field: \"iam_principal\" }\n ==> increment counter \/iam\/policy\/backend_debug_access_count\n {iam_principal=[value of IAMContext.principal]}\n\nAt this time we do not support:\n* multiple field names (though this may be supported in the future)\n* decrementing the counter\n* incrementing it by anything other than 1", "type": "object", "properties": { "counter": { "description": "Counter options.", "$ref": "CounterOptions" }, "dataAccess": { "description": "Data access options.", "$ref": "DataAccessOptions" }, "cloudAudit": { "description": "Cloud audit options.", "$ref": "CloudAuditOptions" } } }, "CounterOptions": { "id": "CounterOptions", "description": "Options for counters", "type": "object", "properties": { "metric": { "description": "The metric to update.", "type": "string" }, "field": { "description": "The field value to attribute.", "type": "string" } } }, "DataAccessOptions": { "id": "DataAccessOptions", "description": "Write a Data Access (Gin) log", "type": "object", "properties": { } }, "CloudAuditOptions": { "id": "CloudAuditOptions", "description": "Write a Cloud Audit log", "type": "object", "properties": { } }, "SetIamPolicyRequest": { "id": "SetIamPolicyRequest", "description": "Request message for `SetIamPolicy` method.", "type": "object", "properties": { "policy": { "description": "REQUIRED: The complete policy to be applied to the `resource`. The size of\nthe policy is limited to a few 10s of KB. An empty policy is a\nvalid policy but certain Cloud Platform services (such as Projects)\nmight reject them.", "$ref": "Policy" } } }, "TestIamPermissionsRequest": { "id": "TestIamPermissionsRequest", "description": "Request message for `TestIamPermissions` method.", "type": "object", "properties": { "permissions": { "description": "The set of permissions to check for the `resource`. Permissions with\nwildcards (such as '*' or 'storage.*') are not allowed. For more\ninformation see\nIAM Overview.", "type": "array", "items": { "type": "string" } } } }, "TestIamPermissionsResponse": { "id": "TestIamPermissionsResponse", "description": "Response message for `TestIamPermissions` method.", "type": "object", "properties": { "permissions": { "description": "A subset of `TestPermissionsRequest.permissions` that the caller is\nallowed.", "type": "array", "items": { "type": "string" } } } }, "QueryGrantableRolesRequest": { "id": "QueryGrantableRolesRequest", "description": "The grantable role query request.", "type": "object", "properties": { "fullResourceName": { "description": "Required. The full resource name to query from the list of grantable roles.\n\nThe name follows the Google Cloud Platform resource format.\nFor example, a Cloud Platform project with id `my-project` will be named\n`\/\/cloudresourcemanager.googleapis.com\/projects\/my-project`.", "type": "string" } } }, "QueryGrantableRolesResponse": { "id": "QueryGrantableRolesResponse", "description": "The grantable role query response.", "type": "object", "properties": { "roles": { "description": "The list of matching roles.", "type": "array", "items": { "$ref": "Role" } } } }, "Role": { "id": "Role", "description": "A role in the Identity and Access Management API.", "type": "object", "properties": { "name": { "description": "The name of the role.\n\nExamples of roles names are:\n`roles\/editor`, `roles\/viewer` and `roles\/logging.viewer`.", "type": "string" }, "title": { "description": "Optional. A human-readable title for the role. Typically this\nis limited to 100 UTF-8 bytes.", "type": "string" }, "description": { "description": "Optional. A human-readable description for the role.", "type": "string" }, "apiTokens": { "type": "array", "items": { "type": "string" } } } }, "GetPolicyDetailsRequest": { "id": "GetPolicyDetailsRequest", "description": "The request to get the current policy and the policies on the inherited\nresources the user has access to.", "type": "object", "properties": { "fullResourcePath": { "description": "REQUIRED: The full resource path of the current policy being\nrequested, e.g., `\/\/dataflow.googleapis.com\/projects\/..\/jobs\/..`.", "type": "string" }, "pageToken": { "description": "Optional pagination token returned in an earlier\nGetPolicyDetailsResponse.next_page_token\nresponse.", "type": "string" }, "pageSize": { "description": "Limit on the number of policies to include in the response.\nFurther accounts can subsequently be obtained by including the\nGetPolicyDetailsResponse.next_page_token\nin a subsequent request.\nIf zero, the default page size 20 will be used.\nMust be given a value in range [0, 100], otherwise an invalid argument\nerror will be returned.", "type": "integer", "format": "int32" } } }, "GetPolicyDetailsResponse": { "id": "GetPolicyDetailsResponse", "description": "The response to the `GetPolicyDetailsRequest` containing the current policy and\nthe policies on the inherited resources the user has access to.", "type": "object", "properties": { "policies": { "description": "The current policy and all the inherited policies the user has\naccess to.", "type": "array", "items": { "$ref": "PolicyDetail" } }, "nextPageToken": { "description": "To retrieve the next page of results, set\nGetPolicyDetailsRequest.page_token\nto this value.\nIf this value is empty, then there are not any further policies that the\nuser has access to.\nThe lifetime is 60 minutes. An \"Expired pagination token\" error will be\nreturned if exceeded.", "type": "string" } } }, "PolicyDetail": { "id": "PolicyDetail", "description": "A policy and its full resource path.", "type": "object", "properties": { "policy": { "description": "The policy of a `resource\/project\/folder`.", "$ref": "Policy" }, "fullResourcePath": { "description": "The full resource path of the policy\ne.g., `\/\/dataflow.googleapis.com\/projects\/..\/jobs\/..`.\nNote that a resource and its inherited resource have different\n`full_resource_path`.", "type": "string" } } } }, "resources": { "projects": { "resources": { "serviceAccounts": { "methods": { "list": { "id": "iam.projects.serviceAccounts.list", "path": "v1/{+name}/serviceAccounts", "flatPath": "v1/projects/{projectsId}/serviceAccounts", "httpMethod": "GET", "description": "Lists ServiceAccounts for a project.", "parameters": { "name": { "description": "Required. The resource name of the project associated with the service\naccounts, such as `projects\/my-project-123`.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*$", "type": "string" }, "pageSize": { "description": "Optional limit on the number of service accounts to include in the\nresponse. Further accounts can subsequently be obtained by including the\nListServiceAccountsResponse.next_page_token\nin a subsequent request.", "location": "query", "type": "integer", "format": "int32" }, "pageToken": { "description": "Optional pagination token returned in an earlier\nListServiceAccountsResponse.next_page_token.", "location": "query", "type": "string" }, "removeDeletedServiceAccounts": { "description": "Do not list service accounts deleted from Gaia.\n<b><font color=\"red\">DO NOT INCLUDE IN EXTERNAL DOCUMENTATION<\/font><\/b>.", "location": "query", "type": "boolean" } }, "parameterOrder": [ "name" ], "response": { "$ref": "ListServiceAccountsResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "get": { "id": "iam.projects.serviceAccounts.get", "path": "v1/{+name}", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}", "httpMethod": "GET", "description": "Gets a ServiceAccount.", "parameters": { "name": { "description": "The resource name of the service account in the following format:\n`projects\/{project}\/serviceAccounts\/{account}`.\nUsing `-` as a wildcard for the project will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "name" ], "response": { "$ref": "ServiceAccount" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "create": { "id": "iam.projects.serviceAccounts.create", "path": "v1/{+name}/serviceAccounts", "flatPath": "v1/projects/{projectsId}/serviceAccounts", "httpMethod": "POST", "description": "Creates a ServiceAccount\nand returns it.", "parameters": { "name": { "description": "Required. The resource name of the project associated with the service\naccounts, such as `projects\/my-project-123`.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "name" ], "request": { "$ref": "CreateServiceAccountRequest" }, "response": { "$ref": "ServiceAccount" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "update": { "id": "iam.projects.serviceAccounts.update", "path": "v1/{+name}", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}", "httpMethod": "PUT", "description": "Updates a ServiceAccount.\n\nCurrently, only the following fields are updatable:\n`display_name` .\nThe `etag` is mandatory.", "parameters": { "name": { "description": "The resource name of the service account in the following format:\n`projects\/{project}\/serviceAccounts\/{account}`.\n\nRequests using `-` as a wildcard for the project will infer the project\nfrom the `account` and the `account` value can be the `email` address or\nthe `unique_id` of the service account.\n\nIn responses the resource name will always be in the format\n`projects\/{project}\/serviceAccounts\/{email}`.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "name" ], "request": { "$ref": "ServiceAccount" }, "response": { "$ref": "ServiceAccount" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "delete": { "id": "iam.projects.serviceAccounts.delete", "path": "v1/{+name}", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}", "httpMethod": "DELETE", "description": "Deletes a ServiceAccount.", "parameters": { "name": { "description": "The resource name of the service account in the following format:\n`projects\/{project}\/serviceAccounts\/{account}`.\nUsing `-` as a wildcard for the project will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "name" ], "response": { "$ref": "Empty" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "signBlob": { "id": "iam.projects.serviceAccounts.signBlob", "path": "v1/{+name}:signBlob", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signBlob", "httpMethod": "POST", "description": "Signs a blob using a service account's system-managed private key.", "parameters": { "name": { "description": "The resource name of the service account in the following format:\n`projects\/{project}\/serviceAccounts\/{account}`.\nUsing `-` as a wildcard for the project will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "name" ], "request": { "$ref": "SignBlobRequest" }, "response": { "$ref": "SignBlobResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "signJwt": { "id": "iam.projects.serviceAccounts.signJwt", "path": "v1/{+name}:signJwt", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signJwt", "httpMethod": "POST", "description": "Signs a JWT using a service account's system-managed private key.\n\nIf no `exp` (expiry) time is contained in the claims, we will\nprovide an expiry of one hour in the future. If an expiry\nof more than one hour in the future is requested, the request\nwill fail.", "parameters": { "name": { "description": "The resource name of the service account in the following format:\n`projects\/{project}\/serviceAccounts\/{account}`.\nUsing `-` as a wildcard for the project will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "name" ], "request": { "$ref": "SignJwtRequest" }, "response": { "$ref": "SignJwtResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "getIamPolicy": { "id": "iam.projects.serviceAccounts.getIamPolicy", "path": "v1/{+resource}:getIamPolicy", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:getIamPolicy", "httpMethod": "POST", "description": "Returns the IAM access control policy for specified IAM resource.", "parameters": { "resource": { "description": "REQUIRED: The resource for which the policy is being requested.\n`resource` is usually specified as a path, such as\n`projects\/*project*\/zones\/*zone*\/disks\/*disk*`.\n\nThe format for the path specified in this value is resource specific and\nis specified in the `getIamPolicy` documentation.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" }, "options.requestedPolicyVersion": { "description": "Optional. The policy format version to be returned.\nAcceptable values are 0 and 1.\nIf the value is 0, or the field is omitted, policy format version 1 will be\nreturned.", "location": "query", "type": "integer", "format": "int32" } }, "parameterOrder": [ "resource" ], "response": { "$ref": "Policy" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "setIamPolicy": { "id": "iam.projects.serviceAccounts.setIamPolicy", "path": "v1/{+resource}:setIamPolicy", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:setIamPolicy", "httpMethod": "POST", "description": "Sets the IAM access control policy for the specified IAM resource.", "parameters": { "resource": { "description": "REQUIRED: The resource for which the policy is being specified.\n`resource` is usually specified as a path, such as\n`projects\/*project*\/zones\/*zone*\/disks\/*disk*`.\n\nThe format for the path specified in this value is resource specific and\nis specified in the `setIamPolicy` documentation.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "resource" ], "request": { "$ref": "SetIamPolicyRequest" }, "response": { "$ref": "Policy" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "testIamPermissions": { "id": "iam.projects.serviceAccounts.testIamPermissions", "path": "v1/{+resource}:testIamPermissions", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:testIamPermissions", "httpMethod": "POST", "description": "Tests the specified permissions against the IAM access control policy\nfor the specified IAM resource.", "parameters": { "resource": { "description": "REQUIRED: The resource for which the policy detail is being requested.\n`resource` is usually specified as a path, such as\n`projects\/*project*\/zones\/*zone*\/disks\/*disk*`.\n\nThe format for the path specified in this value is resource specific and\nis specified in the `testIamPermissions` documentation.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "resource" ], "request": { "$ref": "TestIamPermissionsRequest" }, "response": { "$ref": "TestIamPermissionsResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] } } , "resources": { "keys": { "methods": { "list": { "id": "iam.projects.serviceAccounts.keys.list", "path": "v1/{+name}/keys", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys", "httpMethod": "GET", "description": "Lists ServiceAccountKeys.", "parameters": { "name": { "description": "The resource name of the service account in the following format:\n`projects\/{project}\/serviceAccounts\/{account}`.\n\nUsing `-` as a wildcard for the project, will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" }, "keyTypes": { "description": "Filters the types of keys the user wants to include in the list\nresponse. Duplicate key types are not allowed. If no key type\nis provided, all keys are returned.", "location": "query", "repeated": true, "type": "string", "enum": [ "KEY_TYPE_UNSPECIFIED", "USER_MANAGED", "SYSTEM_MANAGED" ] } }, "parameterOrder": [ "name" ], "response": { "$ref": "ListServiceAccountKeysResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "get": { "id": "iam.projects.serviceAccounts.keys.get", "path": "v1/{+name}", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}", "httpMethod": "GET", "description": "Gets the ServiceAccountKey\nby key id.", "parameters": { "name": { "description": "The resource name of the service account key in the following format:\n`projects\/{project}\/serviceAccounts\/{account}\/keys\/{key}`.\n\nUsing `-` as a wildcard for the project will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*\/keys\/[^\/]*$", "type": "string" }, "publicKeyType": { "description": "The output format of the public key requested.\nX509_PEM is the default output format.", "location": "query", "type": "string", "enum": [ "TYPE_NONE", "TYPE_X509_PEM_FILE", "TYPE_RAW_PUBLIC_KEY" ] } }, "parameterOrder": [ "name" ], "response": { "$ref": "ServiceAccountKey" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "create": { "id": "iam.projects.serviceAccounts.keys.create", "path": "v1/{+name}/keys", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys", "httpMethod": "POST", "description": "Creates a ServiceAccountKey\nand returns it.", "parameters": { "name": { "description": "The resource name of the service account in the following format:\n`projects\/{project}\/serviceAccounts\/{account}`.\nUsing `-` as a wildcard for the project will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "name" ], "request": { "$ref": "CreateServiceAccountKeyRequest" }, "response": { "$ref": "ServiceAccountKey" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] }, "delete": { "id": "iam.projects.serviceAccounts.keys.delete", "path": "v1/{+name}", "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}", "httpMethod": "DELETE", "description": "Deletes a ServiceAccountKey.", "parameters": { "name": { "description": "The resource name of the service account key in the following format:\n`projects\/{project}\/serviceAccounts\/{account}\/keys\/{key}`.\nUsing `-` as a wildcard for the project will infer the project from\nthe account. The `account` value can be the `email` address or the\n`unique_id` of the service account.", "location": "path", "required": true, "pattern": "^projects\/[^\/]*\/serviceAccounts\/[^\/]*\/keys\/[^\/]*$", "type": "string" } }, "parameterOrder": [ "name" ], "response": { "$ref": "Empty" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] } } } } } } }, "roles": { "methods": { "queryGrantableRoles": { "id": "iam.roles.queryGrantableRoles", "path": "v1/roles:queryGrantableRoles", "flatPath": "v1/roles:queryGrantableRoles", "httpMethod": "POST", "description": "Queries roles that can be granted on a particular resource.", "parameters": { }, "parameterOrder": [ ], "request": { "$ref": "QueryGrantableRolesRequest" }, "response": { "$ref": "QueryGrantableRolesResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] } } }, "iamPolicies": { "methods": { "getPolicyDetails": { "id": "iam.iamPolicies.getPolicyDetails", "path": "v1/iamPolicies:getPolicyDetails", "flatPath": "v1/iamPolicies:getPolicyDetails", "httpMethod": "POST", "description": "Returns the current IAM policy and the policies on the inherited resources\nthat the user has access to.", "parameters": { }, "parameterOrder": [ ], "request": { "$ref": "GetPolicyDetailsRequest" }, "response": { "$ref": "GetPolicyDetailsResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform" ] } } } }, "basePath": "" } samples/iam_sample/iam_client_test.py 0000644 00000005475 15025176453 0014057 0 ustar 00 # # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test for generated sample module.""" import unittest import six from apitools.base.py.testing import mock from samples.iam_sample.iam_v1 import iam_v1_client # nopep8 from samples.iam_sample.iam_v1 import iam_v1_messages # nopep8 class DnsGenClientSanityTest(unittest.TestCase): def testBaseUrl(self): self.assertEqual(u'https://iam.googleapis.com/', iam_v1_client.IamV1.BASE_URL) def testMessagesModule(self): self.assertEqual(iam_v1_messages, iam_v1_client.IamV1.MESSAGES_MODULE) def testAttributes(self): inner_classes = set([]) for key, value in iam_v1_client.IamV1.__dict__.items(): if isinstance(value, six.class_types): inner_classes.add(key) self.assertEqual(set([ 'IamPoliciesService', 'ProjectsService', 'ProjectsServiceAccountsKeysService', 'ProjectsServiceAccountsService', 'RolesService']), inner_classes) class IamGenClientTest(unittest.TestCase): def setUp(self): self.mocked_iam_v1 = mock.Client(iam_v1_client.IamV1) self.mocked_iam_v1.Mock() self.addCleanup(self.mocked_iam_v1.Unmock) def testFlatPath(self): get_method_config = (self.mocked_iam_v1.projects_serviceAccounts_keys .GetMethodConfig('Get')) self.assertEqual('v1/projects/{projectsId}/serviceAccounts' '/{serviceAccountsId}/keys/{keysId}', get_method_config.flat_path) self.assertEqual('v1/{+name}', get_method_config.relative_path) def testServiceAccountsKeysList(self): response_key = iam_v1_messages.ServiceAccountKey( name=u'test-key') self.mocked_iam_v1.projects_serviceAccounts_keys.List.Expect( iam_v1_messages.IamProjectsServiceAccountsKeysListRequest( name=u'test-service-account.'), iam_v1_messages.ListServiceAccountKeysResponse( keys=[response_key])) result = self.mocked_iam_v1.projects_serviceAccounts_keys.List( iam_v1_messages.IamProjectsServiceAccountsKeysListRequest( name=u'test-service-account.')) self.assertEqual([response_key], result.keys) samples/iam_sample/iam_v1/iam_v1_client.py 0000644 00000047455 15025176453 0014606 0 ustar 00 """Generated client library for iam version v1.""" # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.py import base_api from samples.iam_sample.iam_v1 import iam_v1_messages as messages class IamV1(base_api.BaseApiClient): """Generated client library for service iam version v1.""" MESSAGES_MODULE = messages BASE_URL = 'https://iam.googleapis.com/' MTLS_BASE_URL = '' _PACKAGE = 'iam' _SCOPES = ['https://www.googleapis.com/auth/cloud-platform'] _VERSION = 'v1' _CLIENT_ID = 'CLIENT_ID' _CLIENT_SECRET = 'CLIENT_SECRET' _USER_AGENT = 'x_Tw5K8nnjoRAqULM9PFAC2b' _CLIENT_CLASS_NAME = 'IamV1' _URL_VERSION = 'v1' _API_KEY = None def __init__(self, url='', credentials=None, get_credentials=True, http=None, model=None, log_request=False, log_response=False, credentials_args=None, default_global_params=None, additional_http_headers=None, response_encoding=None): """Create a new iam handle.""" url = url or self.BASE_URL super(IamV1, self).__init__( url, credentials=credentials, get_credentials=get_credentials, http=http, model=model, log_request=log_request, log_response=log_response, credentials_args=credentials_args, default_global_params=default_global_params, additional_http_headers=additional_http_headers, response_encoding=response_encoding) self.iamPolicies = self.IamPoliciesService(self) self.projects_serviceAccounts_keys = self.ProjectsServiceAccountsKeysService(self) self.projects_serviceAccounts = self.ProjectsServiceAccountsService(self) self.projects = self.ProjectsService(self) self.roles = self.RolesService(self) class IamPoliciesService(base_api.BaseApiService): """Service class for the iamPolicies resource.""" _NAME = 'iamPolicies' def __init__(self, client): super(IamV1.IamPoliciesService, self).__init__(client) self._upload_configs = { } def GetPolicyDetails(self, request, global_params=None): r"""Returns the current IAM policy and the policies on the inherited resources. that the user has access to. Args: request: (GetPolicyDetailsRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (GetPolicyDetailsResponse) The response message. """ config = self.GetMethodConfig('GetPolicyDetails') return self._RunMethod( config, request, global_params=global_params) GetPolicyDetails.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='iam.iamPolicies.getPolicyDetails', ordered_params=[], path_params=[], query_params=[], relative_path='v1/iamPolicies:getPolicyDetails', request_field='<request>', request_type_name='GetPolicyDetailsRequest', response_type_name='GetPolicyDetailsResponse', supports_download=False, ) class ProjectsServiceAccountsKeysService(base_api.BaseApiService): """Service class for the projects_serviceAccounts_keys resource.""" _NAME = 'projects_serviceAccounts_keys' def __init__(self, client): super(IamV1.ProjectsServiceAccountsKeysService, self).__init__(client) self._upload_configs = { } def Create(self, request, global_params=None): r"""Creates a ServiceAccountKey. and returns it. Args: request: (IamProjectsServiceAccountsKeysCreateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ServiceAccountKey) The response message. """ config = self.GetMethodConfig('Create') return self._RunMethod( config, request, global_params=global_params) Create.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys', http_method='POST', method_id='iam.projects.serviceAccounts.keys.create', ordered_params=['name'], path_params=['name'], query_params=[], relative_path='v1/{+name}/keys', request_field='createServiceAccountKeyRequest', request_type_name='IamProjectsServiceAccountsKeysCreateRequest', response_type_name='ServiceAccountKey', supports_download=False, ) def Delete(self, request, global_params=None): r"""Deletes a ServiceAccountKey. Args: request: (IamProjectsServiceAccountsKeysDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Empty) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}', http_method='DELETE', method_id='iam.projects.serviceAccounts.keys.delete', ordered_params=['name'], path_params=['name'], query_params=[], relative_path='v1/{+name}', request_field='', request_type_name='IamProjectsServiceAccountsKeysDeleteRequest', response_type_name='Empty', supports_download=False, ) def Get(self, request, global_params=None): r"""Gets the ServiceAccountKey. by key id. Args: request: (IamProjectsServiceAccountsKeysGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ServiceAccountKey) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}', http_method='GET', method_id='iam.projects.serviceAccounts.keys.get', ordered_params=['name'], path_params=['name'], query_params=['publicKeyType'], relative_path='v1/{+name}', request_field='', request_type_name='IamProjectsServiceAccountsKeysGetRequest', response_type_name='ServiceAccountKey', supports_download=False, ) def List(self, request, global_params=None): r"""Lists ServiceAccountKeys. Args: request: (IamProjectsServiceAccountsKeysListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ListServiceAccountKeysResponse) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys', http_method='GET', method_id='iam.projects.serviceAccounts.keys.list', ordered_params=['name'], path_params=['name'], query_params=['keyTypes'], relative_path='v1/{+name}/keys', request_field='', request_type_name='IamProjectsServiceAccountsKeysListRequest', response_type_name='ListServiceAccountKeysResponse', supports_download=False, ) class ProjectsServiceAccountsService(base_api.BaseApiService): """Service class for the projects_serviceAccounts resource.""" _NAME = 'projects_serviceAccounts' def __init__(self, client): super(IamV1.ProjectsServiceAccountsService, self).__init__(client) self._upload_configs = { } def Create(self, request, global_params=None): r"""Creates a ServiceAccount. and returns it. Args: request: (IamProjectsServiceAccountsCreateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ServiceAccount) The response message. """ config = self.GetMethodConfig('Create') return self._RunMethod( config, request, global_params=global_params) Create.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts', http_method='POST', method_id='iam.projects.serviceAccounts.create', ordered_params=['name'], path_params=['name'], query_params=[], relative_path='v1/{+name}/serviceAccounts', request_field='createServiceAccountRequest', request_type_name='IamProjectsServiceAccountsCreateRequest', response_type_name='ServiceAccount', supports_download=False, ) def Delete(self, request, global_params=None): r"""Deletes a ServiceAccount. Args: request: (IamProjectsServiceAccountsDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Empty) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}', http_method='DELETE', method_id='iam.projects.serviceAccounts.delete', ordered_params=['name'], path_params=['name'], query_params=[], relative_path='v1/{+name}', request_field='', request_type_name='IamProjectsServiceAccountsDeleteRequest', response_type_name='Empty', supports_download=False, ) def Get(self, request, global_params=None): r"""Gets a ServiceAccount. Args: request: (IamProjectsServiceAccountsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ServiceAccount) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}', http_method='GET', method_id='iam.projects.serviceAccounts.get', ordered_params=['name'], path_params=['name'], query_params=[], relative_path='v1/{+name}', request_field='', request_type_name='IamProjectsServiceAccountsGetRequest', response_type_name='ServiceAccount', supports_download=False, ) def GetIamPolicy(self, request, global_params=None): r"""Returns the IAM access control policy for specified IAM resource. Args: request: (IamProjectsServiceAccountsGetIamPolicyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Policy) The response message. """ config = self.GetMethodConfig('GetIamPolicy') return self._RunMethod( config, request, global_params=global_params) GetIamPolicy.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:getIamPolicy', http_method='POST', method_id='iam.projects.serviceAccounts.getIamPolicy', ordered_params=['resource'], path_params=['resource'], query_params=['options_requestedPolicyVersion'], relative_path='v1/{+resource}:getIamPolicy', request_field='', request_type_name='IamProjectsServiceAccountsGetIamPolicyRequest', response_type_name='Policy', supports_download=False, ) def List(self, request, global_params=None): r"""Lists ServiceAccounts for a project. Args: request: (IamProjectsServiceAccountsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ListServiceAccountsResponse) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts', http_method='GET', method_id='iam.projects.serviceAccounts.list', ordered_params=['name'], path_params=['name'], query_params=['pageSize', 'pageToken', 'removeDeletedServiceAccounts'], relative_path='v1/{+name}/serviceAccounts', request_field='', request_type_name='IamProjectsServiceAccountsListRequest', response_type_name='ListServiceAccountsResponse', supports_download=False, ) def SetIamPolicy(self, request, global_params=None): r"""Sets the IAM access control policy for the specified IAM resource. Args: request: (IamProjectsServiceAccountsSetIamPolicyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Policy) The response message. """ config = self.GetMethodConfig('SetIamPolicy') return self._RunMethod( config, request, global_params=global_params) SetIamPolicy.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:setIamPolicy', http_method='POST', method_id='iam.projects.serviceAccounts.setIamPolicy', ordered_params=['resource'], path_params=['resource'], query_params=[], relative_path='v1/{+resource}:setIamPolicy', request_field='setIamPolicyRequest', request_type_name='IamProjectsServiceAccountsSetIamPolicyRequest', response_type_name='Policy', supports_download=False, ) def SignBlob(self, request, global_params=None): r"""Signs a blob using a service account's system-managed private key. Args: request: (IamProjectsServiceAccountsSignBlobRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (SignBlobResponse) The response message. """ config = self.GetMethodConfig('SignBlob') return self._RunMethod( config, request, global_params=global_params) SignBlob.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signBlob', http_method='POST', method_id='iam.projects.serviceAccounts.signBlob', ordered_params=['name'], path_params=['name'], query_params=[], relative_path='v1/{+name}:signBlob', request_field='signBlobRequest', request_type_name='IamProjectsServiceAccountsSignBlobRequest', response_type_name='SignBlobResponse', supports_download=False, ) def SignJwt(self, request, global_params=None): r"""Signs a JWT using a service account's system-managed private key. If no `exp` (expiry) time is contained in the claims, we will provide an expiry of one hour in the future. If an expiry of more than one hour in the future is requested, the request will fail. Args: request: (IamProjectsServiceAccountsSignJwtRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (SignJwtResponse) The response message. """ config = self.GetMethodConfig('SignJwt') return self._RunMethod( config, request, global_params=global_params) SignJwt.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signJwt', http_method='POST', method_id='iam.projects.serviceAccounts.signJwt', ordered_params=['name'], path_params=['name'], query_params=[], relative_path='v1/{+name}:signJwt', request_field='signJwtRequest', request_type_name='IamProjectsServiceAccountsSignJwtRequest', response_type_name='SignJwtResponse', supports_download=False, ) def TestIamPermissions(self, request, global_params=None): r"""Tests the specified permissions against the IAM access control policy. for the specified IAM resource. Args: request: (IamProjectsServiceAccountsTestIamPermissionsRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (TestIamPermissionsResponse) The response message. """ config = self.GetMethodConfig('TestIamPermissions') return self._RunMethod( config, request, global_params=global_params) TestIamPermissions.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:testIamPermissions', http_method='POST', method_id='iam.projects.serviceAccounts.testIamPermissions', ordered_params=['resource'], path_params=['resource'], query_params=[], relative_path='v1/{+resource}:testIamPermissions', request_field='testIamPermissionsRequest', request_type_name='IamProjectsServiceAccountsTestIamPermissionsRequest', response_type_name='TestIamPermissionsResponse', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates a ServiceAccount. Currently, only the following fields are updatable: `display_name` . The `etag` is mandatory. Args: request: (ServiceAccount) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ServiceAccount) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( flat_path='v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}', http_method='PUT', method_id='iam.projects.serviceAccounts.update', ordered_params=['name'], path_params=['name'], query_params=[], relative_path='v1/{+name}', request_field='<request>', request_type_name='ServiceAccount', response_type_name='ServiceAccount', supports_download=False, ) class ProjectsService(base_api.BaseApiService): """Service class for the projects resource.""" _NAME = 'projects' def __init__(self, client): super(IamV1.ProjectsService, self).__init__(client) self._upload_configs = { } class RolesService(base_api.BaseApiService): """Service class for the roles resource.""" _NAME = 'roles' def __init__(self, client): super(IamV1.RolesService, self).__init__(client) self._upload_configs = { } def QueryGrantableRoles(self, request, global_params=None): r"""Queries roles that can be granted on a particular resource. Args: request: (QueryGrantableRolesRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (QueryGrantableRolesResponse) The response message. """ config = self.GetMethodConfig('QueryGrantableRoles') return self._RunMethod( config, request, global_params=global_params) QueryGrantableRoles.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='iam.roles.queryGrantableRoles', ordered_params=[], path_params=[], query_params=[], relative_path='v1/roles:queryGrantableRoles', request_field='<request>', request_type_name='QueryGrantableRolesRequest', response_type_name='QueryGrantableRolesResponse', supports_download=False, ) samples/iam_sample/iam_v1/iam_v1_messages.py 0000644 00000111557 15025176453 0015132 0 ustar 00 """Generated message classes for iam version v1. Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls. """ # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.protorpclite import messages as _messages from apitools.base.py import encoding package = 'iam' class AuditConfig(_messages.Message): r"""Enables "data access" audit logging for a service and specifies a list of members that are log-exempted. Fields: exemptedMembers: Specifies the identities that are exempted from "data access" audit logging for the `service` specified above. Follows the same format of Binding.members. service: Specifies a service that will be enabled for "data access" audit logging. For example, `resourcemanager`, `storage`, `compute`. `allServices` is a special value that covers all services. """ exemptedMembers = _messages.StringField(1, repeated=True) service = _messages.StringField(2) class Binding(_messages.Message): r"""Associates `members` with a `role`. Fields: members: Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`. * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other- app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`. role: Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. Required """ members = _messages.StringField(1, repeated=True) role = _messages.StringField(2) class CloudAuditOptions(_messages.Message): r"""Write a Cloud Audit log""" class Condition(_messages.Message): r"""A condition to be met. Enums: IamValueValuesEnum: Trusted attributes supplied by the IAM system. OpValueValuesEnum: An operator to apply the subject with. SysValueValuesEnum: Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. Fields: iam: Trusted attributes supplied by the IAM system. op: An operator to apply the subject with. svc: Trusted attributes discharged by the service. sys: Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. value: DEPRECATED. Use 'values' instead. values: The objects of the condition. This is mutually exclusive with 'value'. """ class IamValueValuesEnum(_messages.Enum): r"""Trusted attributes supplied by the IAM system. Values: NO_ATTR: Default non-attribute. AUTHORITY: Either principal or (if present) authority ATTRIBUTION: selector Always the original principal, but making clear """ NO_ATTR = 0 AUTHORITY = 1 ATTRIBUTION = 2 class OpValueValuesEnum(_messages.Enum): r"""An operator to apply the subject with. Values: NO_OP: Default no-op. EQUALS: DEPRECATED. Use IN instead. NOT_EQUALS: DEPRECATED. Use NOT_IN instead. IN: Set-inclusion check. NOT_IN: Set-exclusion check. DISCHARGED: Subject is discharged """ NO_OP = 0 EQUALS = 1 NOT_EQUALS = 2 IN = 3 NOT_IN = 4 DISCHARGED = 5 class SysValueValuesEnum(_messages.Enum): r"""Trusted attributes supplied by any service that owns resources and uses the IAM system for access control. Values: NO_ATTR: Default non-attribute type REGION: Region of the resource SERVICE: Service name NAME: Resource name IP: IP address of the caller """ NO_ATTR = 0 REGION = 1 SERVICE = 2 NAME = 3 IP = 4 iam = _messages.EnumField('IamValueValuesEnum', 1) op = _messages.EnumField('OpValueValuesEnum', 2) svc = _messages.StringField(3) sys = _messages.EnumField('SysValueValuesEnum', 4) value = _messages.StringField(5) values = _messages.StringField(6, repeated=True) class CounterOptions(_messages.Message): r"""Options for counters Fields: field: The field value to attribute. metric: The metric to update. """ field = _messages.StringField(1) metric = _messages.StringField(2) class CreateServiceAccountKeyRequest(_messages.Message): r"""The service account key create request. Enums: PrivateKeyTypeValueValuesEnum: The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the default output format. Fields: privateKeyType: The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the default output format. """ class PrivateKeyTypeValueValuesEnum(_messages.Enum): r"""The output format of the private key. `GOOGLE_CREDENTIALS_FILE` is the default output format. Values: TYPE_UNSPECIFIED: Unspecified. Equivalent to `TYPE_GOOGLE_CREDENTIALS_FILE`. TYPE_PKCS12_FILE: PKCS12 format. The password for the PKCS12 file is `notasecret`. For more information, see https://tools.ietf.org/html/rfc7292. TYPE_GOOGLE_CREDENTIALS_FILE: Google Credentials File format. """ TYPE_UNSPECIFIED = 0 TYPE_PKCS12_FILE = 1 TYPE_GOOGLE_CREDENTIALS_FILE = 2 privateKeyType = _messages.EnumField('PrivateKeyTypeValueValuesEnum', 1) class CreateServiceAccountRequest(_messages.Message): r"""The service account create request. Fields: accountId: Required. The account id that is used to generate the service account email address and a stable unique id. It is unique within a project, must be 1-63 characters long, and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035. serviceAccount: The ServiceAccount resource to create. Currently, only the following values are user assignable: `display_name` . """ accountId = _messages.StringField(1) serviceAccount = _messages.MessageField('ServiceAccount', 2) class DataAccessOptions(_messages.Message): r"""Write a Data Access (Gin) log""" class Empty(_messages.Message): r"""A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`. """ class GetPolicyDetailsRequest(_messages.Message): r"""The request to get the current policy and the policies on the inherited resources the user has access to. Fields: fullResourcePath: REQUIRED: The full resource path of the current policy being requested, e.g., `//dataflow.googleapis.com/projects/../jobs/..`. pageSize: Limit on the number of policies to include in the response. Further accounts can subsequently be obtained by including the GetPolicyDetailsResponse.next_page_token in a subsequent request. If zero, the default page size 20 will be used. Must be given a value in range [0, 100], otherwise an invalid argument error will be returned. pageToken: Optional pagination token returned in an earlier GetPolicyDetailsResponse.next_page_token response. """ fullResourcePath = _messages.StringField(1) pageSize = _messages.IntegerField(2, variant=_messages.Variant.INT32) pageToken = _messages.StringField(3) class GetPolicyDetailsResponse(_messages.Message): r"""The response to the `GetPolicyDetailsRequest` containing the current policy and the policies on the inherited resources the user has access to. Fields: nextPageToken: To retrieve the next page of results, set GetPolicyDetailsRequest.page_token to this value. If this value is empty, then there are not any further policies that the user has access to. The lifetime is 60 minutes. An "Expired pagination token" error will be returned if exceeded. policies: The current policy and all the inherited policies the user has access to. """ nextPageToken = _messages.StringField(1) policies = _messages.MessageField('PolicyDetail', 2, repeated=True) class IamProjectsServiceAccountsCreateRequest(_messages.Message): r"""A IamProjectsServiceAccountsCreateRequest object. Fields: createServiceAccountRequest: A CreateServiceAccountRequest resource to be passed as the request body. name: Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`. """ createServiceAccountRequest = _messages.MessageField('CreateServiceAccountRequest', 1) name = _messages.StringField(2, required=True) class IamProjectsServiceAccountsDeleteRequest(_messages.Message): r"""A IamProjectsServiceAccountsDeleteRequest object. Fields: name: The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. """ name = _messages.StringField(1, required=True) class IamProjectsServiceAccountsGetIamPolicyRequest(_messages.Message): r"""A IamProjectsServiceAccountsGetIamPolicyRequest object. Fields: options_requestedPolicyVersion: Optional. The policy format version to be returned. Acceptable values are 0 and 1. If the value is 0, or the field is omitted, policy format version 1 will be returned. resource: REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `getIamPolicy` documentation. """ options_requestedPolicyVersion = _messages.IntegerField(1, variant=_messages.Variant.INT32) resource = _messages.StringField(2, required=True) class IamProjectsServiceAccountsGetRequest(_messages.Message): r"""A IamProjectsServiceAccountsGetRequest object. Fields: name: The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. """ name = _messages.StringField(1, required=True) class IamProjectsServiceAccountsKeysCreateRequest(_messages.Message): r"""A IamProjectsServiceAccountsKeysCreateRequest object. Fields: createServiceAccountKeyRequest: A CreateServiceAccountKeyRequest resource to be passed as the request body. name: The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. """ createServiceAccountKeyRequest = _messages.MessageField('CreateServiceAccountKeyRequest', 1) name = _messages.StringField(2, required=True) class IamProjectsServiceAccountsKeysDeleteRequest(_messages.Message): r"""A IamProjectsServiceAccountsKeysDeleteRequest object. Fields: name: The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. """ name = _messages.StringField(1, required=True) class IamProjectsServiceAccountsKeysGetRequest(_messages.Message): r"""A IamProjectsServiceAccountsKeysGetRequest object. Enums: PublicKeyTypeValueValuesEnum: The output format of the public key requested. X509_PEM is the default output format. Fields: name: The resource name of the service account key in the following format: `projects/{project}/serviceAccounts/{account}/keys/{key}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. publicKeyType: The output format of the public key requested. X509_PEM is the default output format. """ class PublicKeyTypeValueValuesEnum(_messages.Enum): r"""The output format of the public key requested. X509_PEM is the default output format. Values: TYPE_NONE: <no description> TYPE_X509_PEM_FILE: <no description> TYPE_RAW_PUBLIC_KEY: <no description> """ TYPE_NONE = 0 TYPE_X509_PEM_FILE = 1 TYPE_RAW_PUBLIC_KEY = 2 name = _messages.StringField(1, required=True) publicKeyType = _messages.EnumField('PublicKeyTypeValueValuesEnum', 2) class IamProjectsServiceAccountsKeysListRequest(_messages.Message): r"""A IamProjectsServiceAccountsKeysListRequest object. Enums: KeyTypesValueValuesEnum: Filters the types of keys the user wants to include in the list response. Duplicate key types are not allowed. If no key type is provided, all keys are returned. Fields: keyTypes: Filters the types of keys the user wants to include in the list response. Duplicate key types are not allowed. If no key type is provided, all keys are returned. name: The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project, will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. """ class KeyTypesValueValuesEnum(_messages.Enum): r"""Filters the types of keys the user wants to include in the list response. Duplicate key types are not allowed. If no key type is provided, all keys are returned. Values: KEY_TYPE_UNSPECIFIED: <no description> USER_MANAGED: <no description> SYSTEM_MANAGED: <no description> """ KEY_TYPE_UNSPECIFIED = 0 USER_MANAGED = 1 SYSTEM_MANAGED = 2 keyTypes = _messages.EnumField('KeyTypesValueValuesEnum', 1, repeated=True) name = _messages.StringField(2, required=True) class IamProjectsServiceAccountsListRequest(_messages.Message): r"""A IamProjectsServiceAccountsListRequest object. Fields: name: Required. The resource name of the project associated with the service accounts, such as `projects/my-project-123`. pageSize: Optional limit on the number of service accounts to include in the response. Further accounts can subsequently be obtained by including the ListServiceAccountsResponse.next_page_token in a subsequent request. pageToken: Optional pagination token returned in an earlier ListServiceAccountsResponse.next_page_token. removeDeletedServiceAccounts: Do not list service accounts deleted from Gaia. <b><font color="red">DO NOT INCLUDE IN EXTERNAL DOCUMENTATION</font></b>. """ name = _messages.StringField(1, required=True) pageSize = _messages.IntegerField(2, variant=_messages.Variant.INT32) pageToken = _messages.StringField(3) removeDeletedServiceAccounts = _messages.BooleanField(4) class IamProjectsServiceAccountsSetIamPolicyRequest(_messages.Message): r"""A IamProjectsServiceAccountsSetIamPolicyRequest object. Fields: resource: REQUIRED: The resource for which the policy is being specified. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `setIamPolicy` documentation. setIamPolicyRequest: A SetIamPolicyRequest resource to be passed as the request body. """ resource = _messages.StringField(1, required=True) setIamPolicyRequest = _messages.MessageField('SetIamPolicyRequest', 2) class IamProjectsServiceAccountsSignBlobRequest(_messages.Message): r"""A IamProjectsServiceAccountsSignBlobRequest object. Fields: name: The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. signBlobRequest: A SignBlobRequest resource to be passed as the request body. """ name = _messages.StringField(1, required=True) signBlobRequest = _messages.MessageField('SignBlobRequest', 2) class IamProjectsServiceAccountsSignJwtRequest(_messages.Message): r"""A IamProjectsServiceAccountsSignJwtRequest object. Fields: name: The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. signJwtRequest: A SignJwtRequest resource to be passed as the request body. """ name = _messages.StringField(1, required=True) signJwtRequest = _messages.MessageField('SignJwtRequest', 2) class IamProjectsServiceAccountsTestIamPermissionsRequest(_messages.Message): r"""A IamProjectsServiceAccountsTestIamPermissionsRequest object. Fields: resource: REQUIRED: The resource for which the policy detail is being requested. `resource` is usually specified as a path, such as `projects/*project*/zones/*zone*/disks/*disk*`. The format for the path specified in this value is resource specific and is specified in the `testIamPermissions` documentation. testIamPermissionsRequest: A TestIamPermissionsRequest resource to be passed as the request body. """ resource = _messages.StringField(1, required=True) testIamPermissionsRequest = _messages.MessageField('TestIamPermissionsRequest', 2) class ListServiceAccountKeysResponse(_messages.Message): r"""The service account keys list response. Fields: keys: The public keys for the service account. """ keys = _messages.MessageField('ServiceAccountKey', 1, repeated=True) class ListServiceAccountsResponse(_messages.Message): r"""The service account list response. Fields: accounts: The list of matching service accounts. nextPageToken: To retrieve the next page of results, set ListServiceAccountsRequest.page_token to this value. """ accounts = _messages.MessageField('ServiceAccount', 1, repeated=True) nextPageToken = _messages.StringField(2) class LogConfig(_messages.Message): r"""Specifies what kind of log the caller must write Increment a streamz counter with the specified metric and field names. Metric names should start with a '/', generally be lowercase-only, and end in "_count". Field names should not contain an initial slash. The actual exported metric names will have "/iam/policy" prepended. Field names correspond to IAM request parameters and field values are their respective values. At present the only supported field names are - "iam_principal", corresponding to IAMContext.principal; - "" (empty string), resulting in one aggretated counter with no field. Examples: counter { metric: "/debug_access_count" field: "iam_principal" } ==> increment counter /iam/policy/backend_debug_access_count {iam_principal=[value of IAMContext.principal]} At this time we do not support: * multiple field names (though this may be supported in the future) * decrementing the counter * incrementing it by anything other than 1 Fields: cloudAudit: Cloud audit options. counter: Counter options. dataAccess: Data access options. """ cloudAudit = _messages.MessageField('CloudAuditOptions', 1) counter = _messages.MessageField('CounterOptions', 2) dataAccess = _messages.MessageField('DataAccessOptions', 3) class Policy(_messages.Message): r"""Defines an Identity and Access Management (IAM) policy. It is used to specify access control policies for Cloud Platform resources. A `Policy` consists of a list of `bindings`. A `Binding` binds a list of `members` to a `role`, where the members can be user accounts, Google groups, Google domains, and service accounts. A `role` is a named list of permissions defined by IAM. **Example** { "bindings": [ { "role": "roles/owner", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-other- app@appspot.gserviceaccount.com", ] }, { "role": "roles/viewer", "members": ["user:sean@example.com"] } ] } For a description of IAM and its features, see the [IAM developer's guide](https://cloud.google.com/iam). Fields: auditConfigs: Specifies audit logging configs for "data access". "data access": generally refers to data reads/writes and admin reads. "admin activity": generally refers to admin writes. Note: `AuditConfig` doesn't apply to "admin activity", which always enables audit logging. bindings: Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error. etag: `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read- modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly. iamOwned: A boolean attribute. rules: If more than one rule is specified, the rules are applied in the following manner: - All matching LOG rules are always applied. - If any DENY/DENY_WITH_LOG rule matches, permission is denied. Logging will be applied if one or more matching rule requires logging. - Otherwise, if any ALLOW/ALLOW_WITH_LOG rule matches, permission is granted. Logging will be applied if one or more matching rule requires logging. - Otherwise, if no rule applies, permission is denied. version: Version of the `Policy`. The default version is 0. """ auditConfigs = _messages.MessageField('AuditConfig', 1, repeated=True) bindings = _messages.MessageField('Binding', 2, repeated=True) etag = _messages.BytesField(3) iamOwned = _messages.BooleanField(4) rules = _messages.MessageField('Rule', 5, repeated=True) version = _messages.IntegerField(6, variant=_messages.Variant.INT32) class PolicyDetail(_messages.Message): r"""A policy and its full resource path. Fields: fullResourcePath: The full resource path of the policy e.g., `//dataflow.googleapis.com/projects/../jobs/..`. Note that a resource and its inherited resource have different `full_resource_path`. policy: The policy of a `resource/project/folder`. """ fullResourcePath = _messages.StringField(1) policy = _messages.MessageField('Policy', 2) class QueryGrantableRolesRequest(_messages.Message): r"""The grantable role query request. Fields: fullResourceName: Required. The full resource name to query from the list of grantable roles. The name follows the Google Cloud Platform resource format. For example, a Cloud Platform project with id `my-project` will be named `//cloudresourcemanager.googleapis.com/projects/my-project`. """ fullResourceName = _messages.StringField(1) class QueryGrantableRolesResponse(_messages.Message): r"""The grantable role query response. Fields: roles: The list of matching roles. """ roles = _messages.MessageField('Role', 1, repeated=True) class Role(_messages.Message): r"""A role in the Identity and Access Management API. Fields: apiTokens: A string attribute. description: Optional. A human-readable description for the role. name: The name of the role. Examples of roles names are: `roles/editor`, `roles/viewer` and `roles/logging.viewer`. title: Optional. A human-readable title for the role. Typically this is limited to 100 UTF-8 bytes. """ apiTokens = _messages.StringField(1, repeated=True) description = _messages.StringField(2) name = _messages.StringField(3) title = _messages.StringField(4) class Rule(_messages.Message): r"""A rule to be applied in a Policy. Enums: ActionValueValuesEnum: Required Fields: action: Required conditions: Additional restrictions that must be met description: Human-readable description of the rule. in_: If one or more 'in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in at least one of these entries. logConfig: The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action. notIn: If one or more 'not_in' clauses are specified, the rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in none of the entries. The format for in and not_in entries is the same as for members in a Binding (see google/iam/v1/policy.proto). permissions: A permission is a string of form '<service>.<resource type>.<verb>' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs. """ class ActionValueValuesEnum(_messages.Enum): r"""Required Values: NO_ACTION: Default no action. ALLOW: Matching 'Entries' grant access. ALLOW_WITH_LOG: Matching 'Entries' grant access and the caller promises to log the request per the returned log_configs. DENY: Matching 'Entries' deny access. DENY_WITH_LOG: Matching 'Entries' deny access and the caller promises to log the request per the returned log_configs. LOG: Matching 'Entries' tell IAM.Check callers to generate logs. """ NO_ACTION = 0 ALLOW = 1 ALLOW_WITH_LOG = 2 DENY = 3 DENY_WITH_LOG = 4 LOG = 5 action = _messages.EnumField('ActionValueValuesEnum', 1) conditions = _messages.MessageField('Condition', 2, repeated=True) description = _messages.StringField(3) in_ = _messages.StringField(4, repeated=True) logConfig = _messages.MessageField('LogConfig', 5, repeated=True) notIn = _messages.StringField(6, repeated=True) permissions = _messages.StringField(7, repeated=True) class ServiceAccount(_messages.Message): r"""A service account in the Identity and Access Management API. To create a service account, specify the `project_id` and the `account_id` for the account. The `account_id` is unique within the project, and is used to generate the service account email address and a stable `unique_id`. All other methods can identify the service account using the format `projects/{project}/serviceAccounts/{account}`. Using `-` as a wildcard for the project will infer the project from the account. The `account` value can be the `email` address or the `unique_id` of the service account. Fields: description: Optional. A user-specified opaque description of the service account. displayName: Optional. A user-specified description of the service account. Must be fewer than 100 UTF-8 bytes. email: @OutputOnly The email address of the service account. etag: Used to perform a consistent read-modify-write. name: The resource name of the service account in the following format: `projects/{project}/serviceAccounts/{account}`. Requests using `-` as a wildcard for the project will infer the project from the `account` and the `account` value can be the `email` address or the `unique_id` of the service account. In responses the resource name will always be in the format `projects/{project}/serviceAccounts/{email}`. oauth2ClientId: @OutputOnly. The OAuth2 client id for the service account. This is used in conjunction with the OAuth2 clientconfig API to make three legged OAuth2 (3LO) flows to access the data of Google users. projectId: @OutputOnly The id of the project that owns the service account. uniqueId: @OutputOnly The unique and stable id of the service account. """ description = _messages.StringField(1) displayName = _messages.StringField(2) email = _messages.StringField(3) etag = _messages.BytesField(4) name = _messages.StringField(5) oauth2ClientId = _messages.StringField(6) projectId = _messages.StringField(7) uniqueId = _messages.StringField(8) class ServiceAccountKey(_messages.Message): r"""Represents a service account key. A service account has two sets of key-pairs: user-managed, and system-managed. User-managed key-pairs can be created and deleted by users. Users are responsible for rotating these keys periodically to ensure security of their service accounts. Users retain the private key of these key-pairs, and Google retains ONLY the public key. System-managed key-pairs are managed automatically by Google, and rotated daily without user intervention. The private key never leaves Google's servers to maximize security. Public keys for all service accounts are also published at the OAuth2 Service Account API. Enums: PrivateKeyTypeValueValuesEnum: The output format for the private key. Only provided in `CreateServiceAccountKey` responses, not in `GetServiceAccountKey` or `ListServiceAccountKey` responses. Google never exposes system-managed private keys, and never retains user- managed private keys. Fields: name: The resource name of the service account key in the following format `projects/{project}/serviceAccounts/{account}/keys/{key}`. privateKeyData: The private key data. Only provided in `CreateServiceAccountKey` responses. privateKeyType: The output format for the private key. Only provided in `CreateServiceAccountKey` responses, not in `GetServiceAccountKey` or `ListServiceAccountKey` responses. Google never exposes system-managed private keys, and never retains user-managed private keys. publicKeyData: The public key data. Only provided in `GetServiceAccountKey` responses. validAfterTime: The key can be used after this timestamp. validBeforeTime: The key can be used before this timestamp. """ class PrivateKeyTypeValueValuesEnum(_messages.Enum): r"""The output format for the private key. Only provided in `CreateServiceAccountKey` responses, not in `GetServiceAccountKey` or `ListServiceAccountKey` responses. Google never exposes system-managed private keys, and never retains user-managed private keys. Values: TYPE_UNSPECIFIED: Unspecified. Equivalent to `TYPE_GOOGLE_CREDENTIALS_FILE`. TYPE_PKCS12_FILE: PKCS12 format. The password for the PKCS12 file is `notasecret`. For more information, see https://tools.ietf.org/html/rfc7292. TYPE_GOOGLE_CREDENTIALS_FILE: Google Credentials File format. """ TYPE_UNSPECIFIED = 0 TYPE_PKCS12_FILE = 1 TYPE_GOOGLE_CREDENTIALS_FILE = 2 name = _messages.StringField(1) privateKeyData = _messages.BytesField(2) privateKeyType = _messages.EnumField('PrivateKeyTypeValueValuesEnum', 3) publicKeyData = _messages.BytesField(4) validAfterTime = _messages.StringField(5) validBeforeTime = _messages.StringField(6) class SetIamPolicyRequest(_messages.Message): r"""Request message for `SetIamPolicy` method. Fields: policy: REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them. """ policy = _messages.MessageField('Policy', 1) class SignBlobRequest(_messages.Message): r"""The service account sign blob request. Fields: bytesToSign: The bytes to sign. """ bytesToSign = _messages.BytesField(1) class SignBlobResponse(_messages.Message): r"""The service account sign blob response. Fields: keyId: The id of the key used to sign the blob. signature: The signed blob. """ keyId = _messages.StringField(1) signature = _messages.BytesField(2) class SignJwtRequest(_messages.Message): r"""The service account sign JWT request. Fields: payload: The JWT payload to sign, a JSON JWT Claim set. """ payload = _messages.StringField(1) class SignJwtResponse(_messages.Message): r"""The service account sign JWT response. Fields: keyId: The id of the key used to sign the JWT. signedJwt: The signed JWT. """ keyId = _messages.StringField(1) signedJwt = _messages.StringField(2) class StandardQueryParameters(_messages.Message): r"""Query parameters accepted by all methods. Enums: FXgafvValueValuesEnum: V1 error format. AltValueValuesEnum: Data format for response. Fields: f__xgafv: V1 error format. access_token: OAuth access token. alt: Data format for response. bearer_token: OAuth bearer token. callback: JSONP fields: Selector specifying which fields to include in a partial response. key: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. oauth_token: OAuth 2.0 token for the current user. pp: Pretty-print response. prettyPrint: Returns response with indentations and line breaks. quotaUser: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. trace: A tracing token of the form "token:<tokenid>" to include in api requests. uploadType: Legacy upload protocol for media (e.g. "media", "multipart"). upload_protocol: Upload protocol for media (e.g. "raw", "multipart"). """ class AltValueValuesEnum(_messages.Enum): r"""Data format for response. Values: json: Responses with Content-Type of application/json media: Media download with context-dependent Content-Type proto: Responses with Content-Type of application/x-protobuf """ json = 0 media = 1 proto = 2 class FXgafvValueValuesEnum(_messages.Enum): r"""V1 error format. Values: _1: v1 error format _2: v2 error format """ _1 = 0 _2 = 1 f__xgafv = _messages.EnumField('FXgafvValueValuesEnum', 1) access_token = _messages.StringField(2) alt = _messages.EnumField('AltValueValuesEnum', 3, default='json') bearer_token = _messages.StringField(4) callback = _messages.StringField(5) fields = _messages.StringField(6) key = _messages.StringField(7) oauth_token = _messages.StringField(8) pp = _messages.BooleanField(9, default=True) prettyPrint = _messages.BooleanField(10, default=True) quotaUser = _messages.StringField(11) trace = _messages.StringField(12) uploadType = _messages.StringField(13) upload_protocol = _messages.StringField(14) class TestIamPermissionsRequest(_messages.Message): r"""Request message for `TestIamPermissions` method. Fields: permissions: The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see IAM Overview. """ permissions = _messages.StringField(1, repeated=True) class TestIamPermissionsResponse(_messages.Message): r"""Response message for `TestIamPermissions` method. Fields: permissions: A subset of `TestPermissionsRequest.permissions` that the caller is allowed. """ permissions = _messages.StringField(1, repeated=True) encoding.AddCustomJsonFieldMapping( Rule, 'in_', 'in') encoding.AddCustomJsonFieldMapping( StandardQueryParameters, 'f__xgafv', '$.xgafv') encoding.AddCustomJsonEnumMapping( StandardQueryParameters.FXgafvValueValuesEnum, '_1', '1') encoding.AddCustomJsonEnumMapping( StandardQueryParameters.FXgafvValueValuesEnum, '_2', '2') encoding.AddCustomJsonFieldMapping( IamProjectsServiceAccountsGetIamPolicyRequest, 'options_requestedPolicyVersion', 'options.requestedPolicyVersion') samples/iam_sample/iam_v1/__init__.py 0000644 00000000207 15025176453 0013613 0 ustar 00 """Package marker file.""" from __future__ import absolute_import import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) samples/iam_sample/__init__.py 0000644 00000001077 15025176453 0012445 0 ustar 00 # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. samples/dns_sample/dns_v1/dns_v1_client.py 0000644 00000026630 15025176453 0014650 0 ustar 00 """Generated client library for dns version v1.""" # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.py import base_api from samples.dns_sample.dns_v1 import dns_v1_messages as messages class DnsV1(base_api.BaseApiClient): """Generated client library for service dns version v1.""" MESSAGES_MODULE = messages BASE_URL = 'https://www.googleapis.com/dns/v1/' MTLS_BASE_URL = '' _PACKAGE = 'dns' _SCOPES = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/cloud-platform.read-only', 'https://www.googleapis.com/auth/ndev.clouddns.readonly', 'https://www.googleapis.com/auth/ndev.clouddns.readwrite'] _VERSION = 'v1' _CLIENT_ID = 'CLIENT_ID' _CLIENT_SECRET = 'CLIENT_SECRET' _USER_AGENT = 'x_Tw5K8nnjoRAqULM9PFAC2b' _CLIENT_CLASS_NAME = 'DnsV1' _URL_VERSION = 'v1' _API_KEY = None def __init__(self, url='', credentials=None, get_credentials=True, http=None, model=None, log_request=False, log_response=False, credentials_args=None, default_global_params=None, additional_http_headers=None, response_encoding=None): """Create a new dns handle.""" url = url or self.BASE_URL super(DnsV1, self).__init__( url, credentials=credentials, get_credentials=get_credentials, http=http, model=model, log_request=log_request, log_response=log_response, credentials_args=credentials_args, default_global_params=default_global_params, additional_http_headers=additional_http_headers, response_encoding=response_encoding) self.changes = self.ChangesService(self) self.managedZones = self.ManagedZonesService(self) self.projects = self.ProjectsService(self) self.resourceRecordSets = self.ResourceRecordSetsService(self) class ChangesService(base_api.BaseApiService): """Service class for the changes resource.""" _NAME = 'changes' def __init__(self, client): super(DnsV1.ChangesService, self).__init__(client) self._upload_configs = { } def Create(self, request, global_params=None): r"""Atomically update the ResourceRecordSet collection. Args: request: (DnsChangesCreateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Change) The response message. """ config = self.GetMethodConfig('Create') return self._RunMethod( config, request, global_params=global_params) Create.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='dns.changes.create', ordered_params=['project', 'managedZone'], path_params=['managedZone', 'project'], query_params=[], relative_path='projects/{project}/managedZones/{managedZone}/changes', request_field='change', request_type_name='DnsChangesCreateRequest', response_type_name='Change', supports_download=False, ) def Get(self, request, global_params=None): r"""Fetch the representation of an existing Change. Args: request: (DnsChangesGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Change) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='dns.changes.get', ordered_params=['project', 'managedZone', 'changeId'], path_params=['changeId', 'managedZone', 'project'], query_params=[], relative_path='projects/{project}/managedZones/{managedZone}/changes/{changeId}', request_field='', request_type_name='DnsChangesGetRequest', response_type_name='Change', supports_download=False, ) def List(self, request, global_params=None): r"""Enumerate Changes to a ResourceRecordSet collection. Args: request: (DnsChangesListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ChangesListResponse) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='dns.changes.list', ordered_params=['project', 'managedZone'], path_params=['managedZone', 'project'], query_params=['maxResults', 'pageToken', 'sortBy', 'sortOrder'], relative_path='projects/{project}/managedZones/{managedZone}/changes', request_field='', request_type_name='DnsChangesListRequest', response_type_name='ChangesListResponse', supports_download=False, ) class ManagedZonesService(base_api.BaseApiService): """Service class for the managedZones resource.""" _NAME = 'managedZones' def __init__(self, client): super(DnsV1.ManagedZonesService, self).__init__(client) self._upload_configs = { } def Create(self, request, global_params=None): r"""Create a new ManagedZone. Args: request: (DnsManagedZonesCreateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ManagedZone) The response message. """ config = self.GetMethodConfig('Create') return self._RunMethod( config, request, global_params=global_params) Create.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='dns.managedZones.create', ordered_params=['project'], path_params=['project'], query_params=[], relative_path='projects/{project}/managedZones', request_field='managedZone', request_type_name='DnsManagedZonesCreateRequest', response_type_name='ManagedZone', supports_download=False, ) def Delete(self, request, global_params=None): r"""Delete a previously created ManagedZone. Args: request: (DnsManagedZonesDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (DnsManagedZonesDeleteResponse) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='dns.managedZones.delete', ordered_params=['project', 'managedZone'], path_params=['managedZone', 'project'], query_params=[], relative_path='projects/{project}/managedZones/{managedZone}', request_field='', request_type_name='DnsManagedZonesDeleteRequest', response_type_name='DnsManagedZonesDeleteResponse', supports_download=False, ) def Get(self, request, global_params=None): r"""Fetch the representation of an existing ManagedZone. Args: request: (DnsManagedZonesGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ManagedZone) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='dns.managedZones.get', ordered_params=['project', 'managedZone'], path_params=['managedZone', 'project'], query_params=[], relative_path='projects/{project}/managedZones/{managedZone}', request_field='', request_type_name='DnsManagedZonesGetRequest', response_type_name='ManagedZone', supports_download=False, ) def List(self, request, global_params=None): r"""Enumerate ManagedZones that have been created but not yet deleted. Args: request: (DnsManagedZonesListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ManagedZonesListResponse) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='dns.managedZones.list', ordered_params=['project'], path_params=['project'], query_params=['dnsName', 'maxResults', 'pageToken'], relative_path='projects/{project}/managedZones', request_field='', request_type_name='DnsManagedZonesListRequest', response_type_name='ManagedZonesListResponse', supports_download=False, ) class ProjectsService(base_api.BaseApiService): """Service class for the projects resource.""" _NAME = 'projects' def __init__(self, client): super(DnsV1.ProjectsService, self).__init__(client) self._upload_configs = { } def Get(self, request, global_params=None): r"""Fetch the representation of an existing Project. Args: request: (DnsProjectsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Project) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='dns.projects.get', ordered_params=['project'], path_params=['project'], query_params=[], relative_path='projects/{project}', request_field='', request_type_name='DnsProjectsGetRequest', response_type_name='Project', supports_download=False, ) class ResourceRecordSetsService(base_api.BaseApiService): """Service class for the resourceRecordSets resource.""" _NAME = 'resourceRecordSets' def __init__(self, client): super(DnsV1.ResourceRecordSetsService, self).__init__(client) self._upload_configs = { } def List(self, request, global_params=None): r"""Enumerate ResourceRecordSets that have been created but not yet deleted. Args: request: (DnsResourceRecordSetsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ResourceRecordSetsListResponse) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='dns.resourceRecordSets.list', ordered_params=['project', 'managedZone'], path_params=['managedZone', 'project'], query_params=['maxResults', 'name', 'pageToken', 'type'], relative_path='projects/{project}/managedZones/{managedZone}/rrsets', request_field='', request_type_name='DnsResourceRecordSetsListRequest', response_type_name='ResourceRecordSetsListResponse', supports_download=False, ) samples/dns_sample/dns_v1/__init__.py 0000644 00000000207 15025176453 0013647 0 ustar 00 """Package marker file.""" from __future__ import absolute_import import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) samples/dns_sample/dns_v1/dns_v1_messages.py 0000644 00000040473 15025176453 0015202 0 ustar 00 """Generated message classes for dns version v1. The Google Cloud DNS API provides services for configuring and serving authoritative DNS records. """ # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.protorpclite import messages as _messages package = 'dns' class Change(_messages.Message): r"""An atomic update to a collection of ResourceRecordSets. Enums: StatusValueValuesEnum: Status of the operation (output only). Fields: additions: Which ResourceRecordSets to add? deletions: Which ResourceRecordSets to remove? Must match existing data exactly. id: Unique identifier for the resource; defined by the server (output only). kind: Identifies what kind of resource this is. Value: the fixed string "dns#change". startTime: The time that this operation was started by the server. This is in RFC3339 text format. status: Status of the operation (output only). """ class StatusValueValuesEnum(_messages.Enum): r"""Status of the operation (output only). Values: done: <no description> pending: <no description> """ done = 0 pending = 1 additions = _messages.MessageField('ResourceRecordSet', 1, repeated=True) deletions = _messages.MessageField('ResourceRecordSet', 2, repeated=True) id = _messages.StringField(3) kind = _messages.StringField(4, default='dns#change') startTime = _messages.StringField(5) status = _messages.EnumField('StatusValueValuesEnum', 6) class ChangesListResponse(_messages.Message): r"""The response to a request to enumerate Changes to a ResourceRecordSets collection. Fields: changes: The requested changes. kind: Type of resource. nextPageToken: The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token. In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a "snapshot" of collections larger than the maximum page size. """ changes = _messages.MessageField('Change', 1, repeated=True) kind = _messages.StringField(2, default='dns#changesListResponse') nextPageToken = _messages.StringField(3) class DnsChangesCreateRequest(_messages.Message): r"""A DnsChangesCreateRequest object. Fields: change: A Change resource to be passed as the request body. managedZone: Identifies the managed zone addressed by this request. Can be the managed zone name or id. project: Identifies the project addressed by this request. """ change = _messages.MessageField('Change', 1) managedZone = _messages.StringField(2, required=True) project = _messages.StringField(3, required=True) class DnsChangesGetRequest(_messages.Message): r"""A DnsChangesGetRequest object. Fields: changeId: The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse. managedZone: Identifies the managed zone addressed by this request. Can be the managed zone name or id. project: Identifies the project addressed by this request. """ changeId = _messages.StringField(1, required=True) managedZone = _messages.StringField(2, required=True) project = _messages.StringField(3, required=True) class DnsChangesListRequest(_messages.Message): r"""A DnsChangesListRequest object. Enums: SortByValueValuesEnum: Sorting criterion. The only supported value is change sequence. Fields: managedZone: Identifies the managed zone addressed by this request. Can be the managed zone name or id. maxResults: Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return. pageToken: Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. project: Identifies the project addressed by this request. sortBy: Sorting criterion. The only supported value is change sequence. sortOrder: Sorting order direction: 'ascending' or 'descending'. """ class SortByValueValuesEnum(_messages.Enum): r"""Sorting criterion. The only supported value is change sequence. Values: changeSequence: <no description> """ changeSequence = 0 managedZone = _messages.StringField(1, required=True) maxResults = _messages.IntegerField(2, variant=_messages.Variant.INT32) pageToken = _messages.StringField(3) project = _messages.StringField(4, required=True) sortBy = _messages.EnumField('SortByValueValuesEnum', 5, default='changeSequence') sortOrder = _messages.StringField(6) class DnsManagedZonesCreateRequest(_messages.Message): r"""A DnsManagedZonesCreateRequest object. Fields: managedZone: A ManagedZone resource to be passed as the request body. project: Identifies the project addressed by this request. """ managedZone = _messages.MessageField('ManagedZone', 1) project = _messages.StringField(2, required=True) class DnsManagedZonesDeleteRequest(_messages.Message): r"""A DnsManagedZonesDeleteRequest object. Fields: managedZone: Identifies the managed zone addressed by this request. Can be the managed zone name or id. project: Identifies the project addressed by this request. """ managedZone = _messages.StringField(1, required=True) project = _messages.StringField(2, required=True) class DnsManagedZonesDeleteResponse(_messages.Message): r"""An empty DnsManagedZonesDelete response.""" class DnsManagedZonesGetRequest(_messages.Message): r"""A DnsManagedZonesGetRequest object. Fields: managedZone: Identifies the managed zone addressed by this request. Can be the managed zone name or id. project: Identifies the project addressed by this request. """ managedZone = _messages.StringField(1, required=True) project = _messages.StringField(2, required=True) class DnsManagedZonesListRequest(_messages.Message): r"""A DnsManagedZonesListRequest object. Fields: dnsName: Restricts the list to return only zones with this domain name. maxResults: Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return. pageToken: Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. project: Identifies the project addressed by this request. """ dnsName = _messages.StringField(1) maxResults = _messages.IntegerField(2, variant=_messages.Variant.INT32) pageToken = _messages.StringField(3) project = _messages.StringField(4, required=True) class DnsProjectsGetRequest(_messages.Message): r"""A DnsProjectsGetRequest object. Fields: project: Identifies the project addressed by this request. """ project = _messages.StringField(1, required=True) class DnsResourceRecordSetsListRequest(_messages.Message): r"""A DnsResourceRecordSetsListRequest object. Fields: managedZone: Identifies the managed zone addressed by this request. Can be the managed zone name or id. maxResults: Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return. name: Restricts the list to return only records with this fully qualified domain name. pageToken: Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. project: Identifies the project addressed by this request. type: Restricts the list to return only records of this type. If present, the "name" parameter must also be present. """ managedZone = _messages.StringField(1, required=True) maxResults = _messages.IntegerField(2, variant=_messages.Variant.INT32) name = _messages.StringField(3) pageToken = _messages.StringField(4) project = _messages.StringField(5, required=True) type = _messages.StringField(6) class ManagedZone(_messages.Message): r"""A zone is a subtree of the DNS namespace under one administrative responsibility. A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service. Fields: creationTime: The time that this resource was created on the server. This is in RFC3339 text format. Output only. description: A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the managed zone's function. dnsName: The DNS name of this managed zone, for instance "example.com.". id: Unique identifier for the resource; defined by the server (output only) kind: Identifies what kind of resource this is. Value: the fixed string "dns#managedZone". name: User assigned name for this resource. Must be unique within the project. The name must be 1-32 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes. nameServerSet: Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset. nameServers: Delegate your managed_zone to these virtual name servers; defined by the server (output only) """ creationTime = _messages.StringField(1) description = _messages.StringField(2) dnsName = _messages.StringField(3) id = _messages.IntegerField(4, variant=_messages.Variant.UINT64) kind = _messages.StringField(5, default='dns#managedZone') name = _messages.StringField(6) nameServerSet = _messages.StringField(7) nameServers = _messages.StringField(8, repeated=True) class ManagedZonesListResponse(_messages.Message): r"""A ManagedZonesListResponse object. Fields: kind: Type of resource. managedZones: The managed zone resources. nextPageToken: The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token. In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size. """ kind = _messages.StringField(1, default='dns#managedZonesListResponse') managedZones = _messages.MessageField('ManagedZone', 2, repeated=True) nextPageToken = _messages.StringField(3) class Project(_messages.Message): r"""A project resource. The project is a top level container for resources including Cloud DNS ManagedZones. Projects can be created only in the APIs console. Fields: id: User assigned unique identifier for the resource (output only). kind: Identifies what kind of resource this is. Value: the fixed string "dns#project". number: Unique numeric identifier for the resource; defined by the server (output only). quota: Quotas assigned to this project (output only). """ id = _messages.StringField(1) kind = _messages.StringField(2, default='dns#project') number = _messages.IntegerField(3, variant=_messages.Variant.UINT64) quota = _messages.MessageField('Quota', 4) class Quota(_messages.Message): r"""Limits associated with a Project. Fields: kind: Identifies what kind of resource this is. Value: the fixed string "dns#quota". managedZones: Maximum allowed number of managed zones in the project. resourceRecordsPerRrset: Maximum allowed number of ResourceRecords per ResourceRecordSet. rrsetAdditionsPerChange: Maximum allowed number of ResourceRecordSets to add per ChangesCreateRequest. rrsetDeletionsPerChange: Maximum allowed number of ResourceRecordSets to delete per ChangesCreateRequest. rrsetsPerManagedZone: Maximum allowed number of ResourceRecordSets per zone in the project. totalRrdataSizePerChange: Maximum allowed size for total rrdata in one ChangesCreateRequest in bytes. """ kind = _messages.StringField(1, default='dns#quota') managedZones = _messages.IntegerField(2, variant=_messages.Variant.INT32) resourceRecordsPerRrset = _messages.IntegerField(3, variant=_messages.Variant.INT32) rrsetAdditionsPerChange = _messages.IntegerField(4, variant=_messages.Variant.INT32) rrsetDeletionsPerChange = _messages.IntegerField(5, variant=_messages.Variant.INT32) rrsetsPerManagedZone = _messages.IntegerField(6, variant=_messages.Variant.INT32) totalRrdataSizePerChange = _messages.IntegerField(7, variant=_messages.Variant.INT32) class ResourceRecordSet(_messages.Message): r"""A unit of data that will be returned by the DNS servers. Fields: kind: Identifies what kind of resource this is. Value: the fixed string "dns#resourceRecordSet". name: For example, www.example.com. rrdatas: As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1). ttl: Number of seconds that this ResourceRecordSet can be cached by resolvers. type: The identifier of a supported record type, for example, A, AAAA, MX, TXT, and so on. """ kind = _messages.StringField(1, default='dns#resourceRecordSet') name = _messages.StringField(2) rrdatas = _messages.StringField(3, repeated=True) ttl = _messages.IntegerField(4, variant=_messages.Variant.INT32) type = _messages.StringField(5) class ResourceRecordSetsListResponse(_messages.Message): r"""A ResourceRecordSetsListResponse object. Fields: kind: Type of resource. nextPageToken: The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token. In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size. rrsets: The resource record set resources. """ kind = _messages.StringField(1, default='dns#resourceRecordSetsListResponse') nextPageToken = _messages.StringField(2) rrsets = _messages.MessageField('ResourceRecordSet', 3, repeated=True) class StandardQueryParameters(_messages.Message): r"""Query parameters accepted by all methods. Enums: AltValueValuesEnum: Data format for the response. Fields: alt: Data format for the response. fields: Selector specifying which fields to include in a partial response. key: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. oauth_token: OAuth 2.0 token for the current user. prettyPrint: Returns response with indentations and line breaks. quotaUser: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. trace: A tracing token of the form "token:<tokenid>" to include in api requests. userIp: IP address of the site where the request originates. Use this if you want to enforce per-user limits. """ class AltValueValuesEnum(_messages.Enum): r"""Data format for the response. Values: json: Responses with Content-Type of application/json """ json = 0 alt = _messages.EnumField('AltValueValuesEnum', 1, default='json') fields = _messages.StringField(2) key = _messages.StringField(3) oauth_token = _messages.StringField(4) prettyPrint = _messages.BooleanField(5, default=True) quotaUser = _messages.StringField(6) trace = _messages.StringField(7) userIp = _messages.StringField(8) samples/dns_sample/dns_v1.json 0000644 00000056305 15025176453 0012443 0 ustar 00 { "kind": "discovery#restDescription", "discoveryVersion": "v1", "id": "dns:v1", "name": "dns", "version": "v1", "revision": "20150807", "title": "Google Cloud DNS API", "description": "The Google Cloud DNS API provides services for configuring and serving authoritative DNS records.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "http://www.google.com/images/icons/product/search-16.gif", "x32": "http://www.google.com/images/icons/product/search-32.gif" }, "documentationLink": "https://developers.google.com/cloud-dns", "protocol": "rest", "baseUrl": "https://www.googleapis.com/dns/v1/projects/", "basePath": "/dns/v1/projects/", "rootUrl": "https://www.googleapis.com/", "servicePath": "dns/v1/projects/", "batchPath": "batch", "parameters": { "alt": { "type": "string", "description": "Data format for the response.", "default": "json", "enum": [ "json" ], "enumDescriptions": [ "Responses with Content-Type of application/json" ], "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", "location": "query" }, "userIp": { "type": "string", "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/cloud-platform.read-only": { "description": "MESSAGE UNDER CONSTRUCTION View your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/ndev.clouddns.readonly": { "description": "View your DNS records hosted by Google Cloud DNS" }, "https://www.googleapis.com/auth/ndev.clouddns.readwrite": { "description": "View and manage your DNS records hosted by Google Cloud DNS" } } } }, "schemas": { "Change": { "id": "Change", "type": "object", "description": "An atomic update to a collection of ResourceRecordSets.", "properties": { "additions": { "type": "array", "description": "Which ResourceRecordSets to add?", "items": { "$ref": "ResourceRecordSet" } }, "deletions": { "type": "array", "description": "Which ResourceRecordSets to remove? Must match existing data exactly.", "items": { "$ref": "ResourceRecordSet" } }, "id": { "type": "string", "description": "Unique identifier for the resource; defined by the server (output only)." }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#change\".", "default": "dns#change" }, "startTime": { "type": "string", "description": "The time that this operation was started by the server. This is in RFC3339 text format." }, "status": { "type": "string", "description": "Status of the operation (output only).", "enum": [ "done", "pending" ], "enumDescriptions": [ "", "" ] } } }, "ChangesListResponse": { "id": "ChangesListResponse", "type": "object", "description": "The response to a request to enumerate Changes to a ResourceRecordSets collection.", "properties": { "changes": { "type": "array", "description": "The requested changes.", "items": { "$ref": "Change" } }, "kind": { "type": "string", "description": "Type of resource.", "default": "dns#changesListResponse" }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a \"snapshot\" of collections larger than the maximum page size." } } }, "ManagedZone": { "id": "ManagedZone", "type": "object", "description": "A zone is a subtree of the DNS namespace under one administrative responsibility. A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service.", "properties": { "creationTime": { "type": "string", "description": "The time that this resource was created on the server. This is in RFC3339 text format. Output only." }, "description": { "type": "string", "description": "A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the managed zone's function." }, "dnsName": { "type": "string", "description": "The DNS name of this managed zone, for instance \"example.com.\"." }, "id": { "type": "string", "description": "Unique identifier for the resource; defined by the server (output only)", "format": "uint64" }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#managedZone\".", "default": "dns#managedZone" }, "name": { "type": "string", "description": "User assigned name for this resource. Must be unique within the project. The name must be 1-32 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes." }, "nameServerSet": { "type": "string", "description": "Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset." }, "nameServers": { "type": "array", "description": "Delegate your managed_zone to these virtual name servers; defined by the server (output only)", "items": { "type": "string" } } } }, "ManagedZonesListResponse": { "id": "ManagedZonesListResponse", "type": "object", "properties": { "kind": { "type": "string", "description": "Type of resource.", "default": "dns#managedZonesListResponse" }, "managedZones": { "type": "array", "description": "The managed zone resources.", "items": { "$ref": "ManagedZone" } }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size." } } }, "Project": { "id": "Project", "type": "object", "description": "A project resource. The project is a top level container for resources including Cloud DNS ManagedZones. Projects can be created only in the APIs console.", "properties": { "id": { "type": "string", "description": "User assigned unique identifier for the resource (output only)." }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#project\".", "default": "dns#project" }, "number": { "type": "string", "description": "Unique numeric identifier for the resource; defined by the server (output only).", "format": "uint64" }, "quota": { "$ref": "Quota", "description": "Quotas assigned to this project (output only)." } } }, "Quota": { "id": "Quota", "type": "object", "description": "Limits associated with a Project.", "properties": { "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#quota\".", "default": "dns#quota" }, "managedZones": { "type": "integer", "description": "Maximum allowed number of managed zones in the project.", "format": "int32" }, "resourceRecordsPerRrset": { "type": "integer", "description": "Maximum allowed number of ResourceRecords per ResourceRecordSet.", "format": "int32" }, "rrsetAdditionsPerChange": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets to add per ChangesCreateRequest.", "format": "int32" }, "rrsetDeletionsPerChange": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets to delete per ChangesCreateRequest.", "format": "int32" }, "rrsetsPerManagedZone": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets per zone in the project.", "format": "int32" }, "totalRrdataSizePerChange": { "type": "integer", "description": "Maximum allowed size for total rrdata in one ChangesCreateRequest in bytes.", "format": "int32" } } }, "ResourceRecordSet": { "id": "ResourceRecordSet", "type": "object", "description": "A unit of data that will be returned by the DNS servers.", "properties": { "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#resourceRecordSet\".", "default": "dns#resourceRecordSet" }, "name": { "type": "string", "description": "For example, www.example.com." }, "rrdatas": { "type": "array", "description": "As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1).", "items": { "type": "string" } }, "ttl": { "type": "integer", "description": "Number of seconds that this ResourceRecordSet can be cached by resolvers.", "format": "int32" }, "type": { "type": "string", "description": "The identifier of a supported record type, for example, A, AAAA, MX, TXT, and so on." } } }, "ResourceRecordSetsListResponse": { "id": "ResourceRecordSetsListResponse", "type": "object", "properties": { "kind": { "type": "string", "description": "Type of resource.", "default": "dns#resourceRecordSetsListResponse" }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size." }, "rrsets": { "type": "array", "description": "The resource record set resources.", "items": { "$ref": "ResourceRecordSet" } } } } }, "resources": { "changes": { "methods": { "create": { "id": "dns.changes.create", "path": "{project}/managedZones/{managedZone}/changes", "httpMethod": "POST", "description": "Atomically update the ResourceRecordSet collection.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "request": { "$ref": "Change" }, "response": { "$ref": "Change" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "get": { "id": "dns.changes.get", "path": "{project}/managedZones/{managedZone}/changes/{changeId}", "httpMethod": "GET", "description": "Fetch the representation of an existing Change.", "parameters": { "changeId": { "type": "string", "description": "The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse.", "required": true, "location": "path" }, "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone", "changeId" ], "response": { "$ref": "Change" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "list": { "id": "dns.changes.list", "path": "{project}/managedZones/{managedZone}/changes", "httpMethod": "GET", "description": "Enumerate Changes to a ResourceRecordSet collection.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" }, "sortBy": { "type": "string", "description": "Sorting criterion. The only supported value is change sequence.", "default": "changeSequence", "enum": [ "changeSequence" ], "enumDescriptions": [ "" ], "location": "query" }, "sortOrder": { "type": "string", "description": "Sorting order direction: 'ascending' or 'descending'.", "location": "query" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ChangesListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "managedZones": { "methods": { "create": { "id": "dns.managedZones.create", "path": "{project}/managedZones", "httpMethod": "POST", "description": "Create a new ManagedZone.", "parameters": { "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "request": { "$ref": "ManagedZone" }, "response": { "$ref": "ManagedZone" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "delete": { "id": "dns.managedZones.delete", "path": "{project}/managedZones/{managedZone}", "httpMethod": "DELETE", "description": "Delete a previously created ManagedZone.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "get": { "id": "dns.managedZones.get", "path": "{project}/managedZones/{managedZone}", "httpMethod": "GET", "description": "Fetch the representation of an existing ManagedZone.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ManagedZone" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "list": { "id": "dns.managedZones.list", "path": "{project}/managedZones", "httpMethod": "GET", "description": "Enumerate ManagedZones that have been created but not yet deleted.", "parameters": { "dnsName": { "type": "string", "description": "Restricts the list to return only zones with this domain name.", "location": "query" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "response": { "$ref": "ManagedZonesListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "projects": { "methods": { "get": { "id": "dns.projects.get", "path": "{project}", "httpMethod": "GET", "description": "Fetch the representation of an existing Project.", "parameters": { "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "response": { "$ref": "Project" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "resourceRecordSets": { "methods": { "list": { "id": "dns.resourceRecordSets.list", "path": "{project}/managedZones/{managedZone}/rrsets", "httpMethod": "GET", "description": "Enumerate ResourceRecordSets that have been created but not yet deleted.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "name": { "type": "string", "description": "Restricts the list to return only records with this fully qualified domain name.", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" }, "type": { "type": "string", "description": "Restricts the list to return only records of this type. If present, the \"name\" parameter must also be present.", "location": "query" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ResourceRecordSetsListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } } } } samples/dns_sample/gen_dns_client_test.py 0000644 00000005742 15025176453 0014741 0 ustar 00 # # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test for generated sample module.""" import unittest import six from apitools.base.py import list_pager from apitools.base.py.testing import mock from samples.dns_sample.dns_v1 import dns_v1_client from samples.dns_sample.dns_v1 import dns_v1_messages class DnsGenClientSanityTest(unittest.TestCase): def testBaseUrl(self): self.assertEqual(u'https://www.googleapis.com/dns/v1/', dns_v1_client.DnsV1.BASE_URL) def testMessagesModule(self): self.assertEqual(dns_v1_messages, dns_v1_client.DnsV1.MESSAGES_MODULE) def testAttributes(self): inner_classes = set([]) for key, value in dns_v1_client.DnsV1.__dict__.items(): if isinstance(value, six.class_types): inner_classes.add(key) self.assertEqual(set([ 'ChangesService', 'ProjectsService', 'ManagedZonesService', 'ResourceRecordSetsService']), inner_classes) class DnsGenClientTest(unittest.TestCase): def setUp(self): self.mocked_dns_v1 = mock.Client(dns_v1_client.DnsV1) self.mocked_dns_v1.Mock() self.addCleanup(self.mocked_dns_v1.Unmock) def testFlatPath(self): get_method_config = self.mocked_dns_v1.projects.GetMethodConfig('Get') self.assertIsNone(get_method_config.flat_path) self.assertEqual('projects/{project}', get_method_config.relative_path) def testRecordSetList(self): response_record_set = dns_v1_messages.ResourceRecordSet( kind=u"dns#resourceRecordSet", name=u"zone.com.", rrdatas=[u"1.2.3.4"], ttl=21600, type=u"A") self.mocked_dns_v1.resourceRecordSets.List.Expect( dns_v1_messages.DnsResourceRecordSetsListRequest( project=u'my-project', managedZone=u'test_zone_name', type=u'green', maxResults=100), dns_v1_messages.ResourceRecordSetsListResponse( rrsets=[response_record_set])) results = list(list_pager.YieldFromList( self.mocked_dns_v1.resourceRecordSets, dns_v1_messages.DnsResourceRecordSetsListRequest( project='my-project', managedZone='test_zone_name', type='green'), limit=100, field='rrsets')) self.assertEqual([response_record_set], results) samples/dns_sample/__init__.py 0000644 00000001077 15025176453 0012463 0 ustar 00 # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. samples/servicemanagement_sample/messages_test.py 0000644 00000004241 15025176453 0016477 0 ustar 00 # # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test for generated servicemanagement messages module.""" import unittest from apitools.base.py import extra_types from samples.servicemanagement_sample.servicemanagement_v1 \ import servicemanagement_v1_messages as messages # nopep8 class MessagesTest(unittest.TestCase): def testInstantiateMessageWithAdditionalProperties(self): PROJECT_NAME = 'test-project' SERVICE_NAME = 'test-service' SERVICE_VERSION = '1.0' prop = messages.Operation.ResponseValue.AdditionalProperty messages.Operation( name='operation-12345-67890', done=False, response=messages.Operation.ResponseValue( additionalProperties=[ prop(key='producerProjectId', value=extra_types.JsonValue( string_value=PROJECT_NAME)), prop(key='serviceName', value=extra_types.JsonValue( string_value=SERVICE_NAME)), prop(key='serviceConfig', value=extra_types.JsonValue( object_value=extra_types.JsonObject( properties=[ extra_types.JsonObject.Property( key='id', value=extra_types.JsonValue( string_value=SERVICE_VERSION) ) ]) )) ])) samples/servicemanagement_sample/servicemanagement_v1.json 0000644 00000530705 15025176453 0020266 0 ustar 00 { "kind": "discovery#restDescription", "discoveryVersion": "v1", "id": "servicemanagement:v1", "name": "servicemanagement", "version": "v1", "revision": "0", "title": "Google Service Management API", "description": "The service management API for Google Cloud Platform", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "http://www.google.com/images/icons/product/search-16.gif", "x32": "http://www.google.com/images/icons/product/search-32.gif" }, "documentationLink": "https://cloud.google.com/service-management/", "protocol": "rest", "rootUrl": "https://servicemanagement.googleapis.com/", "servicePath": "", "baseUrl": "https://servicemanagement.googleapis.com/", "batchPath": "batch", "parameters": { "access_token": { "type": "string", "description": "OAuth access token.", "location": "query" }, "alt": { "type": "string", "description": "Data format for response.", "default": "json", "enum": [ "json", "media", "proto" ], "enumDescriptions": [ "Responses with Content-Type of application/json", "Media download with context-dependent Content-Type", "Responses with Content-Type of application/x-protobuf" ], "location": "query" }, "bearer_token": { "type": "string", "description": "OAuth bearer token.", "location": "query" }, "callback": { "type": "string", "description": "JSONP", "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "pp": { "type": "boolean", "description": "Pretty-print response.", "default": "true", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", "location": "query" }, "upload_protocol": { "type": "string", "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").", "location": "query" }, "uploadType": { "type": "string", "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").", "location": "query" }, "$.xgafv": { "type": "string", "description": "V1 error format.", "enum": [ "1", "2" ], "enumDescriptions": [ "v1 error format", "v2 error format" ], "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/service.management": { "description": "Manage your Google API service configuration" } } } }, "schemas": { "ListServicesResponse": { "id": "ListServicesResponse", "description": "Response message for `ListServices` method.", "type": "object", "properties": { "services": { "description": "The results of the query.", "type": "array", "items": { "$ref": "ManagedService" } }, "nextPageToken": { "description": "Token that can be passed to `ListServices` to resume a paginated query.", "type": "string" } } }, "ManagedService": { "id": "ManagedService", "description": "The full representation of an API Service that is managed by the\n`ServiceManager` API. Includes both the service configuration, as well as\nother control plane deployment related information.", "type": "object", "properties": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. This name must match `google.api.Service.name` in the\n`service_config` field.", "type": "string" }, "producerProjectId": { "description": "ID of the project that produces and owns this service.", "type": "string" }, "generation": { "description": "A server-assigned monotonically increasing number that changes whenever a\nmutation is made to the `ManagedService` or any of its components via the\n`ServiceManager` API.", "type": "string", "format": "int64" }, "serviceConfig": { "description": "The service's generated configuration.", "$ref": "Service" }, "configSource": { "description": "User-supplied source configuration for the service. This is distinct from\nthe generated configuration provided in `google.api.Service`.\nThis is NOT populated on GetService calls at the moment.\nNOTE: Any upsert operation that contains both a service_config\nand a config_source is considered invalid and will result in\nan error being returned.", "$ref": "ConfigSource" }, "operations": { "description": "Read-only view of pending operations affecting this resource, if requested.", "type": "array", "items": { "$ref": "Operation" } }, "projectSettings": { "description": "Read-only view of settings for a particular consumer project, if requested.", "$ref": "ProjectSettings" } } }, "Service": { "id": "Service", "description": "`Service` is the root object of the configuration schema. It\ndescribes basic information like the name of the service and the\nexposed API interfaces, and delegates other aspects to configuration\nsub-sections.\n\nExample:\n\n type: google.api.Service\n config_version: 1\n name: calendar.googleapis.com\n title: Google Calendar API\n apis:\n - name: google.calendar.Calendar\n backend:\n rules:\n - selector: \"*\"\n address: calendar.example.com", "type": "object", "properties": { "configVersion": { "description": "The version of the service configuration. The config version may\ninfluence interpretation of the configuration, for example, to\ndetermine defaults. This is documented together with applicable\noptions. The current default for the config version itself is `3`.", "type": "integer", "format": "uint32" }, "name": { "description": "The DNS address at which this service is available,\ne.g. `calendar.googleapis.com`.", "type": "string" }, "id": { "description": "A unique ID for a specific instance of this message, typically assigned\nby the client for tracking purpose. If empty, the server may choose to\ngenerate one instead.", "type": "string" }, "title": { "description": "The product title associated with this service.", "type": "string" }, "producerProjectId": { "description": "The id of the Google developer project that owns the service.\nMembers of this project can manage the service configuration,\nmanage consumption of the service, etc.", "type": "string" }, "apis": { "description": "A list of API interfaces exported by this service. Only the `name` field\nof the google.protobuf.Api needs to be provided by the configuration\nauthor, as the remaining fields will be derived from the IDL during the\nnormalization process. It is an error to specify an API interface here\nwhich cannot be resolved against the associated IDL files.", "type": "array", "items": { "$ref": "Api" } }, "types": { "description": "A list of all proto message types included in this API service.\nTypes referenced directly or indirectly by the `apis` are\nautomatically included. Messages which are not referenced but\nshall be included, such as types used by the `google.protobuf.Any` type,\nshould be listed here by name. Example:\n\n types:\n - name: google.protobuf.Int32", "type": "array", "items": { "$ref": "Type" } }, "enums": { "description": "A list of all enum types included in this API service. Enums\nreferenced directly or indirectly by the `apis` are automatically\nincluded. Enums which are not referenced but shall be included\nshould be listed here by name. Example:\n\n enums:\n - name: google.someapi.v1.SomeEnum", "type": "array", "items": { "$ref": "Enum" } }, "documentation": { "description": "Additional API documentation.", "$ref": "Documentation" }, "visibility": { "description": "API visibility configuration.", "$ref": "Visibility" }, "backend": { "description": "API backend configuration.", "$ref": "Backend" }, "http": { "description": "HTTP configuration.", "$ref": "Http" }, "quota": { "description": "Quota configuration.", "$ref": "Quota" }, "authentication": { "description": "Auth configuration.", "$ref": "Authentication" }, "context": { "description": "Context configuration.", "$ref": "Context" }, "usage": { "description": "Configuration controlling usage of this service.", "$ref": "Usage" }, "customError": { "description": "Custom error configuration.", "$ref": "CustomError" }, "projectProperties": { "description": "Configuration of per-consumer project properties.", "$ref": "ProjectProperties" }, "control": { "description": "Configuration for the service control plane.", "$ref": "Control" }, "logs": { "description": "Defines the logs used by this service.", "type": "array", "items": { "$ref": "LogDescriptor" } }, "metrics": { "description": "Defines the metrics used by this service.", "type": "array", "items": { "$ref": "MetricDescriptor" } }, "monitoredResources": { "description": "Defines the monitored resources used by this service. This is required\nby the Service.monitoring and Service.logging configurations.\n", "type": "array", "items": { "$ref": "MonitoredResourceDescriptor" } }, "billing": { "description": "Billing configuration of the service.", "$ref": "Billing" }, "logging": { "description": "Logging configuration of the service.", "$ref": "Logging" }, "monitoring": { "description": "Monitoring configuration of the service.", "$ref": "Monitoring" }, "systemParameters": { "description": "Configuration for system parameters.", "$ref": "SystemParameters" }, "systemTypes": { "description": "A list of all proto message types included in this API service.\nIt serves similar purpose as [google.api.Service.types], except that\nthese types are not needed by user-defined APIs. Therefore, they will not\nshow up in the generated discovery doc. This field should only be used\nto define system APIs in ESF.", "type": "array", "items": { "$ref": "Type" } } } }, "Api": { "id": "Api", "description": "Api is a light-weight descriptor for a protocol buffer service.", "type": "object", "properties": { "name": { "description": "The fully qualified name of this api, including package name\nfollowed by the api's simple name.", "type": "string" }, "methods": { "description": "The methods of this api, in unspecified order.", "type": "array", "items": { "$ref": "Method" } }, "options": { "description": "Any metadata attached to the API.", "type": "array", "items": { "$ref": "Option" } }, "version": { "description": "A version string for this api. If specified, must have the form\n`major-version.minor-version`, as in `1.10`. If the minor version\nis omitted, it defaults to zero. If the entire version field is\nempty, the major version is derived from the package name, as\noutlined below. If the field is not empty, the version in the\npackage name will be verified to be consistent with what is\nprovided here.\n\nThe versioning schema uses [semantic\nversioning](http:\/\/semver.org) where the major version number\nindicates a breaking change and the minor version an additive,\nnon-breaking change. Both version numbers are signals to users\nwhat to expect from different versions, and should be carefully\nchosen based on the product plan.\n\nThe major version is also reflected in the package name of the\nAPI, which must end in `v<major-version>`, as in\n`google.feature.v1`. For major versions 0 and 1, the suffix can\nbe omitted. Zero major versions must only be used for\nexperimental, none-GA apis.\n\n", "type": "string" }, "sourceContext": { "description": "Source context for the protocol buffer service represented by this\nmessage.", "$ref": "SourceContext" }, "mixins": { "description": "Included APIs. See Mixin.", "type": "array", "items": { "$ref": "Mixin" } }, "syntax": { "description": "The source syntax of the service.", "enumDescriptions": [ "Syntax `proto2`.", "Syntax `proto3`." ], "type": "string", "enum": [ "SYNTAX_PROTO2", "SYNTAX_PROTO3" ] } } }, "Method": { "id": "Method", "description": "Method represents a method of an api.", "type": "object", "properties": { "name": { "description": "The simple name of this method.", "type": "string" }, "requestTypeUrl": { "description": "A URL of the input message type.", "type": "string" }, "requestStreaming": { "description": "If true, the request is streamed.", "type": "boolean" }, "responseTypeUrl": { "description": "The URL of the output message type.", "type": "string" }, "responseStreaming": { "description": "If true, the response is streamed.", "type": "boolean" }, "options": { "description": "Any metadata attached to the method.", "type": "array", "items": { "$ref": "Option" } }, "syntax": { "description": "The source syntax of this method.", "enumDescriptions": [ "Syntax `proto2`.", "Syntax `proto3`." ], "type": "string", "enum": [ "SYNTAX_PROTO2", "SYNTAX_PROTO3" ] } } }, "Option": { "id": "Option", "description": "A protocol buffer option, which can be attached to a message, field,\nenumeration, etc.", "type": "object", "properties": { "name": { "description": "The option's name. For example, `\"java_package\"`.", "type": "string" }, "value": { "description": "The option's value. For example, `\"com.google.protobuf\"`.", "type": "object", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." } } } }, "SourceContext": { "id": "SourceContext", "description": "`SourceContext` represents information about the source of a\nprotobuf element, like the file in which it is defined.", "type": "object", "properties": { "fileName": { "description": "The path-qualified name of the .proto file that contained the associated\nprotobuf element. For example: `\"google\/protobuf\/source_context.proto\"`.", "type": "string" } } }, "Mixin": { "id": "Mixin", "description": "Declares an API to be included in this API. The including API must\nredeclare all the methods from the included API, but documentation\nand options are inherited as follows:\n\n- If after comment and whitespace stripping, the documentation\n string of the redeclared method is empty, it will be inherited\n from the original method.\n\n- Each annotation belonging to the service config (http,\n visibility) which is not set in the redeclared method will be\n inherited.\n\n- If an http annotation is inherited, the path pattern will be\n modified as follows. Any version prefix will be replaced by the\n version of the including API plus the root path if specified.\n\nExample of a simple mixin:\n\n package google.acl.v1;\n service AccessControl {\n \/\/ Get the underlying ACL object.\n rpc GetAcl(GetAclRequest) returns (Acl) {\n option (google.api.http).get = \"\/v1\/{resource=**}:getAcl\";\n }\n }\n\n package google.storage.v2;\n service Storage {\n \/\/ rpc GetAcl(GetAclRequest) returns (Acl);\n\n \/\/ Get a data record.\n rpc GetData(GetDataRequest) returns (Data) {\n option (google.api.http).get = \"\/v2\/{resource=**}\";\n }\n }\n\nExample of a mixin configuration:\n\n apis:\n - name: google.storage.v2.Storage\n mixins:\n - name: google.acl.v1.AccessControl\n\nThe mixin construct implies that all methods in `AccessControl` are\nalso declared with same name and request\/response types in\n`Storage`. A documentation generator or annotation processor will\nsee the effective `Storage.GetAcl` method after inherting\ndocumentation and annotations as follows:\n\n service Storage {\n \/\/ Get the underlying ACL object.\n rpc GetAcl(GetAclRequest) returns (Acl) {\n option (google.api.http).get = \"\/v2\/{resource=**}:getAcl\";\n }\n ...\n }\n\nNote how the version in the path pattern changed from `v1` to `v2`.\n\nIf the `root` field in the mixin is specified, it should be a\nrelative path under which inherited HTTP paths are placed. Example:\n\n apis:\n - name: google.storage.v2.Storage\n mixins:\n - name: google.acl.v1.AccessControl\n root: acls\n\nThis implies the following inherited HTTP annotation:\n\n service Storage {\n \/\/ Get the underlying ACL object.\n rpc GetAcl(GetAclRequest) returns (Acl) {\n option (google.api.http).get = \"\/v2\/acls\/{resource=**}:getAcl\";\n }\n ...\n }", "type": "object", "properties": { "name": { "description": "The fully qualified name of the API which is included.", "type": "string" }, "root": { "description": "If non-empty specifies a path under which inherited HTTP paths\nare rooted.", "type": "string" } } }, "Type": { "id": "Type", "description": "A protocol buffer message type.", "type": "object", "properties": { "name": { "description": "The fully qualified message name.", "type": "string" }, "fields": { "description": "The list of fields.", "type": "array", "items": { "$ref": "Field" } }, "oneofs": { "description": "The list of types appearing in `oneof` definitions in this type.", "type": "array", "items": { "type": "string" } }, "options": { "description": "The protocol buffer options.", "type": "array", "items": { "$ref": "Option" } }, "sourceContext": { "description": "The source context.", "$ref": "SourceContext" }, "syntax": { "description": "The source syntax.", "enumDescriptions": [ "Syntax `proto2`.", "Syntax `proto3`." ], "type": "string", "enum": [ "SYNTAX_PROTO2", "SYNTAX_PROTO3" ] } } }, "Field": { "id": "Field", "description": "A single field of a message type.", "type": "object", "properties": { "kind": { "description": "The field type.", "enumDescriptions": [ "Field type unknown.", "Field type double.", "Field type float.", "Field type int64.", "Field type uint64.", "Field type int32.", "Field type fixed64.", "Field type fixed32.", "Field type bool.", "Field type string.", "Field type group. Proto2 syntax only, and deprecated.", "Field type message.", "Field type bytes.", "Field type uint32.", "Field type enum.", "Field type sfixed32.", "Field type sfixed64.", "Field type sint32.", "Field type sint64." ], "type": "string", "enum": [ "TYPE_UNKNOWN", "TYPE_DOUBLE", "TYPE_FLOAT", "TYPE_INT64", "TYPE_UINT64", "TYPE_INT32", "TYPE_FIXED64", "TYPE_FIXED32", "TYPE_BOOL", "TYPE_STRING", "TYPE_GROUP", "TYPE_MESSAGE", "TYPE_BYTES", "TYPE_UINT32", "TYPE_ENUM", "TYPE_SFIXED32", "TYPE_SFIXED64", "TYPE_SINT32", "TYPE_SINT64" ] }, "cardinality": { "description": "The field cardinality.", "enumDescriptions": [ "For fields with unknown cardinality.", "For optional fields.", "For required fields. Proto2 syntax only.", "For repeated fields." ], "type": "string", "enum": [ "CARDINALITY_UNKNOWN", "CARDINALITY_OPTIONAL", "CARDINALITY_REQUIRED", "CARDINALITY_REPEATED" ] }, "number": { "description": "The field number.", "type": "integer", "format": "int32" }, "name": { "description": "The field name.", "type": "string" }, "typeUrl": { "description": "The field type URL, without the scheme, for message or enumeration\ntypes. Example: `\"type.googleapis.com\/google.protobuf.Timestamp\"`.", "type": "string" }, "oneofIndex": { "description": "The index of the field type in `Type.oneofs`, for message or enumeration\ntypes. The first type has index 1; zero means the type is not in the list.", "type": "integer", "format": "int32" }, "packed": { "description": "Whether to use alternative packed wire representation.", "type": "boolean" }, "options": { "description": "The protocol buffer options.", "type": "array", "items": { "$ref": "Option" } }, "jsonName": { "description": "The field JSON name.", "type": "string" }, "defaultValue": { "description": "The string value of the default value of this field. Proto2 syntax only.", "type": "string" } } }, "Enum": { "id": "Enum", "description": "Enum type definition.", "type": "object", "properties": { "name": { "description": "Enum type name.", "type": "string" }, "enumvalue": { "description": "Enum value definitions.", "type": "array", "items": { "$ref": "EnumValue" } }, "options": { "description": "Protocol buffer options.", "type": "array", "items": { "$ref": "Option" } }, "sourceContext": { "description": "The source context.", "$ref": "SourceContext" }, "syntax": { "description": "The source syntax.", "enumDescriptions": [ "Syntax `proto2`.", "Syntax `proto3`." ], "type": "string", "enum": [ "SYNTAX_PROTO2", "SYNTAX_PROTO3" ] } } }, "EnumValue": { "id": "EnumValue", "description": "Enum value definition.", "type": "object", "properties": { "name": { "description": "Enum value name.", "type": "string" }, "number": { "description": "Enum value number.", "type": "integer", "format": "int32" }, "options": { "description": "Protocol buffer options.", "type": "array", "items": { "$ref": "Option" } } } }, "Documentation": { "id": "Documentation", "description": "`Documentation` provides the information for describing a service.\n\nExample:\n<pre><code>documentation:\n summary: >\n The Google Calendar API gives access\n to most calendar features.\n pages:\n - name: Overview\n content: (== include google\/foo\/overview.md ==)\n - name: Tutorial\n content: (== include google\/foo\/tutorial.md ==)\n subpages;\n - name: Java\n content: (== include google\/foo\/tutorial_java.md ==)\n rules:\n - selector: google.calendar.Calendar.Get\n description: >\n ...\n - selector: google.calendar.Calendar.Put\n description: >\n ...\n<\/code><\/pre>\nDocumentation is provided in markdown syntax. In addition to\nstandard markdown features, definition lists, tables and fenced\ncode blocks are supported. Section headers can be provided and are\ninterpreted relative to the section nesting of the context where\na documentation fragment is embedded.\n\nDocumentation from the IDL is merged with documentation defined\nvia the config at normalization time, where documentation provided\nby config rules overrides IDL provided.\n\nA number of constructs specific to the API platform are supported\nin documentation text.\n\nIn order to reference a proto element, the following\nnotation can be used:\n<pre><code>[fully.qualified.proto.name][]<\/code><\/pre>\nTo override the display text used for the link, this can be used:\n<pre><code>[display text][fully.qualified.proto.name]<\/code><\/pre>\nText can be excluded from doc using the following notation:\n<pre><code>(-- internal comment --)<\/code><\/pre>\nComments can be made conditional using a visibility label. The below\ntext will be only rendered if the `BETA` label is available:\n<pre><code>(--BETA: comment for BETA users --)<\/code><\/pre>\nA few directives are available in documentation. Note that\ndirectives must appear on a single line to be properly\nidentified. The `include` directive includes a markdown file from\nan external source:\n<pre><code>(== include path\/to\/file ==)<\/code><\/pre>\nThe `resource_for` directive marks a message to be the resource of\na collection in REST view. If it is not specified, tools attempt\nto infer the resource from the operations in a collection:\n<pre><code>(== resource_for v1.shelves.books ==)<\/code><\/pre>\nThe directive `suppress_warning` does not directly affect documentation\nand is documented together with service config validation.", "type": "object", "properties": { "summary": { "description": "A short summary of what the service does. Can only be provided by\nplain text.", "type": "string" }, "pages": { "description": "The top level pages for the documentation set.", "type": "array", "items": { "$ref": "Page" } }, "rules": { "description": "Documentation rules for individual elements of the service.", "type": "array", "items": { "$ref": "DocumentationRule" } }, "documentationRootUrl": { "description": "The URL to the root of documentation.", "type": "string" }, "overview": { "description": "Declares a single overview page. For example:\n<pre><code>documentation:\n summary: ...\n overview: (== include overview.md ==)\n<\/code><\/pre>\nThis is a shortcut for the following declaration (using pages style):\n<pre><code>documentation:\n summary: ...\n pages:\n - name: Overview\n content: (== include overview.md ==)\n<\/code><\/pre>\nNote: you cannot specify both `overview` field and `pages` field.", "type": "string" } } }, "Page": { "id": "Page", "description": "Represents a documentation page. A page can contain subpages to represent\nnested documentation set structure.", "type": "object", "properties": { "name": { "description": "The name of the page. It will be used as an identity of the page to\ngenerate URI of the page, text of the link to this page in navigation,\netc. The full page name (start from the root page name to this page\nconcatenated with `.`) can be used as reference to the page in your\ndocumentation. For example:\n<pre><code>pages:\n- name: Tutorial\n content: (== include tutorial.md ==)\n subpages:\n - name: Java\n content: (== include tutorial_java.md ==)\n<\/code><\/pre>\nYou can reference `Java` page using Markdown reference link syntax:\n`Java`.", "type": "string" }, "content": { "description": "The Markdown content of the page. You can use <code>(== include {path} ==)<\/code>\nto include content from a Markdown file.", "type": "string" }, "subpages": { "description": "Subpages of this page. The order of subpages specified here will be\nhonored in the generated docset.", "type": "array", "items": { "$ref": "Page" } } } }, "DocumentationRule": { "id": "DocumentationRule", "description": "A documentation rule provides information about individual API elements.", "type": "object", "properties": { "selector": { "description": "The selector is a comma-separated list of patterns. Each pattern is a\nqualified name of the element which may end in \"*\", indicating a wildcard.\nWildcards are only allowed at the end and for a whole component of the\nqualified name, i.e. \"foo.*\" is ok, but not \"foo.b*\" or \"foo.*.bar\". To\nspecify a default for all applicable elements, the whole pattern \"*\"\nis used.", "type": "string" }, "description": { "description": "Description of the selected API(s).", "type": "string" }, "deprecationDescription": { "description": "Deprecation description of the selected element(s). It can be provided if an\nelement is marked as `deprecated`.", "type": "string" } } }, "Visibility": { "id": "Visibility", "description": "`Visibility` defines restrictions for the visibility of service\nelements. Restrictions are specified using visibility labels\n(e.g., TRUSTED_TESTER) that are elsewhere linked to users and projects.\n\nUsers and projects can have access to more than one visibility label. The\neffective visibility for multiple labels is the union of each label's\nelements, plus any unrestricted elements.\n\nIf an element and its parents have no restrictions, visibility is\nunconditionally granted.\n\nExample:\n\n visibility:\n rules:\n - selector: google.calendar.Calendar.EnhancedSearch\n restriction: TRUSTED_TESTER\n - selector: google.calendar.Calendar.Delegate\n restriction: GOOGLE_INTERNAL\n\nHere, all methods are publicly visible except for the restricted methods\nEnhancedSearch and Delegate.", "type": "object", "properties": { "rules": { "description": "A list of visibility rules providing visibility configuration for\nindividual API elements.", "type": "array", "items": { "$ref": "VisibilityRule" } }, "enforceRuntimeVisibility": { "description": "Controls whether visibility rules are enforced at runtime for requests to\nall APIs and methods.\n\nIf true, requests without method visibility will receive a\nNOT_FOUND error, and any non-visible fields will be scrubbed from\nthe response messages. In service config version 0, the default is false.\nIn later config versions, it's true.\n\nNote, the `enforce_runtime_visibility` specified in a visibility rule\noverrides this setting for the APIs or methods asscoiated with the rule.", "type": "boolean" } } }, "VisibilityRule": { "id": "VisibilityRule", "description": "A visibility rule provides visibility configuration for an individual API\nelement.", "type": "object", "properties": { "selector": { "description": "Selects methods, messages, fields, enums, etc. to which this rule applies.\n\nRefer to selector for syntax details.", "type": "string" }, "restriction": { "description": "Lists the visibility labels for this rule. Any of the listed labels grants\nvisibility to the element.\n\nIf a rule has multiple labels, removing one of the labels but not all of\nthem can break clients.\n\nExample:\n\n visibility:\n rules:\n - selector: google.calendar.Calendar.EnhancedSearch\n restriction: GOOGLE_INTERNAL, TRUSTED_TESTER\n\nRemoving GOOGLE_INTERNAL from this restriction will break clients that\nrely on this method and only had access to it through GOOGLE_INTERNAL.", "type": "string" }, "enforceRuntimeVisibility": { "description": "Controls whether visibility is enforced at runtime for requests to an API\nmethod. This setting has meaning only when the selector applies to a method\nor an API.\n\nIf true, requests without method visibility will receive a\nNOT_FOUND error, and any non-visible fields will be scrubbed from\nthe response messages. The default is determined by the value of\ngoogle.api.Visibility.enforce_runtime_visibility.", "type": "boolean" } } }, "Backend": { "id": "Backend", "description": "`Backend` defines the backend configuration for a service.", "type": "object", "properties": { "rules": { "description": "A list of backend rules providing configuration for individual API\nelements.", "type": "array", "items": { "$ref": "BackendRule" } } } }, "BackendRule": { "id": "BackendRule", "description": "A backend rule provides configuration for an individual API element.", "type": "object", "properties": { "selector": { "description": "Selects the methods to which this rule applies.\n\nRefer to selector for syntax details.", "type": "string" }, "address": { "description": "The address of the API backend.\n", "type": "string" }, "deadline": { "description": "The number of seconds to wait for a response from a request. The\ndefault depends on the deployment context.", "type": "number", "format": "double" } } }, "Http": { "id": "Http", "description": "Defines the HTTP configuration for a service. It contains a list of\nHttpRule, each specifying the mapping of an RPC method\nto one or more HTTP REST API methods.", "type": "object", "properties": { "rules": { "description": "A list of HTTP rules for configuring the HTTP REST API methods.", "type": "array", "items": { "$ref": "HttpRule" } } } }, "HttpRule": { "id": "HttpRule", "description": "`HttpRule` defines the mapping of an RPC method to one or more HTTP\nREST APIs. The mapping determines what portions of the request\nmessage are populated from the path, query parameters, or body of\nthe HTTP request. The mapping is typically specified as an\n`google.api.http` annotation, see \"google\/api\/annotations.proto\"\nfor details.\n\nThe mapping consists of a field specifying the path template and\nmethod kind. The path template can refer to fields in the request\nmessage, as in the example below which describes a REST GET\noperation on a resource collection of messages:\n\n```proto\nservice Messaging {\n rpc GetMessage(GetMessageRequest) returns (Message) {\n option (google.api.http).get = \"\/v1\/messages\/{message_id}\/{sub.subfield}\";\n }\n}\nmessage GetMessageRequest {\n message SubMessage {\n string subfield = 1;\n }\n string message_id = 1; \/\/ mapped to the URL\n SubMessage sub = 2; \/\/ `sub.subfield` is url-mapped\n}\nmessage Message {\n string text = 1; \/\/ content of the resource\n}\n```\n\nThis definition enables an automatic, bidrectional mapping of HTTP\nJSON to RPC. Example:\n\nHTTP | RPC\n-----|-----\n`GET \/v1\/messages\/123456\/foo` | `GetMessage(message_id: \"123456\" sub: SubMessage(subfield: \"foo\"))`\n\nIn general, not only fields but also field paths can be referenced\nfrom a path pattern. Fields mapped to the path pattern cannot be\nrepeated and must have a primitive (non-message) type.\n\nAny fields in the request message which are not bound by the path\npattern automatically become (optional) HTTP query\nparameters. Assume the following definition of the request message:\n\n```proto\nmessage GetMessageRequest {\n message SubMessage {\n string subfield = 1;\n }\n string message_id = 1; \/\/ mapped to the URL\n int64 revision = 2; \/\/ becomes a parameter\n SubMessage sub = 3; \/\/ `sub.subfield` becomes a parameter\n}\n```\n\nThis enables a HTTP JSON to RPC mapping as below:\n\nHTTP | RPC\n-----|-----\n`GET \/v1\/messages\/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: \"123456\" revision: 2 sub: SubMessage(subfield: \"foo\"))`\n\nNote that fields which are mapped to HTTP parameters must have a\nprimitive type or a repeated primitive type. Message types are not\nallowed. In the case of a repeated type, the parameter can be\nrepeated in the URL, as in `...?param=A¶m=B`.\n\nFor HTTP method kinds which allow a request body, the `body` field\nspecifies the mapping. Consider a REST update method on the\nmessage resource collection:\n\n```proto\nservice Messaging {\n rpc UpdateMessage(UpdateMessageRequest) returns (Message) {\n option (google.api.http) = {\n put: \"\/v1\/messages\/{message_id}\"\n body: \"message\"\n };\n }\n}\nmessage UpdateMessageRequest {\n string message_id = 1; \/\/ mapped to the URL\n Message message = 2; \/\/ mapped to the body\n}\n```\n\nThe following HTTP JSON to RPC mapping is enabled, where the\nrepresentation of the JSON in the request body is determined by\nprotos JSON encoding:\n\nHTTP | RPC\n-----|-----\n`PUT \/v1\/messages\/123456 { \"text\": \"Hi!\" }` | `UpdateMessage(message_id: \"123456\" message { text: \"Hi!\" })`\n\nThe special name `*` can be used in the body mapping to define that\nevery field not bound by the path template should be mapped to the\nrequest body. This enables the following alternative definition of\nthe update method:\n\n```proto\nservice Messaging {\n rpc UpdateMessage(Message) returns (Message) {\n option (google.api.http) = {\n put: \"\/v1\/messages\/{message_id}\"\n body: \"*\"\n };\n }\n}\nmessage Message {\n string message_id = 1;\n string text = 2;\n}\n```\n\nThe following HTTP JSON to RPC mapping is enabled:\n\nHTTP | RPC\n-----|-----\n`PUT \/v1\/messages\/123456 { \"text\": \"Hi!\" }` | `UpdateMessage(message_id: \"123456\" text: \"Hi!\")`\n\nNote that when using `*` in the body mapping, it is not possible to\nhave HTTP parameters, as all fields not bound by the path end in\nthe body. This makes this option more rarely used in practice of\ndefining REST APIs. The common usage of `*` is in custom methods\nwhich don't use the URL at all for transferring data.\n\nIt is possible to define multiple HTTP methods for one RPC by using\nthe `additional_bindings` option. Example:\n\n```proto\nservice Messaging {\n rpc GetMessage(GetMessageRequest) returns (Message) {\n option (google.api.http) = {\n get: \"\/v1\/messages\/{message_id}\"\n additional_bindings {\n get: \"\/v1\/users\/{user_id}\/messages\/{message_id}\"\n }\n };\n }\n}\nmessage GetMessageRequest {\n string message_id = 1;\n string user_id = 2;\n}\n```\n\nThis enables the following two alternative HTTP JSON to RPC\nmappings:\n\nHTTP | RPC\n-----|-----\n`GET \/v1\/messages\/123456` | `GetMessage(message_id: \"123456\")`\n`GET \/v1\/users\/me\/messages\/123456` | `GetMessage(user_id: \"me\" message_id: \"123456\")`\n\n# Rules for HTTP mapping\n\nThe rules for mapping HTTP path, query parameters, and body fields\nto the request message are as follows:\n\n1. The `body` field specifies either `*` or a field path, or is\n omitted. If omitted, it assumes there is no HTTP body.\n2. Leaf fields (recursive expansion of nested messages in the\n request) can be classified into three types:\n (a) Matched in the URL template.\n (b) Covered by body (if body is `*`, everything except (a) fields;\n else everything under the body field)\n (c) All other fields.\n3. URL query parameters found in the HTTP request are mapped to (c) fields.\n4. Any body sent with an HTTP request can contain only (b) fields.\n\nThe syntax of the path template is as follows:\n\n Template = \"\/\" Segments [ Verb ] ;\n Segments = Segment { \"\/\" Segment } ;\n Segment = \"*\" | \"**\" | LITERAL | Variable ;\n Variable = \"{\" FieldPath [ \"=\" Segments ] \"}\" ;\n FieldPath = IDENT { \".\" IDENT } ;\n Verb = \":\" LITERAL ;\n\nThe syntax `*` matches a single path segment. It follows the semantics of\n[RFC 6570](https:\/\/tools.ietf.org\/html\/rfc6570) Section 3.2.2 Simple String\nExpansion.\n\nThe syntax `**` matches zero or more path segments. It follows the semantics\nof [RFC 6570](https:\/\/tools.ietf.org\/html\/rfc6570) Section 3.2.3 Reserved\nExpansion.\n\nThe syntax `LITERAL` matches literal text in the URL path.\n\nThe syntax `Variable` matches the entire path as specified by its template;\nthis nested template must not contain further variables. If a variable\nmatches a single path segment, its template may be omitted, e.g. `{var}`\nis equivalent to `{var=*}`.\n\nNOTE: the field paths in variables and in the `body` must not refer to\nrepeated fields or map fields.\n\nUse CustomHttpPattern to specify any HTTP method that is not included in the\n`pattern` field, such as HEAD, or \"*\" to leave the HTTP method unspecified for\na given URL path rule. The wild-card rule is useful for services that provide\ncontent to Web (HTML) clients.", "type": "object", "properties": { "selector": { "description": "Selects methods to which this rule applies.\n\nRefer to selector for syntax details.", "type": "string" }, "get": { "description": "Used for listing and getting information about resources.", "type": "string" }, "put": { "description": "Used for updating a resource.", "type": "string" }, "post": { "description": "Used for creating a resource.", "type": "string" }, "delete": { "description": "Used for deleting a resource.", "type": "string" }, "patch": { "description": "Used for updating a resource.", "type": "string" }, "custom": { "description": "Custom pattern is used for defining custom verbs.", "$ref": "CustomHttpPattern" }, "body": { "description": "The name of the request field whose value is mapped to the HTTP body, or\n`*` for mapping all fields not captured by the path pattern to the HTTP\nbody. NOTE: the referred field must not be a repeated field.", "type": "string" }, "mediaUpload": { "description": "Do not use this. For media support, add instead\n[][google.bytestream.RestByteStream] as an API to your\nconfiguration.", "$ref": "MediaUpload" }, "mediaDownload": { "description": "Do not use this. For media support, add instead\n[][google.bytestream.RestByteStream] as an API to your\nconfiguration.", "$ref": "MediaDownload" }, "additionalBindings": { "description": "Additional HTTP bindings for the selector. Nested bindings must\nnot contain an `additional_bindings` field themselves (that is,\nthe nesting may only be one level deep).", "type": "array", "items": { "$ref": "HttpRule" } } } }, "CustomHttpPattern": { "id": "CustomHttpPattern", "description": "A custom pattern is used for defining custom HTTP verb.", "type": "object", "properties": { "kind": { "description": "The name of this custom HTTP verb.", "type": "string" }, "path": { "description": "The path matched by this custom verb.", "type": "string" } } }, "MediaUpload": { "id": "MediaUpload", "description": "Do not use this. For media support, add instead\n[][google.bytestream.RestByteStream] as an API to your\nconfiguration.", "type": "object", "properties": { "enabled": { "description": "Whether upload is enabled.", "type": "boolean" } } }, "MediaDownload": { "id": "MediaDownload", "description": "Do not use this. For media support, add instead\n[][google.bytestream.RestByteStream] as an API to your\nconfiguration.", "type": "object", "properties": { "enabled": { "description": "Whether download is enabled.", "type": "boolean" } } }, "Quota": { "id": "Quota", "description": "Quota configuration helps to achieve fairness and budgeting in service\nusage.\n\n- Fairness is achieved through the use of short-term quota limits\n that are usually defined over a time window of several seconds or\n minutes. When such a limit is applied, for example at the user\n level, it ensures that no single user will monopolize the service\n or a given customer's allocated portion of it.\n- Budgeting is achieved through the use of long-term quota limits\n that are usually defined over a time window of one or more\n days. These limits help client application developers predict the\n usage and help budgeting.\n\nQuota enforcement uses a simple token-based algorithm for resource sharing.\n\nThe quota configuration structure is as follows:\n\n- `QuotaLimit` defines a single enforceable limit with a specified\n token amount that can be consumed over a specific duration and\n applies to a particular entity, like a project or an end user. If\n the limit applies to a user, each user making the request will\n get the specified number of tokens to consume. When the tokens\n run out, the requests from that user will be blocked until the\n duration elapses and the next duration window starts.\n\n- `QuotaGroup` groups a set of quota limits.\n\n- `QuotaRule` maps a method to a set of quota groups. This allows\n sharing of quota groups across methods as well as one method\n consuming tokens from more than one quota group. When a group\n contains multiple limits, requests to a method consuming tokens\n from that group must satisfy all the limits in that group.\n\nExample:\n\n quota:\n groups:\n - name: ReadGroup\n limits:\n - description: Daily Limit\n name: ProjectQpd\n default_limit: 10000\n duration: 1d\n limit_by: CLIENT_PROJECT\n\n - description: Per-second Limit\n name: UserQps\n default_limit: 20000\n duration: 100s\n limit_by: USER\n\n - name: WriteGroup\n limits:\n - description: Daily Limit\n name: ProjectQpd\n default_limit: 1000\n max_limit: 1000\n duration: 1d\n limit_by: CLIENT_PROJECT\n\n - description: Per-second Limit\n name: UserQps\n default_limit: 2000\n max_limit: 4000\n duration: 100s\n limit_by: USER\n\n rules:\n - selector: \"*\"\n groups:\n - group: ReadGroup\n - selector: google.calendar.Calendar.Update\n groups:\n - group: WriteGroup\n cost: 2\n - selector: google.calendar.Calendar.Delete\n groups:\n - group: WriteGroup\n\nHere, the configuration defines two quota groups: ReadGroup and WriteGroup,\neach defining its own daily and per-second limits. Note that One Platform\nenforces per-second limits averaged over a duration of 100 seconds. The rules\nmap ReadGroup for all methods, except for the Update and Delete methods.\nThese two methods consume from WriteGroup, with Update method consuming at\ntwice the rate as Delete method.\n\nMultiple quota groups can be specified for a method. The quota limits in all\nof those groups will be enforced. Example:\n\n quota:\n groups:\n - name: WriteGroup\n limits:\n - description: Daily Limit\n name: ProjectQpd\n default_limit: 1000\n max_limit: 1000\n duration: 1d\n limit_by: CLIENT_PROJECT\n\n - description: Per-second Limit\n name: UserQps\n default_limit: 2000\n max_limit: 4000\n duration: 100s\n limit_by: USER\n\n - name: StorageGroup\n limits:\n - description: Storage Quota\n name: StorageQuota\n default_limit: 1000\n duration: 0\n limit_by: USER\n\n rules:\n - selector: google.calendar.Calendar.Create\n groups:\n - group: StorageGroup\n - group: WriteGroup\n - selector: google.calendar.Calendar.Delete\n groups:\n - group: StorageGroup\n\nIn the above example, the Create and Delete methods manage the user's\nstorage space. In addition, Create method uses WriteGroup to manage the\nrequests. In this case, requests to Create method need to satisfy all quota\nlimits defined in both quota groups.\n\nOne can disable quota for selected method(s) identified by the selector by\nsetting disable_quota to ture. For example,\n\n rules:\n - selector: \"*\"\n group:\n - group ReadGroup\n - selector: google.calendar.Calendar.Select\n disable_quota: true\n", "type": "object", "properties": { "groups": { "description": "List of `QuotaGroup` definitions for the service.", "type": "array", "items": { "$ref": "QuotaGroup" } }, "rules": { "description": "List of `QuotaRule` definitions, each one mapping a selected method to one\nor more quota groups.", "type": "array", "items": { "$ref": "QuotaRule" } } } }, "QuotaGroup": { "id": "QuotaGroup", "description": "`QuotaGroup` defines a set of quota limits to enforce.", "type": "object", "properties": { "name": { "description": "Name of this quota group. Must be unique within the service.\n\nQuota group name is used as part of the id for quota limits. Once the quota\ngroup has been put into use, the name of the quota group should be\nimmutable.", "type": "string" }, "description": { "description": "User-visible description of this quota group.", "type": "string" }, "limits": { "description": "Quota limits to be enforced when this quota group is used. A request must\nsatisfy all the limits in a group for it to be permitted.", "type": "array", "items": { "$ref": "QuotaLimit" } }, "billable": { "description": "Indicates if the quota limits defined in this quota group apply to\nconsumers who have active billing. Quota limits defined in billable\ngroups will be applied only to consumers who have active billing. The\namount of tokens consumed from billable quota group will also be reported\nfor billing. Quota limits defined in non-billable groups will be applied\nonly to consumers who have no active billing.", "type": "boolean" } } }, "QuotaLimit": { "id": "QuotaLimit", "description": "`QuotaLimit` defines a specific limit that applies over a specified duration\nfor a limit type. There can be at most one limit for a duration and limit\ntype combination defined within a `QuotaGroup`.", "type": "object", "properties": { "name": { "description": "Name of the quota limit. Must be unique within the quota group.\nThis name is used to refer to the limit when overriding the limit on\na per-project basis. If a name is not provided, it will be generated\nfrom the limit_by and duration fields.\n\nThe maximum length of the limit name is 64 characters.\n\nThe name of a limit is used as a unique identifier for this limit.\nTherefore, once a limit has been put into use, its name should be\nimmutable. You can use the display_name field to provide a user-friendly\nname for the limit. The display name can be evolved over time without\naffecting the identity of the limit.\n", "type": "string" }, "limitBy": { "description": "Limit type to use for enforcing this quota limit. Each unique value gets\nthe defined number of tokens to consume from. For a quota limit that uses\nuser type, each user making requests through the same client application\nproject will get his\/her own pool of tokens to consume, whereas for a limit\nthat uses client project type, all users making requests through the same\nclient application project share a single pool of tokens.", "enumDescriptions": [ "ID of the project owned by the client application developer making the\nrequest.", "ID of the end user making the request using the client application." ], "type": "string", "enum": [ "CLIENT_PROJECT", "USER" ] }, "description": { "description": "Optional. User-visible, extended description for this quota limit.\nShould be used only when more context is needed to understand this limit\nthan provided by the limit's display name (see: `display_name`).", "type": "string" }, "defaultLimit": { "description": "Default number of tokens that can be consumed during the specified\nduration. This is the number of tokens assigned when a client\napplication developer activates the service for his\/her project.\n\nSpecifying a value of 0 will block all requests. This can be used if you\nare provisioning quota to selected consumers and blocking others.\nSimilarly, a value of -1 will indicate an unlimited quota. No other\nnegative values are allowed.", "type": "string", "format": "int64" }, "maxLimit": { "description": "Maximum number of tokens that can be consumed during the specified\nduration. Client application developers can override the default limit up\nto this maximum. If specified, this value cannot be set to a value less\nthan the default limit. If not specified, it is set to the default limit.\n\nTo allow clients to apply overrides with no upper bound, set this to -1,\nindicating unlimited maximum quota.", "type": "string", "format": "int64" }, "freeTier": { "description": "Free tier value displayed in the Developers Console for this limit.\nThe free tier is the number of tokens that will be subtracted from the\nbilled amount when billing is enabled.\nThis field can only be set on a limit with duration \"1d\", in a billable\ngroup; it is invalid on any other limit. If this field is not set, it\ndefaults to 0, indicating that there is no free tier for this service.", "type": "string", "format": "int64" }, "duration": { "description": "Duration of this limit in textual notation. Example: \"100s\", \"24h\", \"1d\".\nFor duration longer than a day, only multiple of days is supported. We\nsupport only \"100s\" and \"1d\" for now. Additional support will be added in\nthe future. \"0\" indicates indefinite duration.", "type": "string" }, "displayName": { "description": "User-visible display name for this limit.\nOptional. If not set, the UI will provide a default display name based on\nthe quota configuration. This field can be used to override the default\ndisplay name generated from the configuration.", "type": "string" } } }, "QuotaRule": { "id": "QuotaRule", "description": "`QuotaRule` maps a method to a set of `QuotaGroup`s.", "type": "object", "properties": { "selector": { "description": "Selects methods to which this rule applies.\n\nRefer to selector for syntax details.", "type": "string" }, "groups": { "description": "Quota groups to be used for this method. This supports associating a cost\nwith each quota group.", "type": "array", "items": { "$ref": "QuotaGroupMapping" } }, "disableQuota": { "description": "Indicates if quota checking should be enforced. Quota will be disabled for\nmethods without quota rules or with quota rules having this field set to\ntrue. When this field is set to true, no quota group mapping is allowed.", "type": "boolean" } } }, "QuotaGroupMapping": { "id": "QuotaGroupMapping", "description": "A quota group mapping.", "type": "object", "properties": { "group": { "description": "The `QuotaGroup.name` of the group. Requests for the mapped methods will\nconsume tokens from each of the limits defined in this group.", "type": "string" }, "cost": { "description": "Number of tokens to consume for each request. This allows different cost\nto be associated with different methods that consume from the same quota\ngroup. By default, each request will cost one token.", "type": "integer", "format": "int32" } } }, "Authentication": { "id": "Authentication", "description": "`Authentication` defines the authentication configuration for an API.\n\nExample for an API targeted for external use:\n\n name: calendar.googleapis.com\n authentication:\n rules:\n - selector: \"*\"\n oauth:\n canonical_scopes: https:\/\/www.googleapis.com\/auth\/calendar\n\n - selector: google.calendar.Delegate\n oauth:\n canonical_scopes: https:\/\/www.googleapis.com\/auth\/calendar.read", "type": "object", "properties": { "rules": { "description": "Individual rules for authentication.", "type": "array", "items": { "$ref": "AuthenticationRule" } }, "providers": { "description": "Defines a set of authentication providers that a service supports.", "type": "array", "items": { "$ref": "AuthProvider" } } } }, "AuthenticationRule": { "id": "AuthenticationRule", "description": "Authentication rules for the service.\n\nBy default, if a method has any authentication requirements, every request\nmust include a valid credential matching one of the requirements.\nIt's an error to include more than one kind of credential in a single\nrequest.\n\nIf a method doesn't have any auth requirements, request credentials will be\nignored.\n", "type": "object", "properties": { "selector": { "description": "Selects the methods to which this rule applies.\n\nRefer to selector for syntax details.", "type": "string" }, "oauth": { "description": "The requirements for OAuth credentials.", "$ref": "OAuthRequirements" }, "allowWithoutCredential": { "description": "Whether to allow requests without a credential. If quota is enabled, an\nAPI key is required for such request to pass the quota check.\n", "type": "boolean" }, "requirements": { "description": "Requirements for additional authentication providers.", "type": "array", "items": { "$ref": "AuthRequirement" } } } }, "OAuthRequirements": { "id": "OAuthRequirements", "description": "OAuth scopes are a way to define data and permissions on data. For example,\nthere are scopes defined for \"Read-only access to Google Calendar\" and\n\"Access to Cloud Platform\". Users can consent to a scope for an application,\ngiving it permission to access that data on their behalf.\n\nOAuth scope specifications should be fairly coarse grained; a user will need\nto see and understand the text description of what your scope means.\n\nIn most cases: use one or at most two OAuth scopes for an entire family of\nproducts. If your product has multiple APIs, you should probably be sharing\nthe OAuth scope across all of those APIs.\n\nWhen you need finer grained OAuth consent screens: talk with your product\nmanagement about how developers will use them in practice.\n\nPlease note that even though each of the canonical scopes is enough for a\nrequest to be accepted and passed to the backend, a request can still fail\ndue to the backend requiring additional scopes or permissions.\n", "type": "object", "properties": { "canonicalScopes": { "description": "The list of publicly documented OAuth scopes that are allowed access. An\nOAuth token containing any of these scopes will be accepted.\n\nExample:\n\n canonical_scopes: https:\/\/www.googleapis.com\/auth\/calendar,\n https:\/\/www.googleapis.com\/auth\/calendar.read", "type": "string" } } }, "AuthRequirement": { "id": "AuthRequirement", "description": "User-defined authentication requirements, including support for\n[JSON Web Token (JWT)](https:\/\/tools.ietf.org\/html\/draft-ietf-oauth-json-web-token-32).", "type": "object", "properties": { "providerId": { "description": "id from authentication provider.\n\nExample:\n\n provider_id: bookstore_auth", "type": "string" }, "audiences": { "description": "The list of JWT\n[audiences](https:\/\/tools.ietf.org\/html\/draft-ietf-oauth-json-web-token-32#section-4.1.3).\nthat are allowed to access. A JWT containing any of these audiences will\nbe accepted. When this setting is absent, only JWTs with audience\n\"https:\/\/Service_name\/API_name\"\nwill be accepted. For example, if no audiences are in the setting,\nLibraryService API will only accept JWTs with the following audience\n\"https:\/\/library-example.googleapis.com\/google.example.library.v1.LibraryService\".\n\nExample:\n\n audiences: bookstore_android.apps.googleusercontent.com,\n bookstore_web.apps.googleusercontent.com", "type": "string" } } }, "AuthProvider": { "id": "AuthProvider", "description": "Configuration for an anthentication provider, including support for\n[JSON Web Token (JWT)](https:\/\/tools.ietf.org\/html\/draft-ietf-oauth-json-web-token-32).", "type": "object", "properties": { "id": { "description": "The unique identifier of the auth provider. It will be referred to by\n`AuthRequirement.provider_id`.\n\nExample: \"bookstore_auth\".", "type": "string" }, "issuer": { "description": "Identifies the principal that issued the JWT. See\nhttps:\/\/tools.ietf.org\/html\/draft-ietf-oauth-json-web-token-32#section-4.1.1\nUsually a URL or an email address.\n\nExample: https:\/\/securetoken.google.com\nExample: 1234567-compute@developer.gserviceaccount.com", "type": "string" }, "jwksUri": { "description": "URL of the provider's public key set to validate signature of the JWT. See\n[OpenID Discovery](https:\/\/openid.net\/specs\/openid-connect-discovery-1_0.html#ProviderMetadata).\nOptional if the key set document:\n - can be retrieved from\n [OpenID Discovery](https:\/\/openid.net\/specs\/openid-connect-discovery-1_0.html\n of the issuer.\n - can be inferred from the email domain of the issuer (e.g. a Google service account).\n\nExample: https:\/\/www.googleapis.com\/oauth2\/v1\/certs", "type": "string" } } }, "Context": { "id": "Context", "description": "`Context` defines which contexts an API requests.\n\nExample:\n\n context:\n rules:\n - selector: \"*\"\n requested:\n - google.rpc.context.ProjectContext\n - google.rpc.context.OriginContext\n\nThe above specifies that all methods in the API request\n`google.rpc.context.ProjectContext` and\n`google.rpc.context.OriginContext`.\n\nAvailable context types are defined in package\n`google.rpc.context`.", "type": "object", "properties": { "rules": { "description": "List of rules for context, applicable to methods.", "type": "array", "items": { "$ref": "ContextRule" } } } }, "ContextRule": { "id": "ContextRule", "description": "A context rule provides information about the context for an individual API\nelement.", "type": "object", "properties": { "selector": { "description": "Selects the methods to which this rule applies.\n\nRefer to selector for syntax details.", "type": "string" }, "requested": { "description": "A list of full type names of requested contexts.", "type": "array", "items": { "type": "string" } }, "provided": { "description": "A list of full type names of provided contexts.", "type": "array", "items": { "type": "string" } } } }, "Usage": { "id": "Usage", "description": "Configuration controlling usage of a service.", "type": "object", "properties": { "serviceAccess": { "description": "Controls which users can see or activate the service.", "enumDescriptions": [ "The service can only be seen\/used by users identified in the service's\naccess control policy.\n\nIf the service has not been whitelisted by your domain administrator\nfor out-of-org publishing, then this mode will be treated like\nORG_RESTRICTED.", "The service can be seen\/used by anyone.\n\nIf the service has not been whitelisted by your domain administrator\nfor out-of-org publishing, then this mode will be treated like\nORG_PUBLIC.\n\nThe discovery document for the service will also be public and allow\nunregistered access.", "The service can be seen\/used by users identified in the service's\naccess control policy and they are within the organization that owns the\nservice.\n\nAccess is further constrained to the group\ncontrolled by the administrator of the project\/org that owns the\nservice.", "The service can be seen\/used by the group of users controlled by the\nadministrator of the project\/org that owns the service." ], "type": "string", "enum": [ "RESTRICTED", "PUBLIC", "ORG_RESTRICTED", "ORG_PUBLIC" ] }, "requirements": { "description": "Requirements that must be satisfied before a consumer project can use the\nservice. Each requirement is of the form <service.name>\/<requirement-id>;\nfor example 'serviceusage.googleapis.com\/billing-enabled'.", "type": "array", "items": { "type": "string" } }, "dependsOnServices": { "description": "Services that must be activated in order for this service to be used.\nThe set of services activated as a result of these relations are all\nactivated in parallel with no guaranteed order of activation.\nEach string is a service name, e.g. `calendar.googleapis.com`.", "type": "array", "items": { "type": "string" } }, "activationHooks": { "description": "Services that must be contacted before a consumer can begin using the\nservice. Each service will be contacted in sequence, and, if any activation\ncall fails, the entire activation will fail. Each hook is of the form\n<service.name>\/<hook-id>, where <hook-id> is optional; for example:\n'robotservice.googleapis.com\/default'.", "type": "array", "items": { "type": "string" } }, "deactivationHooks": { "description": "Services that must be contacted before a consumer can deactivate a\nservice. Each service will be contacted in sequence, and, if any\ndeactivation call fails, the entire deactivation will fail. Each hook is\nof the form <service.name>\/<hook-id>, where <hook-id> is optional; for\nexample:\n'compute.googleapis.com\/'.", "type": "array", "items": { "type": "string" } }, "rules": { "description": "Individual rules for configuring usage on selected methods.", "type": "array", "items": { "$ref": "UsageRule" } } } }, "UsageRule": { "id": "UsageRule", "description": "Usage configuration rules for the service.\n\nNOTE: Under development.\n\n\nUse this rule to configure unregistered calls for the service. Unregistered\ncalls are calls that do not contain consumer project identity.\n(Example: calls that do not contain an API key).\nBy default, API methods do not allow unregistered calls, and each method call\nmust be identified by a consumer project identity. Use this rule to\nallow\/disallow unregistered calls.\n\nExample of an API that wants to allow unregistered calls for entire service.\n\n usage:\n rules:\n - selector: \"*\"\n allow_unregistered_calls: true\n\nExample of a method that wants to allow unregistered calls.\n\n usage:\n rules:\n - selector: \"google.example.library.v1.LibraryService.CreateBook\"\n allow_unregistered_calls: true", "type": "object", "properties": { "selector": { "description": "Selects the methods to which this rule applies. Use '*' to indicate all\nmethods in all APIs.\n\nRefer to selector for syntax details.", "type": "string" }, "allowUnregisteredCalls": { "description": "True, if the method allows unregistered calls; false otherwise.", "type": "boolean" } } }, "CustomError": { "id": "CustomError", "description": "Customize service error responses. For example, list any service\nspecific protobuf types that can appear in error detail lists of\nerror responses.\n\nExample:\n\n custom_error:\n types:\n - google.foo.v1.CustomError\n - google.foo.v1.AnotherError\n", "type": "object", "properties": { "rules": { "description": "The list of custom error rules to select to which messages this should\napply.", "type": "array", "items": { "$ref": "CustomErrorRule" } }, "types": { "description": "The list of custom error detail types, e.g. 'google.foo.v1.CustomError'.", "type": "array", "items": { "type": "string" } } } }, "CustomErrorRule": { "id": "CustomErrorRule", "description": "A custom error rule.", "type": "object", "properties": { "selector": { "description": "Selects messages to which this rule applies.\n\nRefer to selector for syntax details.", "type": "string" }, "isErrorType": { "description": "Mark this message as possible payload in error response. Otherwise,\nobjects of this type will be filtered when they appear in error payload.", "type": "boolean" } } }, "ProjectProperties": { "id": "ProjectProperties", "description": "A descriptor for defining project properties for a service. One service may\nhave many consumer projects, and the service may want to behave differently\ndepending on some properties on the project. For example, a project may be\nassociated with a school, or a business, or a government agency, a business\ntype property on the project may affect how a service responds to the client.\nThis descriptor defines which properties are allowed to be set on a project.\n\nExample:\n\n project_properties:\n properties:\n - name: NO_WATERMARK\n type: BOOL\n description: Allows usage of the API without watermarks.\n - name: EXTENDED_TILE_CACHE_PERIOD\n type: INT64", "type": "object", "properties": { "properties": { "description": "List of per consumer project-specific properties.", "type": "array", "items": { "$ref": "Property" } } } }, "Property": { "id": "Property", "description": "Defines project properties.\n\nAPI services can define properties that can be assigned to consumer projects\nso that backends can perform response customization without having to make\nadditional calls or maintain additional storage. For example, Maps API\ndefines properties that controls map tile cache period, or whether to embed a\nwatermark in a result.\n\nThese values can be set via API producer console. Only API providers can\ndefine and set these properties.", "type": "object", "properties": { "name": { "description": "The name of the property (a.k.a key).", "type": "string" }, "type": { "description": "The type of this property.", "enumDescriptions": [ "The type is unspecified, and will result in an error.", "The type is `int64`.", "The type is `bool`.", "The type is `string`.", "The type is 'double'." ], "type": "string", "enum": [ "UNSPECIFIED", "INT64", "BOOL", "STRING", "DOUBLE" ] }, "description": { "description": "The description of the property", "type": "string" } } }, "Control": { "id": "Control", "description": "Selects and configures the service controller used by the service. The\nservice controller handles features like abuse, quota, billing, logging,\nmonitoring, etc.\n", "type": "object", "properties": { "environment": { "description": "The service control environment to use. If empty, no control plane\nfeature (like quota and billing) will be enabled.", "type": "string" } } }, "LogDescriptor": { "id": "LogDescriptor", "description": "A description of a log type. Example in YAML format:\n\n - name: library.googleapis.com\/activity_history\n description: The history of borrowing and returning library items.\n display_name: Activity\n labels:\n - key: \/customer_id\n description: Identifier of a library customer", "type": "object", "properties": { "name": { "description": "The name of the log. It must be less than 512 characters long and can\ninclude the following characters: upper- and lower-case alphanumeric\ncharacters [A-Za-z0-9], and punctuation characters including\nslash, underscore, hyphen, period [\/_-.].", "type": "string" }, "labels": { "description": "The set of labels that are available to describe a specific log entry.\nRuntime requests that contain labels not specified here are\nconsidered invalid.", "type": "array", "items": { "$ref": "LabelDescriptor" } }, "description": { "description": "A human-readable description of this log. This information appears in\nthe documentation and can contain details.", "type": "string" }, "displayName": { "description": "The human-readable name for this log. This information appears on\nthe user interface and should be concise.", "type": "string" } } }, "LabelDescriptor": { "id": "LabelDescriptor", "description": "A description of a label.", "type": "object", "properties": { "key": { "description": "The label key.", "type": "string" }, "valueType": { "description": "The type of data that can be assigned to the label.", "enumDescriptions": [ "A variable-length string. This is the default.", "Boolean; true or false.", "A 64-bit signed integer." ], "type": "string", "enum": [ "STRING", "BOOL", "INT64" ] }, "description": { "description": "A human-readable description for the label.", "type": "string" } } }, "MetricDescriptor": { "id": "MetricDescriptor", "description": "Defines a metric type and its schema.", "type": "object", "properties": { "name": { "description": "Resource name. The format of the name may vary between different\nimplementations. For examples:\n\n projects\/{project_id}\/metricDescriptors\/{type=**}\n metricDescriptors\/{type=**}", "type": "string" }, "type": { "description": "The metric type including a DNS name prefix, for example\n`\"compute.googleapis.com\/instance\/cpu\/utilization\"`. Metric types\nshould use a natural hierarchical grouping such as the following:\n\n compute.googleapis.com\/instance\/cpu\/utilization\n compute.googleapis.com\/instance\/disk\/read_ops_count\n compute.googleapis.com\/instance\/network\/received_bytes_count\n\nNote that if the metric type changes, the monitoring data will be\ndiscontinued, and anything depends on it will break, such as monitoring\ndashboards, alerting rules and quota limits. Therefore, once a metric has\nbeen published, its type should be immutable.", "type": "string" }, "labels": { "description": "The set of labels that can be used to describe a specific instance of this\nmetric type. For example, the\n`compute.googleapis.com\/instance\/network\/received_bytes_count` metric type\nhas a label, `loadbalanced`, that specifies whether the traffic was\nreceived through a load balanced IP address.", "type": "array", "items": { "$ref": "LabelDescriptor" } }, "metricKind": { "description": "Whether the metric records instantaneous values, changes to a value, etc.", "enumDescriptions": [ "Do not use this default value.", "Instantaneous measurements of a varying quantity.", "Changes over non-overlapping time intervals.", "Cumulative value over time intervals that can overlap.\nThe overlapping intervals must have the same start time." ], "type": "string", "enum": [ "METRIC_KIND_UNSPECIFIED", "GAUGE", "DELTA", "CUMULATIVE" ] }, "valueType": { "description": "Whether the measurement is an integer, a floating-point number, etc.", "enumDescriptions": [ "Do not use this default value.", "The value is a boolean.\nThis value type can be used only if the metric kind is `GAUGE`.", "The value is a signed 64-bit integer.", "The value is a double precision floating point number.", "The value is a text string.\nThis value type can be used only if the metric kind is `GAUGE`.", "The value is a `Distribution`.", "The value is money." ], "type": "string", "enum": [ "VALUE_TYPE_UNSPECIFIED", "BOOL", "INT64", "DOUBLE", "STRING", "DISTRIBUTION", "MONEY" ] }, "unit": { "description": "The unit in which the metric value is reported. It is only applicable\nif the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The\nsupported units are a subset of [The Unified Code for Units of\nMeasure](http:\/\/unitsofmeasure.org\/ucum.html) standard:\n\n**Basic units (UNIT)**\n\n* `bit` bit\n* `By` byte\n* `s` second\n* `min` minute\n* `h` hour\n* `d` day\n\n**Prefixes (PREFIX)**\n\n* `k` kilo (10**3)\n* `M` mega (10**6)\n* `G` giga (10**9)\n* `T` tera (10**12)\n* `P` peta (10**15)\n* `E` exa (10**18)\n* `Z` zetta (10**21)\n* `Y` yotta (10**24)\n* `m` milli (10**-3)\n* `u` micro (10**-6)\n* `n` nano (10**-9)\n* `p` pico (10**-12)\n* `f` femto (10**-15)\n* `a` atto (10**-18)\n* `z` zepto (10**-21)\n* `y` yocto (10**-24)\n* `Ki` kibi (2**10)\n* `Mi` mebi (2**20)\n* `Gi` gibi (2**30)\n* `Ti` tebi (2**40)\n\n**Grammar**\n\nThe grammar includes the dimensionless unit `1`, such as `1\/s`.\n\nThe grammar also includes these connectors:\n\n* `\/` division (as an infix operator, e.g. `1\/s`).\n* `.` multiplication (as an infix operator, e.g. `GBy.d`)\n\nThe grammar for a unit is as follows:\n\n Expression = Component { \".\" Component } { \"\/\" Component } ;\n\n Component = [ PREFIX ] UNIT [ Annotation ]\n | Annotation\n | \"1\"\n ;\n\n Annotation = \"{\" NAME \"}\" ;\n\nNotes:\n\n* `Annotation` is just a comment if it follows a `UNIT` and is\n equivalent to `1` if it is used alone. For examples,\n `{requests}\/s == 1\/s`, `By{transmitted}\/s == By\/s`.\n* `NAME` is a sequence of non-blank printable ASCII characters not\n containing '{' or '}'.", "type": "string" }, "description": { "description": "A detailed description of the metric, which can be used in documentation.", "type": "string" }, "displayName": { "description": "A concise name for the metric, which can be displayed in user interfaces.\nUse sentence case without an ending period, for example \"Request count\".", "type": "string" } } }, "MonitoredResourceDescriptor": { "id": "MonitoredResourceDescriptor", "description": "An object that describes the schema of a MonitoredResource object using a\ntype name and a set of labels. For example, the monitored resource\ndescriptor for Google Compute Engine VM instances has a type of\n`\"gce_instance\"` and specifies the use of the labels `\"instance_id\"` and\n`\"zone\"` to identify particular VM instances.\n\nDifferent APIs can support different monitored resource types. APIs generally\nprovide a `list` method that returns the monitored resource descriptors used\nby the API.", "type": "object", "properties": { "name": { "description": "Optional. The resource name of the monitored resource descriptor:\n`\"projects\/{project_id}\/monitoredResourceDescriptors\/{type}\"` where\n{type} is the value of the `type` field in this object and\n{project_id} is a project ID that provides API-specific context for\naccessing the type. APIs that do not use project information can use the\nresource name format `\"monitoredResourceDescriptors\/{type}\"`.", "type": "string" }, "type": { "description": "Required. The monitored resource type. For example, the type\n`\"cloudsql_database\"` represents databases in Google Cloud SQL.\nThe maximum length of this value is 256 characters.", "type": "string" }, "displayName": { "description": "Optional. A concise name for the monitored resource type that might be\ndisplayed in user interfaces. For example, `\"Google Cloud SQL Database\"`.", "type": "string" }, "description": { "description": "Optional. A detailed description of the monitored resource type that might\nbe used in documentation.", "type": "string" }, "labels": { "description": "Required. A set of labels used to describe instances of this monitored\nresource type. For example, an individual Google Cloud SQL database is\nidentified by values for the labels `\"database_id\"` and `\"zone\"`.", "type": "array", "items": { "$ref": "LabelDescriptor" } } } }, "Billing": { "id": "Billing", "description": "Billing related configuration of the service.\n\nThe following example shows how to configure metrics for billing:\n\n metrics:\n - name: library.googleapis.com\/read_calls\n metric_kind: DELTA\n value_type: INT64\n - name: library.googleapis.com\/write_calls\n metric_kind: DELTA\n value_type: INT64\n billing:\n metrics:\n - library.googleapis.com\/read_calls\n - library.googleapis.com\/write_calls\n\nThe next example shows how to enable billing status check and customize the\ncheck behavior. It makes sure billing status check is included in the `Check`\nmethod of [Service Control API](https:\/\/cloud.google.com\/service-control\/).\nIn the example, \"google.storage.Get\" method can be served when the billing\nstatus is either `current` or `delinquent`, while \"google.storage.Write\"\nmethod can only be served when the billing status is `current`:\n\n billing:\n rules:\n - selector: google.storage.Get\n allowed_statuses:\n - current\n - delinquent\n - selector: google.storage.Write\n allowed_statuses: current\n\nMostly services should only allow `current` status when serving requests.\nIn addition, services can choose to allow both `current` and `delinquent`\nstatuses when serving read-only requests to resources. If there's no\nmatching selector for operation, no billing status check will be performed.\n", "type": "object", "properties": { "metrics": { "description": "Names of the metrics to report to billing. Each name must\nbe defined in Service.metrics section.", "type": "array", "items": { "type": "string" } }, "rules": { "description": "A list of billing status rules for configuring billing status check.", "type": "array", "items": { "$ref": "BillingStatusRule" } }, "areaUnderCurveParams": { "description": "Per resource grouping for delta billing based resource configs.", "type": "array", "items": { "$ref": "AreaUnderCurveParams" } } } }, "BillingStatusRule": { "id": "BillingStatusRule", "description": "Defines the billing status requirements for operations.\n\nWhen used with\n[Service Control API](https:\/\/cloud.google.com\/service-control\/), the\nfollowing statuses are supported:\n\n- **current**: the associated billing account is up to date and capable of\n paying for resource usages.\n- **delinquent**: the associated billing account has a correctable problem,\n such as late payment.\n\nMostly services should only allow `current` status when serving requests.\nIn addition, services can choose to allow both `current` and `delinquent`\nstatuses when serving read-only requests to resources. If the list of\nallowed_statuses is empty, it means no billing requirement.\n", "type": "object", "properties": { "selector": { "description": "Selects the operation names to which this rule applies.\nRefer to selector for syntax details.", "type": "string" }, "allowedStatuses": { "description": "Allowed billing statuses. The billing status check passes if the actual\nbilling status matches any of the provided values here.", "type": "array", "items": { "type": "string" } } } }, "AreaUnderCurveParams": { "id": "AreaUnderCurveParams", "description": "AreaUnderCurveParams groups the metrics relevant to generating\nduration based metric from base (snapshot) metric and delta\n(change) metric. The generated metric has two dimensions:\n resource usage metric and the duration the metric applies.\n\nEssentially the generated metric is the Area Under Curve(AUC) of\nthe \"duration - resource\" usage curve. This AUC metric is readily\nappliable to billing since \"billable resource usage\" depends on\nresource usage and duration of the resource used.\n\nA service config may contain multiple resources and corresponding\nmetrics. AreaUnderCurveParams groups the relevant ones: which\nsnapshot_metric and change_metric are used to produce which\ngenerated_metric.\n", "type": "object", "properties": { "snapshotMetric": { "description": "Total usage of a resource at a particular timestamp. This should be\na GAUGE metric.", "type": "string" }, "changeMetric": { "description": "Change of resource usage at a particular timestamp. This should a\nDELTA metric.", "type": "string" }, "generatedMetric": { "description": "Metric generated from snapshot_metric and change_metric. This\nis also a DELTA metric.", "type": "string" } } }, "Logging": { "id": "Logging", "description": "Logging configuration of the service.\n\nThe following example shows how to configure logs to be sent to the\nproducer and consumer projects. In the example,\nthe `library.googleapis.com\/activity_history` log is\nsent to both the producer and consumer projects, whereas\nthe `library.googleapis.com\/purchase_history` log is only sent to the\nproducer project:\n\n monitored_resources:\n - type: library.googleapis.com\/branch\n labels:\n - key: \/city\n description: The city where the library branch is located in.\n - key: \/name\n description: The name of the branch.\n logs:\n - name: library.googleapis.com\/activity_history\n labels:\n - key: \/customer_id\n - name: library.googleapis.com\/purchase_history\n logging:\n producer_destinations:\n - monitored_resource: library.googleapis.com\/branch\n logs:\n - library.googleapis.com\/activity_history\n - library.googleapis.com\/purchase_history\n consumer_destinations:\n - monitored_resource: library.googleapis.com\/branch\n logs:\n - library.googleapis.com\/activity_history\n", "type": "object", "properties": { "producerDestinations": { "description": "Logging configurations for sending logs to the producer project.\nThere can be multiple producer destinations, each one must have a\ndifferent monitored resource type. A log can be used in at most\none producer destination.", "type": "array", "items": { "$ref": "LoggingDestination" } }, "consumerDestinations": { "description": "Logging configurations for sending logs to the consumer project.\nThere can be multiple consumer destinations, each one must have a\ndifferent monitored resource type. A log can be used in at most\none consumer destination.", "type": "array", "items": { "$ref": "LoggingDestination" } } } }, "LoggingDestination": { "id": "LoggingDestination", "description": "Configuration of a specific logging destination (the producer project\nor the consumer project).", "type": "object", "properties": { "monitoredResource": { "description": "The monitored resource type. The type must be defined in\nService.monitored_resources section.", "type": "string" }, "logs": { "description": "Names of the logs to be sent to this destination. Each name must\nbe defined in the Service.logs section.", "type": "array", "items": { "type": "string" } } } }, "Monitoring": { "id": "Monitoring", "description": "Monitoring configuration of the service.\n\nThe example below shows how to configure monitored resources and metrics\nfor monitoring. In the example, a monitored resource and two metrics are\ndefined. The `library.googleapis.com\/book\/returned_count` metric is sent\nto both producer and consumer projects, whereas the\n`library.googleapis.com\/book\/overdue_count` metric is only sent to the\nconsumer project.\n\n monitored_resources:\n - type: library.googleapis.com\/branch\n labels:\n - key: \/city\n description: The city where the library branch is located in.\n - key: \/name\n description: The name of the branch.\n metrics:\n - name: library.googleapis.com\/book\/returned_count\n metric_kind: DELTA\n value_type: INT64\n labels:\n - key: \/customer_id\n - name: library.googleapis.com\/book\/overdue_count\n metric_kind: GAUGE\n value_type: INT64\n labels:\n - key: \/customer_id\n monitoring:\n producer_destinations:\n - monitored_resource: library.googleapis.com\/branch\n metrics:\n - library.googleapis.com\/book\/returned_count\n consumer_destinations:\n - monitored_resource: library.googleapis.com\/branch\n metrics:\n - library.googleapis.com\/book\/returned_count\n - library.googleapis.com\/book\/overdue_count\n", "type": "object", "properties": { "producerDestinations": { "description": "Monitoring configurations for sending metrics to the producer project.\nThere can be multiple producer destinations, each one must have a\ndifferent monitored resource type. A metric can be used in at most\none producer destination.", "type": "array", "items": { "$ref": "MonitoringDestination" } }, "consumerDestinations": { "description": "Monitoring configurations for sending metrics to the consumer project.\nThere can be multiple consumer destinations, each one must have a\ndifferent monitored resource type. A metric can be used in at most\none consumer destination.", "type": "array", "items": { "$ref": "MonitoringDestination" } } } }, "MonitoringDestination": { "id": "MonitoringDestination", "description": "Configuration of a specific monitoring destination (the producer project\nor the consumer project).", "type": "object", "properties": { "monitoredResource": { "description": "The monitored resource type. The type must be defined in\nService.monitored_resources section.", "type": "string" }, "metrics": { "description": "Names of the metrics to report to this monitoring destination.\nEach name must be defined in Service.metrics section.", "type": "array", "items": { "type": "string" } } } }, "SystemParameters": { "id": "SystemParameters", "description": "### System parameter configuration\n\nA system parameter is a special kind of parameter defined by the API\nsystem, not by an individual API. It is typically mapped to an HTTP header\nand\/or a URL query parameter. This configuration specifies which methods\nchange the names of the system parameters.", "type": "object", "properties": { "rules": { "description": "Define system parameters.\n\nThe parameters defined here will override the default parameters\nimplemented by the system. If this field is missing from the service\nconfig, default system parameters will be used. Default system parameters\nand names is implementation-dependent.\n\nExample: define api key and alt name for all methods\n\nsystem_parameters\n rules:\n - selector: \"*\"\n parameters:\n - name: api_key\n url_query_parameter: api_key\n - name: alt\n http_header: Response-Content-Type\n\nExample: define 2 api key names for a specific method.\n\nsystem_parameters\n rules:\n - selector: \"\/ListShelves\"\n parameters:\n - name: api_key\n http_header: Api-Key1\n - name: api_key\n http_header: Api-Key2", "type": "array", "items": { "$ref": "SystemParameterRule" } } } }, "SystemParameterRule": { "id": "SystemParameterRule", "description": "Define a system parameter rule mapping system parameter definitions to\nmethods.", "type": "object", "properties": { "selector": { "description": "Selects the methods to which this rule applies. Use '*' to indicate all\nmethods in all APIs.\n\nRefer to selector for syntax details.", "type": "string" }, "parameters": { "description": "Define parameters. Multiple names may be defined for a parameter.\nFor a given method call, only one of them should be used. If multiple\nnames are used the behavior is implementation-dependent.\nIf none of the specified names are present the behavior is\nparameter-dependent.", "type": "array", "items": { "$ref": "SystemParameter" } } } }, "SystemParameter": { "id": "SystemParameter", "description": "Define a parameter's name and location. The parameter may be passed as either\nan HTTP header or a URL query parameter, and if both are passed the behavior\nis implementation-dependent.", "type": "object", "properties": { "name": { "description": "Define the name of the parameter, such as \"api_key\", \"alt\", \"callback\",\nand etc. It is case sensitive.", "type": "string" }, "httpHeader": { "description": "Define the HTTP header name to use for the parameter. It is case\ninsensitive.", "type": "string" }, "urlQueryParameter": { "description": "Define the URL query parameter name to use for the parameter. It is case\nsensitive.", "type": "string" } } }, "ConfigSource": { "id": "ConfigSource", "description": "Represents a user-specified configuration for a service (as opposed to the\nthe generated service config form provided by `google.api.Service`). This is\nmeant to encode service config as manipulated directly by customers,\nrather than the config form resulting from toolchain generation and\nnormalization.", "type": "object", "properties": { "id": { "description": "A unique ID for a specific instance of this message, typically assigned\nby the client for tracking purpose. If empty, the server may choose to\ngenerate one instead.", "type": "string" }, "options": { "description": "Options to cover use of source config within ServiceManager and tools", "$ref": "ConfigOptions" }, "files": { "description": "Set of source configuration files that are used to generate a service\nconfig (`google.api.Service`).", "type": "array", "items": { "$ref": "ConfigFile" } }, "openApiSpec": { "description": "OpenAPI specification", "$ref": "OpenApiSpec" }, "protoSpec": { "description": "Protocol buffer API specification", "$ref": "ProtoSpec" } } }, "ConfigOptions": { "id": "ConfigOptions", "description": "A set of options to cover use of source config within `ServiceManager`\nand related tools.", "type": "object", "properties": { } }, "ConfigFile": { "id": "ConfigFile", "description": "Generic specification of a source configuration file", "type": "object", "properties": { "filePath": { "description": "The file name of the configuration file (full or relative path).", "type": "string" }, "contents": { "description": "DEPRECATED. The contents of the configuration file. Use file_contents\nmoving forward.", "type": "string" }, "fileContents": { "description": "The bytes that constitute the file.", "type": "string", "format": "byte" }, "fileType": { "description": "The kind of configuration file represented. This is used to determine\nthe method for generating `google.api.Service` using this file.", "enumDescriptions": [ "Unknown file type.", "YAML-specification of service.", "OpenAPI specification, serialized in JSON.", "OpenAPI specification, serialized in YAML.", "FileDescriptorSet, generated by protoc.\n\nTo generate, use protoc with imports and source info included.\nFor an example test.proto file, the following command would put the value\nin a new file named out.pb.\n\n$protoc --include_imports --include_source_info test.proto -o out.pb" ], "type": "string", "enum": [ "FILE_TYPE_UNSPECIFIED", "SERVICE_CONFIG_YAML", "OPEN_API_JSON", "OPEN_API_YAML", "FILE_DESCRIPTOR_SET_PROTO" ] } } }, "OpenApiSpec": { "id": "OpenApiSpec", "description": "A collection of OpenAPI specification files.", "type": "object", "properties": { "openApiFiles": { "description": "Individual files.", "type": "array", "items": { "$ref": "ConfigFile" } } } }, "ProtoSpec": { "id": "ProtoSpec", "description": "A collection of protocol buffer service specification files.", "type": "object", "properties": { "protoDescriptor": { "description": "A complete descriptor of a protocol buffer specification", "$ref": "ProtoDescriptor" } } }, "ProtoDescriptor": { "id": "ProtoDescriptor", "description": "Contains a serialized protoc-generated protocol buffer message descriptor set\nalong with a URL that describes the type of the descriptor message.", "type": "object", "properties": { "typeUrl": { "description": "A URL\/resource name whose content describes the type of the\nserialized protocol buffer message.\n\nOnly 'type.googleapis.com\/google.protobuf.FileDescriptorSet' is supported.\nIf the type_url is not specificed,\n'type.googleapis.com\/google.protobuf.FileDescriptorSet' will be assumed.\n", "type": "string" }, "value": { "description": "Must be a valid serialized protocol buffer descriptor set.\n\nTo generate, use protoc with imports and source info included.\nFor an example test.proto file, the following command would put the value\nin a new file named descriptor.pb.\n\n$protoc --include_imports --include_source_info test.proto -o descriptor.pb", "type": "string", "format": "byte" } } }, "Operation": { "id": "Operation", "description": "This resource represents a long-running operation that is the result of a\nnetwork API call.", "type": "object", "properties": { "name": { "description": "The server-assigned name, which is only unique within the same service that\noriginally returns it. If you use the default HTTP mapping, the\n`name` should have the format of `operations\/some\/unique\/name`.", "type": "string" }, "metadata": { "description": "Service-specific metadata associated with the operation. It typically\ncontains progress information and common metadata such as create time.\nSome services might not provide such metadata. Any method that returns a\nlong-running operation should document the metadata type, if any.", "type": "object", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." } }, "done": { "description": "If the value is `false`, it means the operation is still in progress.\nIf true, the operation is completed, and either `error` or `response` is\navailable.", "type": "boolean" }, "error": { "description": "The error result of the operation in case of failure.", "$ref": "Status" }, "response": { "description": "The normal response of the operation in case of success. If the original\nmethod returns no data on success, such as `Delete`, the response is\n`google.protobuf.Empty`. If the original method is standard\n`Get`\/`Create`\/`Update`, the response should be the resource. For other\nmethods, the response should have the type `XxxResponse`, where `Xxx`\nis the original method name. For example, if the original method name\nis `TakeSnapshot()`, the inferred response type is\n`TakeSnapshotResponse`.", "type": "object", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." } } } }, "Status": { "id": "Status", "description": "The `Status` type defines a logical error model that is suitable for different\nprogramming environments, including REST APIs and RPC APIs. It is used by\n[gRPC](https:\/\/github.com\/grpc). The error model is designed to be:\n\n- Simple to use and understand for most users\n- Flexible enough to meet unexpected needs\n\n# Overview\n\nThe `Status` message contains three pieces of data: error code, error message,\nand error details. The error code should be an enum value of\ngoogle.rpc.Code, but it may accept additional error codes if needed. The\nerror message should be a developer-facing English message that helps\ndevelopers *understand* and *resolve* the error. If a localized user-facing\nerror message is needed, put the localized message in the error details or\nlocalize it in the client. The optional error details may contain arbitrary\ninformation about the error. There is a predefined set of error detail types\nin the package `google.rpc` which can be used for common error conditions.\n\n# Language mapping\n\nThe `Status` message is the logical representation of the error model, but it\nis not necessarily the actual wire format. When the `Status` message is\nexposed in different client libraries and different wire protocols, it can be\nmapped differently. For example, it will likely be mapped to some exceptions\nin Java, but more likely mapped to some error codes in C.\n\n# Other uses\n\nThe error model and the `Status` message can be used in a variety of\nenvironments, either with or without APIs, to provide a\nconsistent developer experience across different environments.\n\nExample uses of this error model include:\n\n- Partial errors. If a service needs to return partial errors to the client,\n it may embed the `Status` in the normal response to indicate the partial\n errors.\n\n- Workflow errors. A typical workflow has multiple steps. Each step may\n have a `Status` message for error reporting purpose.\n\n- Batch operations. If a client uses batch request and batch response, the\n `Status` message should be used directly inside batch response, one for\n each error sub-response.\n\n- Asynchronous operations. If an API call embeds asynchronous operation\n results in its response, the status of those operations should be\n represented directly using the `Status` message.\n\n- Logging. If some API errors are stored in logs, the message `Status` could\n be used directly after any stripping needed for security\/privacy reasons.", "type": "object", "properties": { "code": { "description": "The status code, which should be an enum value of google.rpc.Code.", "type": "integer", "format": "int32" }, "message": { "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\ngoogle.rpc.Status.details field, or localized by the client.", "type": "string" }, "details": { "description": "A list of messages that carry the error details. There will be a\ncommon set of message types for APIs to use.", "type": "array", "items": { "type": "object", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." } } } } }, "ProjectSettings": { "id": "ProjectSettings", "description": "Settings that control how a consumer project uses a service.", "type": "object", "properties": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements.", "type": "string" }, "consumerProjectId": { "description": "ID for the project consuming this service.", "type": "string" }, "usageSettings": { "description": "Settings that control whether this service is usable by the consumer\nproject.", "$ref": "UsageSettings" }, "quotaSettings": { "description": "Settings that control how much or how fast the service can be used by the\nconsumer project.", "$ref": "QuotaSettings" }, "visibilitySettings": { "description": "Settings that control which features of the service are visible to the\nconsumer project.", "$ref": "VisibilitySettings" }, "properties": { "description": "Service-defined per-consumer properties.\n\nA key-value mapping a string key to a google.protobuf.ListValue proto.\nValues in the list are typed as defined in the Service configuration's\nconsumer.properties field.", "type": "object", "additionalProperties": { "type": "array", "items": { "type": "any" } } }, "operations": { "description": "Read-only view of pending operations affecting this resource, if requested.", "type": "array", "items": { "$ref": "Operation" } } } }, "UsageSettings": { "id": "UsageSettings", "description": "Usage settings for a consumer of a service.", "type": "object", "properties": { "consumerEnableStatus": { "description": "Consumer controlled setting to enable\/disable use of this service by the\nconsumer project. The default value of this is controlled by the service\nconfiguration.", "enumDescriptions": [ "The service is disabled.", "The service is enabled." ], "type": "string", "enum": [ "DISABLED", "ENABLED" ] } } }, "QuotaSettings": { "id": "QuotaSettings", "description": "Per-consumer overrides for quota settings. See google\/api\/quota.proto\nfor the corresponding service configuration which provides the default\nvalues.", "type": "object", "properties": { "consumerOverrides": { "description": "Quota overrides set by the consumer. Consumer overrides will only have\nan effect up to the max_limit specified in the service config, or the\nthe producer override, if one exists.\n\nThe key for this map is one of the following:\n\n- '<GROUP_NAME>\/<LIMIT_NAME>' for quotas defined within quota groups,\nwhere GROUP_NAME is the google.api.QuotaGroup.name field and\nLIMIT_NAME is the google.api.QuotaLimit.name field from the service\nconfig. For example: 'ReadGroup\/ProjectDaily'.\n\n- '<LIMIT_NAME>' for quotas defined without quota groups, where LIMIT_NAME\nis the google.api.QuotaLimit.name field from the service config. For\nexample: 'borrowedCountPerOrganization'.", "type": "object", "additionalProperties": { "$ref": "QuotaLimitOverride" } }, "producerOverrides": { "description": "Quota overrides set by the producer. Note that if a consumer override is\nalso specified, then the minimum of the two will be used. This allows\nconsumers to cap their usage voluntarily.\n\nThe key for this map is one of the following:\n\n- '<GROUP_NAME>\/<LIMIT_NAME>' for quotas defined within quota groups,\nwhere GROUP_NAME is the google.api.QuotaGroup.name field and\nLIMIT_NAME is the google.api.QuotaLimit.name field from the service\nconfig. For example: 'ReadGroup\/ProjectDaily'.\n\n- '<LIMIT_NAME>' for quotas defined without quota groups, where LIMIT_NAME\nis the google.api.QuotaLimit.name field from the service config. For\nexample: 'borrowedCountPerOrganization'.", "type": "object", "additionalProperties": { "$ref": "QuotaLimitOverride" } }, "effectiveQuotas": { "description": "The effective quota limits for each group, derived from the service\ndefaults together with any producer or consumer overrides.\nFor each limit, the effective value is the minimum of the producer\nand consumer overrides if either is present, or else the service default\nif neither is present.\nDEPRECATED. Use effective_quota_groups instead.", "type": "object", "additionalProperties": { "$ref": "QuotaLimitOverride" } }, "variableTermQuotas": { "description": "Quotas that are active over a specified time period. Only writeable\nby the producer.", "type": "array", "items": { "$ref": "VariableTermQuota" } }, "effectiveQuotaGroups": { "description": "Use this field for quota limits defined under quota groups.\nCombines service quota configuration and project-specific settings, as\na map from quota group name to the effective quota information for that\ngroup.\nOutput-only.", "type": "array", "items": { "$ref": "EffectiveQuotaGroup" } } } }, "QuotaLimitOverride": { "id": "QuotaLimitOverride", "description": "Specifies a custom quota limit that is applied for this consumer project.\nThis overrides the default value in google.api.QuotaLimit.", "type": "object", "properties": { "limit": { "description": "The new limit for this project.\nMay be -1 (unlimited), 0 (block), or any positive integer.", "type": "string", "format": "int64" }, "unlimited": { "description": "Indicates the override is to provide unlimited quota. If true,\nany value set for limit will be ignored.\nDEPRECATED. Use a limit value of -1 instead.", "type": "boolean" } } }, "VariableTermQuota": { "id": "VariableTermQuota", "description": "A variable term quota is a bucket of tokens that is consumed over a\nspecified (usually long) time period. When present, it overrides any\n\"1d\" duration per-project quota specified on the group.\n\nVariable terms run from midnight to midnight, start_date to end_date\n(inclusive) in the America\/Los_Angeles time zone.", "type": "object", "properties": { "groupName": { "description": "The quota group that has the variable term quota applied to it.\nThis must be a google.api.QuotaGroup.name specified in the\nservice configuration.", "type": "string" }, "startDate": { "description": "The beginning of the active period for the variable term quota.\nYYYYMMdd date format, e.g. 20140730.", "type": "string" }, "endDate": { "description": "The effective end of the active period for the variable term quota\n(inclusive). This must be no more than 5 years after start_date.\nYYYYMMdd date format, e.g. 20140730.", "type": "string" }, "displayEndDate": { "description": "The displayed end of the active period for the variable term quota.\nThis may be before the effective end to give the user a grace period.\nYYYYMMdd date format, e.g. 20140730.", "type": "string" }, "createTime": { "description": "Time when this variable term quota was created. If multiple quotas\nare simultaneously active, then the quota with the latest create_time\nis the effective one.", "type": "string", "format": "google-datetime" }, "limit": { "description": "The number of tokens available during the configured term.", "type": "string", "format": "int64" }, "quotaUsage": { "description": "The usage data of this quota.", "$ref": "QuotaUsage" } } }, "QuotaUsage": { "id": "QuotaUsage", "description": "Specifies the used quota amount for a quota limit at a particular time.", "type": "object", "properties": { "usage": { "description": "The used quota value at the \"query_time\".", "type": "string", "format": "int64" }, "startTime": { "description": "The time the quota duration started.", "type": "string", "format": "google-datetime" }, "endTime": { "description": "The time the quota duration ended.", "type": "string", "format": "google-datetime" }, "queryTime": { "description": "The time the quota usage data was queried.", "type": "string", "format": "google-datetime" } } }, "EffectiveQuotaGroup": { "id": "EffectiveQuotaGroup", "description": "An effective quota group contains both the metadata for a quota group\nas derived from the service config, and the effective limits in that\ngroup as calculated from producer and consumer overrides together with\nservice defaults.", "type": "object", "properties": { "baseGroup": { "description": "The service configuration for this quota group, minus the quota limits,\nwhich are replaced by the effective limits below.", "$ref": "QuotaGroup" }, "billingInteraction": { "enumDescriptions": [ "The interaction between this quota group and the project billing status\nis unspecified.", "This quota group is enforced only when the consumer project\nis not billable.", "This quota group is enforced only when the consumer project\nis billable.", "This quota group is enforced regardless of the consumer project's\nbilling status." ], "type": "string", "enum": [ "BILLING_INTERACTION_UNSPECIFIED", "NONBILLABLE_ONLY", "BILLABLE_ONLY", "ANY_BILLING_STATUS" ] }, "quotas": { "description": "The usage and limit information for each limit within this quota group.", "type": "array", "items": { "$ref": "QuotaInfo" } } } }, "QuotaInfo": { "id": "QuotaInfo", "description": "Metadata about an individual quota, containing usage and limit information.", "type": "object", "properties": { "limit": { "description": "The effective limit for this quota.", "$ref": "EffectiveQuotaLimit" }, "currentUsage": { "description": "The usage data for this quota as it applies to the current limit.", "$ref": "QuotaUsage" }, "historicalUsage": { "description": "The historical usage data of this quota limit. Currently it is only\navailable for daily quota limit, that is, base_limit.duration = \"1d\".", "type": "array", "items": { "$ref": "QuotaUsage" } } } }, "EffectiveQuotaLimit": { "id": "EffectiveQuotaLimit", "description": "An effective quota limit contains the metadata for a quota limit\nas derived from the service config, together with fields that describe\nthe effective limit value and what overrides can be applied to it.", "type": "object", "properties": { "baseLimit": { "description": "The service's configuration for this quota limit.", "$ref": "QuotaLimit" }, "key": { "description": "The key used to identify this limit when applying overrides.\nThe consumer_overrides and producer_overrides maps are keyed\nby strings of the form \"QuotaGroupName\/QuotaLimitName\".", "type": "string" }, "maxConsumerOverrideAllowed": { "description": "The maximum override value that a consumer may specify.", "type": "string", "format": "int64" }, "effectiveLimit": { "description": "The effective limit value, based on the stored producer and consumer\noverrides and the service defaults.", "type": "string", "format": "int64" } } }, "VisibilitySettings": { "id": "VisibilitySettings", "description": "Settings that control which features of the service are visible to the\nconsumer project.", "type": "object", "properties": { "visibilityLabels": { "description": "The set of visibility labels that are used to determine what API surface is\nvisible to calls made by this project. The visible surface is a union of\nthe surface features associated with each label listed here, plus the\npublicly visible (unrestricted) surface.\n\nThe service producer may add or remove labels at any time. The service\nconsumer may add a label if the calling user has been granted permission\nto do so by the producer. The service consumer may also remove any label\nat any time.", "type": "array", "items": { "type": "string" } } } }, "ListServiceConfigsResponse": { "id": "ListServiceConfigsResponse", "description": "Response message for ListServiceConfigs method.", "type": "object", "properties": { "serviceConfigs": { "description": "The list of service config resources.", "type": "array", "items": { "$ref": "Service" } }, "nextPageToken": { "description": "The token of the next page of results.", "type": "string" } } }, "SubmitConfigSourceRequest": { "id": "SubmitConfigSourceRequest", "description": "Request message for SubmitConfigSource method.", "type": "object", "properties": { "configSource": { "description": "The source configuration for the service.", "$ref": "ConfigSource" }, "validateOnly": { "description": "Optional. If set, this will result in the generation of a\n`google.api.Service` configuration based on the `ConfigSource` provided,\nbut the generated config and the sources will NOT be persisted.", "type": "boolean" } } }, "ConvertConfigRequest": { "id": "ConvertConfigRequest", "description": "Request message for `ConvertConfig` method.", "type": "object", "properties": { "swaggerSpec": { "description": "The swagger specification for an API.", "$ref": "SwaggerSpec" }, "openApiSpec": { "description": "The OpenAPI specification for an API.", "$ref": "OpenApiSpec" }, "serviceName": { "description": "The service name to use for constructing the normalized service\nconfiguration equivalent of the provided configuration specification.", "type": "string" }, "configSpec": { "description": "Input configuration\nFor this version of API, the supported type is OpenApiSpec", "type": "object", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." } } } }, "SwaggerSpec": { "id": "SwaggerSpec", "description": "A collection of swagger specification files.", "type": "object", "properties": { "swaggerFiles": { "description": "The individual files.", "type": "array", "items": { "$ref": "File" } } } }, "File": { "id": "File", "description": "A single swagger specification file.", "type": "object", "properties": { "path": { "description": "The relative path of the swagger spec file.", "type": "string" }, "contents": { "description": "The contents of the swagger spec file.", "type": "string" } } }, "ConvertConfigResponse": { "id": "ConvertConfigResponse", "description": "Response message for `ConvertConfig` method.", "type": "object", "properties": { "serviceConfig": { "description": "The service configuration. Not set if errors occured during conversion.", "$ref": "Service" }, "diagnostics": { "description": "Any errors or warnings that occured during config conversion.", "type": "array", "items": { "$ref": "Diagnostic" } } } }, "Diagnostic": { "id": "Diagnostic", "description": "A collection that represents a diagnostic message (error or warning)", "type": "object", "properties": { "location": { "description": "Location of the cause or context of the diagnostic information.", "type": "string" }, "kind": { "description": "The kind of diagnostic information provided.", "enumDescriptions": [ "Warnings and errors", "Only errors" ], "type": "string", "enum": [ "WARNING", "ERROR" ] }, "message": { "description": "The string message of the diagnostic information.", "type": "string" } } }, "EnableServiceRequest": { "id": "EnableServiceRequest", "description": "Request message for EnableService method.", "type": "object", "properties": { "consumerId": { "description": "The identity of consumer resource which service enablement will be\napplied to.\n\nThe Google Service Management implementation accepts the following\nforms: \"project:<project_id>\", \"project_number:<project_number>\".\n\nNote: this is made compatible with\ngoogle.api.servicecontrol.v1.Operation.consumer_id.", "type": "string" } } }, "DisableServiceRequest": { "id": "DisableServiceRequest", "description": "Request message for DisableService method.", "type": "object", "properties": { "consumerId": { "description": "The identity of consumer resource which service disablement will be\napplied to.\n\nThe Google Service Management implementation accepts the following\nforms: \"project:<project_id>\", \"project_number:<project_number>\".\n\nNote: this is made compatible with\ngoogle.api.servicecontrol.v1.Operation.consumer_id.", "type": "string" } } }, "ServiceAccessPolicy": { "id": "ServiceAccessPolicy", "description": "Policy describing who can access a service and any visibility labels on that\nservice.", "type": "object", "properties": { "serviceName": { "description": "The service protected by this policy.", "type": "string" }, "accessList": { "description": "ACL for access to the unrestricted surface of the service.", "$ref": "ServiceAccessList" }, "visibilityLabelAccessLists": { "description": "ACLs for access to restricted parts of the service. The map key is the\nvisibility label that is being controlled. Note that access to any label\nalso implies access to the unrestricted surface.", "type": "object", "additionalProperties": { "$ref": "ServiceAccessList" } } } }, "ServiceAccessList": { "id": "ServiceAccessList", "description": "List of users and groups that are granted access to a service or visibility\nlabel.", "type": "object", "properties": { "members": { "description": "Members that are granted access.\n\n- \"user:{$user_email}\" - Grant access to an individual user\n- \"group:{$group_email}\" - Grant access to direct members of the group\n- \"domain:{$domain}\" - Grant access to all members of the domain. For now,\n domain membership check will be similar to Devconsole\/TT check:\n compare domain part of the user email to configured domain name.\n When IAM integration is complete, this will be replaced with IAM\n check.", "type": "array", "items": { "type": "string" } } } }, "QueryUserAccessResponse": { "id": "QueryUserAccessResponse", "description": "Request message for QueryUserAccess method.", "type": "object", "properties": { "canAccessService": { "description": "True if the user can access the service and any unrestricted API surface.", "type": "boolean" }, "accessibleVisibilityLabels": { "description": "Any visibility labels on the service that are accessible by the user.", "type": "array", "items": { "type": "string" } } } }, "CustomerSettings": { "id": "CustomerSettings", "description": "Settings that control how a customer (identified by a billing account) uses\na service", "type": "object", "properties": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements.", "type": "string" }, "customerId": { "description": "ID for the customer that consumes the service (see above).\nThe supported types of customers are:\n\n1. domain:{domain}\nA Google Apps domain name. For example, google.com.\n\n2. billingAccount:{billing_account_id}\nA Google Cloud Plafrom billing account. For Example, 123456-7890ab-cdef12.\n", "type": "string" }, "quotaSettings": { "description": "Settings that control how much or how fast the service can be used by the\nconsumer projects owned by the customer collectively.", "$ref": "QuotaSettings" } } }, "CompositeOperationMetadata": { "id": "CompositeOperationMetadata", "description": "Metadata for composite operations.", "type": "object", "properties": { "childOperations": { "description": "The child operations. The details of the asynchronous\nchild operations are stored in a separate row and not in this\nmetadata. Only the operation name is stored here.", "type": "array", "items": { "$ref": "Operation" } }, "originalRequest": { "description": "Original request that triggered this operation.", "type": "object", "additionalProperties": { "type": "any", "description": "Properties of the object. Contains field @type with type URL." } }, "responseFieldMasks": { "description": "Defines which part of the response a child operation will contribute.\nEach key of the map is the name of a child operation. Each value is a\nfield mask that identifies what that child operation contributes to the\nresponse, for example, \"quota_settings\", \"visiblity_settings\", etc.", "type": "object", "additionalProperties": { "type": "string", "format": "google-fieldmask" } }, "persisted": { "description": "Indicates whether the requested state change has been persisted. Once this\nfield is set, it is guaranteed to propagate to all backends eventually, but\nit may not be visible immediately. Clients that are not concerned with\nwaiting on propagation can stop polling the operation once the persisted\nfield is set", "type": "boolean" } } }, "OperationMetadata": { "id": "OperationMetadata", "description": "The metadata associated with a long running operation resource.", "type": "object", "properties": { "resourceNames": { "description": "The full name of the resources that this operation is directly\nassociated with.", "type": "array", "items": { "type": "string" } }, "steps": { "description": "Detailed status information for each step. The order is undetermined.", "type": "array", "items": { "$ref": "Step" } }, "progressPercentage": { "description": "Percentage of completion of this operation, ranging from 0 to 100.", "type": "integer", "format": "int32" }, "startTime": { "description": "The start time of the operation.", "type": "string", "format": "google-datetime" } } }, "Step": { "id": "Step", "description": "Represents the status of one operation step.", "type": "object", "properties": { "description": { "description": "The short description of the step.", "type": "string" }, "status": { "description": "The status code.", "enumDescriptions": [ "Unspecifed code.", "The step has completed without errors.", "The step has not started yet.", "The step is in progress.", "The step has completed with errors." ], "type": "string", "enum": [ "STATUS_UNSPECIFIED", "DONE", "NOT_STARTED", "IN_PROGRESS", "FAILED" ] } } } }, "resources": { "services": { "methods": { "list": { "id": "servicemanagement.services.list", "path": "v1/services", "flatPath": "v1/services", "httpMethod": "GET", "description": "Lists all managed services. If the `consumer_project_id` is specified,\nthe project's settings for the specified service are also returned.", "parameters": { "producerProjectId": { "description": "Include services produced by the specified project.", "location": "query", "type": "string" }, "category": { "description": "Include services only in the specified category. Supported categories are\nservicemanagement.googleapis.com\/categories\/google-services or\nservicemanagement.googleapis.com\/categories\/play-games.", "location": "query", "type": "string" }, "consumerProjectId": { "description": "Include services consumed by the specified project.\n\nIf project_settings is expanded, then this field controls which project\nproject_settings is populated for.", "location": "query", "type": "string" }, "expand": { "description": "Fields to expand in any results. By default, the following fields\nare not fully included in list results:\n- `operations`\n- `project_settings`\n- `project_settings.operations`\n- `quota_usage` (It requires `project_settings`)", "location": "query", "type": "string", "format": "google-fieldmask" }, "pageSize": { "description": "Requested size of the next page of data.", "location": "query", "type": "integer", "format": "int32" }, "pageToken": { "description": "Token identifying which result to start with; returned by a previous list\ncall.", "location": "query", "type": "string" } }, "parameterOrder": [ ], "response": { "$ref": "ListServicesResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "get": { "id": "servicemanagement.services.get", "path": "v1/services/{serviceName}", "flatPath": "v1/services/{serviceName}", "httpMethod": "GET", "description": "Gets a managed service. If the `consumer_project_id` is specified,\nthe project's settings for the specified service are also returned.", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "expand": { "description": "Fields to expand in any results. By default, the following fields\nare not present in the result:\n- `operations`\n- `project_settings`\n- `project_settings.operations`\n- `quota_usage` (It requires `project_settings`)\n- `historical_quota_usage` (It requires `project_settings`)", "location": "query", "type": "string", "format": "google-fieldmask" }, "consumerProjectId": { "description": "If project_settings is expanded, return settings for the specified\nconsumer project.", "location": "query", "type": "string" }, "view": { "description": "If project_settings is expanded, request only fields for the specified\nview.", "location": "query", "type": "string", "enum": [ "PROJECT_SETTINGS_VIEW_UNSPECIFIED", "CONSUMER_VIEW", "PRODUCER_VIEW", "ALL" ] } }, "parameterOrder": [ "serviceName" ], "response": { "$ref": "ManagedService" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "create": { "id": "servicemanagement.services.create", "path": "v1/services", "flatPath": "v1/services", "httpMethod": "POST", "description": "Creates a new managed service.\n\nOperation<response: ManagedService>", "parameters": { }, "parameterOrder": [ ], "request": { "$ref": "ManagedService" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "delete": { "id": "servicemanagement.services.delete", "path": "v1/services/{serviceName}", "flatPath": "v1/services/{serviceName}", "httpMethod": "DELETE", "description": "Deletes a managed service.\n\nOperation<response: google.protobuf.Empty>", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName" ], "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "getConfig": { "id": "servicemanagement.services.getConfig", "path": "v1/services/{serviceName}/config", "flatPath": "v1/services/{serviceName}/config", "httpMethod": "GET", "description": "Gets a service config (version) for a managed service. If `config_id` is\nnot specified, the latest service config will be returned.", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "configId": { "description": "The id of the service config resource.\nOptional. If it is not specified, the latest version of config will be\nreturned.", "location": "query", "type": "string" } }, "parameterOrder": [ "serviceName" ], "response": { "$ref": "Service" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "convertConfig": { "id": "servicemanagement.services.convertConfig", "path": "v1/services:convertConfig", "flatPath": "v1/services:convertConfig", "httpMethod": "POST", "description": "DEPRECATED. `SubmitConfigSource` with `validate_only=true` will provide\nconfig conversion moving forward.\n\nConverts an API specification (e.g. Swagger spec) to an\nequivalent `google.api.Service`.", "parameters": { }, "parameterOrder": [ ], "request": { "$ref": "ConvertConfigRequest" }, "response": { "$ref": "ConvertConfigResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "enable": { "id": "servicemanagement.services.enable", "path": "v1/services/{serviceName}:enable", "flatPath": "v1/services/{serviceName}:enable", "httpMethod": "POST", "description": "Enable a managed service for a project with default setting.\nIf the managed service has dependencies, they will be enabled as well.\n\nOperation<response: EnableServiceResponse>\n", "parameters": { "serviceName": { "description": "Name of the service to enable. Specifying an unknown service name will\ncause the request to fail.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "EnableServiceRequest" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "disable": { "id": "servicemanagement.services.disable", "path": "v1/services/{serviceName}:disable", "flatPath": "v1/services/{serviceName}:disable", "httpMethod": "POST", "description": "Disable a managed service for a project.\nGoogle Service Management will only disable the managed service even if\nthere are other services depend on the managed service.\n\nOperation<response: DisableServiceResponse>\n", "parameters": { "serviceName": { "description": "Name of the service to disable. Specifying an unknown service name\nwill cause the request to fail.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "DisableServiceRequest" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "update": { "id": "servicemanagement.services.update", "path": "v1/services/{serviceName}", "flatPath": "v1/services/{serviceName}", "httpMethod": "PUT", "description": "Updates the configuration of a service. If the specified service does not\nalready exist, then it is created.\n\nOperation<response: ManagedService>", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "updateMask": { "description": "A mask specifying which fields to update.\nUpdate mask has been deprecated on UpdateService service method. Please\nuse PatchService method instead to do partial updates.", "location": "query", "type": "string", "format": "google-fieldmask" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "ManagedService" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "patch": { "id": "servicemanagement.services.patch", "path": "v1/services/{serviceName}", "flatPath": "v1/services/{serviceName}", "httpMethod": "PATCH", "description": "Updates the specified subset of the configuration. If the specified service\ndoes not exists the patch operation fails.\n\nOperation<response: ManagedService>", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "updateMask": { "description": "A mask specifying which fields to update.", "location": "query", "type": "string", "format": "google-fieldmask" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "ManagedService" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "updateConfig": { "id": "servicemanagement.services.updateConfig", "path": "v1/services/{serviceName}/config", "flatPath": "v1/services/{serviceName}/config", "httpMethod": "PUT", "description": "Updates the specified subset of the service resource. Equivalent to\ncalling `UpdateService` with only the `service_config` field updated.\n\nOperation<response: google.api.Service>", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "updateMask": { "description": "A mask specifying which fields to update.\nUpdate mask has been deprecated on UpdateServiceConfig service method.\nPlease use PatchServiceConfig method instead to do partial updates.", "location": "query", "type": "string", "format": "google-fieldmask" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "Service" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "patchConfig": { "id": "servicemanagement.services.patchConfig", "path": "v1/services/{serviceName}/config", "flatPath": "v1/services/{serviceName}/config", "httpMethod": "PATCH", "description": "Updates the specified subset of the service resource. Equivalent to\ncalling `PatchService` with only the `service_config` field updated.\n\nOperation<response: google.api.Service>", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "updateMask": { "description": "A mask specifying which fields to update.", "location": "query", "type": "string", "format": "google-fieldmask" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "Service" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "getAccessPolicy": { "id": "servicemanagement.services.getAccessPolicy", "path": "v1/services/{serviceName}/accessPolicy", "flatPath": "v1/services/{serviceName}/accessPolicy", "httpMethod": "GET", "description": "Producer method to retrieve current policy.", "parameters": { "serviceName": { "description": "The name of the service. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName" ], "response": { "$ref": "ServiceAccessPolicy" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "updateAccessPolicy": { "id": "servicemanagement.services.updateAccessPolicy", "path": "v1/services/{serviceName}/accessPolicy", "flatPath": "v1/services/{serviceName}/accessPolicy", "httpMethod": "PUT", "description": "Producer method to update the current policy. This method will return an\nerror if the policy is too large (more than 50 entries across all lists).", "parameters": { "serviceName": { "description": "The name of the service. For example: `example.googleapis.com`.\nIf set, policy's service_name should be same as this one.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "ServiceAccessPolicy" }, "response": { "$ref": "ServiceAccessPolicy" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] } } , "resources": { "configs": { "methods": { "list": { "id": "servicemanagement.services.configs.list", "path": "v1/services/{serviceName}/configs", "flatPath": "v1/services/{serviceName}/configs", "httpMethod": "GET", "description": "Lists the history of the service config for a managed service,\nfrom the newest to the oldest.\n", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "pageToken": { "description": "The token of the page to retrieve.", "location": "query", "type": "string" }, "pageSize": { "description": "The max number of items to include in the response list.", "location": "query", "type": "integer", "format": "int32" } }, "parameterOrder": [ "serviceName" ], "response": { "$ref": "ListServiceConfigsResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "get": { "id": "servicemanagement.services.configs.get", "path": "v1/services/{serviceName}/configs/{configId}", "flatPath": "v1/services/{serviceName}/configs/{configId}", "httpMethod": "GET", "description": "Gets a service config (version) for a managed service. If `config_id` is\nnot specified, the latest service config will be returned.", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "configId": { "description": "The id of the service config resource.\nOptional. If it is not specified, the latest version of config will be\nreturned.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName", "configId" ], "response": { "$ref": "Service" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "create": { "id": "servicemanagement.services.configs.create", "path": "v1/services/{serviceName}/configs", "flatPath": "v1/services/{serviceName}/configs", "httpMethod": "POST", "description": "Creates a new service config (version) for a managed service. This method\nonly stores the service config, but does not apply the service config to\nany backend services.\n", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "Service" }, "response": { "$ref": "Service" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "submit": { "id": "servicemanagement.services.configs.submit", "path": "v1/services/{serviceName}/configs:submit", "flatPath": "v1/services/{serviceName}/configs:submit", "httpMethod": "POST", "description": "Creates a new service config (version) for a managed service based on\nuser-supplied configuration sources files (for example: OpenAPI\nSpecification). This method stores the source configurations as well as the\ngenerated service config. It does NOT apply the service config to any\nbackend services.\n\nOperation<response: SubmitConfigSourceResponse>\n", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName" ], "request": { "$ref": "SubmitConfigSourceRequest" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] } } }, "accessPolicy": { "methods": { "query": { "id": "servicemanagement.services.accessPolicy.query", "path": "v1/services/{serviceName}/accessPolicy:query", "flatPath": "v1/services/{serviceName}/accessPolicy:query", "httpMethod": "POST", "description": "Method to query the accessibility of a service and any associated\nvisibility labels for a specified user.\n\nMembers of the producer project may call this method and specify any user.\n\nAny user may call this method, but must specify their own email address.\nIn this case the method will return NOT_FOUND if the user has no access to\nthe service.", "parameters": { "serviceName": { "description": "The service to query access for.", "location": "path", "required": true, "type": "string" }, "userEmail": { "description": "The user to query access for.", "location": "query", "type": "string" } }, "parameterOrder": [ "serviceName" ], "response": { "$ref": "QueryUserAccessResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] } } }, "customerSettings": { "methods": { "get": { "id": "servicemanagement.services.customerSettings.get", "path": "v1/services/{serviceName}/customerSettings/{customerId}", "flatPath": "v1/services/{serviceName}/customerSettings/{customerId}", "httpMethod": "GET", "description": "Retrieves the settings that control the specified customer's usage of the\nservice.", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`. This field is\nrequired.", "location": "path", "required": true, "type": "string" }, "customerId": { "description": "ID for the customer. See the comment for `CustomerSettings.customer_id`\nfield of message for its format. This field is required.", "location": "path", "required": true, "type": "string" }, "expand": { "description": "Fields to expand in any results.", "location": "query", "type": "string", "format": "google-fieldmask" }, "view": { "description": "Request only fields for the specified view.", "location": "query", "type": "string", "enum": [ "PROJECT_SETTINGS_VIEW_UNSPECIFIED", "CONSUMER_VIEW", "PRODUCER_VIEW", "ALL" ] } }, "parameterOrder": [ "serviceName", "customerId" ], "response": { "$ref": "CustomerSettings" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "patch": { "id": "servicemanagement.services.customerSettings.patch", "path": "v1/services/{serviceName}/customerSettings/{customerId}", "flatPath": "v1/services/{serviceName}/customerSettings/{customerId}", "httpMethod": "PATCH", "description": "Updates specified subset of the settings that control the specified\ncustomer's usage of the service. Attempts to update a field not\ncontrolled by the caller will result in an access denied error.\n\nOperation<response: CustomerSettings>", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`. This field is\nrequired.", "location": "path", "required": true, "type": "string" }, "customerId": { "description": "ID for the customer. See the comment for `CustomerSettings.customer_id`\nfield of message for its format. This field is required.", "location": "path", "required": true, "type": "string" }, "updateMask": { "description": "The field mask specifying which fields are to be updated.", "location": "query", "type": "string", "format": "google-fieldmask" } }, "parameterOrder": [ "serviceName", "customerId" ], "request": { "$ref": "CustomerSettings" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] } } }, "projectSettings": { "methods": { "get": { "id": "servicemanagement.services.projectSettings.get", "path": "v1/services/{serviceName}/projectSettings/{consumerProjectId}", "flatPath": "v1/services/{serviceName}/projectSettings/{consumerProjectId}", "httpMethod": "GET", "description": "Retrieves the settings that control the specified consumer project's usage\nof the service.", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "consumerProjectId": { "description": "The project ID of the consumer.", "location": "path", "required": true, "type": "string" }, "expand": { "description": "Fields to expand in any results. By default, the following fields\nare not present in the result:\n- `operations`\n- `quota_usage`", "location": "query", "type": "string", "format": "google-fieldmask" }, "view": { "description": "Request only the fields for the specified view.", "location": "query", "type": "string", "enum": [ "PROJECT_SETTINGS_VIEW_UNSPECIFIED", "CONSUMER_VIEW", "PRODUCER_VIEW", "ALL" ] } }, "parameterOrder": [ "serviceName", "consumerProjectId" ], "response": { "$ref": "ProjectSettings" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "update": { "id": "servicemanagement.services.projectSettings.update", "path": "v1/services/{serviceName}/projectSettings/{consumerProjectId}", "flatPath": "v1/services/{serviceName}/projectSettings/{consumerProjectId}", "httpMethod": "PUT", "description": "NOTE: Currently unsupported. Use PatchProjectSettings instead.\n\nUpdates the settings that control the specified consumer project's usage\nof the service. Attempts to update a field not controlled by the caller\nwill result in an access denied error.\n\nOperation<response: ProjectSettings>", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "consumerProjectId": { "description": "The project ID of the consumer.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "serviceName", "consumerProjectId" ], "request": { "$ref": "ProjectSettings" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] }, "patch": { "id": "servicemanagement.services.projectSettings.patch", "path": "v1/services/{serviceName}/projectSettings/{consumerProjectId}", "flatPath": "v1/services/{serviceName}/projectSettings/{consumerProjectId}", "httpMethod": "PATCH", "description": "Updates specified subset of the settings that control the specified\nconsumer project's usage of the service. Attempts to update a field not\ncontrolled by the caller will result in an access denied error.\n\nOperation<response: ProjectSettings>", "parameters": { "serviceName": { "description": "The name of the service. See the `ServiceManager` overview for naming\nrequirements. For example: `example.googleapis.com`.", "location": "path", "required": true, "type": "string" }, "consumerProjectId": { "description": "The project ID of the consumer.", "location": "path", "required": true, "type": "string" }, "updateMask": { "description": "The field mask specifying which fields are to be updated.", "location": "query", "type": "string", "format": "google-fieldmask" } }, "parameterOrder": [ "serviceName", "consumerProjectId" ], "request": { "$ref": "ProjectSettings" }, "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] } } } } }, "v1": { "methods": { "convertConfig": { "id": "servicemanagement.convertConfig", "path": "v1:convertConfig", "flatPath": "v1:convertConfig", "httpMethod": "POST", "description": "DEPRECATED. `SubmitConfigSource` with `validate_only=true` will provide\nconfig conversion moving forward.\n\nConverts an API specification (e.g. Swagger spec) to an\nequivalent `google.api.Service`.", "parameters": { }, "parameterOrder": [ ], "request": { "$ref": "ConvertConfigRequest" }, "response": { "$ref": "ConvertConfigResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] } } }, "operations": { "methods": { "get": { "id": "servicemanagement.operations.get", "path": "v1/operations/{operationsId}", "flatPath": "v1/operations/{operationsId}", "httpMethod": "GET", "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", "parameters": { "operationsId": { "description": "Part of `name`. The name of the operation resource.", "location": "path", "required": true, "type": "string" } }, "parameterOrder": [ "operationsId" ], "response": { "$ref": "Operation" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/service.management" ] } } } }, "basePath": "" } samples/servicemanagement_sample/servicemanagement_v1/servicemanagement_v1_client.py 0000644 00000100623 15025176453 0025376 0 ustar 00 """Generated client library for servicemanagement version v1.""" # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.py import base_api from samples.servicemanagement_sample.servicemanagement_v1 import servicemanagement_v1_messages as messages class ServicemanagementV1(base_api.BaseApiClient): """Generated client library for service servicemanagement version v1.""" MESSAGES_MODULE = messages BASE_URL = 'https://servicemanagement.googleapis.com/' MTLS_BASE_URL = '' _PACKAGE = 'servicemanagement' _SCOPES = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/service.management'] _VERSION = 'v1' _CLIENT_ID = 'CLIENT_ID' _CLIENT_SECRET = 'CLIENT_SECRET' _USER_AGENT = 'x_Tw5K8nnjoRAqULM9PFAC2b' _CLIENT_CLASS_NAME = 'ServicemanagementV1' _URL_VERSION = 'v1' _API_KEY = None def __init__(self, url='', credentials=None, get_credentials=True, http=None, model=None, log_request=False, log_response=False, credentials_args=None, default_global_params=None, additional_http_headers=None, response_encoding=None): """Create a new servicemanagement handle.""" url = url or self.BASE_URL super(ServicemanagementV1, self).__init__( url, credentials=credentials, get_credentials=get_credentials, http=http, model=model, log_request=log_request, log_response=log_response, credentials_args=credentials_args, default_global_params=default_global_params, additional_http_headers=additional_http_headers, response_encoding=response_encoding) self.operations = self.OperationsService(self) self.services_accessPolicy = self.ServicesAccessPolicyService(self) self.services_configs = self.ServicesConfigsService(self) self.services_customerSettings = self.ServicesCustomerSettingsService(self) self.services_projectSettings = self.ServicesProjectSettingsService(self) self.services = self.ServicesService(self) self.v1 = self.V1Service(self) class OperationsService(base_api.BaseApiService): """Service class for the operations resource.""" _NAME = 'operations' def __init__(self, client): super(ServicemanagementV1.OperationsService, self).__init__(client) self._upload_configs = { } def Get(self, request, global_params=None): r"""Gets the latest state of a long-running operation. Clients can use this. method to poll the operation result at intervals as recommended by the API service. Args: request: (ServicemanagementOperationsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.operations.get', ordered_params=['operationsId'], path_params=['operationsId'], query_params=[], relative_path='v1/operations/{operationsId}', request_field='', request_type_name='ServicemanagementOperationsGetRequest', response_type_name='Operation', supports_download=False, ) class ServicesAccessPolicyService(base_api.BaseApiService): """Service class for the services_accessPolicy resource.""" _NAME = 'services_accessPolicy' def __init__(self, client): super(ServicemanagementV1.ServicesAccessPolicyService, self).__init__(client) self._upload_configs = { } def Query(self, request, global_params=None): r"""Method to query the accessibility of a service and any associated. visibility labels for a specified user. Members of the producer project may call this method and specify any user. Any user may call this method, but must specify their own email address. In this case the method will return NOT_FOUND if the user has no access to the service. Args: request: (ServicemanagementServicesAccessPolicyQueryRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (QueryUserAccessResponse) The response message. """ config = self.GetMethodConfig('Query') return self._RunMethod( config, request, global_params=global_params) Query.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='servicemanagement.services.accessPolicy.query', ordered_params=['serviceName'], path_params=['serviceName'], query_params=['userEmail'], relative_path='v1/services/{serviceName}/accessPolicy:query', request_field='', request_type_name='ServicemanagementServicesAccessPolicyQueryRequest', response_type_name='QueryUserAccessResponse', supports_download=False, ) class ServicesConfigsService(base_api.BaseApiService): """Service class for the services_configs resource.""" _NAME = 'services_configs' def __init__(self, client): super(ServicemanagementV1.ServicesConfigsService, self).__init__(client) self._upload_configs = { } def Create(self, request, global_params=None): r"""Creates a new service config (version) for a managed service. This method. only stores the service config, but does not apply the service config to any backend services. Args: request: (ServicemanagementServicesConfigsCreateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Service) The response message. """ config = self.GetMethodConfig('Create') return self._RunMethod( config, request, global_params=global_params) Create.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='servicemanagement.services.configs.create', ordered_params=['serviceName'], path_params=['serviceName'], query_params=[], relative_path='v1/services/{serviceName}/configs', request_field='service', request_type_name='ServicemanagementServicesConfigsCreateRequest', response_type_name='Service', supports_download=False, ) def Get(self, request, global_params=None): r"""Gets a service config (version) for a managed service. If `config_id` is. not specified, the latest service config will be returned. Args: request: (ServicemanagementServicesConfigsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Service) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.services.configs.get', ordered_params=['serviceName', 'configId'], path_params=['configId', 'serviceName'], query_params=[], relative_path='v1/services/{serviceName}/configs/{configId}', request_field='', request_type_name='ServicemanagementServicesConfigsGetRequest', response_type_name='Service', supports_download=False, ) def List(self, request, global_params=None): r"""Lists the history of the service config for a managed service,. from the newest to the oldest. Args: request: (ServicemanagementServicesConfigsListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ListServiceConfigsResponse) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.services.configs.list', ordered_params=['serviceName'], path_params=['serviceName'], query_params=['pageSize', 'pageToken'], relative_path='v1/services/{serviceName}/configs', request_field='', request_type_name='ServicemanagementServicesConfigsListRequest', response_type_name='ListServiceConfigsResponse', supports_download=False, ) def Submit(self, request, global_params=None): r"""Creates a new service config (version) for a managed service based on. user-supplied configuration sources files (for example: OpenAPI Specification). This method stores the source configurations as well as the generated service config. It does NOT apply the service config to any backend services. Operation<response: SubmitConfigSourceResponse> Args: request: (ServicemanagementServicesConfigsSubmitRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Submit') return self._RunMethod( config, request, global_params=global_params) Submit.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='servicemanagement.services.configs.submit', ordered_params=['serviceName'], path_params=['serviceName'], query_params=[], relative_path='v1/services/{serviceName}/configs:submit', request_field='submitConfigSourceRequest', request_type_name='ServicemanagementServicesConfigsSubmitRequest', response_type_name='Operation', supports_download=False, ) class ServicesCustomerSettingsService(base_api.BaseApiService): """Service class for the services_customerSettings resource.""" _NAME = 'services_customerSettings' def __init__(self, client): super(ServicemanagementV1.ServicesCustomerSettingsService, self).__init__(client) self._upload_configs = { } def Get(self, request, global_params=None): r"""Retrieves the settings that control the specified customer's usage of the. service. Args: request: (ServicemanagementServicesCustomerSettingsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (CustomerSettings) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.services.customerSettings.get', ordered_params=['serviceName', 'customerId'], path_params=['customerId', 'serviceName'], query_params=['expand', 'view'], relative_path='v1/services/{serviceName}/customerSettings/{customerId}', request_field='', request_type_name='ServicemanagementServicesCustomerSettingsGetRequest', response_type_name='CustomerSettings', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates specified subset of the settings that control the specified. customer's usage of the service. Attempts to update a field not controlled by the caller will result in an access denied error. Operation<response: CustomerSettings> Args: request: (ServicemanagementServicesCustomerSettingsPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='servicemanagement.services.customerSettings.patch', ordered_params=['serviceName', 'customerId'], path_params=['customerId', 'serviceName'], query_params=['updateMask'], relative_path='v1/services/{serviceName}/customerSettings/{customerId}', request_field='customerSettings', request_type_name='ServicemanagementServicesCustomerSettingsPatchRequest', response_type_name='Operation', supports_download=False, ) class ServicesProjectSettingsService(base_api.BaseApiService): """Service class for the services_projectSettings resource.""" _NAME = 'services_projectSettings' def __init__(self, client): super(ServicemanagementV1.ServicesProjectSettingsService, self).__init__(client) self._upload_configs = { } def Get(self, request, global_params=None): r"""Retrieves the settings that control the specified consumer project's usage. of the service. Args: request: (ServicemanagementServicesProjectSettingsGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ProjectSettings) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.services.projectSettings.get', ordered_params=['serviceName', 'consumerProjectId'], path_params=['consumerProjectId', 'serviceName'], query_params=['expand', 'view'], relative_path='v1/services/{serviceName}/projectSettings/{consumerProjectId}', request_field='', request_type_name='ServicemanagementServicesProjectSettingsGetRequest', response_type_name='ProjectSettings', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates specified subset of the settings that control the specified. consumer project's usage of the service. Attempts to update a field not controlled by the caller will result in an access denied error. Operation<response: ProjectSettings> Args: request: (ServicemanagementServicesProjectSettingsPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='servicemanagement.services.projectSettings.patch', ordered_params=['serviceName', 'consumerProjectId'], path_params=['consumerProjectId', 'serviceName'], query_params=['updateMask'], relative_path='v1/services/{serviceName}/projectSettings/{consumerProjectId}', request_field='projectSettings', request_type_name='ServicemanagementServicesProjectSettingsPatchRequest', response_type_name='Operation', supports_download=False, ) def Update(self, request, global_params=None): r"""NOTE: Currently unsupported. Use PatchProjectSettings instead. Updates the settings that control the specified consumer project's usage of the service. Attempts to update a field not controlled by the caller will result in an access denied error. Operation<response: ProjectSettings> Args: request: (ProjectSettings) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='servicemanagement.services.projectSettings.update', ordered_params=['serviceName', 'consumerProjectId'], path_params=['consumerProjectId', 'serviceName'], query_params=[], relative_path='v1/services/{serviceName}/projectSettings/{consumerProjectId}', request_field='<request>', request_type_name='ProjectSettings', response_type_name='Operation', supports_download=False, ) class ServicesService(base_api.BaseApiService): """Service class for the services resource.""" _NAME = 'services' def __init__(self, client): super(ServicemanagementV1.ServicesService, self).__init__(client) self._upload_configs = { } def ConvertConfig(self, request, global_params=None): r"""DEPRECATED. `SubmitConfigSource` with `validate_only=true` will provide. config conversion moving forward. Converts an API specification (e.g. Swagger spec) to an equivalent `google.api.Service`. Args: request: (ConvertConfigRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ConvertConfigResponse) The response message. """ config = self.GetMethodConfig('ConvertConfig') return self._RunMethod( config, request, global_params=global_params) ConvertConfig.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='servicemanagement.services.convertConfig', ordered_params=[], path_params=[], query_params=[], relative_path='v1/services:convertConfig', request_field='<request>', request_type_name='ConvertConfigRequest', response_type_name='ConvertConfigResponse', supports_download=False, ) def Create(self, request, global_params=None): r"""Creates a new managed service. Operation<response: ManagedService> Args: request: (ManagedService) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Create') return self._RunMethod( config, request, global_params=global_params) Create.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='servicemanagement.services.create', ordered_params=[], path_params=[], query_params=[], relative_path='v1/services', request_field='<request>', request_type_name='ManagedService', response_type_name='Operation', supports_download=False, ) def Delete(self, request, global_params=None): r"""Deletes a managed service. Operation<response: google.protobuf.Empty> Args: request: (ServicemanagementServicesDeleteRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Delete') return self._RunMethod( config, request, global_params=global_params) Delete.method_config = lambda: base_api.ApiMethodInfo( http_method='DELETE', method_id='servicemanagement.services.delete', ordered_params=['serviceName'], path_params=['serviceName'], query_params=[], relative_path='v1/services/{serviceName}', request_field='', request_type_name='ServicemanagementServicesDeleteRequest', response_type_name='Operation', supports_download=False, ) def Disable(self, request, global_params=None): r"""Disable a managed service for a project. Google Service Management will only disable the managed service even if there are other services depend on the managed service. Operation<response: DisableServiceResponse> Args: request: (ServicemanagementServicesDisableRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Disable') return self._RunMethod( config, request, global_params=global_params) Disable.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='servicemanagement.services.disable', ordered_params=['serviceName'], path_params=['serviceName'], query_params=[], relative_path='v1/services/{serviceName}:disable', request_field='disableServiceRequest', request_type_name='ServicemanagementServicesDisableRequest', response_type_name='Operation', supports_download=False, ) def Enable(self, request, global_params=None): r"""Enable a managed service for a project with default setting. If the managed service has dependencies, they will be enabled as well. Operation<response: EnableServiceResponse> Args: request: (ServicemanagementServicesEnableRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Enable') return self._RunMethod( config, request, global_params=global_params) Enable.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='servicemanagement.services.enable', ordered_params=['serviceName'], path_params=['serviceName'], query_params=[], relative_path='v1/services/{serviceName}:enable', request_field='enableServiceRequest', request_type_name='ServicemanagementServicesEnableRequest', response_type_name='Operation', supports_download=False, ) def Get(self, request, global_params=None): r"""Gets a managed service. If the `consumer_project_id` is specified,. the project's settings for the specified service are also returned. Args: request: (ServicemanagementServicesGetRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ManagedService) The response message. """ config = self.GetMethodConfig('Get') return self._RunMethod( config, request, global_params=global_params) Get.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.services.get', ordered_params=['serviceName'], path_params=['serviceName'], query_params=['consumerProjectId', 'expand', 'view'], relative_path='v1/services/{serviceName}', request_field='', request_type_name='ServicemanagementServicesGetRequest', response_type_name='ManagedService', supports_download=False, ) def GetAccessPolicy(self, request, global_params=None): r"""Producer method to retrieve current policy. Args: request: (ServicemanagementServicesGetAccessPolicyRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ServiceAccessPolicy) The response message. """ config = self.GetMethodConfig('GetAccessPolicy') return self._RunMethod( config, request, global_params=global_params) GetAccessPolicy.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.services.getAccessPolicy', ordered_params=['serviceName'], path_params=['serviceName'], query_params=[], relative_path='v1/services/{serviceName}/accessPolicy', request_field='', request_type_name='ServicemanagementServicesGetAccessPolicyRequest', response_type_name='ServiceAccessPolicy', supports_download=False, ) def GetConfig(self, request, global_params=None): r"""Gets a service config (version) for a managed service. If `config_id` is. not specified, the latest service config will be returned. Args: request: (ServicemanagementServicesGetConfigRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Service) The response message. """ config = self.GetMethodConfig('GetConfig') return self._RunMethod( config, request, global_params=global_params) GetConfig.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.services.getConfig', ordered_params=['serviceName'], path_params=['serviceName'], query_params=['configId'], relative_path='v1/services/{serviceName}/config', request_field='', request_type_name='ServicemanagementServicesGetConfigRequest', response_type_name='Service', supports_download=False, ) def List(self, request, global_params=None): r"""Lists all managed services. If the `consumer_project_id` is specified,. the project's settings for the specified service are also returned. Args: request: (ServicemanagementServicesListRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ListServicesResponse) The response message. """ config = self.GetMethodConfig('List') return self._RunMethod( config, request, global_params=global_params) List.method_config = lambda: base_api.ApiMethodInfo( http_method='GET', method_id='servicemanagement.services.list', ordered_params=[], path_params=[], query_params=['category', 'consumerProjectId', 'expand', 'pageSize', 'pageToken', 'producerProjectId'], relative_path='v1/services', request_field='', request_type_name='ServicemanagementServicesListRequest', response_type_name='ListServicesResponse', supports_download=False, ) def Patch(self, request, global_params=None): r"""Updates the specified subset of the configuration. If the specified service. does not exists the patch operation fails. Operation<response: ManagedService> Args: request: (ServicemanagementServicesPatchRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Patch') return self._RunMethod( config, request, global_params=global_params) Patch.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='servicemanagement.services.patch', ordered_params=['serviceName'], path_params=['serviceName'], query_params=['updateMask'], relative_path='v1/services/{serviceName}', request_field='managedService', request_type_name='ServicemanagementServicesPatchRequest', response_type_name='Operation', supports_download=False, ) def PatchConfig(self, request, global_params=None): r"""Updates the specified subset of the service resource. Equivalent to. calling `PatchService` with only the `service_config` field updated. Operation<response: google.api.Service> Args: request: (ServicemanagementServicesPatchConfigRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('PatchConfig') return self._RunMethod( config, request, global_params=global_params) PatchConfig.method_config = lambda: base_api.ApiMethodInfo( http_method='PATCH', method_id='servicemanagement.services.patchConfig', ordered_params=['serviceName'], path_params=['serviceName'], query_params=['updateMask'], relative_path='v1/services/{serviceName}/config', request_field='service', request_type_name='ServicemanagementServicesPatchConfigRequest', response_type_name='Operation', supports_download=False, ) def Update(self, request, global_params=None): r"""Updates the configuration of a service. If the specified service does not. already exist, then it is created. Operation<response: ManagedService> Args: request: (ServicemanagementServicesUpdateRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('Update') return self._RunMethod( config, request, global_params=global_params) Update.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='servicemanagement.services.update', ordered_params=['serviceName'], path_params=['serviceName'], query_params=['updateMask'], relative_path='v1/services/{serviceName}', request_field='managedService', request_type_name='ServicemanagementServicesUpdateRequest', response_type_name='Operation', supports_download=False, ) def UpdateAccessPolicy(self, request, global_params=None): r"""Producer method to update the current policy. This method will return an. error if the policy is too large (more than 50 entries across all lists). Args: request: (ServiceAccessPolicy) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ServiceAccessPolicy) The response message. """ config = self.GetMethodConfig('UpdateAccessPolicy') return self._RunMethod( config, request, global_params=global_params) UpdateAccessPolicy.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='servicemanagement.services.updateAccessPolicy', ordered_params=['serviceName'], path_params=['serviceName'], query_params=[], relative_path='v1/services/{serviceName}/accessPolicy', request_field='<request>', request_type_name='ServiceAccessPolicy', response_type_name='ServiceAccessPolicy', supports_download=False, ) def UpdateConfig(self, request, global_params=None): r"""Updates the specified subset of the service resource. Equivalent to. calling `UpdateService` with only the `service_config` field updated. Operation<response: google.api.Service> Args: request: (ServicemanagementServicesUpdateConfigRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (Operation) The response message. """ config = self.GetMethodConfig('UpdateConfig') return self._RunMethod( config, request, global_params=global_params) UpdateConfig.method_config = lambda: base_api.ApiMethodInfo( http_method='PUT', method_id='servicemanagement.services.updateConfig', ordered_params=['serviceName'], path_params=['serviceName'], query_params=['updateMask'], relative_path='v1/services/{serviceName}/config', request_field='service', request_type_name='ServicemanagementServicesUpdateConfigRequest', response_type_name='Operation', supports_download=False, ) class V1Service(base_api.BaseApiService): """Service class for the v1 resource.""" _NAME = 'v1' def __init__(self, client): super(ServicemanagementV1.V1Service, self).__init__(client) self._upload_configs = { } def ConvertConfig(self, request, global_params=None): r"""DEPRECATED. `SubmitConfigSource` with `validate_only=true` will provide. config conversion moving forward. Converts an API specification (e.g. Swagger spec) to an equivalent `google.api.Service`. Args: request: (ConvertConfigRequest) input message global_params: (StandardQueryParameters, default: None) global arguments Returns: (ConvertConfigResponse) The response message. """ config = self.GetMethodConfig('ConvertConfig') return self._RunMethod( config, request, global_params=global_params) ConvertConfig.method_config = lambda: base_api.ApiMethodInfo( http_method='POST', method_id='servicemanagement.convertConfig', ordered_params=[], path_params=[], query_params=[], relative_path='v1:convertConfig', request_field='<request>', request_type_name='ConvertConfigRequest', response_type_name='ConvertConfigResponse', supports_download=False, ) samples/servicemanagement_sample/servicemanagement_v1/__init__.py 0000644 00000000207 15025176453 0021471 0 ustar 00 """Package marker file.""" from __future__ import absolute_import import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) samples/servicemanagement_sample/servicemanagement_v1/servicemanagement_v1_messages.py 0000644 00000452765 15025176453 0025750 0 ustar 00 """Generated message classes for servicemanagement version v1. The service management API for Google Cloud Platform """ # NOTE: This file is autogenerated and should not be edited by hand. from __future__ import absolute_import from apitools.base.protorpclite import messages as _messages from apitools.base.py import encoding from apitools.base.py import extra_types package = 'servicemanagement' class Api(_messages.Message): r"""Api is a light-weight descriptor for a protocol buffer service. Enums: SyntaxValueValuesEnum: The source syntax of the service. Fields: methods: The methods of this api, in unspecified order. mixins: Included APIs. See Mixin. name: The fully qualified name of this api, including package name followed by the api's simple name. options: Any metadata attached to the API. sourceContext: Source context for the protocol buffer service represented by this message. syntax: The source syntax of the service. version: A version string for this api. If specified, must have the form `major-version.minor-version`, as in `1.10`. If the minor version is omitted, it defaults to zero. If the entire version field is empty, the major version is derived from the package name, as outlined below. If the field is not empty, the version in the package name will be verified to be consistent with what is provided here. The versioning schema uses [semantic versioning](http://semver.org) where the major version number indicates a breaking change and the minor version an additive, non- breaking change. Both version numbers are signals to users what to expect from different versions, and should be carefully chosen based on the product plan. The major version is also reflected in the package name of the API, which must end in `v<major-version>`, as in `google.feature.v1`. For major versions 0 and 1, the suffix can be omitted. Zero major versions must only be used for experimental, none-GA apis. """ class SyntaxValueValuesEnum(_messages.Enum): r"""The source syntax of the service. Values: SYNTAX_PROTO2: Syntax `proto2`. SYNTAX_PROTO3: Syntax `proto3`. """ SYNTAX_PROTO2 = 0 SYNTAX_PROTO3 = 1 methods = _messages.MessageField('Method', 1, repeated=True) mixins = _messages.MessageField('Mixin', 2, repeated=True) name = _messages.StringField(3) options = _messages.MessageField('Option', 4, repeated=True) sourceContext = _messages.MessageField('SourceContext', 5) syntax = _messages.EnumField('SyntaxValueValuesEnum', 6) version = _messages.StringField(7) class AreaUnderCurveParams(_messages.Message): r"""AreaUnderCurveParams groups the metrics relevant to generating duration based metric from base (snapshot) metric and delta (change) metric. The generated metric has two dimensions: resource usage metric and the duration the metric applies. Essentially the generated metric is the Area Under Curve(AUC) of the "duration - resource" usage curve. This AUC metric is readily appliable to billing since "billable resource usage" depends on resource usage and duration of the resource used. A service config may contain multiple resources and corresponding metrics. AreaUnderCurveParams groups the relevant ones: which snapshot_metric and change_metric are used to produce which generated_metric. Fields: changeMetric: Change of resource usage at a particular timestamp. This should a DELTA metric. generatedMetric: Metric generated from snapshot_metric and change_metric. This is also a DELTA metric. snapshotMetric: Total usage of a resource at a particular timestamp. This should be a GAUGE metric. """ changeMetric = _messages.StringField(1) generatedMetric = _messages.StringField(2) snapshotMetric = _messages.StringField(3) class AuthProvider(_messages.Message): r"""Configuration for an anthentication provider, including support for [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json- web-token-32). Fields: id: The unique identifier of the auth provider. It will be referred to by `AuthRequirement.provider_id`. Example: "bookstore_auth". issuer: Identifies the principal that issued the JWT. See https://tools.ietf.org/html/draft-ietf-oauth-json-web- token-32#section-4.1.1 Usually a URL or an email address. Example: https://securetoken.google.com Example: 1234567-compute@developer.gserviceaccount.com jwksUri: URL of the provider's public key set to validate signature of the JWT. See [OpenID Discovery](https://openid.net/specs/openid-connect- discovery-1_0.html#ProviderMetadata). Optional if the key set document: - can be retrieved from [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html of the issuer. - can be inferred from the email domain of the issuer (e.g. a Google service account). Example: https://www.googleapis.com/oauth2/v1/certs """ id = _messages.StringField(1) issuer = _messages.StringField(2) jwksUri = _messages.StringField(3) class AuthRequirement(_messages.Message): r"""User-defined authentication requirements, including support for [JSON Web Token (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web- token-32). Fields: audiences: The list of JWT [audiences](https://tools.ietf.org/html/draft- ietf-oauth-json-web-token-32#section-4.1.3). that are allowed to access. A JWT containing any of these audiences will be accepted. When this setting is absent, only JWTs with audience "https://Service_name/API_name" will be accepted. For example, if no audiences are in the setting, LibraryService API will only accept JWTs with the following audience "https://library- example.googleapis.com/google.example.library.v1.LibraryService". Example: audiences: bookstore_android.apps.googleusercontent.com, bookstore_web.apps.googleusercontent.com providerId: id from authentication provider. Example: provider_id: bookstore_auth """ audiences = _messages.StringField(1) providerId = _messages.StringField(2) class Authentication(_messages.Message): r"""`Authentication` defines the authentication configuration for an API. Example for an API targeted for external use: name: calendar.googleapis.com authentication: rules: - selector: "*" oauth: canonical_scopes: https://www.googleapis.com/auth/calendar - selector: google.calendar.Delegate oauth: canonical_scopes: https://www.googleapis.com/auth/calendar.read Fields: providers: Defines a set of authentication providers that a service supports. rules: Individual rules for authentication. """ providers = _messages.MessageField('AuthProvider', 1, repeated=True) rules = _messages.MessageField('AuthenticationRule', 2, repeated=True) class AuthenticationRule(_messages.Message): r"""Authentication rules for the service. By default, if a method has any authentication requirements, every request must include a valid credential matching one of the requirements. It's an error to include more than one kind of credential in a single request. If a method doesn't have any auth requirements, request credentials will be ignored. Fields: allowWithoutCredential: Whether to allow requests without a credential. If quota is enabled, an API key is required for such request to pass the quota check. oauth: The requirements for OAuth credentials. requirements: Requirements for additional authentication providers. selector: Selects the methods to which this rule applies. Refer to selector for syntax details. """ allowWithoutCredential = _messages.BooleanField(1) oauth = _messages.MessageField('OAuthRequirements', 2) requirements = _messages.MessageField('AuthRequirement', 3, repeated=True) selector = _messages.StringField(4) class Backend(_messages.Message): r"""`Backend` defines the backend configuration for a service. Fields: rules: A list of backend rules providing configuration for individual API elements. """ rules = _messages.MessageField('BackendRule', 1, repeated=True) class BackendRule(_messages.Message): r"""A backend rule provides configuration for an individual API element. Fields: address: The address of the API backend. deadline: The number of seconds to wait for a response from a request. The default depends on the deployment context. selector: Selects the methods to which this rule applies. Refer to selector for syntax details. """ address = _messages.StringField(1) deadline = _messages.FloatField(2) selector = _messages.StringField(3) class Billing(_messages.Message): r"""Billing related configuration of the service. The following example shows how to configure metrics for billing: metrics: - name: library.googleapis.com/read_calls metric_kind: DELTA value_type: INT64 - name: library.googleapis.com/write_calls metric_kind: DELTA value_type: INT64 billing: metrics: - library.googleapis.com/read_calls - library.googleapis.com/write_calls The next example shows how to enable billing status check and customize the check behavior. It makes sure billing status check is included in the `Check` method of [Service Control API](https://cloud.google.com/service- control/). In the example, "google.storage.Get" method can be served when the billing status is either `current` or `delinquent`, while "google.storage.Write" method can only be served when the billing status is `current`: billing: rules: - selector: google.storage.Get allowed_statuses: - current - delinquent - selector: google.storage.Write allowed_statuses: current Mostly services should only allow `current` status when serving requests. In addition, services can choose to allow both `current` and `delinquent` statuses when serving read-only requests to resources. If there's no matching selector for operation, no billing status check will be performed. Fields: areaUnderCurveParams: Per resource grouping for delta billing based resource configs. metrics: Names of the metrics to report to billing. Each name must be defined in Service.metrics section. rules: A list of billing status rules for configuring billing status check. """ areaUnderCurveParams = _messages.MessageField('AreaUnderCurveParams', 1, repeated=True) metrics = _messages.StringField(2, repeated=True) rules = _messages.MessageField('BillingStatusRule', 3, repeated=True) class BillingStatusRule(_messages.Message): r"""Defines the billing status requirements for operations. When used with [Service Control API](https://cloud.google.com/service-control/), the following statuses are supported: - **current**: the associated billing account is up to date and capable of paying for resource usages. - **delinquent**: the associated billing account has a correctable problem, such as late payment. Mostly services should only allow `current` status when serving requests. In addition, services can choose to allow both `current` and `delinquent` statuses when serving read- only requests to resources. If the list of allowed_statuses is empty, it means no billing requirement. Fields: allowedStatuses: Allowed billing statuses. The billing status check passes if the actual billing status matches any of the provided values here. selector: Selects the operation names to which this rule applies. Refer to selector for syntax details. """ allowedStatuses = _messages.StringField(1, repeated=True) selector = _messages.StringField(2) class CompositeOperationMetadata(_messages.Message): r"""Metadata for composite operations. Messages: OriginalRequestValue: Original request that triggered this operation. ResponseFieldMasksValue: Defines which part of the response a child operation will contribute. Each key of the map is the name of a child operation. Each value is a field mask that identifies what that child operation contributes to the response, for example, "quota_settings", "visiblity_settings", etc. Fields: childOperations: The child operations. The details of the asynchronous child operations are stored in a separate row and not in this metadata. Only the operation name is stored here. originalRequest: Original request that triggered this operation. persisted: Indicates whether the requested state change has been persisted. Once this field is set, it is guaranteed to propagate to all backends eventually, but it may not be visible immediately. Clients that are not concerned with waiting on propagation can stop polling the operation once the persisted field is set responseFieldMasks: Defines which part of the response a child operation will contribute. Each key of the map is the name of a child operation. Each value is a field mask that identifies what that child operation contributes to the response, for example, "quota_settings", "visiblity_settings", etc. """ @encoding.MapUnrecognizedFields('additionalProperties') class OriginalRequestValue(_messages.Message): r"""Original request that triggered this operation. Messages: AdditionalProperty: An additional property for a OriginalRequestValue object. Fields: additionalProperties: Properties of the object. Contains field @type with type URL. """ class AdditionalProperty(_messages.Message): r"""An additional property for a OriginalRequestValue object. Fields: key: Name of the additional property. value: A extra_types.JsonValue attribute. """ key = _messages.StringField(1) value = _messages.MessageField('extra_types.JsonValue', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) @encoding.MapUnrecognizedFields('additionalProperties') class ResponseFieldMasksValue(_messages.Message): r"""Defines which part of the response a child operation will contribute. Each key of the map is the name of a child operation. Each value is a field mask that identifies what that child operation contributes to the response, for example, "quota_settings", "visiblity_settings", etc. Messages: AdditionalProperty: An additional property for a ResponseFieldMasksValue object. Fields: additionalProperties: Additional properties of type ResponseFieldMasksValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a ResponseFieldMasksValue object. Fields: key: Name of the additional property. value: A string attribute. """ key = _messages.StringField(1) value = _messages.StringField(2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) childOperations = _messages.MessageField('Operation', 1, repeated=True) originalRequest = _messages.MessageField('OriginalRequestValue', 2) persisted = _messages.BooleanField(3) responseFieldMasks = _messages.MessageField('ResponseFieldMasksValue', 4) class ConfigFile(_messages.Message): r"""Generic specification of a source configuration file Enums: FileTypeValueValuesEnum: The kind of configuration file represented. This is used to determine the method for generating `google.api.Service` using this file. Fields: contents: DEPRECATED. The contents of the configuration file. Use file_contents moving forward. fileContents: The bytes that constitute the file. filePath: The file name of the configuration file (full or relative path). fileType: The kind of configuration file represented. This is used to determine the method for generating `google.api.Service` using this file. """ class FileTypeValueValuesEnum(_messages.Enum): r"""The kind of configuration file represented. This is used to determine the method for generating `google.api.Service` using this file. Values: FILE_TYPE_UNSPECIFIED: Unknown file type. SERVICE_CONFIG_YAML: YAML-specification of service. OPEN_API_JSON: OpenAPI specification, serialized in JSON. OPEN_API_YAML: OpenAPI specification, serialized in YAML. FILE_DESCRIPTOR_SET_PROTO: FileDescriptorSet, generated by protoc. To generate, use protoc with imports and source info included. For an example test.proto file, the following command would put the value in a new file named out.pb. $protoc --include_imports --include_source_info test.proto -o out.pb """ FILE_TYPE_UNSPECIFIED = 0 SERVICE_CONFIG_YAML = 1 OPEN_API_JSON = 2 OPEN_API_YAML = 3 FILE_DESCRIPTOR_SET_PROTO = 4 contents = _messages.StringField(1) fileContents = _messages.BytesField(2) filePath = _messages.StringField(3) fileType = _messages.EnumField('FileTypeValueValuesEnum', 4) class ConfigOptions(_messages.Message): r"""A set of options to cover use of source config within `ServiceManager` and related tools. """ class ConfigSource(_messages.Message): r"""Represents a user-specified configuration for a service (as opposed to the the generated service config form provided by `google.api.Service`). This is meant to encode service config as manipulated directly by customers, rather than the config form resulting from toolchain generation and normalization. Fields: files: Set of source configuration files that are used to generate a service config (`google.api.Service`). id: A unique ID for a specific instance of this message, typically assigned by the client for tracking purpose. If empty, the server may choose to generate one instead. openApiSpec: OpenAPI specification options: Options to cover use of source config within ServiceManager and tools protoSpec: Protocol buffer API specification """ files = _messages.MessageField('ConfigFile', 1, repeated=True) id = _messages.StringField(2) openApiSpec = _messages.MessageField('OpenApiSpec', 3) options = _messages.MessageField('ConfigOptions', 4) protoSpec = _messages.MessageField('ProtoSpec', 5) class Context(_messages.Message): r"""`Context` defines which contexts an API requests. Example: context: rules: - selector: "*" requested: - google.rpc.context.ProjectContext - google.rpc.context.OriginContext The above specifies that all methods in the API request `google.rpc.context.ProjectContext` and `google.rpc.context.OriginContext`. Available context types are defined in package `google.rpc.context`. Fields: rules: List of rules for context, applicable to methods. """ rules = _messages.MessageField('ContextRule', 1, repeated=True) class ContextRule(_messages.Message): r"""A context rule provides information about the context for an individual API element. Fields: provided: A list of full type names of provided contexts. requested: A list of full type names of requested contexts. selector: Selects the methods to which this rule applies. Refer to selector for syntax details. """ provided = _messages.StringField(1, repeated=True) requested = _messages.StringField(2, repeated=True) selector = _messages.StringField(3) class Control(_messages.Message): r"""Selects and configures the service controller used by the service. The service controller handles features like abuse, quota, billing, logging, monitoring, etc. Fields: environment: The service control environment to use. If empty, no control plane feature (like quota and billing) will be enabled. """ environment = _messages.StringField(1) class ConvertConfigRequest(_messages.Message): r"""Request message for `ConvertConfig` method. Messages: ConfigSpecValue: Input configuration For this version of API, the supported type is OpenApiSpec Fields: configSpec: Input configuration For this version of API, the supported type is OpenApiSpec openApiSpec: The OpenAPI specification for an API. serviceName: The service name to use for constructing the normalized service configuration equivalent of the provided configuration specification. swaggerSpec: The swagger specification for an API. """ @encoding.MapUnrecognizedFields('additionalProperties') class ConfigSpecValue(_messages.Message): r"""Input configuration For this version of API, the supported type is OpenApiSpec Messages: AdditionalProperty: An additional property for a ConfigSpecValue object. Fields: additionalProperties: Properties of the object. Contains field @type with type URL. """ class AdditionalProperty(_messages.Message): r"""An additional property for a ConfigSpecValue object. Fields: key: Name of the additional property. value: A extra_types.JsonValue attribute. """ key = _messages.StringField(1) value = _messages.MessageField('extra_types.JsonValue', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) configSpec = _messages.MessageField('ConfigSpecValue', 1) openApiSpec = _messages.MessageField('OpenApiSpec', 2) serviceName = _messages.StringField(3) swaggerSpec = _messages.MessageField('SwaggerSpec', 4) class ConvertConfigResponse(_messages.Message): r"""Response message for `ConvertConfig` method. Fields: diagnostics: Any errors or warnings that occured during config conversion. serviceConfig: The service configuration. Not set if errors occured during conversion. """ diagnostics = _messages.MessageField('Diagnostic', 1, repeated=True) serviceConfig = _messages.MessageField('Service', 2) class CustomError(_messages.Message): r"""Customize service error responses. For example, list any service specific protobuf types that can appear in error detail lists of error responses. Example: custom_error: types: - google.foo.v1.CustomError - google.foo.v1.AnotherError Fields: rules: The list of custom error rules to select to which messages this should apply. types: The list of custom error detail types, e.g. 'google.foo.v1.CustomError'. """ rules = _messages.MessageField('CustomErrorRule', 1, repeated=True) types = _messages.StringField(2, repeated=True) class CustomErrorRule(_messages.Message): r"""A custom error rule. Fields: isErrorType: Mark this message as possible payload in error response. Otherwise, objects of this type will be filtered when they appear in error payload. selector: Selects messages to which this rule applies. Refer to selector for syntax details. """ isErrorType = _messages.BooleanField(1) selector = _messages.StringField(2) class CustomHttpPattern(_messages.Message): r"""A custom pattern is used for defining custom HTTP verb. Fields: kind: The name of this custom HTTP verb. path: The path matched by this custom verb. """ kind = _messages.StringField(1) path = _messages.StringField(2) class CustomerSettings(_messages.Message): r"""Settings that control how a customer (identified by a billing account) uses a service Fields: customerId: ID for the customer that consumes the service (see above). The supported types of customers are: 1. domain:{domain} A Google Apps domain name. For example, google.com. 2. billingAccount:{billing_account_id} A Google Cloud Plafrom billing account. For Example, 123456-7890ab-cdef12. quotaSettings: Settings that control how much or how fast the service can be used by the consumer projects owned by the customer collectively. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. """ customerId = _messages.StringField(1) quotaSettings = _messages.MessageField('QuotaSettings', 2) serviceName = _messages.StringField(3) class Diagnostic(_messages.Message): r"""A collection that represents a diagnostic message (error or warning) Enums: KindValueValuesEnum: The kind of diagnostic information provided. Fields: kind: The kind of diagnostic information provided. location: Location of the cause or context of the diagnostic information. message: The string message of the diagnostic information. """ class KindValueValuesEnum(_messages.Enum): r"""The kind of diagnostic information provided. Values: WARNING: Warnings and errors ERROR: Only errors """ WARNING = 0 ERROR = 1 kind = _messages.EnumField('KindValueValuesEnum', 1) location = _messages.StringField(2) message = _messages.StringField(3) class DisableServiceRequest(_messages.Message): r"""Request message for DisableService method. Fields: consumerId: The identity of consumer resource which service disablement will be applied to. The Google Service Management implementation accepts the following forms: "project:<project_id>", "project_number:<project_number>". Note: this is made compatible with google.api.servicecontrol.v1.Operation.consumer_id. """ consumerId = _messages.StringField(1) class Documentation(_messages.Message): r"""`Documentation` provides the information for describing a service. Example: <pre><code>documentation: summary: > The Google Calendar API gives access to most calendar features. pages: - name: Overview content: (== include google/foo/overview.md ==) - name: Tutorial content: (== include google/foo/tutorial.md ==) subpages; - name: Java content: (== include google/foo/tutorial_java.md ==) rules: - selector: google.calendar.Calendar.Get description: > ... - selector: google.calendar.Calendar.Put description: > ... </code></pre> Documentation is provided in markdown syntax. In addition to standard markdown features, definition lists, tables and fenced code blocks are supported. Section headers can be provided and are interpreted relative to the section nesting of the context where a documentation fragment is embedded. Documentation from the IDL is merged with documentation defined via the config at normalization time, where documentation provided by config rules overrides IDL provided. A number of constructs specific to the API platform are supported in documentation text. In order to reference a proto element, the following notation can be used: <pre><code>[fully.qualified.proto.name][]</code></pre> To override the display text used for the link, this can be used: <pre><code>[display text][fully.qualified.proto.name]</code></pre> Text can be excluded from doc using the following notation: <pre><code>(-- internal comment --)</code></pre> Comments can be made conditional using a visibility label. The below text will be only rendered if the `BETA` label is available: <pre><code>(--BETA: comment for BETA users --)</code></pre> A few directives are available in documentation. Note that directives must appear on a single line to be properly identified. The `include` directive includes a markdown file from an external source: <pre><code>(== include path/to/file ==)</code></pre> The `resource_for` directive marks a message to be the resource of a collection in REST view. If it is not specified, tools attempt to infer the resource from the operations in a collection: <pre><code>(== resource_for v1.shelves.books ==)</code></pre> The directive `suppress_warning` does not directly affect documentation and is documented together with service config validation. Fields: documentationRootUrl: The URL to the root of documentation. overview: Declares a single overview page. For example: <pre><code>documentation: summary: ... overview: (== include overview.md ==) </code></pre> This is a shortcut for the following declaration (using pages style): <pre><code>documentation: summary: ... pages: - name: Overview content: (== include overview.md ==) </code></pre> Note: you cannot specify both `overview` field and `pages` field. pages: The top level pages for the documentation set. rules: Documentation rules for individual elements of the service. summary: A short summary of what the service does. Can only be provided by plain text. """ documentationRootUrl = _messages.StringField(1) overview = _messages.StringField(2) pages = _messages.MessageField('Page', 3, repeated=True) rules = _messages.MessageField('DocumentationRule', 4, repeated=True) summary = _messages.StringField(5) class DocumentationRule(_messages.Message): r"""A documentation rule provides information about individual API elements. Fields: deprecationDescription: Deprecation description of the selected element(s). It can be provided if an element is marked as `deprecated`. description: Description of the selected API(s). selector: The selector is a comma-separated list of patterns. Each pattern is a qualified name of the element which may end in "*", indicating a wildcard. Wildcards are only allowed at the end and for a whole component of the qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To specify a default for all applicable elements, the whole pattern "*" is used. """ deprecationDescription = _messages.StringField(1) description = _messages.StringField(2) selector = _messages.StringField(3) class EffectiveQuotaGroup(_messages.Message): r"""An effective quota group contains both the metadata for a quota group as derived from the service config, and the effective limits in that group as calculated from producer and consumer overrides together with service defaults. Enums: BillingInteractionValueValuesEnum: Fields: baseGroup: The service configuration for this quota group, minus the quota limits, which are replaced by the effective limits below. billingInteraction: A BillingInteractionValueValuesEnum attribute. quotas: The usage and limit information for each limit within this quota group. """ class BillingInteractionValueValuesEnum(_messages.Enum): r"""BillingInteractionValueValuesEnum enum type. Values: BILLING_INTERACTION_UNSPECIFIED: The interaction between this quota group and the project billing status is unspecified. NONBILLABLE_ONLY: This quota group is enforced only when the consumer project is not billable. BILLABLE_ONLY: This quota group is enforced only when the consumer project is billable. ANY_BILLING_STATUS: This quota group is enforced regardless of the consumer project's billing status. """ BILLING_INTERACTION_UNSPECIFIED = 0 NONBILLABLE_ONLY = 1 BILLABLE_ONLY = 2 ANY_BILLING_STATUS = 3 baseGroup = _messages.MessageField('QuotaGroup', 1) billingInteraction = _messages.EnumField('BillingInteractionValueValuesEnum', 2) quotas = _messages.MessageField('QuotaInfo', 3, repeated=True) class EffectiveQuotaLimit(_messages.Message): r"""An effective quota limit contains the metadata for a quota limit as derived from the service config, together with fields that describe the effective limit value and what overrides can be applied to it. Fields: baseLimit: The service's configuration for this quota limit. effectiveLimit: The effective limit value, based on the stored producer and consumer overrides and the service defaults. key: The key used to identify this limit when applying overrides. The consumer_overrides and producer_overrides maps are keyed by strings of the form "QuotaGroupName/QuotaLimitName". maxConsumerOverrideAllowed: The maximum override value that a consumer may specify. """ baseLimit = _messages.MessageField('QuotaLimit', 1) effectiveLimit = _messages.IntegerField(2) key = _messages.StringField(3) maxConsumerOverrideAllowed = _messages.IntegerField(4) class EnableServiceRequest(_messages.Message): r"""Request message for EnableService method. Fields: consumerId: The identity of consumer resource which service enablement will be applied to. The Google Service Management implementation accepts the following forms: "project:<project_id>", "project_number:<project_number>". Note: this is made compatible with google.api.servicecontrol.v1.Operation.consumer_id. """ consumerId = _messages.StringField(1) class Enum(_messages.Message): r"""Enum type definition. Enums: SyntaxValueValuesEnum: The source syntax. Fields: enumvalue: Enum value definitions. name: Enum type name. options: Protocol buffer options. sourceContext: The source context. syntax: The source syntax. """ class SyntaxValueValuesEnum(_messages.Enum): r"""The source syntax. Values: SYNTAX_PROTO2: Syntax `proto2`. SYNTAX_PROTO3: Syntax `proto3`. """ SYNTAX_PROTO2 = 0 SYNTAX_PROTO3 = 1 enumvalue = _messages.MessageField('EnumValue', 1, repeated=True) name = _messages.StringField(2) options = _messages.MessageField('Option', 3, repeated=True) sourceContext = _messages.MessageField('SourceContext', 4) syntax = _messages.EnumField('SyntaxValueValuesEnum', 5) class EnumValue(_messages.Message): r"""Enum value definition. Fields: name: Enum value name. number: Enum value number. options: Protocol buffer options. """ name = _messages.StringField(1) number = _messages.IntegerField(2, variant=_messages.Variant.INT32) options = _messages.MessageField('Option', 3, repeated=True) class Field(_messages.Message): r"""A single field of a message type. Enums: CardinalityValueValuesEnum: The field cardinality. KindValueValuesEnum: The field type. Fields: cardinality: The field cardinality. defaultValue: The string value of the default value of this field. Proto2 syntax only. jsonName: The field JSON name. kind: The field type. name: The field name. number: The field number. oneofIndex: The index of the field type in `Type.oneofs`, for message or enumeration types. The first type has index 1; zero means the type is not in the list. options: The protocol buffer options. packed: Whether to use alternative packed wire representation. typeUrl: The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. """ class CardinalityValueValuesEnum(_messages.Enum): r"""The field cardinality. Values: CARDINALITY_UNKNOWN: For fields with unknown cardinality. CARDINALITY_OPTIONAL: For optional fields. CARDINALITY_REQUIRED: For required fields. Proto2 syntax only. CARDINALITY_REPEATED: For repeated fields. """ CARDINALITY_UNKNOWN = 0 CARDINALITY_OPTIONAL = 1 CARDINALITY_REQUIRED = 2 CARDINALITY_REPEATED = 3 class KindValueValuesEnum(_messages.Enum): r"""The field type. Values: TYPE_UNKNOWN: Field type unknown. TYPE_DOUBLE: Field type double. TYPE_FLOAT: Field type float. TYPE_INT64: Field type int64. TYPE_UINT64: Field type uint64. TYPE_INT32: Field type int32. TYPE_FIXED64: Field type fixed64. TYPE_FIXED32: Field type fixed32. TYPE_BOOL: Field type bool. TYPE_STRING: Field type string. TYPE_GROUP: Field type group. Proto2 syntax only, and deprecated. TYPE_MESSAGE: Field type message. TYPE_BYTES: Field type bytes. TYPE_UINT32: Field type uint32. TYPE_ENUM: Field type enum. TYPE_SFIXED32: Field type sfixed32. TYPE_SFIXED64: Field type sfixed64. TYPE_SINT32: Field type sint32. TYPE_SINT64: Field type sint64. """ TYPE_UNKNOWN = 0 TYPE_DOUBLE = 1 TYPE_FLOAT = 2 TYPE_INT64 = 3 TYPE_UINT64 = 4 TYPE_INT32 = 5 TYPE_FIXED64 = 6 TYPE_FIXED32 = 7 TYPE_BOOL = 8 TYPE_STRING = 9 TYPE_GROUP = 10 TYPE_MESSAGE = 11 TYPE_BYTES = 12 TYPE_UINT32 = 13 TYPE_ENUM = 14 TYPE_SFIXED32 = 15 TYPE_SFIXED64 = 16 TYPE_SINT32 = 17 TYPE_SINT64 = 18 cardinality = _messages.EnumField('CardinalityValueValuesEnum', 1) defaultValue = _messages.StringField(2) jsonName = _messages.StringField(3) kind = _messages.EnumField('KindValueValuesEnum', 4) name = _messages.StringField(5) number = _messages.IntegerField(6, variant=_messages.Variant.INT32) oneofIndex = _messages.IntegerField(7, variant=_messages.Variant.INT32) options = _messages.MessageField('Option', 8, repeated=True) packed = _messages.BooleanField(9) typeUrl = _messages.StringField(10) class File(_messages.Message): r"""A single swagger specification file. Fields: contents: The contents of the swagger spec file. path: The relative path of the swagger spec file. """ contents = _messages.StringField(1) path = _messages.StringField(2) class Http(_messages.Message): r"""Defines the HTTP configuration for a service. It contains a list of HttpRule, each specifying the mapping of an RPC method to one or more HTTP REST API methods. Fields: rules: A list of HTTP rules for configuring the HTTP REST API methods. """ rules = _messages.MessageField('HttpRule', 1, repeated=True) class HttpRule(_messages.Message): r"""`HttpRule` defines the mapping of an RPC method to one or more HTTP REST APIs. The mapping determines what portions of the request message are populated from the path, query parameters, or body of the HTTP request. The mapping is typically specified as an `google.api.http` annotation, see "google/api/annotations.proto" for details. The mapping consists of a field specifying the path template and method kind. The path template can refer to fields in the request message, as in the example below which describes a REST GET operation on a resource collection of messages: ```proto service Messaging { rpc GetMessage(GetMessageRequest) returns (Message) { option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; } } message GetMessageRequest { message SubMessage { string subfield = 1; } string message_id = 1; // mapped to the URL SubMessage sub = 2; // `sub.subfield` is url-mapped } message Message { string text = 1; // content of the resource } ``` This definition enables an automatic, bidrectional mapping of HTTP JSON to RPC. Example: HTTP | RPC -----|----- `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` In general, not only fields but also field paths can be referenced from a path pattern. Fields mapped to the path pattern cannot be repeated and must have a primitive (non-message) type. Any fields in the request message which are not bound by the path pattern automatically become (optional) HTTP query parameters. Assume the following definition of the request message: ```proto message GetMessageRequest { message SubMessage { string subfield = 1; } string message_id = 1; // mapped to the URL int64 revision = 2; // becomes a parameter SubMessage sub = 3; // `sub.subfield` becomes a parameter } ``` This enables a HTTP JSON to RPC mapping as below: HTTP | RPC -----|----- `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` Note that fields which are mapped to HTTP parameters must have a primitive type or a repeated primitive type. Message types are not allowed. In the case of a repeated type, the parameter can be repeated in the URL, as in `...?param=A¶m=B`. For HTTP method kinds which allow a request body, the `body` field specifies the mapping. Consider a REST update method on the message resource collection: ```proto service Messaging { rpc UpdateMessage(UpdateMessageRequest) returns (Message) { option (google.api.http) = { put: "/v1/messages/{message_id}" body: "message" }; } } message UpdateMessageRequest { string message_id = 1; // mapped to the URL Message message = 2; // mapped to the body } ``` The following HTTP JSON to RPC mapping is enabled, where the representation of the JSON in the request body is determined by protos JSON encoding: HTTP | RPC -----|----- `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` The special name `*` can be used in the body mapping to define that every field not bound by the path template should be mapped to the request body. This enables the following alternative definition of the update method: ```proto service Messaging { rpc UpdateMessage(Message) returns (Message) { option (google.api.http) = { put: "/v1/messages/{message_id}" body: "*" }; } } message Message { string message_id = 1; string text = 2; } ``` The following HTTP JSON to RPC mapping is enabled: HTTP | RPC -----|----- `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` Note that when using `*` in the body mapping, it is not possible to have HTTP parameters, as all fields not bound by the path end in the body. This makes this option more rarely used in practice of defining REST APIs. The common usage of `*` is in custom methods which don't use the URL at all for transferring data. It is possible to define multiple HTTP methods for one RPC by using the `additional_bindings` option. Example: ```proto service Messaging { rpc GetMessage(GetMessageRequest) returns (Message) { option (google.api.http) = { get: "/v1/messages/{message_id}" additional_bindings { get: "/v1/users/{user_id}/messages/{message_id}" } }; } } message GetMessageRequest { string message_id = 1; string user_id = 2; } ``` This enables the following two alternative HTTP JSON to RPC mappings: HTTP | RPC -----|----- `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` # Rules for HTTP mapping The rules for mapping HTTP path, query parameters, and body fields to the request message are as follows: 1. The `body` field specifies either `*` or a field path, or is omitted. If omitted, it assumes there is no HTTP body. 2. Leaf fields (recursive expansion of nested messages in the request) can be classified into three types: (a) Matched in the URL template. (b) Covered by body (if body is `*`, everything except (a) fields; else everything under the body field) (c) All other fields. 3. URL query parameters found in the HTTP request are mapped to (c) fields. 4. Any body sent with an HTTP request can contain only (b) fields. The syntax of the path template is as follows: Template = "/" Segments [ Verb ] ; Segments = Segment { "/" Segment } ; Segment = "*" | "**" | LITERAL | Variable ; Variable = "{" FieldPath [ "=" Segments ] "}" ; FieldPath = IDENT { "." IDENT } ; Verb = ":" LITERAL ; The syntax `*` matches a single path segment. It follows the semantics of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String Expansion. The syntax `**` matches zero or more path segments. It follows the semantics of [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.3 Reserved Expansion. The syntax `LITERAL` matches literal text in the URL path. The syntax `Variable` matches the entire path as specified by its template; this nested template must not contain further variables. If a variable matches a single path segment, its template may be omitted, e.g. `{var}` is equivalent to `{var=*}`. NOTE: the field paths in variables and in the `body` must not refer to repeated fields or map fields. Use CustomHttpPattern to specify any HTTP method that is not included in the `pattern` field, such as HEAD, or "*" to leave the HTTP method unspecified for a given URL path rule. The wild-card rule is useful for services that provide content to Web (HTML) clients. Fields: additionalBindings: Additional HTTP bindings for the selector. Nested bindings must not contain an `additional_bindings` field themselves (that is, the nesting may only be one level deep). body: The name of the request field whose value is mapped to the HTTP body, or `*` for mapping all fields not captured by the path pattern to the HTTP body. NOTE: the referred field must not be a repeated field. custom: Custom pattern is used for defining custom verbs. delete: Used for deleting a resource. get: Used for listing and getting information about resources. mediaDownload: Do not use this. For media support, add instead [][google.bytestream.RestByteStream] as an API to your configuration. mediaUpload: Do not use this. For media support, add instead [][google.bytestream.RestByteStream] as an API to your configuration. patch: Used for updating a resource. post: Used for creating a resource. put: Used for updating a resource. selector: Selects methods to which this rule applies. Refer to selector for syntax details. """ additionalBindings = _messages.MessageField('HttpRule', 1, repeated=True) body = _messages.StringField(2) custom = _messages.MessageField('CustomHttpPattern', 3) delete = _messages.StringField(4) get = _messages.StringField(5) mediaDownload = _messages.MessageField('MediaDownload', 6) mediaUpload = _messages.MessageField('MediaUpload', 7) patch = _messages.StringField(8) post = _messages.StringField(9) put = _messages.StringField(10) selector = _messages.StringField(11) class LabelDescriptor(_messages.Message): r"""A description of a label. Enums: ValueTypeValueValuesEnum: The type of data that can be assigned to the label. Fields: description: A human-readable description for the label. key: The label key. valueType: The type of data that can be assigned to the label. """ class ValueTypeValueValuesEnum(_messages.Enum): r"""The type of data that can be assigned to the label. Values: STRING: A variable-length string. This is the default. BOOL: Boolean; true or false. INT64: A 64-bit signed integer. """ STRING = 0 BOOL = 1 INT64 = 2 description = _messages.StringField(1) key = _messages.StringField(2) valueType = _messages.EnumField('ValueTypeValueValuesEnum', 3) class ListServiceConfigsResponse(_messages.Message): r"""Response message for ListServiceConfigs method. Fields: nextPageToken: The token of the next page of results. serviceConfigs: The list of service config resources. """ nextPageToken = _messages.StringField(1) serviceConfigs = _messages.MessageField('Service', 2, repeated=True) class ListServicesResponse(_messages.Message): r"""Response message for `ListServices` method. Fields: nextPageToken: Token that can be passed to `ListServices` to resume a paginated query. services: The results of the query. """ nextPageToken = _messages.StringField(1) services = _messages.MessageField('ManagedService', 2, repeated=True) class LogDescriptor(_messages.Message): r"""A description of a log type. Example in YAML format: - name: library.googleapis.com/activity_history description: The history of borrowing and returning library items. display_name: Activity labels: - key: /customer_id description: Identifier of a library customer Fields: description: A human-readable description of this log. This information appears in the documentation and can contain details. displayName: The human-readable name for this log. This information appears on the user interface and should be concise. labels: The set of labels that are available to describe a specific log entry. Runtime requests that contain labels not specified here are considered invalid. name: The name of the log. It must be less than 512 characters long and can include the following characters: upper- and lower-case alphanumeric characters [A-Za-z0-9], and punctuation characters including slash, underscore, hyphen, period [/_-.]. """ description = _messages.StringField(1) displayName = _messages.StringField(2) labels = _messages.MessageField('LabelDescriptor', 3, repeated=True) name = _messages.StringField(4) class Logging(_messages.Message): r"""Logging configuration of the service. The following example shows how to configure logs to be sent to the producer and consumer projects. In the example, the `library.googleapis.com/activity_history` log is sent to both the producer and consumer projects, whereas the `library.googleapis.com/purchase_history` log is only sent to the producer project: monitored_resources: - type: library.googleapis.com/branch labels: - key: /city description: The city where the library branch is located in. - key: /name description: The name of the branch. logs: - name: library.googleapis.com/activity_history labels: - key: /customer_id - name: library.googleapis.com/purchase_history logging: producer_destinations: - monitored_resource: library.googleapis.com/branch logs: - library.googleapis.com/activity_history - library.googleapis.com/purchase_history consumer_destinations: - monitored_resource: library.googleapis.com/branch logs: - library.googleapis.com/activity_history Fields: consumerDestinations: Logging configurations for sending logs to the consumer project. There can be multiple consumer destinations, each one must have a different monitored resource type. A log can be used in at most one consumer destination. producerDestinations: Logging configurations for sending logs to the producer project. There can be multiple producer destinations, each one must have a different monitored resource type. A log can be used in at most one producer destination. """ consumerDestinations = _messages.MessageField('LoggingDestination', 1, repeated=True) producerDestinations = _messages.MessageField('LoggingDestination', 2, repeated=True) class LoggingDestination(_messages.Message): r"""Configuration of a specific logging destination (the producer project or the consumer project). Fields: logs: Names of the logs to be sent to this destination. Each name must be defined in the Service.logs section. monitoredResource: The monitored resource type. The type must be defined in Service.monitored_resources section. """ logs = _messages.StringField(1, repeated=True) monitoredResource = _messages.StringField(2) class ManagedService(_messages.Message): r"""The full representation of an API Service that is managed by the `ServiceManager` API. Includes both the service configuration, as well as other control plane deployment related information. Fields: configSource: User-supplied source configuration for the service. This is distinct from the generated configuration provided in `google.api.Service`. This is NOT populated on GetService calls at the moment. NOTE: Any upsert operation that contains both a service_config and a config_source is considered invalid and will result in an error being returned. generation: A server-assigned monotonically increasing number that changes whenever a mutation is made to the `ManagedService` or any of its components via the `ServiceManager` API. operations: Read-only view of pending operations affecting this resource, if requested. producerProjectId: ID of the project that produces and owns this service. projectSettings: Read-only view of settings for a particular consumer project, if requested. serviceConfig: The service's generated configuration. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. This name must match `google.api.Service.name` in the `service_config` field. """ configSource = _messages.MessageField('ConfigSource', 1) generation = _messages.IntegerField(2) operations = _messages.MessageField('Operation', 3, repeated=True) producerProjectId = _messages.StringField(4) projectSettings = _messages.MessageField('ProjectSettings', 5) serviceConfig = _messages.MessageField('Service', 6) serviceName = _messages.StringField(7) class MediaDownload(_messages.Message): r"""Do not use this. For media support, add instead [][google.bytestream.RestByteStream] as an API to your configuration. Fields: enabled: Whether download is enabled. """ enabled = _messages.BooleanField(1) class MediaUpload(_messages.Message): r"""Do not use this. For media support, add instead [][google.bytestream.RestByteStream] as an API to your configuration. Fields: enabled: Whether upload is enabled. """ enabled = _messages.BooleanField(1) class Method(_messages.Message): r"""Method represents a method of an api. Enums: SyntaxValueValuesEnum: The source syntax of this method. Fields: name: The simple name of this method. options: Any metadata attached to the method. requestStreaming: If true, the request is streamed. requestTypeUrl: A URL of the input message type. responseStreaming: If true, the response is streamed. responseTypeUrl: The URL of the output message type. syntax: The source syntax of this method. """ class SyntaxValueValuesEnum(_messages.Enum): r"""The source syntax of this method. Values: SYNTAX_PROTO2: Syntax `proto2`. SYNTAX_PROTO3: Syntax `proto3`. """ SYNTAX_PROTO2 = 0 SYNTAX_PROTO3 = 1 name = _messages.StringField(1) options = _messages.MessageField('Option', 2, repeated=True) requestStreaming = _messages.BooleanField(3) requestTypeUrl = _messages.StringField(4) responseStreaming = _messages.BooleanField(5) responseTypeUrl = _messages.StringField(6) syntax = _messages.EnumField('SyntaxValueValuesEnum', 7) class MetricDescriptor(_messages.Message): r"""Defines a metric type and its schema. Enums: MetricKindValueValuesEnum: Whether the metric records instantaneous values, changes to a value, etc. ValueTypeValueValuesEnum: Whether the measurement is an integer, a floating-point number, etc. Fields: description: A detailed description of the metric, which can be used in documentation. displayName: A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". labels: The set of labels that can be used to describe a specific instance of this metric type. For example, the `compute.googleapis.com/instance/network/received_bytes_count` metric type has a label, `loadbalanced`, that specifies whether the traffic was received through a load balanced IP address. metricKind: Whether the metric records instantaneous values, changes to a value, etc. name: Resource name. The format of the name may vary between different implementations. For examples: projects/{project_id}/metricDescriptors/{type=**} metricDescriptors/{type=**} type: The metric type including a DNS name prefix, for example `"compute.googleapis.com/instance/cpu/utilization"`. Metric types should use a natural hierarchical grouping such as the following: compute.googleapis.com/instance/cpu/utilization compute.googleapis.com/instance/disk/read_ops_count compute.googleapis.com/instance/network/received_bytes_count Note that if the metric type changes, the monitoring data will be discontinued, and anything depends on it will break, such as monitoring dashboards, alerting rules and quota limits. Therefore, once a metric has been published, its type should be immutable. unit: The unit in which the metric value is reported. It is only applicable if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The supported units are a subset of [The Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html) standard: **Basic units (UNIT)** * `bit` bit * `By` byte * `s` second * `min` minute * `h` hour * `d` day **Prefixes (PREFIX)** * `k` kilo (10**3) * `M` mega (10**6) * `G` giga (10**9) * `T` tera (10**12) * `P` peta (10**15) * `E` exa (10**18) * `Z` zetta (10**21) * `Y` yotta (10**24) * `m` milli (10**-3) * `u` micro (10**-6) * `n` nano (10**-9) * `p` pico (10**-12) * `f` femto (10**-15) * `a` atto (10**-18) * `z` zepto (10**-21) * `y` yocto (10**-24) * `Ki` kibi (2**10) * `Mi` mebi (2**20) * `Gi` gibi (2**30) * `Ti` tebi (2**40) **Grammar** The grammar includes the dimensionless unit `1`, such as `1/s`. The grammar also includes these connectors: * `/` division (as an infix operator, e.g. `1/s`). * `.` multiplication (as an infix operator, e.g. `GBy.d`) The grammar for a unit is as follows: Expression = Component { "." Component } { "/" Component } ; Component = [ PREFIX ] UNIT [ Annotation ] | Annotation | "1" ; Annotation = "{" NAME "}" ; Notes: * `Annotation` is just a comment if it follows a `UNIT` and is equivalent to `1` if it is used alone. For examples, `{requests}/s == 1/s`, `By{transmitted}/s == By/s`. * `NAME` is a sequence of non-blank printable ASCII characters not containing '{' or '}'. valueType: Whether the measurement is an integer, a floating-point number, etc. """ class MetricKindValueValuesEnum(_messages.Enum): r"""Whether the metric records instantaneous values, changes to a value, etc. Values: METRIC_KIND_UNSPECIFIED: Do not use this default value. GAUGE: Instantaneous measurements of a varying quantity. DELTA: Changes over non-overlapping time intervals. CUMULATIVE: Cumulative value over time intervals that can overlap. The overlapping intervals must have the same start time. """ METRIC_KIND_UNSPECIFIED = 0 GAUGE = 1 DELTA = 2 CUMULATIVE = 3 class ValueTypeValueValuesEnum(_messages.Enum): r"""Whether the measurement is an integer, a floating-point number, etc. Values: VALUE_TYPE_UNSPECIFIED: Do not use this default value. BOOL: The value is a boolean. This value type can be used only if the metric kind is `GAUGE`. INT64: The value is a signed 64-bit integer. DOUBLE: The value is a double precision floating point number. STRING: The value is a text string. This value type can be used only if the metric kind is `GAUGE`. DISTRIBUTION: The value is a `Distribution`. MONEY: The value is money. """ VALUE_TYPE_UNSPECIFIED = 0 BOOL = 1 INT64 = 2 DOUBLE = 3 STRING = 4 DISTRIBUTION = 5 MONEY = 6 description = _messages.StringField(1) displayName = _messages.StringField(2) labels = _messages.MessageField('LabelDescriptor', 3, repeated=True) metricKind = _messages.EnumField('MetricKindValueValuesEnum', 4) name = _messages.StringField(5) type = _messages.StringField(6) unit = _messages.StringField(7) valueType = _messages.EnumField('ValueTypeValueValuesEnum', 8) class Mixin(_messages.Message): r"""Declares an API to be included in this API. The including API must redeclare all the methods from the included API, but documentation and options are inherited as follows: - If after comment and whitespace stripping, the documentation string of the redeclared method is empty, it will be inherited from the original method. - Each annotation belonging to the service config (http, visibility) which is not set in the redeclared method will be inherited. - If an http annotation is inherited, the path pattern will be modified as follows. Any version prefix will be replaced by the version of the including API plus the root path if specified. Example of a simple mixin: package google.acl.v1; service AccessControl { // Get the underlying ACL object. rpc GetAcl(GetAclRequest) returns (Acl) { option (google.api.http).get = "/v1/{resource=**}:getAcl"; } } package google.storage.v2; service Storage { // rpc GetAcl(GetAclRequest) returns (Acl); // Get a data record. rpc GetData(GetDataRequest) returns (Data) { option (google.api.http).get = "/v2/{resource=**}"; } } Example of a mixin configuration: apis: - name: google.storage.v2.Storage mixins: - name: google.acl.v1.AccessControl The mixin construct implies that all methods in `AccessControl` are also declared with same name and request/response types in `Storage`. A documentation generator or annotation processor will see the effective `Storage.GetAcl` method after inherting documentation and annotations as follows: service Storage { // Get the underlying ACL object. rpc GetAcl(GetAclRequest) returns (Acl) { option (google.api.http).get = "/v2/{resource=**}:getAcl"; } ... } Note how the version in the path pattern changed from `v1` to `v2`. If the `root` field in the mixin is specified, it should be a relative path under which inherited HTTP paths are placed. Example: apis: - name: google.storage.v2.Storage mixins: - name: google.acl.v1.AccessControl root: acls This implies the following inherited HTTP annotation: service Storage { // Get the underlying ACL object. rpc GetAcl(GetAclRequest) returns (Acl) { option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; } ... } Fields: name: The fully qualified name of the API which is included. root: If non-empty specifies a path under which inherited HTTP paths are rooted. """ name = _messages.StringField(1) root = _messages.StringField(2) class MonitoredResourceDescriptor(_messages.Message): r"""An object that describes the schema of a MonitoredResource object using a type name and a set of labels. For example, the monitored resource descriptor for Google Compute Engine VM instances has a type of `"gce_instance"` and specifies the use of the labels `"instance_id"` and `"zone"` to identify particular VM instances. Different APIs can support different monitored resource types. APIs generally provide a `list` method that returns the monitored resource descriptors used by the API. Fields: description: Optional. A detailed description of the monitored resource type that might be used in documentation. displayName: Optional. A concise name for the monitored resource type that might be displayed in user interfaces. For example, `"Google Cloud SQL Database"`. labels: Required. A set of labels used to describe instances of this monitored resource type. For example, an individual Google Cloud SQL database is identified by values for the labels `"database_id"` and `"zone"`. name: Optional. The resource name of the monitored resource descriptor: `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where {type} is the value of the `type` field in this object and {project_id} is a project ID that provides API-specific context for accessing the type. APIs that do not use project information can use the resource name format `"monitoredResourceDescriptors/{type}"`. type: Required. The monitored resource type. For example, the type `"cloudsql_database"` represents databases in Google Cloud SQL. The maximum length of this value is 256 characters. """ description = _messages.StringField(1) displayName = _messages.StringField(2) labels = _messages.MessageField('LabelDescriptor', 3, repeated=True) name = _messages.StringField(4) type = _messages.StringField(5) class Monitoring(_messages.Message): r"""Monitoring configuration of the service. The example below shows how to configure monitored resources and metrics for monitoring. In the example, a monitored resource and two metrics are defined. The `library.googleapis.com/book/returned_count` metric is sent to both producer and consumer projects, whereas the `library.googleapis.com/book/overdue_count` metric is only sent to the consumer project. monitored_resources: - type: library.googleapis.com/branch labels: - key: /city description: The city where the library branch is located in. - key: /name description: The name of the branch. metrics: - name: library.googleapis.com/book/returned_count metric_kind: DELTA value_type: INT64 labels: - key: /customer_id - name: library.googleapis.com/book/overdue_count metric_kind: GAUGE value_type: INT64 labels: - key: /customer_id monitoring: producer_destinations: - monitored_resource: library.googleapis.com/branch metrics: - library.googleapis.com/book/returned_count consumer_destinations: - monitored_resource: library.googleapis.com/branch metrics: - library.googleapis.com/book/returned_count - library.googleapis.com/book/overdue_count Fields: consumerDestinations: Monitoring configurations for sending metrics to the consumer project. There can be multiple consumer destinations, each one must have a different monitored resource type. A metric can be used in at most one consumer destination. producerDestinations: Monitoring configurations for sending metrics to the producer project. There can be multiple producer destinations, each one must have a different monitored resource type. A metric can be used in at most one producer destination. """ consumerDestinations = _messages.MessageField('MonitoringDestination', 1, repeated=True) producerDestinations = _messages.MessageField('MonitoringDestination', 2, repeated=True) class MonitoringDestination(_messages.Message): r"""Configuration of a specific monitoring destination (the producer project or the consumer project). Fields: metrics: Names of the metrics to report to this monitoring destination. Each name must be defined in Service.metrics section. monitoredResource: The monitored resource type. The type must be defined in Service.monitored_resources section. """ metrics = _messages.StringField(1, repeated=True) monitoredResource = _messages.StringField(2) class OAuthRequirements(_messages.Message): r"""OAuth scopes are a way to define data and permissions on data. For example, there are scopes defined for "Read-only access to Google Calendar" and "Access to Cloud Platform". Users can consent to a scope for an application, giving it permission to access that data on their behalf. OAuth scope specifications should be fairly coarse grained; a user will need to see and understand the text description of what your scope means. In most cases: use one or at most two OAuth scopes for an entire family of products. If your product has multiple APIs, you should probably be sharing the OAuth scope across all of those APIs. When you need finer grained OAuth consent screens: talk with your product management about how developers will use them in practice. Please note that even though each of the canonical scopes is enough for a request to be accepted and passed to the backend, a request can still fail due to the backend requiring additional scopes or permissions. Fields: canonicalScopes: The list of publicly documented OAuth scopes that are allowed access. An OAuth token containing any of these scopes will be accepted. Example: canonical_scopes: https://www.googleapis.com/auth/calendar, https://www.googleapis.com/auth/calendar.read """ canonicalScopes = _messages.StringField(1) class OpenApiSpec(_messages.Message): r"""A collection of OpenAPI specification files. Fields: openApiFiles: Individual files. """ openApiFiles = _messages.MessageField('ConfigFile', 1, repeated=True) class Operation(_messages.Message): r"""This resource represents a long-running operation that is the result of a network API call. Messages: MetadataValue: Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. ResponseValue: The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. Fields: done: If the value is `false`, it means the operation is still in progress. If true, the operation is completed, and either `error` or `response` is available. error: The error result of the operation in case of failure. metadata: Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. name: The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should have the format of `operations/some/unique/name`. response: The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. """ @encoding.MapUnrecognizedFields('additionalProperties') class MetadataValue(_messages.Message): r"""Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. Messages: AdditionalProperty: An additional property for a MetadataValue object. Fields: additionalProperties: Properties of the object. Contains field @type with type URL. """ class AdditionalProperty(_messages.Message): r"""An additional property for a MetadataValue object. Fields: key: Name of the additional property. value: A extra_types.JsonValue attribute. """ key = _messages.StringField(1) value = _messages.MessageField('extra_types.JsonValue', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) @encoding.MapUnrecognizedFields('additionalProperties') class ResponseValue(_messages.Message): r"""The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. Messages: AdditionalProperty: An additional property for a ResponseValue object. Fields: additionalProperties: Properties of the object. Contains field @type with type URL. """ class AdditionalProperty(_messages.Message): r"""An additional property for a ResponseValue object. Fields: key: Name of the additional property. value: A extra_types.JsonValue attribute. """ key = _messages.StringField(1) value = _messages.MessageField('extra_types.JsonValue', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) done = _messages.BooleanField(1) error = _messages.MessageField('Status', 2) metadata = _messages.MessageField('MetadataValue', 3) name = _messages.StringField(4) response = _messages.MessageField('ResponseValue', 5) class OperationMetadata(_messages.Message): r"""The metadata associated with a long running operation resource. Fields: progressPercentage: Percentage of completion of this operation, ranging from 0 to 100. resourceNames: The full name of the resources that this operation is directly associated with. startTime: The start time of the operation. steps: Detailed status information for each step. The order is undetermined. """ progressPercentage = _messages.IntegerField(1, variant=_messages.Variant.INT32) resourceNames = _messages.StringField(2, repeated=True) startTime = _messages.StringField(3) steps = _messages.MessageField('Step', 4, repeated=True) class Option(_messages.Message): r"""A protocol buffer option, which can be attached to a message, field, enumeration, etc. Messages: ValueValue: The option's value. For example, `"com.google.protobuf"`. Fields: name: The option's name. For example, `"java_package"`. value: The option's value. For example, `"com.google.protobuf"`. """ @encoding.MapUnrecognizedFields('additionalProperties') class ValueValue(_messages.Message): r"""The option's value. For example, `"com.google.protobuf"`. Messages: AdditionalProperty: An additional property for a ValueValue object. Fields: additionalProperties: Properties of the object. Contains field @type with type URL. """ class AdditionalProperty(_messages.Message): r"""An additional property for a ValueValue object. Fields: key: Name of the additional property. value: A extra_types.JsonValue attribute. """ key = _messages.StringField(1) value = _messages.MessageField('extra_types.JsonValue', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) name = _messages.StringField(1) value = _messages.MessageField('ValueValue', 2) class Page(_messages.Message): r"""Represents a documentation page. A page can contain subpages to represent nested documentation set structure. Fields: content: The Markdown content of the page. You can use <code>(== include {path} ==)</code> to include content from a Markdown file. name: The name of the page. It will be used as an identity of the page to generate URI of the page, text of the link to this page in navigation, etc. The full page name (start from the root page name to this page concatenated with `.`) can be used as reference to the page in your documentation. For example: <pre><code>pages: - name: Tutorial content: (== include tutorial.md ==) subpages: - name: Java content: (== include tutorial_java.md ==) </code></pre> You can reference `Java` page using Markdown reference link syntax: `Java`. subpages: Subpages of this page. The order of subpages specified here will be honored in the generated docset. """ content = _messages.StringField(1) name = _messages.StringField(2) subpages = _messages.MessageField('Page', 3, repeated=True) class ProjectProperties(_messages.Message): r"""A descriptor for defining project properties for a service. One service may have many consumer projects, and the service may want to behave differently depending on some properties on the project. For example, a project may be associated with a school, or a business, or a government agency, a business type property on the project may affect how a service responds to the client. This descriptor defines which properties are allowed to be set on a project. Example: project_properties: properties: - name: NO_WATERMARK type: BOOL description: Allows usage of the API without watermarks. - name: EXTENDED_TILE_CACHE_PERIOD type: INT64 Fields: properties: List of per consumer project-specific properties. """ properties = _messages.MessageField('Property', 1, repeated=True) class ProjectSettings(_messages.Message): r"""Settings that control how a consumer project uses a service. Messages: PropertiesValue: Service-defined per-consumer properties. A key-value mapping a string key to a google.protobuf.ListValue proto. Values in the list are typed as defined in the Service configuration's consumer.properties field. Fields: consumerProjectId: ID for the project consuming this service. operations: Read-only view of pending operations affecting this resource, if requested. properties: Service-defined per-consumer properties. A key-value mapping a string key to a google.protobuf.ListValue proto. Values in the list are typed as defined in the Service configuration's consumer.properties field. quotaSettings: Settings that control how much or how fast the service can be used by the consumer project. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. usageSettings: Settings that control whether this service is usable by the consumer project. visibilitySettings: Settings that control which features of the service are visible to the consumer project. """ @encoding.MapUnrecognizedFields('additionalProperties') class PropertiesValue(_messages.Message): r"""Service-defined per-consumer properties. A key-value mapping a string key to a google.protobuf.ListValue proto. Values in the list are typed as defined in the Service configuration's consumer.properties field. Messages: AdditionalProperty: An additional property for a PropertiesValue object. Fields: additionalProperties: Additional properties of type PropertiesValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a PropertiesValue object. Fields: key: Name of the additional property. value: A extra_types.JsonValue attribute. """ key = _messages.StringField(1) value = _messages.MessageField('extra_types.JsonValue', 2, repeated=True) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) consumerProjectId = _messages.StringField(1) operations = _messages.MessageField('Operation', 2, repeated=True) properties = _messages.MessageField('PropertiesValue', 3) quotaSettings = _messages.MessageField('QuotaSettings', 4) serviceName = _messages.StringField(5) usageSettings = _messages.MessageField('UsageSettings', 6) visibilitySettings = _messages.MessageField('VisibilitySettings', 7) class Property(_messages.Message): r"""Defines project properties. API services can define properties that can be assigned to consumer projects so that backends can perform response customization without having to make additional calls or maintain additional storage. For example, Maps API defines properties that controls map tile cache period, or whether to embed a watermark in a result. These values can be set via API producer console. Only API providers can define and set these properties. Enums: TypeValueValuesEnum: The type of this property. Fields: description: The description of the property name: The name of the property (a.k.a key). type: The type of this property. """ class TypeValueValuesEnum(_messages.Enum): r"""The type of this property. Values: UNSPECIFIED: The type is unspecified, and will result in an error. INT64: The type is `int64`. BOOL: The type is `bool`. STRING: The type is `string`. DOUBLE: The type is 'double'. """ UNSPECIFIED = 0 INT64 = 1 BOOL = 2 STRING = 3 DOUBLE = 4 description = _messages.StringField(1) name = _messages.StringField(2) type = _messages.EnumField('TypeValueValuesEnum', 3) class ProtoDescriptor(_messages.Message): r"""Contains a serialized protoc-generated protocol buffer message descriptor set along with a URL that describes the type of the descriptor message. Fields: typeUrl: A URL/resource name whose content describes the type of the serialized protocol buffer message. Only 'type.googleapis.com/google.protobuf.FileDescriptorSet' is supported. If the type_url is not specificed, 'type.googleapis.com/google.protobuf.FileDescriptorSet' will be assumed. value: Must be a valid serialized protocol buffer descriptor set. To generate, use protoc with imports and source info included. For an example test.proto file, the following command would put the value in a new file named descriptor.pb. $protoc --include_imports --include_source_info test.proto -o descriptor.pb """ typeUrl = _messages.StringField(1) value = _messages.BytesField(2) class ProtoSpec(_messages.Message): r"""A collection of protocol buffer service specification files. Fields: protoDescriptor: A complete descriptor of a protocol buffer specification """ protoDescriptor = _messages.MessageField('ProtoDescriptor', 1) class QueryUserAccessResponse(_messages.Message): r"""Request message for QueryUserAccess method. Fields: accessibleVisibilityLabels: Any visibility labels on the service that are accessible by the user. canAccessService: True if the user can access the service and any unrestricted API surface. """ accessibleVisibilityLabels = _messages.StringField(1, repeated=True) canAccessService = _messages.BooleanField(2) class Quota(_messages.Message): r"""Quota configuration helps to achieve fairness and budgeting in service usage. - Fairness is achieved through the use of short-term quota limits that are usually defined over a time window of several seconds or minutes. When such a limit is applied, for example at the user level, it ensures that no single user will monopolize the service or a given customer's allocated portion of it. - Budgeting is achieved through the use of long- term quota limits that are usually defined over a time window of one or more days. These limits help client application developers predict the usage and help budgeting. Quota enforcement uses a simple token-based algorithm for resource sharing. The quota configuration structure is as follows: - `QuotaLimit` defines a single enforceable limit with a specified token amount that can be consumed over a specific duration and applies to a particular entity, like a project or an end user. If the limit applies to a user, each user making the request will get the specified number of tokens to consume. When the tokens run out, the requests from that user will be blocked until the duration elapses and the next duration window starts. - `QuotaGroup` groups a set of quota limits. - `QuotaRule` maps a method to a set of quota groups. This allows sharing of quota groups across methods as well as one method consuming tokens from more than one quota group. When a group contains multiple limits, requests to a method consuming tokens from that group must satisfy all the limits in that group. Example: quota: groups: - name: ReadGroup limits: - description: Daily Limit name: ProjectQpd default_limit: 10000 duration: 1d limit_by: CLIENT_PROJECT - description: Per-second Limit name: UserQps default_limit: 20000 duration: 100s limit_by: USER - name: WriteGroup limits: - description: Daily Limit name: ProjectQpd default_limit: 1000 max_limit: 1000 duration: 1d limit_by: CLIENT_PROJECT - description: Per-second Limit name: UserQps default_limit: 2000 max_limit: 4000 duration: 100s limit_by: USER rules: - selector: "*" groups: - group: ReadGroup - selector: google.calendar.Calendar.Update groups: - group: WriteGroup cost: 2 - selector: google.calendar.Calendar.Delete groups: - group: WriteGroup Here, the configuration defines two quota groups: ReadGroup and WriteGroup, each defining its own daily and per-second limits. Note that One Platform enforces per-second limits averaged over a duration of 100 seconds. The rules map ReadGroup for all methods, except for the Update and Delete methods. These two methods consume from WriteGroup, with Update method consuming at twice the rate as Delete method. Multiple quota groups can be specified for a method. The quota limits in all of those groups will be enforced. Example: quota: groups: - name: WriteGroup limits: - description: Daily Limit name: ProjectQpd default_limit: 1000 max_limit: 1000 duration: 1d limit_by: CLIENT_PROJECT - description: Per- second Limit name: UserQps default_limit: 2000 max_limit: 4000 duration: 100s limit_by: USER - name: StorageGroup limits: - description: Storage Quota name: StorageQuota default_limit: 1000 duration: 0 limit_by: USER rules: - selector: google.calendar.Calendar.Create groups: - group: StorageGroup - group: WriteGroup - selector: google.calendar.Calendar.Delete groups: - group: StorageGroup In the above example, the Create and Delete methods manage the user's storage space. In addition, Create method uses WriteGroup to manage the requests. In this case, requests to Create method need to satisfy all quota limits defined in both quota groups. One can disable quota for selected method(s) identified by the selector by setting disable_quota to ture. For example, rules: - selector: "*" group: - group ReadGroup - selector: google.calendar.Calendar.Select disable_quota: true Fields: groups: List of `QuotaGroup` definitions for the service. rules: List of `QuotaRule` definitions, each one mapping a selected method to one or more quota groups. """ groups = _messages.MessageField('QuotaGroup', 1, repeated=True) rules = _messages.MessageField('QuotaRule', 2, repeated=True) class QuotaGroup(_messages.Message): r"""`QuotaGroup` defines a set of quota limits to enforce. Fields: billable: Indicates if the quota limits defined in this quota group apply to consumers who have active billing. Quota limits defined in billable groups will be applied only to consumers who have active billing. The amount of tokens consumed from billable quota group will also be reported for billing. Quota limits defined in non-billable groups will be applied only to consumers who have no active billing. description: User-visible description of this quota group. limits: Quota limits to be enforced when this quota group is used. A request must satisfy all the limits in a group for it to be permitted. name: Name of this quota group. Must be unique within the service. Quota group name is used as part of the id for quota limits. Once the quota group has been put into use, the name of the quota group should be immutable. """ billable = _messages.BooleanField(1) description = _messages.StringField(2) limits = _messages.MessageField('QuotaLimit', 3, repeated=True) name = _messages.StringField(4) class QuotaGroupMapping(_messages.Message): r"""A quota group mapping. Fields: cost: Number of tokens to consume for each request. This allows different cost to be associated with different methods that consume from the same quota group. By default, each request will cost one token. group: The `QuotaGroup.name` of the group. Requests for the mapped methods will consume tokens from each of the limits defined in this group. """ cost = _messages.IntegerField(1, variant=_messages.Variant.INT32) group = _messages.StringField(2) class QuotaInfo(_messages.Message): r"""Metadata about an individual quota, containing usage and limit information. Fields: currentUsage: The usage data for this quota as it applies to the current limit. historicalUsage: The historical usage data of this quota limit. Currently it is only available for daily quota limit, that is, base_limit.duration = "1d". limit: The effective limit for this quota. """ currentUsage = _messages.MessageField('QuotaUsage', 1) historicalUsage = _messages.MessageField('QuotaUsage', 2, repeated=True) limit = _messages.MessageField('EffectiveQuotaLimit', 3) class QuotaLimit(_messages.Message): r"""`QuotaLimit` defines a specific limit that applies over a specified duration for a limit type. There can be at most one limit for a duration and limit type combination defined within a `QuotaGroup`. Enums: LimitByValueValuesEnum: Limit type to use for enforcing this quota limit. Each unique value gets the defined number of tokens to consume from. For a quota limit that uses user type, each user making requests through the same client application project will get his/her own pool of tokens to consume, whereas for a limit that uses client project type, all users making requests through the same client application project share a single pool of tokens. Fields: defaultLimit: Default number of tokens that can be consumed during the specified duration. This is the number of tokens assigned when a client application developer activates the service for his/her project. Specifying a value of 0 will block all requests. This can be used if you are provisioning quota to selected consumers and blocking others. Similarly, a value of -1 will indicate an unlimited quota. No other negative values are allowed. description: Optional. User-visible, extended description for this quota limit. Should be used only when more context is needed to understand this limit than provided by the limit's display name (see: `display_name`). displayName: User-visible display name for this limit. Optional. If not set, the UI will provide a default display name based on the quota configuration. This field can be used to override the default display name generated from the configuration. duration: Duration of this limit in textual notation. Example: "100s", "24h", "1d". For duration longer than a day, only multiple of days is supported. We support only "100s" and "1d" for now. Additional support will be added in the future. "0" indicates indefinite duration. freeTier: Free tier value displayed in the Developers Console for this limit. The free tier is the number of tokens that will be subtracted from the billed amount when billing is enabled. This field can only be set on a limit with duration "1d", in a billable group; it is invalid on any other limit. If this field is not set, it defaults to 0, indicating that there is no free tier for this service. limitBy: Limit type to use for enforcing this quota limit. Each unique value gets the defined number of tokens to consume from. For a quota limit that uses user type, each user making requests through the same client application project will get his/her own pool of tokens to consume, whereas for a limit that uses client project type, all users making requests through the same client application project share a single pool of tokens. maxLimit: Maximum number of tokens that can be consumed during the specified duration. Client application developers can override the default limit up to this maximum. If specified, this value cannot be set to a value less than the default limit. If not specified, it is set to the default limit. To allow clients to apply overrides with no upper bound, set this to -1, indicating unlimited maximum quota. name: Name of the quota limit. Must be unique within the quota group. This name is used to refer to the limit when overriding the limit on a per-project basis. If a name is not provided, it will be generated from the limit_by and duration fields. The maximum length of the limit name is 64 characters. The name of a limit is used as a unique identifier for this limit. Therefore, once a limit has been put into use, its name should be immutable. You can use the display_name field to provide a user-friendly name for the limit. The display name can be evolved over time without affecting the identity of the limit. """ class LimitByValueValuesEnum(_messages.Enum): r"""Limit type to use for enforcing this quota limit. Each unique value gets the defined number of tokens to consume from. For a quota limit that uses user type, each user making requests through the same client application project will get his/her own pool of tokens to consume, whereas for a limit that uses client project type, all users making requests through the same client application project share a single pool of tokens. Values: CLIENT_PROJECT: ID of the project owned by the client application developer making the request. USER: ID of the end user making the request using the client application. """ CLIENT_PROJECT = 0 USER = 1 defaultLimit = _messages.IntegerField(1) description = _messages.StringField(2) displayName = _messages.StringField(3) duration = _messages.StringField(4) freeTier = _messages.IntegerField(5) limitBy = _messages.EnumField('LimitByValueValuesEnum', 6) maxLimit = _messages.IntegerField(7) name = _messages.StringField(8) class QuotaLimitOverride(_messages.Message): r"""Specifies a custom quota limit that is applied for this consumer project. This overrides the default value in google.api.QuotaLimit. Fields: limit: The new limit for this project. May be -1 (unlimited), 0 (block), or any positive integer. unlimited: Indicates the override is to provide unlimited quota. If true, any value set for limit will be ignored. DEPRECATED. Use a limit value of -1 instead. """ limit = _messages.IntegerField(1) unlimited = _messages.BooleanField(2) class QuotaRule(_messages.Message): r"""`QuotaRule` maps a method to a set of `QuotaGroup`s. Fields: disableQuota: Indicates if quota checking should be enforced. Quota will be disabled for methods without quota rules or with quota rules having this field set to true. When this field is set to true, no quota group mapping is allowed. groups: Quota groups to be used for this method. This supports associating a cost with each quota group. selector: Selects methods to which this rule applies. Refer to selector for syntax details. """ disableQuota = _messages.BooleanField(1) groups = _messages.MessageField('QuotaGroupMapping', 2, repeated=True) selector = _messages.StringField(3) class QuotaSettings(_messages.Message): r"""Per-consumer overrides for quota settings. See google/api/quota.proto for the corresponding service configuration which provides the default values. Messages: ConsumerOverridesValue: Quota overrides set by the consumer. Consumer overrides will only have an effect up to the max_limit specified in the service config, or the the producer override, if one exists. The key for this map is one of the following: - '<GROUP_NAME>/<LIMIT_NAME>' for quotas defined within quota groups, where GROUP_NAME is the google.api.QuotaGroup.name field and LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'ReadGroup/ProjectDaily'. - '<LIMIT_NAME>' for quotas defined without quota groups, where LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'borrowedCountPerOrganization'. EffectiveQuotasValue: The effective quota limits for each group, derived from the service defaults together with any producer or consumer overrides. For each limit, the effective value is the minimum of the producer and consumer overrides if either is present, or else the service default if neither is present. DEPRECATED. Use effective_quota_groups instead. ProducerOverridesValue: Quota overrides set by the producer. Note that if a consumer override is also specified, then the minimum of the two will be used. This allows consumers to cap their usage voluntarily. The key for this map is one of the following: - '<GROUP_NAME>/<LIMIT_NAME>' for quotas defined within quota groups, where GROUP_NAME is the google.api.QuotaGroup.name field and LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'ReadGroup/ProjectDaily'. - '<LIMIT_NAME>' for quotas defined without quota groups, where LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'borrowedCountPerOrganization'. Fields: consumerOverrides: Quota overrides set by the consumer. Consumer overrides will only have an effect up to the max_limit specified in the service config, or the the producer override, if one exists. The key for this map is one of the following: - '<GROUP_NAME>/<LIMIT_NAME>' for quotas defined within quota groups, where GROUP_NAME is the google.api.QuotaGroup.name field and LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'ReadGroup/ProjectDaily'. - '<LIMIT_NAME>' for quotas defined without quota groups, where LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'borrowedCountPerOrganization'. effectiveQuotaGroups: Use this field for quota limits defined under quota groups. Combines service quota configuration and project-specific settings, as a map from quota group name to the effective quota information for that group. Output-only. effectiveQuotas: The effective quota limits for each group, derived from the service defaults together with any producer or consumer overrides. For each limit, the effective value is the minimum of the producer and consumer overrides if either is present, or else the service default if neither is present. DEPRECATED. Use effective_quota_groups instead. producerOverrides: Quota overrides set by the producer. Note that if a consumer override is also specified, then the minimum of the two will be used. This allows consumers to cap their usage voluntarily. The key for this map is one of the following: - '<GROUP_NAME>/<LIMIT_NAME>' for quotas defined within quota groups, where GROUP_NAME is the google.api.QuotaGroup.name field and LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'ReadGroup/ProjectDaily'. - '<LIMIT_NAME>' for quotas defined without quota groups, where LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'borrowedCountPerOrganization'. variableTermQuotas: Quotas that are active over a specified time period. Only writeable by the producer. """ @encoding.MapUnrecognizedFields('additionalProperties') class ConsumerOverridesValue(_messages.Message): r"""Quota overrides set by the consumer. Consumer overrides will only have an effect up to the max_limit specified in the service config, or the the producer override, if one exists. The key for this map is one of the following: - '<GROUP_NAME>/<LIMIT_NAME>' for quotas defined within quota groups, where GROUP_NAME is the google.api.QuotaGroup.name field and LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'ReadGroup/ProjectDaily'. - '<LIMIT_NAME>' for quotas defined without quota groups, where LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'borrowedCountPerOrganization'. Messages: AdditionalProperty: An additional property for a ConsumerOverridesValue object. Fields: additionalProperties: Additional properties of type ConsumerOverridesValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a ConsumerOverridesValue object. Fields: key: Name of the additional property. value: A QuotaLimitOverride attribute. """ key = _messages.StringField(1) value = _messages.MessageField('QuotaLimitOverride', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) @encoding.MapUnrecognizedFields('additionalProperties') class EffectiveQuotasValue(_messages.Message): r"""The effective quota limits for each group, derived from the service defaults together with any producer or consumer overrides. For each limit, the effective value is the minimum of the producer and consumer overrides if either is present, or else the service default if neither is present. DEPRECATED. Use effective_quota_groups instead. Messages: AdditionalProperty: An additional property for a EffectiveQuotasValue object. Fields: additionalProperties: Additional properties of type EffectiveQuotasValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a EffectiveQuotasValue object. Fields: key: Name of the additional property. value: A QuotaLimitOverride attribute. """ key = _messages.StringField(1) value = _messages.MessageField('QuotaLimitOverride', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) @encoding.MapUnrecognizedFields('additionalProperties') class ProducerOverridesValue(_messages.Message): r"""Quota overrides set by the producer. Note that if a consumer override is also specified, then the minimum of the two will be used. This allows consumers to cap their usage voluntarily. The key for this map is one of the following: - '<GROUP_NAME>/<LIMIT_NAME>' for quotas defined within quota groups, where GROUP_NAME is the google.api.QuotaGroup.name field and LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'ReadGroup/ProjectDaily'. - '<LIMIT_NAME>' for quotas defined without quota groups, where LIMIT_NAME is the google.api.QuotaLimit.name field from the service config. For example: 'borrowedCountPerOrganization'. Messages: AdditionalProperty: An additional property for a ProducerOverridesValue object. Fields: additionalProperties: Additional properties of type ProducerOverridesValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a ProducerOverridesValue object. Fields: key: Name of the additional property. value: A QuotaLimitOverride attribute. """ key = _messages.StringField(1) value = _messages.MessageField('QuotaLimitOverride', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) consumerOverrides = _messages.MessageField('ConsumerOverridesValue', 1) effectiveQuotaGroups = _messages.MessageField('EffectiveQuotaGroup', 2, repeated=True) effectiveQuotas = _messages.MessageField('EffectiveQuotasValue', 3) producerOverrides = _messages.MessageField('ProducerOverridesValue', 4) variableTermQuotas = _messages.MessageField('VariableTermQuota', 5, repeated=True) class QuotaUsage(_messages.Message): r"""Specifies the used quota amount for a quota limit at a particular time. Fields: endTime: The time the quota duration ended. queryTime: The time the quota usage data was queried. startTime: The time the quota duration started. usage: The used quota value at the "query_time". """ endTime = _messages.StringField(1) queryTime = _messages.StringField(2) startTime = _messages.StringField(3) usage = _messages.IntegerField(4) class Service(_messages.Message): r"""`Service` is the root object of the configuration schema. It describes basic information like the name of the service and the exposed API interfaces, and delegates other aspects to configuration sub-sections. Example: type: google.api.Service config_version: 1 name: calendar.googleapis.com title: Google Calendar API apis: - name: google.calendar.Calendar backend: rules: - selector: "*" address: calendar.example.com Fields: apis: A list of API interfaces exported by this service. Only the `name` field of the google.protobuf.Api needs to be provided by the configuration author, as the remaining fields will be derived from the IDL during the normalization process. It is an error to specify an API interface here which cannot be resolved against the associated IDL files. authentication: Auth configuration. backend: API backend configuration. billing: Billing configuration of the service. configVersion: The version of the service configuration. The config version may influence interpretation of the configuration, for example, to determine defaults. This is documented together with applicable options. The current default for the config version itself is `3`. context: Context configuration. control: Configuration for the service control plane. customError: Custom error configuration. documentation: Additional API documentation. enums: A list of all enum types included in this API service. Enums referenced directly or indirectly by the `apis` are automatically included. Enums which are not referenced but shall be included should be listed here by name. Example: enums: - name: google.someapi.v1.SomeEnum http: HTTP configuration. id: A unique ID for a specific instance of this message, typically assigned by the client for tracking purpose. If empty, the server may choose to generate one instead. logging: Logging configuration of the service. logs: Defines the logs used by this service. metrics: Defines the metrics used by this service. monitoredResources: Defines the monitored resources used by this service. This is required by the Service.monitoring and Service.logging configurations. monitoring: Monitoring configuration of the service. name: The DNS address at which this service is available, e.g. `calendar.googleapis.com`. producerProjectId: The id of the Google developer project that owns the service. Members of this project can manage the service configuration, manage consumption of the service, etc. projectProperties: Configuration of per-consumer project properties. quota: Quota configuration. systemParameters: Configuration for system parameters. systemTypes: A list of all proto message types included in this API service. It serves similar purpose as [google.api.Service.types], except that these types are not needed by user-defined APIs. Therefore, they will not show up in the generated discovery doc. This field should only be used to define system APIs in ESF. title: The product title associated with this service. types: A list of all proto message types included in this API service. Types referenced directly or indirectly by the `apis` are automatically included. Messages which are not referenced but shall be included, such as types used by the `google.protobuf.Any` type, should be listed here by name. Example: types: - name: google.protobuf.Int32 usage: Configuration controlling usage of this service. visibility: API visibility configuration. """ apis = _messages.MessageField('Api', 1, repeated=True) authentication = _messages.MessageField('Authentication', 2) backend = _messages.MessageField('Backend', 3) billing = _messages.MessageField('Billing', 4) configVersion = _messages.IntegerField(5, variant=_messages.Variant.UINT32) context = _messages.MessageField('Context', 6) control = _messages.MessageField('Control', 7) customError = _messages.MessageField('CustomError', 8) documentation = _messages.MessageField('Documentation', 9) enums = _messages.MessageField('Enum', 10, repeated=True) http = _messages.MessageField('Http', 11) id = _messages.StringField(12) logging = _messages.MessageField('Logging', 13) logs = _messages.MessageField('LogDescriptor', 14, repeated=True) metrics = _messages.MessageField('MetricDescriptor', 15, repeated=True) monitoredResources = _messages.MessageField('MonitoredResourceDescriptor', 16, repeated=True) monitoring = _messages.MessageField('Monitoring', 17) name = _messages.StringField(18) producerProjectId = _messages.StringField(19) projectProperties = _messages.MessageField('ProjectProperties', 20) quota = _messages.MessageField('Quota', 21) systemParameters = _messages.MessageField('SystemParameters', 22) systemTypes = _messages.MessageField('Type', 23, repeated=True) title = _messages.StringField(24) types = _messages.MessageField('Type', 25, repeated=True) usage = _messages.MessageField('Usage', 26) visibility = _messages.MessageField('Visibility', 27) class ServiceAccessList(_messages.Message): r"""List of users and groups that are granted access to a service or visibility label. Fields: members: Members that are granted access. - "user:{$user_email}" - Grant access to an individual user - "group:{$group_email}" - Grant access to direct members of the group - "domain:{$domain}" - Grant access to all members of the domain. For now, domain membership check will be similar to Devconsole/TT check: compare domain part of the user email to configured domain name. When IAM integration is complete, this will be replaced with IAM check. """ members = _messages.StringField(1, repeated=True) class ServiceAccessPolicy(_messages.Message): r"""Policy describing who can access a service and any visibility labels on that service. Messages: VisibilityLabelAccessListsValue: ACLs for access to restricted parts of the service. The map key is the visibility label that is being controlled. Note that access to any label also implies access to the unrestricted surface. Fields: accessList: ACL for access to the unrestricted surface of the service. serviceName: The service protected by this policy. visibilityLabelAccessLists: ACLs for access to restricted parts of the service. The map key is the visibility label that is being controlled. Note that access to any label also implies access to the unrestricted surface. """ @encoding.MapUnrecognizedFields('additionalProperties') class VisibilityLabelAccessListsValue(_messages.Message): r"""ACLs for access to restricted parts of the service. The map key is the visibility label that is being controlled. Note that access to any label also implies access to the unrestricted surface. Messages: AdditionalProperty: An additional property for a VisibilityLabelAccessListsValue object. Fields: additionalProperties: Additional properties of type VisibilityLabelAccessListsValue """ class AdditionalProperty(_messages.Message): r"""An additional property for a VisibilityLabelAccessListsValue object. Fields: key: Name of the additional property. value: A ServiceAccessList attribute. """ key = _messages.StringField(1) value = _messages.MessageField('ServiceAccessList', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) accessList = _messages.MessageField('ServiceAccessList', 1) serviceName = _messages.StringField(2) visibilityLabelAccessLists = _messages.MessageField('VisibilityLabelAccessListsValue', 3) class ServicemanagementOperationsGetRequest(_messages.Message): r"""A ServicemanagementOperationsGetRequest object. Fields: operationsId: Part of `name`. The name of the operation resource. """ operationsId = _messages.StringField(1, required=True) class ServicemanagementServicesAccessPolicyQueryRequest(_messages.Message): r"""A ServicemanagementServicesAccessPolicyQueryRequest object. Fields: serviceName: The service to query access for. userEmail: The user to query access for. """ serviceName = _messages.StringField(1, required=True) userEmail = _messages.StringField(2) class ServicemanagementServicesConfigsCreateRequest(_messages.Message): r"""A ServicemanagementServicesConfigsCreateRequest object. Fields: service: A Service resource to be passed as the request body. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. """ service = _messages.MessageField('Service', 1) serviceName = _messages.StringField(2, required=True) class ServicemanagementServicesConfigsGetRequest(_messages.Message): r"""A ServicemanagementServicesConfigsGetRequest object. Fields: configId: The id of the service config resource. Optional. If it is not specified, the latest version of config will be returned. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. """ configId = _messages.StringField(1, required=True) serviceName = _messages.StringField(2, required=True) class ServicemanagementServicesConfigsListRequest(_messages.Message): r"""A ServicemanagementServicesConfigsListRequest object. Fields: pageSize: The max number of items to include in the response list. pageToken: The token of the page to retrieve. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. """ pageSize = _messages.IntegerField(1, variant=_messages.Variant.INT32) pageToken = _messages.StringField(2) serviceName = _messages.StringField(3, required=True) class ServicemanagementServicesConfigsSubmitRequest(_messages.Message): r"""A ServicemanagementServicesConfigsSubmitRequest object. Fields: serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. submitConfigSourceRequest: A SubmitConfigSourceRequest resource to be passed as the request body. """ serviceName = _messages.StringField(1, required=True) submitConfigSourceRequest = _messages.MessageField('SubmitConfigSourceRequest', 2) class ServicemanagementServicesCustomerSettingsGetRequest(_messages.Message): r"""A ServicemanagementServicesCustomerSettingsGetRequest object. Enums: ViewValueValuesEnum: Request only fields for the specified view. Fields: customerId: ID for the customer. See the comment for `CustomerSettings.customer_id` field of message for its format. This field is required. expand: Fields to expand in any results. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. This field is required. view: Request only fields for the specified view. """ class ViewValueValuesEnum(_messages.Enum): r"""Request only fields for the specified view. Values: PROJECT_SETTINGS_VIEW_UNSPECIFIED: <no description> CONSUMER_VIEW: <no description> PRODUCER_VIEW: <no description> ALL: <no description> """ PROJECT_SETTINGS_VIEW_UNSPECIFIED = 0 CONSUMER_VIEW = 1 PRODUCER_VIEW = 2 ALL = 3 customerId = _messages.StringField(1, required=True) expand = _messages.StringField(2) serviceName = _messages.StringField(3, required=True) view = _messages.EnumField('ViewValueValuesEnum', 4) class ServicemanagementServicesCustomerSettingsPatchRequest(_messages.Message): r"""A ServicemanagementServicesCustomerSettingsPatchRequest object. Fields: customerId: ID for the customer. See the comment for `CustomerSettings.customer_id` field of message for its format. This field is required. customerSettings: A CustomerSettings resource to be passed as the request body. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. This field is required. updateMask: The field mask specifying which fields are to be updated. """ customerId = _messages.StringField(1, required=True) customerSettings = _messages.MessageField('CustomerSettings', 2) serviceName = _messages.StringField(3, required=True) updateMask = _messages.StringField(4) class ServicemanagementServicesDeleteRequest(_messages.Message): r"""A ServicemanagementServicesDeleteRequest object. Fields: serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. """ serviceName = _messages.StringField(1, required=True) class ServicemanagementServicesDisableRequest(_messages.Message): r"""A ServicemanagementServicesDisableRequest object. Fields: disableServiceRequest: A DisableServiceRequest resource to be passed as the request body. serviceName: Name of the service to disable. Specifying an unknown service name will cause the request to fail. """ disableServiceRequest = _messages.MessageField('DisableServiceRequest', 1) serviceName = _messages.StringField(2, required=True) class ServicemanagementServicesEnableRequest(_messages.Message): r"""A ServicemanagementServicesEnableRequest object. Fields: enableServiceRequest: A EnableServiceRequest resource to be passed as the request body. serviceName: Name of the service to enable. Specifying an unknown service name will cause the request to fail. """ enableServiceRequest = _messages.MessageField('EnableServiceRequest', 1) serviceName = _messages.StringField(2, required=True) class ServicemanagementServicesGetAccessPolicyRequest(_messages.Message): r"""A ServicemanagementServicesGetAccessPolicyRequest object. Fields: serviceName: The name of the service. For example: `example.googleapis.com`. """ serviceName = _messages.StringField(1, required=True) class ServicemanagementServicesGetConfigRequest(_messages.Message): r"""A ServicemanagementServicesGetConfigRequest object. Fields: configId: The id of the service config resource. Optional. If it is not specified, the latest version of config will be returned. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. """ configId = _messages.StringField(1) serviceName = _messages.StringField(2, required=True) class ServicemanagementServicesGetRequest(_messages.Message): r"""A ServicemanagementServicesGetRequest object. Enums: ViewValueValuesEnum: If project_settings is expanded, request only fields for the specified view. Fields: consumerProjectId: If project_settings is expanded, return settings for the specified consumer project. expand: Fields to expand in any results. By default, the following fields are not present in the result: - `operations` - `project_settings` - `project_settings.operations` - `quota_usage` (It requires `project_settings`) - `historical_quota_usage` (It requires `project_settings`) serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. view: If project_settings is expanded, request only fields for the specified view. """ class ViewValueValuesEnum(_messages.Enum): r"""If project_settings is expanded, request only fields for the specified view. Values: PROJECT_SETTINGS_VIEW_UNSPECIFIED: <no description> CONSUMER_VIEW: <no description> PRODUCER_VIEW: <no description> ALL: <no description> """ PROJECT_SETTINGS_VIEW_UNSPECIFIED = 0 CONSUMER_VIEW = 1 PRODUCER_VIEW = 2 ALL = 3 consumerProjectId = _messages.StringField(1) expand = _messages.StringField(2) serviceName = _messages.StringField(3, required=True) view = _messages.EnumField('ViewValueValuesEnum', 4) class ServicemanagementServicesListRequest(_messages.Message): r"""A ServicemanagementServicesListRequest object. Fields: category: Include services only in the specified category. Supported categories are servicemanagement.googleapis.com/categories/google- services or servicemanagement.googleapis.com/categories/play-games. consumerProjectId: Include services consumed by the specified project. If project_settings is expanded, then this field controls which project project_settings is populated for. expand: Fields to expand in any results. By default, the following fields are not fully included in list results: - `operations` - `project_settings` - `project_settings.operations` - `quota_usage` (It requires `project_settings`) pageSize: Requested size of the next page of data. pageToken: Token identifying which result to start with; returned by a previous list call. producerProjectId: Include services produced by the specified project. """ category = _messages.StringField(1) consumerProjectId = _messages.StringField(2) expand = _messages.StringField(3) pageSize = _messages.IntegerField(4, variant=_messages.Variant.INT32) pageToken = _messages.StringField(5) producerProjectId = _messages.StringField(6) class ServicemanagementServicesPatchConfigRequest(_messages.Message): r"""A ServicemanagementServicesPatchConfigRequest object. Fields: service: A Service resource to be passed as the request body. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. updateMask: A mask specifying which fields to update. """ service = _messages.MessageField('Service', 1) serviceName = _messages.StringField(2, required=True) updateMask = _messages.StringField(3) class ServicemanagementServicesPatchRequest(_messages.Message): r"""A ServicemanagementServicesPatchRequest object. Fields: managedService: A ManagedService resource to be passed as the request body. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. updateMask: A mask specifying which fields to update. """ managedService = _messages.MessageField('ManagedService', 1) serviceName = _messages.StringField(2, required=True) updateMask = _messages.StringField(3) class ServicemanagementServicesProjectSettingsGetRequest(_messages.Message): r"""A ServicemanagementServicesProjectSettingsGetRequest object. Enums: ViewValueValuesEnum: Request only the fields for the specified view. Fields: consumerProjectId: The project ID of the consumer. expand: Fields to expand in any results. By default, the following fields are not present in the result: - `operations` - `quota_usage` serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. view: Request only the fields for the specified view. """ class ViewValueValuesEnum(_messages.Enum): r"""Request only the fields for the specified view. Values: PROJECT_SETTINGS_VIEW_UNSPECIFIED: <no description> CONSUMER_VIEW: <no description> PRODUCER_VIEW: <no description> ALL: <no description> """ PROJECT_SETTINGS_VIEW_UNSPECIFIED = 0 CONSUMER_VIEW = 1 PRODUCER_VIEW = 2 ALL = 3 consumerProjectId = _messages.StringField(1, required=True) expand = _messages.StringField(2) serviceName = _messages.StringField(3, required=True) view = _messages.EnumField('ViewValueValuesEnum', 4) class ServicemanagementServicesProjectSettingsPatchRequest(_messages.Message): r"""A ServicemanagementServicesProjectSettingsPatchRequest object. Fields: consumerProjectId: The project ID of the consumer. projectSettings: A ProjectSettings resource to be passed as the request body. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. updateMask: The field mask specifying which fields are to be updated. """ consumerProjectId = _messages.StringField(1, required=True) projectSettings = _messages.MessageField('ProjectSettings', 2) serviceName = _messages.StringField(3, required=True) updateMask = _messages.StringField(4) class ServicemanagementServicesUpdateConfigRequest(_messages.Message): r"""A ServicemanagementServicesUpdateConfigRequest object. Fields: service: A Service resource to be passed as the request body. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. updateMask: A mask specifying which fields to update. Update mask has been deprecated on UpdateServiceConfig service method. Please use PatchServiceConfig method instead to do partial updates. """ service = _messages.MessageField('Service', 1) serviceName = _messages.StringField(2, required=True) updateMask = _messages.StringField(3) class ServicemanagementServicesUpdateRequest(_messages.Message): r"""A ServicemanagementServicesUpdateRequest object. Fields: managedService: A ManagedService resource to be passed as the request body. serviceName: The name of the service. See the `ServiceManager` overview for naming requirements. For example: `example.googleapis.com`. updateMask: A mask specifying which fields to update. Update mask has been deprecated on UpdateService service method. Please use PatchService method instead to do partial updates. """ managedService = _messages.MessageField('ManagedService', 1) serviceName = _messages.StringField(2, required=True) updateMask = _messages.StringField(3) class SourceContext(_messages.Message): r"""`SourceContext` represents information about the source of a protobuf element, like the file in which it is defined. Fields: fileName: The path-qualified name of the .proto file that contained the associated protobuf element. For example: `"google/protobuf/source_context.proto"`. """ fileName = _messages.StringField(1) class StandardQueryParameters(_messages.Message): r"""Query parameters accepted by all methods. Enums: FXgafvValueValuesEnum: V1 error format. AltValueValuesEnum: Data format for response. Fields: f__xgafv: V1 error format. access_token: OAuth access token. alt: Data format for response. bearer_token: OAuth bearer token. callback: JSONP fields: Selector specifying which fields to include in a partial response. key: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. oauth_token: OAuth 2.0 token for the current user. pp: Pretty-print response. prettyPrint: Returns response with indentations and line breaks. quotaUser: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. trace: A tracing token of the form "token:<tokenid>" to include in api requests. uploadType: Legacy upload protocol for media (e.g. "media", "multipart"). upload_protocol: Upload protocol for media (e.g. "raw", "multipart"). """ class AltValueValuesEnum(_messages.Enum): r"""Data format for response. Values: json: Responses with Content-Type of application/json media: Media download with context-dependent Content-Type proto: Responses with Content-Type of application/x-protobuf """ json = 0 media = 1 proto = 2 class FXgafvValueValuesEnum(_messages.Enum): r"""V1 error format. Values: _1: v1 error format _2: v2 error format """ _1 = 0 _2 = 1 f__xgafv = _messages.EnumField('FXgafvValueValuesEnum', 1) access_token = _messages.StringField(2) alt = _messages.EnumField('AltValueValuesEnum', 3, default='json') bearer_token = _messages.StringField(4) callback = _messages.StringField(5) fields = _messages.StringField(6) key = _messages.StringField(7) oauth_token = _messages.StringField(8) pp = _messages.BooleanField(9, default=True) prettyPrint = _messages.BooleanField(10, default=True) quotaUser = _messages.StringField(11) trace = _messages.StringField(12) uploadType = _messages.StringField(13) upload_protocol = _messages.StringField(14) class Status(_messages.Message): r"""The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). The error model is designed to be: - Simple to use and understand for most users - Flexible enough to meet unexpected needs # Overview The `Status` message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers *understand* and *resolve* the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package `google.rpc` which can be used for common error conditions. # Language mapping The `Status` message is the logical representation of the error model, but it is not necessarily the actual wire format. When the `Status` message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C. # Other uses The error model and the `Status` message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments. Example uses of this error model include: - Partial errors. If a service needs to return partial errors to the client, it may embed the `Status` in the normal response to indicate the partial errors. - Workflow errors. A typical workflow has multiple steps. Each step may have a `Status` message for error reporting purpose. - Batch operations. If a client uses batch request and batch response, the `Status` message should be used directly inside batch response, one for each error sub- response. - Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the `Status` message. - Logging. If some API errors are stored in logs, the message `Status` could be used directly after any stripping needed for security/privacy reasons. Messages: DetailsValueListEntry: A DetailsValueListEntry object. Fields: code: The status code, which should be an enum value of google.rpc.Code. details: A list of messages that carry the error details. There will be a common set of message types for APIs to use. message: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. """ @encoding.MapUnrecognizedFields('additionalProperties') class DetailsValueListEntry(_messages.Message): r"""A DetailsValueListEntry object. Messages: AdditionalProperty: An additional property for a DetailsValueListEntry object. Fields: additionalProperties: Properties of the object. Contains field @type with type URL. """ class AdditionalProperty(_messages.Message): r"""An additional property for a DetailsValueListEntry object. Fields: key: Name of the additional property. value: A extra_types.JsonValue attribute. """ key = _messages.StringField(1) value = _messages.MessageField('extra_types.JsonValue', 2) additionalProperties = _messages.MessageField('AdditionalProperty', 1, repeated=True) code = _messages.IntegerField(1, variant=_messages.Variant.INT32) details = _messages.MessageField('DetailsValueListEntry', 2, repeated=True) message = _messages.StringField(3) class Step(_messages.Message): r"""Represents the status of one operation step. Enums: StatusValueValuesEnum: The status code. Fields: description: The short description of the step. status: The status code. """ class StatusValueValuesEnum(_messages.Enum): r"""The status code. Values: STATUS_UNSPECIFIED: Unspecifed code. DONE: The step has completed without errors. NOT_STARTED: The step has not started yet. IN_PROGRESS: The step is in progress. FAILED: The step has completed with errors. """ STATUS_UNSPECIFIED = 0 DONE = 1 NOT_STARTED = 2 IN_PROGRESS = 3 FAILED = 4 description = _messages.StringField(1) status = _messages.EnumField('StatusValueValuesEnum', 2) class SubmitConfigSourceRequest(_messages.Message): r"""Request message for SubmitConfigSource method. Fields: configSource: The source configuration for the service. validateOnly: Optional. If set, this will result in the generation of a `google.api.Service` configuration based on the `ConfigSource` provided, but the generated config and the sources will NOT be persisted. """ configSource = _messages.MessageField('ConfigSource', 1) validateOnly = _messages.BooleanField(2) class SwaggerSpec(_messages.Message): r"""A collection of swagger specification files. Fields: swaggerFiles: The individual files. """ swaggerFiles = _messages.MessageField('File', 1, repeated=True) class SystemParameter(_messages.Message): r"""Define a parameter's name and location. The parameter may be passed as either an HTTP header or a URL query parameter, and if both are passed the behavior is implementation-dependent. Fields: httpHeader: Define the HTTP header name to use for the parameter. It is case insensitive. name: Define the name of the parameter, such as "api_key", "alt", "callback", and etc. It is case sensitive. urlQueryParameter: Define the URL query parameter name to use for the parameter. It is case sensitive. """ httpHeader = _messages.StringField(1) name = _messages.StringField(2) urlQueryParameter = _messages.StringField(3) class SystemParameterRule(_messages.Message): r"""Define a system parameter rule mapping system parameter definitions to methods. Fields: parameters: Define parameters. Multiple names may be defined for a parameter. For a given method call, only one of them should be used. If multiple names are used the behavior is implementation-dependent. If none of the specified names are present the behavior is parameter- dependent. selector: Selects the methods to which this rule applies. Use '*' to indicate all methods in all APIs. Refer to selector for syntax details. """ parameters = _messages.MessageField('SystemParameter', 1, repeated=True) selector = _messages.StringField(2) class SystemParameters(_messages.Message): r"""### System parameter configuration A system parameter is a special kind of parameter defined by the API system, not by an individual API. It is typically mapped to an HTTP header and/or a URL query parameter. This configuration specifies which methods change the names of the system parameters. Fields: rules: Define system parameters. The parameters defined here will override the default parameters implemented by the system. If this field is missing from the service config, default system parameters will be used. Default system parameters and names is implementation-dependent. Example: define api key and alt name for all methods system_parameters rules: - selector: "*" parameters: - name: api_key url_query_parameter: api_key - name: alt http_header: Response-Content-Type Example: define 2 api key names for a specific method. system_parameters rules: - selector: "/ListShelves" parameters: - name: api_key http_header: Api-Key1 - name: api_key http_header: Api-Key2 """ rules = _messages.MessageField('SystemParameterRule', 1, repeated=True) class Type(_messages.Message): r"""A protocol buffer message type. Enums: SyntaxValueValuesEnum: The source syntax. Fields: fields: The list of fields. name: The fully qualified message name. oneofs: The list of types appearing in `oneof` definitions in this type. options: The protocol buffer options. sourceContext: The source context. syntax: The source syntax. """ class SyntaxValueValuesEnum(_messages.Enum): r"""The source syntax. Values: SYNTAX_PROTO2: Syntax `proto2`. SYNTAX_PROTO3: Syntax `proto3`. """ SYNTAX_PROTO2 = 0 SYNTAX_PROTO3 = 1 fields = _messages.MessageField('Field', 1, repeated=True) name = _messages.StringField(2) oneofs = _messages.StringField(3, repeated=True) options = _messages.MessageField('Option', 4, repeated=True) sourceContext = _messages.MessageField('SourceContext', 5) syntax = _messages.EnumField('SyntaxValueValuesEnum', 6) class Usage(_messages.Message): r"""Configuration controlling usage of a service. Enums: ServiceAccessValueValuesEnum: Controls which users can see or activate the service. Fields: activationHooks: Services that must be contacted before a consumer can begin using the service. Each service will be contacted in sequence, and, if any activation call fails, the entire activation will fail. Each hook is of the form <service.name>/<hook-id>, where <hook-id> is optional; for example: 'robotservice.googleapis.com/default'. deactivationHooks: Services that must be contacted before a consumer can deactivate a service. Each service will be contacted in sequence, and, if any deactivation call fails, the entire deactivation will fail. Each hook is of the form <service.name>/<hook-id>, where <hook-id> is optional; for example: 'compute.googleapis.com/'. dependsOnServices: Services that must be activated in order for this service to be used. The set of services activated as a result of these relations are all activated in parallel with no guaranteed order of activation. Each string is a service name, e.g. `calendar.googleapis.com`. requirements: Requirements that must be satisfied before a consumer project can use the service. Each requirement is of the form <service.name>/<requirement-id>; for example 'serviceusage.googleapis.com/billing-enabled'. rules: Individual rules for configuring usage on selected methods. serviceAccess: Controls which users can see or activate the service. """ class ServiceAccessValueValuesEnum(_messages.Enum): r"""Controls which users can see or activate the service. Values: RESTRICTED: The service can only be seen/used by users identified in the service's access control policy. If the service has not been whitelisted by your domain administrator for out-of-org publishing, then this mode will be treated like ORG_RESTRICTED. PUBLIC: The service can be seen/used by anyone. If the service has not been whitelisted by your domain administrator for out-of-org publishing, then this mode will be treated like ORG_PUBLIC. The discovery document for the service will also be public and allow unregistered access. ORG_RESTRICTED: The service can be seen/used by users identified in the service's access control policy and they are within the organization that owns the service. Access is further constrained to the group controlled by the administrator of the project/org that owns the service. ORG_PUBLIC: The service can be seen/used by the group of users controlled by the administrator of the project/org that owns the service. """ RESTRICTED = 0 PUBLIC = 1 ORG_RESTRICTED = 2 ORG_PUBLIC = 3 activationHooks = _messages.StringField(1, repeated=True) deactivationHooks = _messages.StringField(2, repeated=True) dependsOnServices = _messages.StringField(3, repeated=True) requirements = _messages.StringField(4, repeated=True) rules = _messages.MessageField('UsageRule', 5, repeated=True) serviceAccess = _messages.EnumField('ServiceAccessValueValuesEnum', 6) class UsageRule(_messages.Message): r"""Usage configuration rules for the service. NOTE: Under development. Use this rule to configure unregistered calls for the service. Unregistered calls are calls that do not contain consumer project identity. (Example: calls that do not contain an API key). By default, API methods do not allow unregistered calls, and each method call must be identified by a consumer project identity. Use this rule to allow/disallow unregistered calls. Example of an API that wants to allow unregistered calls for entire service. usage: rules: - selector: "*" allow_unregistered_calls: true Example of a method that wants to allow unregistered calls. usage: rules: - selector: "google.example.library.v1.LibraryService.CreateBook" allow_unregistered_calls: true Fields: allowUnregisteredCalls: True, if the method allows unregistered calls; false otherwise. selector: Selects the methods to which this rule applies. Use '*' to indicate all methods in all APIs. Refer to selector for syntax details. """ allowUnregisteredCalls = _messages.BooleanField(1) selector = _messages.StringField(2) class UsageSettings(_messages.Message): r"""Usage settings for a consumer of a service. Enums: ConsumerEnableStatusValueValuesEnum: Consumer controlled setting to enable/disable use of this service by the consumer project. The default value of this is controlled by the service configuration. Fields: consumerEnableStatus: Consumer controlled setting to enable/disable use of this service by the consumer project. The default value of this is controlled by the service configuration. """ class ConsumerEnableStatusValueValuesEnum(_messages.Enum): r"""Consumer controlled setting to enable/disable use of this service by the consumer project. The default value of this is controlled by the service configuration. Values: DISABLED: The service is disabled. ENABLED: The service is enabled. """ DISABLED = 0 ENABLED = 1 consumerEnableStatus = _messages.EnumField('ConsumerEnableStatusValueValuesEnum', 1) class VariableTermQuota(_messages.Message): r"""A variable term quota is a bucket of tokens that is consumed over a specified (usually long) time period. When present, it overrides any "1d" duration per-project quota specified on the group. Variable terms run from midnight to midnight, start_date to end_date (inclusive) in the America/Los_Angeles time zone. Fields: createTime: Time when this variable term quota was created. If multiple quotas are simultaneously active, then the quota with the latest create_time is the effective one. displayEndDate: The displayed end of the active period for the variable term quota. This may be before the effective end to give the user a grace period. YYYYMMdd date format, e.g. 20140730. endDate: The effective end of the active period for the variable term quota (inclusive). This must be no more than 5 years after start_date. YYYYMMdd date format, e.g. 20140730. groupName: The quota group that has the variable term quota applied to it. This must be a google.api.QuotaGroup.name specified in the service configuration. limit: The number of tokens available during the configured term. quotaUsage: The usage data of this quota. startDate: The beginning of the active period for the variable term quota. YYYYMMdd date format, e.g. 20140730. """ createTime = _messages.StringField(1) displayEndDate = _messages.StringField(2) endDate = _messages.StringField(3) groupName = _messages.StringField(4) limit = _messages.IntegerField(5) quotaUsage = _messages.MessageField('QuotaUsage', 6) startDate = _messages.StringField(7) class Visibility(_messages.Message): r"""`Visibility` defines restrictions for the visibility of service elements. Restrictions are specified using visibility labels (e.g., TRUSTED_TESTER) that are elsewhere linked to users and projects. Users and projects can have access to more than one visibility label. The effective visibility for multiple labels is the union of each label's elements, plus any unrestricted elements. If an element and its parents have no restrictions, visibility is unconditionally granted. Example: visibility: rules: - selector: google.calendar.Calendar.EnhancedSearch restriction: TRUSTED_TESTER - selector: google.calendar.Calendar.Delegate restriction: GOOGLE_INTERNAL Here, all methods are publicly visible except for the restricted methods EnhancedSearch and Delegate. Fields: enforceRuntimeVisibility: Controls whether visibility rules are enforced at runtime for requests to all APIs and methods. If true, requests without method visibility will receive a NOT_FOUND error, and any non- visible fields will be scrubbed from the response messages. In service config version 0, the default is false. In later config versions, it's true. Note, the `enforce_runtime_visibility` specified in a visibility rule overrides this setting for the APIs or methods asscoiated with the rule. rules: A list of visibility rules providing visibility configuration for individual API elements. """ enforceRuntimeVisibility = _messages.BooleanField(1) rules = _messages.MessageField('VisibilityRule', 2, repeated=True) class VisibilityRule(_messages.Message): r"""A visibility rule provides visibility configuration for an individual API element. Fields: enforceRuntimeVisibility: Controls whether visibility is enforced at runtime for requests to an API method. This setting has meaning only when the selector applies to a method or an API. If true, requests without method visibility will receive a NOT_FOUND error, and any non- visible fields will be scrubbed from the response messages. The default is determined by the value of google.api.Visibility.enforce_runtime_visibility. restriction: Lists the visibility labels for this rule. Any of the listed labels grants visibility to the element. If a rule has multiple labels, removing one of the labels but not all of them can break clients. Example: visibility: rules: - selector: google.calendar.Calendar.EnhancedSearch restriction: GOOGLE_INTERNAL, TRUSTED_TESTER Removing GOOGLE_INTERNAL from this restriction will break clients that rely on this method and only had access to it through GOOGLE_INTERNAL. selector: Selects methods, messages, fields, enums, etc. to which this rule applies. Refer to selector for syntax details. """ enforceRuntimeVisibility = _messages.BooleanField(1) restriction = _messages.StringField(2) selector = _messages.StringField(3) class VisibilitySettings(_messages.Message): r"""Settings that control which features of the service are visible to the consumer project. Fields: visibilityLabels: The set of visibility labels that are used to determine what API surface is visible to calls made by this project. The visible surface is a union of the surface features associated with each label listed here, plus the publicly visible (unrestricted) surface. The service producer may add or remove labels at any time. The service consumer may add a label if the calling user has been granted permission to do so by the producer. The service consumer may also remove any label at any time. """ visibilityLabels = _messages.StringField(1, repeated=True) encoding.AddCustomJsonFieldMapping( StandardQueryParameters, 'f__xgafv', '$.xgafv') encoding.AddCustomJsonEnumMapping( StandardQueryParameters.FXgafvValueValuesEnum, '_1', '1') encoding.AddCustomJsonEnumMapping( StandardQueryParameters.FXgafvValueValuesEnum, '_2', '2') samples/servicemanagement_sample/__init__.py 0000644 00000001077 15025176453 0015374 0 ustar 00 # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. samples/uptodate_check_test.py 0000644 00000005574 15025176453 0012626 0 ustar 00 # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import difflib import unittest import six from apitools.gen import gen_client from apitools.gen import test_utils def GetSampleClientPath(api_name, *path): return os.path.join(os.path.dirname(__file__), api_name + '_sample', *path) def _GetContent(file_path): with open(file_path) as f: return f.read() class ClientGenCliTest(unittest.TestCase): def AssertDiffEqual(self, expected, actual): """Like unittest.assertEqual with a diff in the exception message.""" if expected != actual: unified_diff = difflib.unified_diff( expected.splitlines(), actual.splitlines()) raise AssertionError('\n'.join(unified_diff)) def _CheckGeneratedFiles(self, api_name, api_version): prefix = api_name + '_' + api_version with test_utils.TempDir() as tmp_dir_path: gen_client.main([ gen_client.__file__, '--init-file', 'empty', '--infile', GetSampleClientPath(api_name, prefix + '.json'), '--outdir', tmp_dir_path, '--overwrite', '--root_package', 'samples.{0}_sample.{0}_{1}'.format(api_name, api_version), 'client' ]) expected_files = ( set([prefix + '_client.py', prefix + '_messages.py', '__init__.py'])) self.assertEqual(expected_files, set(os.listdir(tmp_dir_path))) for expected_file in expected_files: self.AssertDiffEqual( _GetContent(GetSampleClientPath( api_name, prefix, expected_file)), _GetContent(os.path.join(tmp_dir_path, expected_file))) def testGenClient_BigqueryDoc(self): self._CheckGeneratedFiles('bigquery', 'v2') def testGenClient_DnsDoc(self): self._CheckGeneratedFiles('dns', 'v1') def testGenClient_FusiontablesDoc(self): self._CheckGeneratedFiles('fusiontables', 'v1') def testGenClient_IamDoc(self): self._CheckGeneratedFiles('iam', 'v1') def testGenClient_ServicemanagementDoc(self): self._CheckGeneratedFiles('servicemanagement', 'v1') def testGenClient_StorageDoc(self): self._CheckGeneratedFiles('storage', 'v1') samples/__init__.py 0000644 00000001077 15025176453 0010336 0 ustar 00 # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. samples/regenerate_samples.py 0000644 00000004264 15025176453 0012445 0 ustar 00 # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Script to regenerate samples with latest client generator. To run: python samples/regenerate_samples.py """ import os import subprocess import sys _SAMPLES = [ 'bigquery_sample/bigquery_v2.json', 'dns_sample/dns_v1.json', 'iam_sample/iam_v1.json', 'fusiontables_sample/fusiontables_v1.json', 'servicemanagement_sample/servicemanagement_v1.json', 'storage_sample/storage_v1.json', ] def _Generate(samples): # insert $PWD onto PYTHONPATH insert_python_dir = os.getcwd() python_path = os.environ.get('PYTHONPATH') if python_path: python_path = os.pathsep.join([insert_python_dir, python_path]) else: python_path = insert_python_dir os.environ['PYTHONPATH'] = python_path for sample in samples: sample_dir, sample_doc = os.path.split(sample) sample_dir = 'samples/' + sample_dir name, ext = os.path.splitext(sample_doc) if ext != '.json': raise RuntimeError('Expected .json discovery doc [{0}]' .format(sample)) api_name, api_version = name.split('_') args = [ 'python', 'apitools/gen/gen_client.py', '--infile', 'samples/' + sample, '--init-file', 'empty', '--outdir={0}'.format(os.path.join(sample_dir, name)), '--overwrite', '--root_package', 'samples.{0}_sample.{0}_{1}'.format(api_name, api_version), 'client', ] sys.stderr.write('Running: {}\n'.format(' '.join(args))) subprocess.check_call(args) if __name__ == '__main__': _Generate(_SAMPLES) LICENSE 0000644 00000026136 15025176453 0005571 0 ustar 00 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. .gitignore 0000644 00000000326 15025176453 0006545 0 ustar 00 *~ *.py[cod] *.egg-info/ build/ dist/ distribute-* # Test files .tox/ nosetests.xml # Coverage related .coverage coverage.xml htmlcov/ # Make sure a generated file isn't accidentally committed. reduced.pylintrc setup.py 0000644 00000005440 15025176453 0006271 0 ustar 00 #!/usr/bin/env python # # Copyright 2013 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Setup configuration.""" import platform try: import setuptools except ImportError: from ez_setup import use_setuptools use_setuptools() import setuptools # Configure the required packages and scripts to install, depending on # Python version and OS. REQUIRED_PACKAGES = [ 'httplib2>=0.8', 'fasteners>=0.14', 'oauth2client>=1.4.12', 'six>=1.12.0', ] CLI_PACKAGES = [ 'python-gflags>=3.0.6', ] TESTING_PACKAGES = [ 'mock>=1.0.1', ] CONSOLE_SCRIPTS = [ 'gen_client = apitools.gen.gen_client:main', ] py_version = platform.python_version() _APITOOLS_VERSION = '0.5.34' with open('README.rst') as fileobj: README = fileobj.read() setuptools.setup( name='google-apitools', version=_APITOOLS_VERSION, description='client libraries for humans', long_description=README, url='http://github.com/google/apitools', author='Craig Citro', author_email='craigcitro@google.com', python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', # Contained modules and scripts. packages=setuptools.find_packages(include=['apitools']), entry_points={'console_scripts': CONSOLE_SCRIPTS}, install_requires=REQUIRED_PACKAGES, tests_require=REQUIRED_PACKAGES + CLI_PACKAGES + TESTING_PACKAGES, extras_require={ 'cli': CLI_PACKAGES, 'testing': TESTING_PACKAGES, }, # Add in any packaged data. include_package_data=True, package_data={ 'apitools.data': ['*'], }, exclude_package_data={ '': [ '*_test.py', '*/testing/*', '*/testdata/*', 'base/protorpclite/test_util.py', 'gen/test_utils.py', ], }, # PyPI package information. classifiers=[ 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', ], license='Apache 2.0', keywords='apitools', ) tox.ini 0000644 00000002370 15025176453 0006071 0 ustar 00 [tox] envlist = py311-oauth2client{1,2,3,4} [testenv] deps = nose-py3 python-gflags oauth2client1: oauth2client<1.5dev oauth2client2: oauth2client>=2,<=3dev oauth2client3: oauth2client>=3,<=4dev oauth2client4: oauth2client>=4,<=5dev commands = pip install google-apitools[testing] nosetests [] passenv = TRAVIS* [testenv:lint] basepython = python3.11 commands = pip install six google-apitools pycodestyle apitools deps = pycodestyle==2.4.0 pylint [testenv:cover] basepython = python3.11 commands = nosetests --with-xunit --with-xcoverage --cover-package=apitools --nocapture --cover-erase --cover-tests --cover-branches [] deps = python-gflags mock nose coverage nosexcover [testenv:coveralls] basepython = {[testenv:cover]basepython} commands = {[testenv:cover]commands} coveralls deps = {[testenv:cover]deps} coveralls [testenv:transfer_coverage] basepython = python3.11 deps = mock nose coverage commands = coverage run --branch -p samples/storage_sample/downloads_test.py coverage run --branch -p samples/storage_sample/uploads_test.py coverage run --branch -p apitools/base/py/transfer_test.py coverage combine coverage html README.rst 0000644 00000003332 15025176453 0006244 0 ustar 00 **DEPRECATED - Please see alternatives below** google-apitools =============== |pypi| |build| |coverage| ``google-apitools`` is a collection of utilities to make it easier to build client-side tools, especially those that talk to Google APIs. **NOTE**: This library is deprecated and unsupported. Please read below for suggested alternatives. Alternatives to apitools ----------------------- For the official Cloud client libraries used to communicating with Google Cloud APIs, go to https://cloud.google.com/apis/docs/cloud-client-libraries. To generate Python API client libraries for APIs specified by protos, such as those inside Google, see https://github.com/googleapis/gapic-generator-python. API client library generators for other languages can be found in https://github.com/googleapis. Installing as a library ----------------------- To install the library into the current virtual environment:: $ pip install google-apitools Installing the command-line tools --------------------------------- To install the command-line scripts into the current virtual environment:: $ pip install google-apitools[cli] Running the tests ----------------- First, install the testing dependencies:: $ pip install google-apitools[testing] and the ``nose`` testrunner:: $ pip install nose Then run the tests:: $ nosetests .. |build| image:: https://travis-ci.org/google/apitools.svg?branch=master :target: https://travis-ci.org/google/apitools .. |pypi| image:: https://img.shields.io/pypi/v/google-apitools.svg :target: https://pypi.python.org/pypi/google-apitools .. |coverage| image:: https://coveralls.io/repos/google/apitools/badge.svg?branch=master :target: https://coveralls.io/r/google/apitools?branch=master ez_setup.py 0000644 00000021351 15025176453 0006766 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Bootstrap setuptools installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from ez_setup import use_setuptools use_setuptools() If you want to require a specific version of setuptools, set a download mirror, or use an alternate download directory, you can do so by supplying the appropriate options to ``use_setuptools()``. This file can also be run as a script to install or upgrade setuptools. """ import sys DEFAULT_VERSION = "0.6c11" DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] md5_data = { 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090', 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4', 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7', 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5', 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de', 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b', 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2', 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086', 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902', 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de', 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b', 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03', 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a', 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6', 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a', } import sys, os try: from hashlib import md5 except ImportError: from md5 import md5 def _validate_md5(egg_name, data): if egg_name in md5_data: digest = md5(data).hexdigest() if digest != md5_data[egg_name]: print >>sys.stderr, ( "md5 validation of %s failed! (Possible download problem?)" % egg_name ) sys.exit(2) return data def use_setuptools( version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, download_delay=15 ): """Automatically find/download setuptools and make it available on sys.path `version` should be a valid setuptools version number that is available as an egg for download under the `download_base` URL (which should end with a '/'). `to_dir` is the directory where setuptools will be downloaded, if it is not already available. If `download_delay` is specified, it should be the number of seconds that will be paused before initiating a download, should one be required. If an older version of setuptools is installed, this routine will print a message to ``sys.stderr`` and raise SystemExit in an attempt to abort the calling script. """ was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules def do_download(): egg = download_setuptools(version, download_base, to_dir, download_delay) sys.path.insert(0, egg) import setuptools; setuptools.bootstrap_install_from = egg try: import pkg_resources except ImportError: return do_download() try: pkg_resources.require("setuptools>="+version); return except pkg_resources.VersionConflict as e: if was_imported: print >>sys.stderr, ( "The required version of setuptools (>=%s) is not available, and\n" "can't be installed while this script is running. Please install\n" " a more recent version first, using 'easy_install -U setuptools'." "\n\n(Currently using %r)" ) % (version, e.args[0]) sys.exit(2) except pkg_resources.DistributionNotFound: pass del pkg_resources, sys.modules['pkg_resources'] # reload ok return do_download() def download_setuptools( version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, delay = 15 ): """Download setuptools from a specified location and return its filename `version` should be a valid setuptools version number that is available as an egg for download under the `download_base` URL (which should end with a '/'). `to_dir` is the directory where the egg will be downloaded. `delay` is the number of seconds to pause before an actual download attempt. """ import urllib2, shutil egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3]) url = download_base + egg_name saveto = os.path.join(to_dir, egg_name) src = dst = None if not os.path.exists(saveto): # Avoid repeated downloads try: from distutils import log if delay: log.warn(""" --------------------------------------------------------------------------- This script requires setuptools version %s to run (even to display help). I will attempt to download it for you (from %s), but you may need to enable firewall access for this script first. I will start the download in %d seconds. (Note: if this machine does not have network access, please obtain the file %s and place it in this directory before rerunning this script.) ---------------------------------------------------------------------------""", version, download_base, delay, url ); from time import sleep; sleep(delay) log.warn("Downloading %s", url) src = urllib2.urlopen(url) # Read/write all in one block, so we don't create a corrupt file # if the download is interrupted. data = _validate_md5(egg_name, src.read()) dst = open(saveto,"wb"); dst.write(data) finally: if src: src.close() if dst: dst.close() return os.path.realpath(saveto) def main(argv, version=DEFAULT_VERSION): """Install or upgrade setuptools and EasyInstall""" try: import setuptools except ImportError: egg = None try: egg = download_setuptools(version, delay=0) sys.path.insert(0,egg) from setuptools.command.easy_install import main return main(list(argv)+[egg]) # we're done here finally: if egg and os.path.exists(egg): os.unlink(egg) else: if setuptools.__version__ == '0.0.1': print >>sys.stderr, ( "You have an obsolete version of setuptools installed. Please\n" "remove it from your system entirely before rerunning this script." ) sys.exit(2) req = "setuptools>="+version import pkg_resources try: pkg_resources.require(req) except pkg_resources.VersionConflict: try: from setuptools.command.easy_install import main except ImportError: from easy_install import main main(list(argv)+[download_setuptools(delay=0)]) sys.exit(0) # try to force an exit else: if argv: from setuptools.command.easy_install import main main(argv) else: print "Setuptools version",version,"or greater has been installed." print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)' def update_md5(filenames): """Update our built-in md5 registry""" import re for name in filenames: base = os.path.basename(name) f = open(name,'rb') md5_data[base] = md5(f.read()).hexdigest() f.close() data = [" %r: %r,\n" % it for it in md5_data.items()] data.sort() repl = "".join(data) import inspect srcfile = inspect.getsourcefile(sys.modules[__name__]) f = open(srcfile, 'rb'); src = f.read(); f.close() match = re.search("\nmd5_data = {\n([^}]+)}", src) if not match: print >>sys.stderr, "Internal error!" sys.exit(2) src = src[:match.start(1)] + repl + src[match.end(1):] f = open(srcfile,'w') f.write(src) f.close() if __name__=='__main__': if len(sys.argv)>2 and sys.argv[1]=='--md5update': update_md5(sys.argv[2:]) else: main(sys.argv[1:]) apitools/__pycache__/__init__.cpython-39.pyc 0000644 00000000414 15025176453 0015005 0 ustar 00 a vyg� � @ s d Z ddlmZ eee�ZdS )z Shared __init__.py for apitools.� )�extend_pathN)�__doc__�pkgutilr �__path__�__name__� r r �5/opt/gsutil/third_party/apitools/apitools/__init__.py�<module> s apitools/gen/util.py 0000644 00000035667 15025176453 0010527 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Assorted utilities shared between parts of apitools.""" from __future__ import print_function from __future__ import unicode_literals import collections import contextlib import gzip import json import keyword import logging import os import re import tempfile import six from six.moves import urllib_parse import six.moves.urllib.error as urllib_error import six.moves.urllib.request as urllib_request class Error(Exception): """Base error for apitools generation.""" class CommunicationError(Error): """Error in network communication.""" def _SortLengthFirstKey(a): return -len(a), a class Names(object): """Utility class for cleaning and normalizing names in a fixed style.""" DEFAULT_NAME_CONVENTION = 'LOWER_CAMEL' NAME_CONVENTIONS = ['LOWER_CAMEL', 'LOWER_WITH_UNDER', 'NONE'] def __init__(self, strip_prefixes, name_convention=None, capitalize_enums=False): self.__strip_prefixes = sorted(strip_prefixes, key=_SortLengthFirstKey) self.__name_convention = ( name_convention or self.DEFAULT_NAME_CONVENTION) self.__capitalize_enums = capitalize_enums @staticmethod def __FromCamel(name, separator='_'): name = re.sub(r'([a-z0-9])([A-Z])', r'\1%s\2' % separator, name) return name.lower() @staticmethod def __ToCamel(name, separator='_'): # TODO(craigcitro): Consider what to do about leading or trailing # underscores (such as `_refValue` in discovery). return ''.join(s[0:1].upper() + s[1:] for s in name.split(separator)) @staticmethod def __ToLowerCamel(name, separator='_'): name = Names.__ToCamel(name, separator=separator) return name[0].lower() + name[1:] def __StripName(self, name): """Strip strip_prefix entries from name.""" if not name: return name for prefix in self.__strip_prefixes: if name.startswith(prefix): return name[len(prefix):] return name @staticmethod def CleanName(name): """Perform generic name cleaning.""" name = re.sub('[^_A-Za-z0-9]', '_', name) if name[0].isdigit(): name = '_%s' % name while keyword.iskeyword(name) or name == 'exec': name = '%s_' % name # If we end up with __ as a prefix, we'll run afoul of python # field renaming, so we manually correct for it. if name.startswith('__'): name = 'f%s' % name return name @staticmethod def NormalizeRelativePath(path): """Normalize camelCase entries in path.""" path_components = path.split('/') normalized_components = [] for component in path_components: if re.match(r'{[A-Za-z0-9_]+}$', component): normalized_components.append( '{%s}' % Names.CleanName(component[1:-1])) else: normalized_components.append(component) return '/'.join(normalized_components) def NormalizeEnumName(self, enum_name): if self.__capitalize_enums: enum_name = enum_name.upper() return self.CleanName(enum_name) def ClassName(self, name, separator='_'): """Generate a valid class name from name.""" # TODO(craigcitro): Get rid of this case here and in MethodName. if name is None: return name # TODO(craigcitro): This is a hack to handle the case of specific # protorpc class names; clean this up. if name.startswith(('protorpc.', 'message_types.', 'apitools.base.protorpclite.', 'apitools.base.protorpclite.message_types.')): return name name = self.__StripName(name) name = self.__ToCamel(name, separator=separator) return self.CleanName(name) def MethodName(self, name, separator='_'): """Generate a valid method name from name.""" if name is None: return None name = Names.__ToCamel(name, separator=separator) return Names.CleanName(name) def FieldName(self, name): """Generate a valid field name from name.""" # TODO(craigcitro): We shouldn't need to strip this name, but some # of the service names here are excessive. Fix the API and then # remove this. name = self.__StripName(name) if self.__name_convention == 'LOWER_CAMEL': name = Names.__ToLowerCamel(name) elif self.__name_convention == 'LOWER_WITH_UNDER': name = Names.__FromCamel(name) return Names.CleanName(name) @contextlib.contextmanager def Chdir(dirname, create=True): if not os.path.exists(dirname): if not create: raise OSError('Cannot find directory %s' % dirname) else: os.mkdir(dirname) previous_directory = os.getcwd() try: os.chdir(dirname) yield finally: os.chdir(previous_directory) def NormalizeVersion(version): # Currently, '.' is the only character that might cause us trouble. return version.replace('.', '_') def _ComputePaths(package, version, root_url, service_path): """Compute the base url and base path. Attributes: package: name field of the discovery, i.e. 'storage' for storage service. version: version of the service, i.e. 'v1'. root_url: root url of the service, i.e. 'https://www.googleapis.com/'. service_path: path of the service under the rool url, i.e. 'storage/v1/'. Returns: base url: string, base url of the service, 'https://www.googleapis.com/storage/v1/' for the storage service. base path: string, common prefix of service endpoints after the base url. """ full_path = urllib_parse.urljoin(root_url, service_path) api_path_component = '/'.join((package, version, '')) if api_path_component not in full_path: return full_path, '' prefix, _, suffix = full_path.rpartition(api_path_component) return prefix + api_path_component, suffix class ClientInfo(collections.namedtuple('ClientInfo', ( 'package', 'scopes', 'version', 'client_id', 'client_secret', 'user_agent', 'client_class_name', 'url_version', 'api_key', 'base_url', 'base_path', 'mtls_base_url'))): """Container for client-related info and names.""" @classmethod def Create(cls, discovery_doc, scope_ls, client_id, client_secret, user_agent, names, api_key, version_identifier): """Create a new ClientInfo object from a discovery document.""" scopes = set( discovery_doc.get('auth', {}).get('oauth2', {}).get('scopes', {})) scopes.update(scope_ls) package = discovery_doc['name'] version = ( version_identifier or NormalizeVersion(discovery_doc['version'])) url_version = discovery_doc['version'] base_url, base_path = _ComputePaths(package, url_version, discovery_doc['rootUrl'], discovery_doc['servicePath']) mtls_root_url = discovery_doc.get('mtlsRootUrl', '') mtls_base_url = '' if mtls_root_url: mtls_base_url, _ = _ComputePaths(package, url_version, mtls_root_url, discovery_doc['servicePath']) client_info = { 'package': package, 'version': version, 'url_version': url_version, 'scopes': sorted(list(scopes)), 'client_id': client_id, 'client_secret': client_secret, 'user_agent': user_agent, 'api_key': api_key, 'base_url': base_url, 'base_path': base_path, 'mtls_base_url': mtls_base_url, } client_class_name = '%s%s' % ( names.ClassName(client_info['package']), names.ClassName(client_info['version'])) client_info['client_class_name'] = client_class_name return cls(**client_info) @property def default_directory(self): return self.package @property def client_rule_name(self): return '%s_%s_client' % (self.package, self.version) @property def client_file_name(self): return '%s.py' % self.client_rule_name @property def messages_rule_name(self): return '%s_%s_messages' % (self.package, self.version) @property def services_rule_name(self): return '%s_%s_services' % (self.package, self.version) @property def messages_file_name(self): return '%s.py' % self.messages_rule_name @property def messages_proto_file_name(self): return '%s.proto' % self.messages_rule_name @property def services_proto_file_name(self): return '%s.proto' % self.services_rule_name def ReplaceHomoglyphs(s): """Returns s with unicode homoglyphs replaced by ascii equivalents.""" homoglyphs = { '\xa0': ' ', # ? '\u00e3': '', # TODO(gsfowler) drop after .proto spurious char elided '\u00a0': ' ', # ? '\u00a9': '(C)', # COPYRIGHT SIGN (would you believe "asciiglyph"?) '\u00ae': '(R)', # REGISTERED SIGN (would you believe "asciiglyph"?) '\u2014': '-', # EM DASH '\u2018': "'", # LEFT SINGLE QUOTATION MARK '\u2019': "'", # RIGHT SINGLE QUOTATION MARK '\u201c': '"', # LEFT DOUBLE QUOTATION MARK '\u201d': '"', # RIGHT DOUBLE QUOTATION MARK '\u2026': '...', # HORIZONTAL ELLIPSIS '\u2e3a': '-', # TWO-EM DASH } def _ReplaceOne(c): """Returns the homoglyph or escaped replacement for c.""" equiv = homoglyphs.get(c) if equiv is not None: return equiv try: c.encode('ascii') return c except UnicodeError: pass try: return c.encode('unicode-escape').decode('ascii') except UnicodeError: return '?' return ''.join([_ReplaceOne(c) for c in s]) def CleanDescription(description): """Return a version of description safe for printing in a docstring.""" if not isinstance(description, six.string_types): return description if six.PY3: # https://docs.python.org/3/reference/lexical_analysis.html#index-18 description = description.replace('\\N', '\\\\N') description = description.replace('\\u', '\\\\u') description = description.replace('\\U', '\\\\U') description = ReplaceHomoglyphs(description) return description.replace('"""', '" " "') class SimplePrettyPrinter(object): """Simple pretty-printer that supports an indent contextmanager.""" def __init__(self, out): self.__out = out self.__indent = '' self.__skip = False self.__comment_context = False @property def indent(self): return self.__indent def CalculateWidth(self, max_width=78): return max_width - len(self.indent) @contextlib.contextmanager def Indent(self, indent=' '): previous_indent = self.__indent self.__indent = '%s%s' % (previous_indent, indent) yield self.__indent = previous_indent @contextlib.contextmanager def CommentContext(self): """Print without any argument formatting.""" old_context = self.__comment_context self.__comment_context = True yield self.__comment_context = old_context def __call__(self, *args): if self.__comment_context and args[1:]: raise Error('Cannot do string interpolation in comment context') if args and args[0]: if not self.__comment_context: line = (args[0] % args[1:]).rstrip() else: line = args[0].rstrip() line = ReplaceHomoglyphs(line) try: print('%s%s' % (self.__indent, line), file=self.__out) except UnicodeEncodeError: line = line.encode('ascii', 'backslashreplace').decode('ascii') print('%s%s' % (self.__indent, line), file=self.__out) else: print('', file=self.__out) def _NormalizeDiscoveryUrls(discovery_url): """Expands a few abbreviations into full discovery urls.""" if discovery_url.startswith('http'): return [discovery_url] elif '.' not in discovery_url: raise ValueError('Unrecognized value "%s" for discovery url') api_name, _, api_version = discovery_url.partition('.') return [ 'https://www.googleapis.com/discovery/v1/apis/%s/%s/rest' % ( api_name, api_version), 'https://%s.googleapis.com/$discovery/rest?version=%s' % ( api_name, api_version), ] def _Gunzip(gzipped_content): """Returns gunzipped content from gzipped contents.""" f = tempfile.NamedTemporaryFile(suffix='gz', mode='w+b', delete=False) try: f.write(gzipped_content) f.close() # force file synchronization with gzip.open(f.name, 'rb') as h: decompressed_content = h.read() return decompressed_content finally: os.unlink(f.name) def _GetURLContent(url): """Download and return the content of URL.""" response = urllib_request.urlopen(url) encoding = response.info().get('Content-Encoding') if encoding == 'gzip': content = _Gunzip(response.read()) else: content = response.read() return content def FetchDiscoveryDoc(discovery_url, retries=5): """Fetch the discovery document at the given url.""" discovery_urls = _NormalizeDiscoveryUrls(discovery_url) discovery_doc = None last_exception = None for url in discovery_urls: for _ in range(retries): try: content = _GetURLContent(url) if isinstance(content, bytes): content = content.decode('utf8') discovery_doc = json.loads(content) if discovery_doc: return discovery_doc except (urllib_error.HTTPError, urllib_error.URLError) as e: logging.info( 'Attempting to fetch discovery doc again after "%s"', e) last_exception = e if discovery_doc is None: raise CommunicationError( 'Could not find discovery doc at any of %s: %s' % ( discovery_urls, last_exception)) apitools/gen/test_utils.py 0000644 00000002650 15025176453 0011733 0 ustar 00 # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Various utilities used in tests.""" import contextlib import os import shutil import sys import tempfile import unittest import six SkipOnWindows = unittest.skipIf( os.name == 'nt', 'Does not run on windows') @contextlib.contextmanager def TempDir(change_to=False): if change_to: original_dir = os.getcwd() path = tempfile.mkdtemp() try: if change_to: os.chdir(path) yield path finally: if change_to: os.chdir(original_dir) shutil.rmtree(path) @contextlib.contextmanager def CaptureOutput(): new_stdout, new_stderr = six.StringIO(), six.StringIO() old_stdout, old_stderr = sys.stdout, sys.stderr try: sys.stdout, sys.stderr = new_stdout, new_stderr yield new_stdout, new_stderr finally: sys.stdout, sys.stderr = old_stdout, old_stderr apitools/gen/extended_descriptor.py 0000644 00000052232 15025176453 0013573 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Extended protorpc descriptors. This takes existing protorpc Descriptor classes and adds extra properties not directly supported in proto itself, notably field and message descriptions. We need this in order to generate protorpc message files with comments. Note that for most of these classes, we can't simply wrap the existing message, since we need to change the type of the subfields. We could have a "plain" descriptor attached, but that seems like unnecessary bookkeeping. Where possible, we purposely reuse existing tag numbers; for new fields, we start numbering at 100. """ import abc import operator import textwrap import six from apitools.base.protorpclite import descriptor as protorpc_descriptor from apitools.base.protorpclite import message_types from apitools.base.protorpclite import messages from apitools.base.py import extra_types class ExtendedEnumValueDescriptor(messages.Message): """Enum value descriptor with additional fields. Fields: name: Name of enumeration value. number: Number of enumeration value. description: Description of this enum value. """ name = messages.StringField(1) number = messages.IntegerField(2, variant=messages.Variant.INT32) description = messages.StringField(100) class ExtendedEnumDescriptor(messages.Message): """Enum class descriptor with additional fields. Fields: name: Name of Enum without any qualification. values: Values defined by Enum class. description: Description of this enum class. full_name: Fully qualified name of this enum class. enum_mappings: Mappings from python to JSON names for enum values. """ class JsonEnumMapping(messages.Message): """Mapping from a python name to the wire name for an enum.""" python_name = messages.StringField(1) json_name = messages.StringField(2) name = messages.StringField(1) values = messages.MessageField( ExtendedEnumValueDescriptor, 2, repeated=True) description = messages.StringField(100) full_name = messages.StringField(101) enum_mappings = messages.MessageField( 'JsonEnumMapping', 102, repeated=True) class ExtendedFieldDescriptor(messages.Message): """Field descriptor with additional fields. Fields: field_descriptor: The underlying field descriptor. name: The name of this field. description: Description of this field. """ field_descriptor = messages.MessageField( protorpc_descriptor.FieldDescriptor, 100) # We duplicate the names for easier bookkeeping. name = messages.StringField(101) description = messages.StringField(102) class ExtendedMessageDescriptor(messages.Message): """Message descriptor with additional fields. Fields: name: Name of Message without any qualification. fields: Fields defined for message. message_types: Nested Message classes defined on message. enum_types: Nested Enum classes defined on message. description: Description of this message. full_name: Full qualified name of this message. decorators: Decorators to include in the definition when printing. Printed in the given order from top to bottom (so the last entry is the innermost decorator). alias_for: This type is just an alias for the named type. field_mappings: Mappings from python to json field names. """ class JsonFieldMapping(messages.Message): """Mapping from a python name to the wire name for a field.""" python_name = messages.StringField(1) json_name = messages.StringField(2) name = messages.StringField(1) fields = messages.MessageField(ExtendedFieldDescriptor, 2, repeated=True) message_types = messages.MessageField( 'extended_descriptor.ExtendedMessageDescriptor', 3, repeated=True) enum_types = messages.MessageField( ExtendedEnumDescriptor, 4, repeated=True) description = messages.StringField(100) full_name = messages.StringField(101) decorators = messages.StringField(102, repeated=True) alias_for = messages.StringField(103) field_mappings = messages.MessageField( 'JsonFieldMapping', 104, repeated=True) class ExtendedFileDescriptor(messages.Message): """File descriptor with additional fields. Fields: package: Fully qualified name of package that definitions belong to. message_types: Message definitions contained in file. enum_types: Enum definitions contained in file. description: Description of this file. additional_imports: Extra imports used in this package. """ package = messages.StringField(2) message_types = messages.MessageField( ExtendedMessageDescriptor, 4, repeated=True) enum_types = messages.MessageField( ExtendedEnumDescriptor, 5, repeated=True) description = messages.StringField(100) additional_imports = messages.StringField(101, repeated=True) def _WriteFile(file_descriptor, package, version, proto_printer): """Write the given extended file descriptor to the printer.""" proto_printer.PrintPreamble(package, version, file_descriptor) _PrintEnums(proto_printer, file_descriptor.enum_types) _PrintMessages(proto_printer, file_descriptor.message_types) custom_json_mappings = _FetchCustomMappings(file_descriptor.enum_types) custom_json_mappings.extend( _FetchCustomMappings(file_descriptor.message_types)) for mapping in custom_json_mappings: proto_printer.PrintCustomJsonMapping(mapping) def WriteMessagesFile(file_descriptor, package, version, printer): """Write the given extended file descriptor to out as a message file.""" _WriteFile(file_descriptor, package, version, _Proto2Printer(printer)) def WritePythonFile(file_descriptor, package, version, printer): """Write the given extended file descriptor to out.""" _WriteFile(file_descriptor, package, version, _ProtoRpcPrinter(printer)) def PrintIndentedDescriptions(printer, ls, name, prefix=''): if ls: with printer.Indent(indent=prefix): with printer.CommentContext(): width = printer.CalculateWidth() - len(prefix) printer() printer(name + ':') for x in ls: description = '%s: %s' % (x.name, x.description) for line in textwrap.wrap(description, width, initial_indent=' ', subsequent_indent=' '): printer(line) def _FetchCustomMappings(descriptor_ls): """Find and return all custom mappings for descriptors in descriptor_ls.""" custom_mappings = [] for descriptor in descriptor_ls: if isinstance(descriptor, ExtendedEnumDescriptor): custom_mappings.extend( _FormatCustomJsonMapping('Enum', m, descriptor) for m in descriptor.enum_mappings) elif isinstance(descriptor, ExtendedMessageDescriptor): custom_mappings.extend( _FormatCustomJsonMapping('Field', m, descriptor) for m in descriptor.field_mappings) custom_mappings.extend( _FetchCustomMappings(descriptor.enum_types)) custom_mappings.extend( _FetchCustomMappings(descriptor.message_types)) return custom_mappings def _FormatCustomJsonMapping(mapping_type, mapping, descriptor): return '\n'.join(( 'encoding.AddCustomJson%sMapping(' % mapping_type, " %s, '%s', '%s')" % (descriptor.full_name, mapping.python_name, mapping.json_name), )) def _EmptyMessage(message_type): return not any((message_type.enum_types, message_type.message_types, message_type.fields)) class ProtoPrinter(six.with_metaclass(abc.ABCMeta, object)): """Interface for proto printers.""" @abc.abstractmethod def PrintPreamble(self, package, version, file_descriptor): """Print the file docstring and import lines.""" @abc.abstractmethod def PrintEnum(self, enum_type): """Print the given enum declaration.""" @abc.abstractmethod def PrintMessage(self, message_type): """Print the given message declaration.""" class _Proto2Printer(ProtoPrinter): """Printer for proto2 definitions.""" def __init__(self, printer): self.__printer = printer def __PrintEnumCommentLines(self, enum_type): description = enum_type.description or '%s enum type.' % enum_type.name for line in textwrap.wrap(description, self.__printer.CalculateWidth() - 3): self.__printer('// %s', line) PrintIndentedDescriptions(self.__printer, enum_type.values, 'Values', prefix='// ') def __PrintEnumValueCommentLines(self, enum_value): if enum_value.description: width = self.__printer.CalculateWidth() - 3 for line in textwrap.wrap(enum_value.description, width): self.__printer('// %s', line) def PrintEnum(self, enum_type): self.__PrintEnumCommentLines(enum_type) self.__printer('enum %s {', enum_type.name) with self.__printer.Indent(): enum_values = sorted( enum_type.values, key=operator.attrgetter('number')) for enum_value in enum_values: self.__printer() self.__PrintEnumValueCommentLines(enum_value) self.__printer('%s = %s;', enum_value.name, enum_value.number) self.__printer('}') self.__printer() def PrintPreamble(self, package, version, file_descriptor): self.__printer('// Generated message classes for %s version %s.', package, version) self.__printer('// NOTE: This file is autogenerated and should not be ' 'edited by hand.') description_lines = textwrap.wrap(file_descriptor.description, 75) if description_lines: self.__printer('//') for line in description_lines: self.__printer('// %s', line) self.__printer() self.__printer('syntax = "proto2";') self.__printer('package %s;', file_descriptor.package) def __PrintMessageCommentLines(self, message_type): """Print the description of this message.""" description = message_type.description or '%s message type.' % ( message_type.name) width = self.__printer.CalculateWidth() - 3 for line in textwrap.wrap(description, width): self.__printer('// %s', line) PrintIndentedDescriptions(self.__printer, message_type.enum_types, 'Enums', prefix='// ') PrintIndentedDescriptions(self.__printer, message_type.message_types, 'Messages', prefix='// ') PrintIndentedDescriptions(self.__printer, message_type.fields, 'Fields', prefix='// ') def __PrintFieldDescription(self, description): for line in textwrap.wrap(description, self.__printer.CalculateWidth() - 3): self.__printer('// %s', line) def __PrintFields(self, fields): for extended_field in fields: field = extended_field.field_descriptor field_type = messages.Field.lookup_field_type_by_variant( field.variant) self.__printer() self.__PrintFieldDescription(extended_field.description) label = str(field.label).lower() if field_type in (messages.EnumField, messages.MessageField): proto_type = field.type_name else: proto_type = str(field.variant).lower() default_statement = '' if field.default_value: if field_type in [messages.BytesField, messages.StringField]: default_value = '"%s"' % field.default_value elif field_type is messages.BooleanField: default_value = str(field.default_value).lower() else: default_value = str(field.default_value) default_statement = ' [default = %s]' % default_value self.__printer( '%s %s %s = %d%s;', label, proto_type, field.name, field.number, default_statement) def PrintMessage(self, message_type): self.__printer() self.__PrintMessageCommentLines(message_type) if _EmptyMessage(message_type): self.__printer('message %s {}', message_type.name) return self.__printer('message %s {', message_type.name) with self.__printer.Indent(): _PrintEnums(self, message_type.enum_types) _PrintMessages(self, message_type.message_types) self.__PrintFields(message_type.fields) self.__printer('}') def PrintCustomJsonMapping(self, mapping_lines): raise NotImplementedError( 'Custom JSON encoding not supported for proto2') class _ProtoRpcPrinter(ProtoPrinter): """Printer for ProtoRPC definitions.""" def __init__(self, printer): self.__printer = printer def __PrintClassSeparator(self): self.__printer() if not self.__printer.indent: self.__printer() def __PrintEnumDocstringLines(self, enum_type): description = enum_type.description or '%s enum type.' % enum_type.name for line in textwrap.wrap('r"""%s' % description, self.__printer.CalculateWidth()): self.__printer(line) PrintIndentedDescriptions(self.__printer, enum_type.values, 'Values') self.__printer('"""') def PrintEnum(self, enum_type): self.__printer('class %s(_messages.Enum):', enum_type.name) with self.__printer.Indent(): self.__PrintEnumDocstringLines(enum_type) enum_values = sorted( enum_type.values, key=operator.attrgetter('number')) for enum_value in enum_values: self.__printer('%s = %s', enum_value.name, enum_value.number) if not enum_type.values: self.__printer('pass') self.__PrintClassSeparator() def __PrintAdditionalImports(self, imports): """Print additional imports needed for protorpc.""" google_imports = [x for x in imports if 'google' in x] other_imports = [x for x in imports if 'google' not in x] if other_imports: for import_ in sorted(other_imports): self.__printer(import_) self.__printer() # Note: If we ever were going to add imports from this package, we'd # need to sort those out and put them at the end. if google_imports: for import_ in sorted(google_imports): self.__printer(import_) self.__printer() def PrintPreamble(self, package, version, file_descriptor): self.__printer('"""Generated message classes for %s version %s.', package, version) self.__printer() for line in textwrap.wrap(file_descriptor.description, 78): self.__printer(line) self.__printer('"""') self.__printer('# NOTE: This file is autogenerated and should not be ' 'edited by hand.') self.__printer() self.__printer('from __future__ import absolute_import') self.__printer() self.__PrintAdditionalImports(file_descriptor.additional_imports) self.__printer() self.__printer("package = '%s'", file_descriptor.package) self.__printer() self.__printer() def __PrintMessageDocstringLines(self, message_type): """Print the docstring for this message.""" description = message_type.description or '%s message type.' % ( message_type.name) short_description = ( _EmptyMessage(message_type) and len(description) < (self.__printer.CalculateWidth() - 6)) with self.__printer.CommentContext(): if short_description: # Note that we use explicit string interpolation here since # we're in comment context. self.__printer('r"""%s"""' % description) return for line in textwrap.wrap('r"""%s' % description, self.__printer.CalculateWidth()): self.__printer(line) PrintIndentedDescriptions(self.__printer, message_type.enum_types, 'Enums') PrintIndentedDescriptions( self.__printer, message_type.message_types, 'Messages') PrintIndentedDescriptions( self.__printer, message_type.fields, 'Fields') self.__printer('"""') self.__printer() def PrintMessage(self, message_type): if message_type.alias_for: self.__printer( '%s = %s', message_type.name, message_type.alias_for) self.__PrintClassSeparator() return for decorator in message_type.decorators: self.__printer('@%s', decorator) self.__printer('class %s(_messages.Message):', message_type.name) with self.__printer.Indent(): self.__PrintMessageDocstringLines(message_type) _PrintEnums(self, message_type.enum_types) _PrintMessages(self, message_type.message_types) _PrintFields(message_type.fields, self.__printer) self.__PrintClassSeparator() def PrintCustomJsonMapping(self, mapping): self.__printer(mapping) def _PrintEnums(proto_printer, enum_types): """Print all enums to the given proto_printer.""" enum_types = sorted(enum_types, key=operator.attrgetter('name')) for enum_type in enum_types: proto_printer.PrintEnum(enum_type) def _PrintMessages(proto_printer, message_list): message_list = sorted(message_list, key=operator.attrgetter('name')) for message_type in message_list: proto_printer.PrintMessage(message_type) _MESSAGE_FIELD_MAP = { message_types.DateTimeMessage.definition_name(): ( message_types.DateTimeField), } def _PrintFields(fields, printer): for extended_field in fields: field = extended_field.field_descriptor printed_field_info = { 'name': field.name, 'module': '_messages', 'type_name': '', 'type_format': '', 'number': field.number, 'label_format': '', 'variant_format': '', 'default_format': '', } message_field = _MESSAGE_FIELD_MAP.get(field.type_name) if message_field: printed_field_info['module'] = '_message_types' field_type = message_field elif field.type_name == 'extra_types.DateField': printed_field_info['module'] = 'extra_types' field_type = extra_types.DateField else: field_type = messages.Field.lookup_field_type_by_variant( field.variant) if field_type in (messages.EnumField, messages.MessageField): printed_field_info['type_format'] = "'%s', " % field.type_name if field.label == protorpc_descriptor.FieldDescriptor.Label.REQUIRED: printed_field_info['label_format'] = ', required=True' elif field.label == protorpc_descriptor.FieldDescriptor.Label.REPEATED: printed_field_info['label_format'] = ', repeated=True' if field_type.DEFAULT_VARIANT != field.variant: printed_field_info['variant_format'] = ( ', variant=_messages.Variant.%s' % field.variant) if field.default_value: if field_type in [messages.BytesField, messages.StringField]: default_value = repr(field.default_value) elif field_type is messages.EnumField: try: default_value = str(int(field.default_value)) except ValueError: default_value = repr(field.default_value) else: default_value = field.default_value printed_field_info[ 'default_format'] = ', default=%s' % (default_value,) printed_field_info['type_name'] = field_type.__name__ args = ''.join('%%(%s)s' % field for field in ( 'type_format', 'number', 'label_format', 'variant_format', 'default_format')) format_str = '%%(name)s = %%(module)s.%%(type_name)s(%s)' % args printer(format_str % printed_field_info) apitools/gen/gen_client_lib.py 0000644 00000024446 15025176453 0012500 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Simple tool for generating a client library. Relevant links: https://developers.google.com/discovery/v1/reference/apis#resource """ import datetime from apitools.gen import message_registry from apitools.gen import service_registry from apitools.gen import util def _ApitoolsVersion(): """Returns version of the currently installed google-apitools package.""" try: import pkg_resources except ImportError: return 'X.X.X' try: return pkg_resources.get_distribution('google-apitools').version except pkg_resources.DistributionNotFound: return 'X.X.X' def _StandardQueryParametersSchema(discovery_doc): """Sets up dict of standard query parameters.""" standard_query_schema = { 'id': 'StandardQueryParameters', 'type': 'object', 'description': 'Query parameters accepted by all methods.', 'properties': discovery_doc.get('parameters', {}), } # We add an entry for the trace, since Discovery doesn't. standard_query_schema['properties']['trace'] = { 'type': 'string', 'description': ('A tracing token of the form "token:<tokenid>" ' 'to include in api requests.'), 'location': 'query', } return standard_query_schema class DescriptorGenerator(object): """Code generator for a given discovery document.""" def __init__(self, discovery_doc, client_info, names, root_package, outdir, base_package, protorpc_package, init_wildcards_file=True, use_proto2=False, unelidable_request_methods=None, apitools_version=''): self.__discovery_doc = discovery_doc self.__client_info = client_info self.__outdir = outdir self.__use_proto2 = use_proto2 self.__description = util.CleanDescription( self.__discovery_doc.get('description', '')) self.__package = self.__client_info.package self.__version = self.__client_info.version self.__revision = discovery_doc.get('revision', '1') self.__init_wildcards_file = init_wildcards_file self.__root_package = root_package self.__base_files_package = base_package self.__protorpc_package = protorpc_package self.__names = names # Order is important here: we need the schemas before we can # define the services. self.__message_registry = message_registry.MessageRegistry( self.__client_info, self.__names, self.__description, self.__root_package, self.__base_files_package, self.__protorpc_package) schemas = self.__discovery_doc.get('schemas', {}) for schema_name, schema in sorted(schemas.items()): self.__message_registry.AddDescriptorFromSchema( schema_name, schema) # We need to add one more message type for the global parameters. standard_query_schema = _StandardQueryParametersSchema( self.__discovery_doc) self.__message_registry.AddDescriptorFromSchema( standard_query_schema['id'], standard_query_schema) # Now that we know all the messages, we need to correct some # fields from MessageFields to EnumFields. self.__message_registry.FixupMessageFields() self.__services_registry = service_registry.ServiceRegistry( self.__client_info, self.__message_registry, self.__names, self.__root_package, self.__base_files_package, unelidable_request_methods or []) services = self.__discovery_doc.get('resources', {}) for service_name, methods in sorted(services.items()): self.__services_registry.AddServiceFromResource( service_name, methods) # We might also have top-level methods. api_methods = self.__discovery_doc.get('methods', []) if api_methods: self.__services_registry.AddServiceFromResource( 'api', {'methods': api_methods}) # pylint: disable=protected-access self.__client_info = self.__client_info._replace( scopes=self.__services_registry.scopes) # The apitools version that will be used in prerequisites for the # generated packages. self.__apitools_version = ( apitools_version if apitools_version else _ApitoolsVersion()) @property def client_info(self): return self.__client_info @property def discovery_doc(self): return self.__discovery_doc @property def names(self): return self.__names @property def outdir(self): return self.__outdir @property def package(self): return self.__package @property def use_proto2(self): return self.__use_proto2 @property def apitools_version(self): return self.__apitools_version def _GetPrinter(self, out): printer = util.SimplePrettyPrinter(out) return printer def WriteInit(self, out): """Write a simple __init__.py for the generated client.""" printer = self._GetPrinter(out) if self.__init_wildcards_file: printer('"""Common imports for generated %s client library."""', self.__client_info.package) printer('# pylint:disable=wildcard-import') else: printer('"""Package marker file."""') printer() printer('from __future__ import absolute_import') printer() printer('import pkgutil') printer() if self.__init_wildcards_file: printer('from %s import *', self.__base_files_package) if self.__root_package == '.': import_prefix = '.' else: import_prefix = '%s.' % self.__root_package printer('from %s%s import *', import_prefix, self.__client_info.client_rule_name) printer('from %s%s import *', import_prefix, self.__client_info.messages_rule_name) printer() printer('__path__ = pkgutil.extend_path(__path__, __name__)') def WriteIntermediateInit(self, out): """Write a simple __init__.py for an intermediate directory.""" printer = self._GetPrinter(out) printer('#!/usr/bin/env python') printer('"""Shared __init__.py for apitools."""') printer() printer('from pkgutil import extend_path') printer('__path__ = extend_path(__path__, __name__)') def WriteSetupPy(self, out): """Write a setup.py for upload to PyPI.""" printer = self._GetPrinter(out) year = datetime.datetime.now().year printer('# Copyright %s Google Inc. All Rights Reserved.' % year) printer('#') printer('# Licensed under the Apache License, Version 2.0 (the' '"License");') printer('# you may not use this file except in compliance with ' 'the License.') printer('# You may obtain a copy of the License at') printer('#') printer('# http://www.apache.org/licenses/LICENSE-2.0') printer('#') printer('# Unless required by applicable law or agreed to in writing, ' 'software') printer('# distributed under the License is distributed on an "AS IS" ' 'BASIS,') printer('# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ' 'express or implied.') printer('# See the License for the specific language governing ' 'permissions and') printer('# limitations under the License.') printer() printer('import setuptools') printer('REQUIREMENTS = [') with printer.Indent(indent=' '): parts = self.apitools_version.split('.') major = parts.pop(0) minor = parts.pop(0) printer('"google-apitools>=%s,~=%s.%s",', self.apitools_version, major, minor) printer('"httplib2>=0.9",') printer('"oauth2client>=1.4.12",') printer(']') printer('_PACKAGE = "apitools.clients.%s"' % self.__package) printer() printer('setuptools.setup(') # TODO(craigcitro): Allow customization of these options. with printer.Indent(indent=' '): printer('name="google-apitools-%s-%s",', self.__package, self.__version) printer('version="%s.%s",', self.apitools_version, self.__revision) printer('description="Autogenerated apitools library for %s",' % ( self.__package,)) printer('url="https://github.com/google/apitools",') printer('author="Craig Citro",') printer('author_email="craigcitro@google.com",') printer('packages=setuptools.find_packages(),') printer('install_requires=REQUIREMENTS,') printer('classifiers=[') with printer.Indent(indent=' '): printer('"Programming Language :: Python :: 2.7",') printer('"License :: OSI Approved :: Apache Software ' 'License",') printer('],') printer('license="Apache 2.0",') printer('keywords="apitools apitools-%s %s",' % ( self.__package, self.__package)) printer(')') def WriteMessagesFile(self, out): self.__message_registry.WriteFile(self._GetPrinter(out)) def WriteMessagesProtoFile(self, out): self.__message_registry.WriteProtoFile(self._GetPrinter(out)) def WriteServicesProtoFile(self, out): self.__services_registry.WriteProtoFile(self._GetPrinter(out)) def WriteClientLibrary(self, out): self.__services_registry.WriteFile(self._GetPrinter(out)) apitools/gen/message_registry.py 0000644 00000052001 15025176453 0013103 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Message registry for apitools.""" import collections import contextlib import json import six from apitools.base.protorpclite import descriptor from apitools.base.protorpclite import messages from apitools.gen import extended_descriptor from apitools.gen import util TypeInfo = collections.namedtuple('TypeInfo', ('type_name', 'variant')) class MessageRegistry(object): """Registry for message types. This closely mirrors a messages.FileDescriptor, but adds additional attributes (such as message and field descriptions) and some extra code for validation and cycle detection. """ # Type information from these two maps comes from here: # https://developers.google.com/discovery/v1/type-format PRIMITIVE_TYPE_INFO_MAP = { 'string': TypeInfo(type_name='string', variant=messages.StringField.DEFAULT_VARIANT), 'integer': TypeInfo(type_name='integer', variant=messages.IntegerField.DEFAULT_VARIANT), 'boolean': TypeInfo(type_name='boolean', variant=messages.BooleanField.DEFAULT_VARIANT), 'number': TypeInfo(type_name='number', variant=messages.FloatField.DEFAULT_VARIANT), 'any': TypeInfo(type_name='extra_types.JsonValue', variant=messages.Variant.MESSAGE), } PRIMITIVE_FORMAT_MAP = { 'int32': TypeInfo(type_name='integer', variant=messages.Variant.INT32), 'uint32': TypeInfo(type_name='integer', variant=messages.Variant.UINT32), 'int64': TypeInfo(type_name='string', variant=messages.Variant.INT64), 'uint64': TypeInfo(type_name='string', variant=messages.Variant.UINT64), 'double': TypeInfo(type_name='number', variant=messages.Variant.DOUBLE), 'float': TypeInfo(type_name='number', variant=messages.Variant.FLOAT), 'byte': TypeInfo(type_name='byte', variant=messages.BytesField.DEFAULT_VARIANT), 'date': TypeInfo(type_name='extra_types.DateField', variant=messages.Variant.STRING), 'date-time': TypeInfo( type_name=('apitools.base.protorpclite.message_types.' 'DateTimeMessage'), variant=messages.Variant.MESSAGE), } def __init__(self, client_info, names, description, root_package_dir, base_files_package, protorpc_package): self.__names = names self.__client_info = client_info self.__package = client_info.package self.__description = util.CleanDescription(description) self.__root_package_dir = root_package_dir self.__base_files_package = base_files_package self.__protorpc_package = protorpc_package self.__file_descriptor = extended_descriptor.ExtendedFileDescriptor( package=self.__package, description=self.__description) # Add required imports self.__file_descriptor.additional_imports = [ 'from %s import messages as _messages' % self.__protorpc_package, ] # Map from scoped names (i.e. Foo.Bar) to MessageDescriptors. self.__message_registry = collections.OrderedDict() # A set of types that we're currently adding (for cycle detection). self.__nascent_types = set() # A set of types for which we've seen a reference but no # definition; if this set is nonempty, validation fails. self.__unknown_types = set() # Used for tracking paths during message creation self.__current_path = [] # Where to register created messages self.__current_env = self.__file_descriptor # TODO(craigcitro): Add a `Finalize` method. @property def file_descriptor(self): self.Validate() return self.__file_descriptor def WriteProtoFile(self, printer): """Write the messages file to out as proto.""" self.Validate() extended_descriptor.WriteMessagesFile( self.__file_descriptor, self.__package, self.__client_info.version, printer) def WriteFile(self, printer): """Write the messages file to out.""" self.Validate() extended_descriptor.WritePythonFile( self.__file_descriptor, self.__package, self.__client_info.version, printer) def Validate(self): mysteries = self.__nascent_types or self.__unknown_types if mysteries: raise ValueError('Malformed MessageRegistry: %s' % mysteries) def __ComputeFullName(self, name): return '.'.join(map(six.text_type, self.__current_path[:] + [name])) def __AddImport(self, new_import): if new_import not in self.__file_descriptor.additional_imports: self.__file_descriptor.additional_imports.append(new_import) def __DeclareDescriptor(self, name): self.__nascent_types.add(self.__ComputeFullName(name)) def __RegisterDescriptor(self, new_descriptor): """Register the given descriptor in this registry.""" if not isinstance(new_descriptor, ( extended_descriptor.ExtendedMessageDescriptor, extended_descriptor.ExtendedEnumDescriptor)): raise ValueError('Cannot add descriptor of type %s' % ( type(new_descriptor),)) full_name = self.__ComputeFullName(new_descriptor.name) if full_name in self.__message_registry: raise ValueError( 'Attempt to re-register descriptor %s' % full_name) if full_name not in self.__nascent_types: raise ValueError('Directly adding types is not supported') new_descriptor.full_name = full_name self.__message_registry[full_name] = new_descriptor if isinstance(new_descriptor, extended_descriptor.ExtendedMessageDescriptor): self.__current_env.message_types.append(new_descriptor) elif isinstance(new_descriptor, extended_descriptor.ExtendedEnumDescriptor): self.__current_env.enum_types.append(new_descriptor) self.__unknown_types.discard(full_name) self.__nascent_types.remove(full_name) def LookupDescriptor(self, name): return self.__GetDescriptorByName(name) def LookupDescriptorOrDie(self, name): message_descriptor = self.LookupDescriptor(name) if message_descriptor is None: raise ValueError('No message descriptor named "%s"' % name) return message_descriptor def __GetDescriptor(self, name): return self.__GetDescriptorByName(self.__ComputeFullName(name)) def __GetDescriptorByName(self, name): if name in self.__message_registry: return self.__message_registry[name] if name in self.__nascent_types: raise ValueError( 'Cannot retrieve type currently being created: %s' % name) return None @contextlib.contextmanager def __DescriptorEnv(self, message_descriptor): # TODO(craigcitro): Typecheck? previous_env = self.__current_env self.__current_path.append(message_descriptor.name) self.__current_env = message_descriptor yield self.__current_path.pop() self.__current_env = previous_env def AddEnumDescriptor(self, name, description, enum_values, enum_descriptions): """Add a new EnumDescriptor named name with the given enum values.""" message = extended_descriptor.ExtendedEnumDescriptor() message.name = self.__names.ClassName(name) message.description = util.CleanDescription(description) self.__DeclareDescriptor(message.name) for index, (enum_name, enum_description) in enumerate( zip(enum_values, enum_descriptions)): enum_value = extended_descriptor.ExtendedEnumValueDescriptor() enum_value.name = self.__names.NormalizeEnumName(enum_name) if enum_value.name != enum_name: message.enum_mappings.append( extended_descriptor.ExtendedEnumDescriptor.JsonEnumMapping( python_name=enum_value.name, json_name=enum_name)) self.__AddImport('from %s import encoding' % self.__base_files_package) enum_value.number = index enum_value.description = util.CleanDescription( enum_description or '<no description>') message.values.append(enum_value) self.__RegisterDescriptor(message) def __DeclareMessageAlias(self, schema, alias_for): """Declare schema as an alias for alias_for.""" # TODO(craigcitro): This is a hack. Remove it. message = extended_descriptor.ExtendedMessageDescriptor() message.name = self.__names.ClassName(schema['id']) message.alias_for = alias_for self.__DeclareDescriptor(message.name) self.__AddImport('from %s import extra_types' % self.__base_files_package) self.__RegisterDescriptor(message) def __AddAdditionalProperties(self, message, schema, properties): """Add an additionalProperties field to message.""" additional_properties_info = schema['additionalProperties'] entries_type_name = self.__AddAdditionalPropertyType( message.name, additional_properties_info) description = util.CleanDescription( additional_properties_info.get('description')) if description is None: description = 'Additional properties of type %s' % message.name attrs = { 'items': { '$ref': entries_type_name, }, 'description': description, 'type': 'array', } field_name = 'additionalProperties' message.fields.append(self.__FieldDescriptorFromProperties( field_name, len(properties) + 1, attrs)) self.__AddImport('from %s import encoding' % self.__base_files_package) message.decorators.append( 'encoding.MapUnrecognizedFields(%r)' % field_name) def AddDescriptorFromSchema(self, schema_name, schema): """Add a new MessageDescriptor named schema_name based on schema.""" # TODO(craigcitro): Is schema_name redundant? if self.__GetDescriptor(schema_name): return if schema.get('enum'): self.__DeclareEnum(schema_name, schema) return if schema.get('type') == 'any': self.__DeclareMessageAlias(schema, 'extra_types.JsonValue') return if schema.get('type') != 'object': raise ValueError('Cannot create message descriptors for type %s' % schema.get('type')) message = extended_descriptor.ExtendedMessageDescriptor() message.name = self.__names.ClassName(schema['id']) message.description = util.CleanDescription(schema.get( 'description', 'A %s object.' % message.name)) self.__DeclareDescriptor(message.name) with self.__DescriptorEnv(message): properties = schema.get('properties', {}) for index, (name, attrs) in enumerate(sorted(properties.items())): field = self.__FieldDescriptorFromProperties( name, index + 1, attrs) message.fields.append(field) if field.name != name: message.field_mappings.append( type(message).JsonFieldMapping( python_name=field.name, json_name=name)) self.__AddImport( 'from %s import encoding' % self.__base_files_package) if 'additionalProperties' in schema: self.__AddAdditionalProperties(message, schema, properties) self.__RegisterDescriptor(message) def __AddAdditionalPropertyType(self, name, property_schema): """Add a new nested AdditionalProperty message.""" new_type_name = 'AdditionalProperty' property_schema = dict(property_schema) # We drop the description here on purpose, so the resulting # messages are less repetitive. property_schema.pop('description', None) description = 'An additional property for a %s object.' % name schema = { 'id': new_type_name, 'type': 'object', 'description': description, 'properties': { 'key': { 'type': 'string', 'description': 'Name of the additional property.', }, 'value': property_schema, }, } self.AddDescriptorFromSchema(new_type_name, schema) return new_type_name def __AddEntryType(self, entry_type_name, entry_schema, parent_name): """Add a type for a list entry.""" entry_schema.pop('description', None) description = 'Single entry in a %s.' % parent_name schema = { 'id': entry_type_name, 'type': 'object', 'description': description, 'properties': { 'entry': { 'type': 'array', 'items': entry_schema, }, }, } self.AddDescriptorFromSchema(entry_type_name, schema) return entry_type_name def __FieldDescriptorFromProperties(self, name, index, attrs): """Create a field descriptor for these attrs.""" field = descriptor.FieldDescriptor() field.name = self.__names.CleanName(name) field.number = index field.label = self.__ComputeLabel(attrs) new_type_name_hint = self.__names.ClassName( '%sValue' % self.__names.ClassName(name)) type_info = self.__GetTypeInfo(attrs, new_type_name_hint) field.type_name = type_info.type_name field.variant = type_info.variant if 'default' in attrs: # TODO(craigcitro): Correctly handle non-primitive default values. default = attrs['default'] if not (field.type_name == 'string' or field.variant == messages.Variant.ENUM): default = str(json.loads(default)) if field.variant == messages.Variant.ENUM: default = self.__names.NormalizeEnumName(default) field.default_value = default extended_field = extended_descriptor.ExtendedFieldDescriptor() extended_field.name = field.name extended_field.description = util.CleanDescription( attrs.get('description', 'A %s attribute.' % field.type_name)) extended_field.field_descriptor = field return extended_field @staticmethod def __ComputeLabel(attrs): if attrs.get('required', False): return descriptor.FieldDescriptor.Label.REQUIRED elif attrs.get('type') == 'array': return descriptor.FieldDescriptor.Label.REPEATED elif attrs.get('repeated'): return descriptor.FieldDescriptor.Label.REPEATED return descriptor.FieldDescriptor.Label.OPTIONAL def __DeclareEnum(self, enum_name, attrs): description = util.CleanDescription(attrs.get('description', '')) enum_values = attrs['enum'] enum_descriptions = attrs.get( 'enumDescriptions', [''] * len(enum_values)) self.AddEnumDescriptor(enum_name, description, enum_values, enum_descriptions) self.__AddIfUnknown(enum_name) return TypeInfo(type_name=enum_name, variant=messages.Variant.ENUM) def __AddIfUnknown(self, type_name): type_name = self.__names.ClassName(type_name) full_type_name = self.__ComputeFullName(type_name) if (full_type_name not in self.__message_registry.keys() and type_name not in self.__message_registry.keys()): self.__unknown_types.add(type_name) def __GetTypeInfo(self, attrs, name_hint): """Return a TypeInfo object for attrs, creating one if needed.""" type_ref = self.__names.ClassName(attrs.get('$ref')) type_name = attrs.get('type') if not (type_ref or type_name): raise ValueError('No type found for %s' % attrs) if type_ref: self.__AddIfUnknown(type_ref) # We don't actually know this is a message -- it might be an # enum. However, we can't check that until we've created all the # types, so we come back and fix this up later. return TypeInfo( type_name=type_ref, variant=messages.Variant.MESSAGE) if 'enum' in attrs: enum_name = '%sValuesEnum' % name_hint return self.__DeclareEnum(enum_name, attrs) if 'format' in attrs: type_info = self.PRIMITIVE_FORMAT_MAP.get(attrs['format']) if type_info is None: # If we don't recognize the format, the spec says we fall back # to just using the type name. if type_name in self.PRIMITIVE_TYPE_INFO_MAP: return self.PRIMITIVE_TYPE_INFO_MAP[type_name] raise ValueError('Unknown type/format "%s"/"%s"' % ( attrs['format'], type_name)) if type_info.type_name.startswith(( 'apitools.base.protorpclite.message_types.', 'message_types.')): self.__AddImport( 'from %s import message_types as _message_types' % self.__protorpc_package) if type_info.type_name.startswith('extra_types.'): self.__AddImport( 'from %s import extra_types' % self.__base_files_package) return type_info if type_name in self.PRIMITIVE_TYPE_INFO_MAP: type_info = self.PRIMITIVE_TYPE_INFO_MAP[type_name] if type_info.type_name.startswith('extra_types.'): self.__AddImport( 'from %s import extra_types' % self.__base_files_package) return type_info if type_name == 'array': items = attrs.get('items') if not items: raise ValueError('Array type with no item type: %s' % attrs) entry_name_hint = self.__names.ClassName( items.get('title') or '%sListEntry' % name_hint) entry_label = self.__ComputeLabel(items) if entry_label == descriptor.FieldDescriptor.Label.REPEATED: parent_name = self.__names.ClassName( items.get('title') or name_hint) entry_type_name = self.__AddEntryType( entry_name_hint, items.get('items'), parent_name) return TypeInfo(type_name=entry_type_name, variant=messages.Variant.MESSAGE) return self.__GetTypeInfo(items, entry_name_hint) elif type_name == 'any': self.__AddImport('from %s import extra_types' % self.__base_files_package) return self.PRIMITIVE_TYPE_INFO_MAP['any'] elif type_name == 'object': # TODO(craigcitro): Think of a better way to come up with names. if not name_hint: raise ValueError( 'Cannot create subtype without some name hint') schema = dict(attrs) schema['id'] = name_hint self.AddDescriptorFromSchema(name_hint, schema) self.__AddIfUnknown(name_hint) return TypeInfo( type_name=name_hint, variant=messages.Variant.MESSAGE) raise ValueError('Unknown type: %s' % type_name) def FixupMessageFields(self): for message_type in self.file_descriptor.message_types: self._FixupMessage(message_type) def _FixupMessage(self, message_type): with self.__DescriptorEnv(message_type): for field in message_type.fields: if field.field_descriptor.variant == messages.Variant.MESSAGE: field_type_name = field.field_descriptor.type_name field_type = self.LookupDescriptor(field_type_name) if isinstance(field_type, extended_descriptor.ExtendedEnumDescriptor): field.field_descriptor.variant = messages.Variant.ENUM for submessage_type in message_type.message_types: self._FixupMessage(submessage_type) apitools/gen/gen_client_test.py 0000644 00000014132 15025176453 0012700 0 ustar 00 # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test for gen_client module.""" import os import unittest from apitools.gen import gen_client from apitools.gen import test_utils def GetTestDataPath(*path): return os.path.join(os.path.dirname(__file__), 'testdata', *path) def _GetContent(file_path): with open(file_path) as f: return f.read() class ClientGenCliTest(unittest.TestCase): def testHelp_NotEnoughArguments(self): with self.assertRaisesRegex(SystemExit, '0'): with test_utils.CaptureOutput() as (_, err): gen_client.main([gen_client.__file__, '-h']) err_output = err.getvalue() self.assertIn('usage:', err_output) self.assertIn('error: too few arguments', err_output) def testGenClient_SimpleDocNoInit(self): with test_utils.TempDir() as tmp_dir_path: gen_client.main([ gen_client.__file__, '--init-file', 'none', '--infile', GetTestDataPath('dns', 'dns_v1.json'), '--outdir', tmp_dir_path, '--overwrite', '--root_package', 'google.apis', 'client' ]) expected_files = ( set(['dns_v1_client.py', 'dns_v1_messages.py'])) self.assertEqual(expected_files, set(os.listdir(tmp_dir_path))) def testGenClient_SimpleDocEmptyInit(self): with test_utils.TempDir() as tmp_dir_path: gen_client.main([ gen_client.__file__, '--init-file', 'empty', '--infile', GetTestDataPath('dns', 'dns_v1.json'), '--outdir', tmp_dir_path, '--overwrite', '--root_package', 'google.apis', 'client' ]) expected_files = ( set(['dns_v1_client.py', 'dns_v1_messages.py', '__init__.py'])) self.assertEqual(expected_files, set(os.listdir(tmp_dir_path))) init_file = _GetContent(os.path.join(tmp_dir_path, '__init__.py')) self.assertEqual("""\"""Package marker file.\""" from __future__ import absolute_import import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) """, init_file) def testGenClient_SimpleDocWithV4(self): with test_utils.TempDir() as tmp_dir_path: gen_client.main([ gen_client.__file__, '--infile', GetTestDataPath('dns', 'dns_v1.json'), '--outdir', tmp_dir_path, '--overwrite', '--apitools_version', '0.4.12', '--root_package', 'google.apis', 'client' ]) self.assertEqual( set(['dns_v1_client.py', 'dns_v1_messages.py', '__init__.py']), set(os.listdir(tmp_dir_path))) def testGenClient_SimpleDocWithV5(self): with test_utils.TempDir() as tmp_dir_path: gen_client.main([ gen_client.__file__, '--infile', GetTestDataPath('dns', 'dns_v1.json'), '--outdir', tmp_dir_path, '--overwrite', '--apitools_version', '0.5.0', '--root_package', 'google.apis', 'client' ]) self.assertEqual( set(['dns_v1_client.py', 'dns_v1_messages.py', '__init__.py']), set(os.listdir(tmp_dir_path))) def testGenClient_ApiVersioning(self): with test_utils.TempDir() as tmp_dir_path: gen_client.main([ gen_client.__file__, '--infile', GetTestDataPath( 'dns', 'dns_2015-08-07-preview.json'), '--outdir', tmp_dir_path, '--overwrite', '--version-identifier', 'v2015_08_07_preview', '--root_package', 'google.apis', 'client' ]) self.assertEqual( set([ 'dns_v2015_08_07_preview_client.py', 'dns_v2015_08_07_preview_messages.py', '__init__.py']), set(os.listdir(tmp_dir_path))) client_file = _GetContent( os.path.join(tmp_dir_path, 'dns_v2015_08_07_preview_client.py')) # Check that "apiVersion" system parameter values from discovery doc # appear in generated client. self.assertIn('2015-01-01-preview', client_file) self.assertIn('2015-02-02-preview', client_file) self.assertIn('2015-03-03-preview', client_file) def testGenPipPackage_SimpleDoc(self): with test_utils.TempDir() as tmp_dir_path: gen_client.main([ gen_client.__file__, '--infile', GetTestDataPath('dns', 'dns_v1.json'), '--outdir', tmp_dir_path, '--overwrite', '--root_package', 'google.apis', 'pip_package' ]) self.assertEqual( set(['apitools', 'setup.py']), set(os.listdir(tmp_dir_path))) def testGenProto_SimpleDoc(self): with test_utils.TempDir() as tmp_dir_path: gen_client.main([ gen_client.__file__, '--infile', GetTestDataPath('dns', 'dns_v1.json'), '--outdir', tmp_dir_path, '--overwrite', '--root_package', 'google.apis', 'proto' ]) self.assertEqual( set(['dns_v1_messages.proto', 'dns_v1_services.proto']), set(os.listdir(tmp_dir_path))) apitools/gen/util_test.py 0000644 00000005650 15025176453 0011553 0 ustar 00 #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for util.""" import codecs import gzip import os import six.moves.urllib.request as urllib_request import tempfile import unittest from apitools.gen import util from mock import patch class NormalizeVersionTest(unittest.TestCase): def testVersions(self): already_valid = 'v1' self.assertEqual(already_valid, util.NormalizeVersion(already_valid)) to_clean = 'v0.1' self.assertEqual('v0_1', util.NormalizeVersion(to_clean)) class NamesTest(unittest.TestCase): def testKeywords(self): names = util.Names(['']) self.assertEqual('in_', names.CleanName('in')) def testNormalizeEnumName(self): names = util.Names(['']) self.assertEqual('_0', names.NormalizeEnumName('0')) class MockRequestResponse(): """Mocks the behavior of urllib.response.""" class MockRequestEncoding(): def __init__(self, encoding): self.encoding = encoding def get(self, _): return self.encoding def __init__(self, content, encoding): self.content = content self.encoding = MockRequestResponse.MockRequestEncoding(encoding) def info(self): return self.encoding def read(self): return self.content def _Gzip(raw_content): """Returns gzipped content from any content.""" f = tempfile.NamedTemporaryFile(suffix='gz', mode='wb', delete=False) f.close() try: with gzip.open(f.name, 'wb') as h: h.write(raw_content) with open(f.name, 'rb') as h: return h.read() finally: os.unlink(f.name) class GetURLContentTest(unittest.TestCase): def testUnspecifiedContentEncoding(self): data = 'regular non-gzipped content' with patch.object(urllib_request, 'urlopen', return_value=MockRequestResponse(data, '')): self.assertEqual(data, util._GetURLContent('unused_url_parameter')) def testGZippedContent(self): data = u'¿Hola qué tal?' compressed_data = _Gzip(data.encode('utf-8')) with patch.object(urllib_request, 'urlopen', return_value=MockRequestResponse( compressed_data, 'gzip')): self.assertEqual(data, util._GetURLContent( 'unused_url_parameter').decode('utf-8')) apitools/gen/service_registry.py 0000644 00000055011 15025176453 0013123 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Service registry for apitools.""" import collections import logging import re import textwrap from apitools.base.py import base_api from apitools.gen import util # We're a code generator. I don't care. # pylint:disable=too-many-statements _MIME_PATTERN_RE = re.compile(r'(?i)[a-z0-9_*-]+/[a-z0-9_*-]+') class ServiceRegistry(object): """Registry for service types.""" def __init__(self, client_info, message_registry, names, root_package, base_files_package, unelidable_request_methods): self.__client_info = client_info self.__package = client_info.package self.__names = names self.__service_method_info_map = collections.OrderedDict() self.__message_registry = message_registry self.__root_package = root_package self.__base_files_package = base_files_package self.__unelidable_request_methods = unelidable_request_methods self.__all_scopes = set(self.__client_info.scopes) def Validate(self): self.__message_registry.Validate() @property def scopes(self): return sorted(list(self.__all_scopes)) def __GetServiceClassName(self, service_name): return self.__names.ClassName( '%sService' % self.__names.ClassName(service_name)) def __PrintDocstring(self, printer, method_info, method_name, name): """Print a docstring for a service method.""" if method_info.description: description = util.CleanDescription(method_info.description) first_line, newline, remaining = method_info.description.partition( '\n') if not first_line.endswith('.'): first_line = '%s.' % first_line description = '%s%s%s' % (first_line, newline, remaining) else: description = '%s method for the %s service.' % (method_name, name) with printer.CommentContext(): printer('r"""%s' % description) printer() printer('Args:') printer(' request: (%s) input message', method_info.request_type_name) printer(' global_params: (StandardQueryParameters, default: None) ' 'global arguments') if method_info.upload_config: printer(' upload: (Upload, default: None) If present, upload') printer(' this stream with the request.') if method_info.supports_download: printer( ' download: (Download, default: None) If present, download') printer(' data from the request via this stream.') printer('Returns:') printer(' (%s) The response message.', method_info.response_type_name) printer('"""') def __WriteSingleService( self, printer, name, method_info_map, client_class_name): printer() class_name = self.__GetServiceClassName(name) printer('class %s(base_api.BaseApiService):', class_name) with printer.Indent(): printer('"""Service class for the %s resource."""', name) printer() printer('_NAME = %s', repr(name)) # Print the configs for the methods first. printer() printer('def __init__(self, client):') with printer.Indent(): printer('super(%s.%s, self).__init__(client)', client_class_name, class_name) printer('self._upload_configs = {') with printer.Indent(indent=' '): for method_name, method_info in method_info_map.items(): upload_config = method_info.upload_config if upload_config is not None: printer( "'%s': base_api.ApiUploadInfo(", method_name) with printer.Indent(indent=' '): attrs = sorted( x.name for x in upload_config.all_fields()) for attr in attrs: printer('%s=%r,', attr, getattr(upload_config, attr)) printer('),') printer('}') # Now write each method in turn. for method_name, method_info in method_info_map.items(): printer() params = ['self', 'request', 'global_params=None'] if method_info.upload_config: params.append('upload=None') if method_info.supports_download: params.append('download=None') printer('def %s(%s):', method_name, ', '.join(params)) with printer.Indent(): self.__PrintDocstring( printer, method_info, method_name, name) printer("config = self.GetMethodConfig('%s')", method_name) upload_config = method_info.upload_config if upload_config is not None: printer("upload_config = self.GetUploadConfig('%s')", method_name) arg_lines = [ 'config, request, global_params=global_params'] if method_info.upload_config: arg_lines.append( 'upload=upload, upload_config=upload_config') if method_info.supports_download: arg_lines.append('download=download') printer('return self._RunMethod(') with printer.Indent(indent=' '): for line in arg_lines[:-1]: printer('%s,', line) printer('%s)', arg_lines[-1]) printer() printer('{0}.method_config = lambda: base_api.ApiMethodInfo(' .format(method_name)) with printer.Indent(indent=' '): method_info = method_info_map[method_name] attrs = sorted( x.name for x in method_info.all_fields()) for attr in attrs: if attr in ('upload_config', 'description'): continue value = getattr(method_info, attr) if value is not None: printer('%s=%r,', attr, value) printer(')') def __WriteProtoServiceDeclaration(self, printer, name, method_info_map): """Write a single service declaration to a proto file.""" printer() printer('service %s {', self.__GetServiceClassName(name)) with printer.Indent(): for method_name, method_info in method_info_map.items(): for line in textwrap.wrap(method_info.description, printer.CalculateWidth() - 3): printer('// %s', line) printer('rpc %s (%s) returns (%s);', method_name, method_info.request_type_name, method_info.response_type_name) printer('}') def WriteProtoFile(self, printer): """Write the services in this registry to out as proto.""" self.Validate() client_info = self.__client_info printer('// Generated services for %s version %s.', client_info.package, client_info.version) printer() printer('syntax = "proto2";') printer('package %s;', self.__package) printer('import "%s";', client_info.messages_proto_file_name) printer() for name, method_info_map in self.__service_method_info_map.items(): self.__WriteProtoServiceDeclaration(printer, name, method_info_map) def WriteFile(self, printer): """Write the services in this registry to out.""" self.Validate() client_info = self.__client_info printer('"""Generated client library for %s version %s."""', client_info.package, client_info.version) printer('# NOTE: This file is autogenerated and should not be edited ' 'by hand.') printer() printer('from __future__ import absolute_import') printer() printer('from %s import base_api', self.__base_files_package) if self.__root_package: import_prefix = 'from {0} '.format(self.__root_package) else: import_prefix = '' printer('%simport %s as messages', import_prefix, client_info.messages_rule_name) printer() printer() printer('class %s(base_api.BaseApiClient):', client_info.client_class_name) with printer.Indent(): printer( '"""Generated client library for service %s version %s."""', client_info.package, client_info.version) printer() printer('MESSAGES_MODULE = messages') printer('BASE_URL = {0!r}'.format(client_info.base_url)) printer('MTLS_BASE_URL = {0!r}'.format(client_info.mtls_base_url)) printer() printer('_PACKAGE = {0!r}'.format(client_info.package)) printer('_SCOPES = {0!r}'.format( client_info.scopes or ['https://www.googleapis.com/auth/userinfo.email'])) printer('_VERSION = {0!r}'.format(client_info.version)) printer('_CLIENT_ID = {0!r}'.format(client_info.client_id)) printer('_CLIENT_SECRET = {0!r}'.format(client_info.client_secret)) printer('_USER_AGENT = {0!r}'.format(client_info.user_agent)) printer('_CLIENT_CLASS_NAME = {0!r}'.format( client_info.client_class_name)) printer('_URL_VERSION = {0!r}'.format(client_info.url_version)) printer('_API_KEY = {0!r}'.format(client_info.api_key)) printer() printer("def __init__(self, url='', credentials=None,") with printer.Indent(indent=' '): printer('get_credentials=True, http=None, model=None,') printer('log_request=False, log_response=False,') printer('credentials_args=None, default_global_params=None,') printer('additional_http_headers=None, ' 'response_encoding=None):') with printer.Indent(): printer('"""Create a new %s handle."""', client_info.package) printer('url = url or self.BASE_URL') printer( 'super(%s, self).__init__(', client_info.client_class_name) printer(' url, credentials=credentials,') printer(' get_credentials=get_credentials, http=http, ' 'model=model,') printer(' log_request=log_request, ' 'log_response=log_response,') printer(' credentials_args=credentials_args,') printer(' default_global_params=default_global_params,') printer(' additional_http_headers=additional_http_headers,') printer(' response_encoding=response_encoding)') for name in self.__service_method_info_map.keys(): printer('self.%s = self.%s(self)', name, self.__GetServiceClassName(name)) for name, method_info in self.__service_method_info_map.items(): self.__WriteSingleService( printer, name, method_info, client_info.client_class_name) def __RegisterService(self, service_name, method_info_map): if service_name in self.__service_method_info_map: raise ValueError( 'Attempt to re-register descriptor %s' % service_name) self.__service_method_info_map[service_name] = method_info_map def __CreateRequestType(self, method_description, body_type=None): """Create a request type for this method.""" schema = {} schema['id'] = self.__names.ClassName('%sRequest' % ( self.__names.ClassName(method_description['id'], separator='.'),)) schema['type'] = 'object' schema['properties'] = collections.OrderedDict() if 'parameterOrder' not in method_description: ordered_parameters = list(method_description.get('parameters', [])) else: ordered_parameters = method_description['parameterOrder'][:] for k in method_description['parameters']: if k not in ordered_parameters: ordered_parameters.append(k) for parameter_name in ordered_parameters: field = dict(method_description['parameters'][parameter_name]) if 'type' not in field: raise ValueError('No type found in parameter %s' % field) schema['properties'][parameter_name] = field if body_type is not None: body_field_name = self.__GetRequestField( method_description, body_type) if body_field_name in schema['properties']: raise ValueError('Failed to normalize request resource name') if 'description' not in body_type: body_type['description'] = ( 'A %s resource to be passed as the request body.' % ( self.__GetRequestType(body_type),)) schema['properties'][body_field_name] = body_type self.__message_registry.AddDescriptorFromSchema(schema['id'], schema) return schema['id'] def __CreateVoidResponseType(self, method_description): """Create an empty response type.""" schema = {} method_name = self.__names.ClassName( method_description['id'], separator='.') schema['id'] = self.__names.ClassName('%sResponse' % method_name) schema['type'] = 'object' schema['description'] = 'An empty %s response.' % method_name self.__message_registry.AddDescriptorFromSchema(schema['id'], schema) return schema['id'] def __NeedRequestType(self, method_description, request_type): """Determine if this method needs a new request type created.""" if not request_type: return True method_id = method_description.get('id', '') if method_id in self.__unelidable_request_methods: return True message = self.__message_registry.LookupDescriptorOrDie(request_type) if message is None: return True field_names = [x.name for x in message.fields] parameters = method_description.get('parameters', {}) for param_name, param_info in parameters.items(): if (param_info.get('location') != 'path' or self.__names.CleanName(param_name) not in field_names): break else: return False return True def __MaxSizeToInt(self, max_size): """Convert max_size to an int.""" size_groups = re.match(r'(?P<size>\d+)(?P<unit>.B)?$', max_size) if size_groups is None: raise ValueError('Could not parse maxSize') size, unit = size_groups.group('size', 'unit') shift = 0 if unit is not None: unit_dict = {'KB': 10, 'MB': 20, 'GB': 30, 'TB': 40} shift = unit_dict.get(unit.upper()) if shift is None: raise ValueError('Unknown unit %s' % unit) return int(size) * (1 << shift) def __ComputeUploadConfig(self, media_upload_config, method_id): """Fill out the upload config for this method.""" config = base_api.ApiUploadInfo() if 'maxSize' in media_upload_config: config.max_size = self.__MaxSizeToInt( media_upload_config['maxSize']) if 'accept' not in media_upload_config: logging.warning( 'No accept types found for upload configuration in ' 'method %s, using */*', method_id) config.accept.extend([ str(a) for a in media_upload_config.get('accept', '*/*')]) for accept_pattern in config.accept: if not _MIME_PATTERN_RE.match(accept_pattern): logging.warning('Unexpected MIME type: %s', accept_pattern) protocols = media_upload_config.get('protocols', {}) for protocol in ('simple', 'resumable'): media = protocols.get(protocol, {}) for attr in ('multipart', 'path'): if attr in media: setattr(config, '%s_%s' % (protocol, attr), media[attr]) return config def __ComputeMethodInfo(self, method_description, request, response, request_field): """Compute the base_api.ApiMethodInfo for this method.""" relative_path = self.__names.NormalizeRelativePath( ''.join((self.__client_info.base_path, method_description['path']))) method_id = method_description['id'] ordered_params = [] for param_name in method_description.get('parameterOrder', []): param_info = method_description['parameters'][param_name] if param_info.get('required', False): ordered_params.append(param_name) method_info = base_api.ApiMethodInfo( relative_path=relative_path, method_id=method_id, http_method=method_description['httpMethod'], description=util.CleanDescription( method_description.get('description', '')), query_params=[], path_params=[], ordered_params=ordered_params, request_type_name=self.__names.ClassName(request), response_type_name=self.__names.ClassName(response), request_field=request_field, ) flat_path = method_description.get('flatPath', None) if flat_path is not None: flat_path = self.__names.NormalizeRelativePath( self.__client_info.base_path + flat_path) if flat_path != relative_path: method_info.flat_path = flat_path if method_description.get('supportsMediaUpload', False): method_info.upload_config = self.__ComputeUploadConfig( method_description.get('mediaUpload'), method_id) method_info.supports_download = method_description.get( 'supportsMediaDownload', False) if method_description.get('apiVersion'): method_info.api_version_param = method_description.get('apiVersion') self.__all_scopes.update(method_description.get('scopes', ())) for param, desc in method_description.get('parameters', {}).items(): param = self.__names.CleanName(param) location = desc['location'] if location == 'query': method_info.query_params.append(param) elif location == 'path': method_info.path_params.append(param) else: raise ValueError( 'Unknown parameter location %s for parameter %s' % ( location, param)) method_info.path_params.sort() method_info.query_params.sort() return method_info def __BodyFieldName(self, body_type): if body_type is None: return '' return self.__names.FieldName(body_type['$ref']) def __GetRequestType(self, body_type): return self.__names.ClassName(body_type.get('$ref')) def __GetRequestField(self, method_description, body_type): """Determine the request field for this method.""" body_field_name = self.__BodyFieldName(body_type) if body_field_name in method_description.get('parameters', {}): body_field_name = self.__names.FieldName( '%s_resource' % body_field_name) # It's exceedingly unlikely that we'd get two name collisions, which # means it's bound to happen at some point. while body_field_name in method_description.get('parameters', {}): body_field_name = self.__names.FieldName( '%s_body' % body_field_name) return body_field_name def AddServiceFromResource(self, service_name, methods): """Add a new service named service_name with the given methods.""" service_name = self.__names.CleanName(service_name) method_descriptions = methods.get('methods', {}) method_info_map = collections.OrderedDict() items = sorted(method_descriptions.items()) for method_name, method_description in items: method_name = self.__names.MethodName(method_name) # NOTE: According to the discovery document, if the request or # response is present, it will simply contain a `$ref`. body_type = method_description.get('request') if body_type is None: request_type = None else: request_type = self.__GetRequestType(body_type) if self.__NeedRequestType(method_description, request_type): request = self.__CreateRequestType( method_description, body_type=body_type) request_field = self.__GetRequestField( method_description, body_type) else: request = request_type request_field = base_api.REQUEST_IS_BODY if 'response' in method_description: response = method_description['response']['$ref'] else: response = self.__CreateVoidResponseType(method_description) method_info_map[method_name] = self.__ComputeMethodInfo( method_description, request, response, request_field) nested_services = methods.get('resources', {}) services = sorted(nested_services.items()) for subservice_name, submethods in services: new_service_name = '%s_%s' % (service_name, subservice_name) self.AddServiceFromResource(new_service_name, submethods) self.__RegisterService(service_name, method_info_map) apitools/gen/testdata/dns/dns_2015-08-07-preview.json 0000644 00000057126 15025176453 0016045 0 ustar 00 { "kind": "discovery#restDescription", "discoveryVersion": "v1", "id": "dns:2015-08-07-preview", "name": "dns", "version": "2015-08-07-preview", "revision": "20150807", "title": "Google Cloud DNS API", "description": "The Google Cloud DNS API provides services for configuring and serving authoritative DNS records.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "http://www.google.com/images/icons/product/search-16.gif", "x32": "http://www.google.com/images/icons/product/search-32.gif" }, "documentationLink": "https://developers.google.com/cloud-dns", "protocol": "rest", "baseUrl": "https://www.googleapis.com/dns/v1/projects/", "basePath": "/dns/v1/projects/", "rootUrl": "https://www.googleapis.com/", "servicePath": "dns/v1/projects/", "batchPath": "batch", "parameters": { "alt": { "type": "string", "description": "Data format for the response.", "default": "json", "enum": [ "json" ], "enumDescriptions": [ "Responses with Content-Type of application/json" ], "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", "location": "query" }, "userIp": { "type": "string", "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/cloud-platform.read-only": { "description": "MESSAGE UNDER CONSTRUCTION View your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/ndev.clouddns.readonly": { "description": "View your DNS records hosted by Google Cloud DNS" }, "https://www.googleapis.com/auth/ndev.clouddns.readwrite": { "description": "View and manage your DNS records hosted by Google Cloud DNS" } } } }, "schemas": { "Change": { "id": "Change", "type": "object", "description": "An atomic update to a collection of ResourceRecordSets.", "properties": { "additions": { "type": "array", "description": "Which ResourceRecordSets to add?", "items": { "$ref": "ResourceRecordSet" } }, "deletions": { "type": "array", "description": "Which ResourceRecordSets to remove? Must match existing data exactly.", "items": { "$ref": "ResourceRecordSet" } }, "id": { "type": "string", "description": "Unique identifier for the resource; defined by the server (output only)." }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#change\".", "default": "dns#change" }, "startTime": { "type": "string", "description": "The time that this operation was started by the server. This is in RFC3339 text format." }, "status": { "type": "string", "description": "Status of the operation (output only).", "enum": [ "done", "pending" ], "enumDescriptions": [ "", "" ] } } }, "ChangesListResponse": { "id": "ChangesListResponse", "type": "object", "description": "The response to a request to enumerate Changes to a ResourceRecordSets collection.", "properties": { "changes": { "type": "array", "description": "The requested changes.", "items": { "$ref": "Change" } }, "kind": { "type": "string", "description": "Type of resource.", "default": "dns#changesListResponse" }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a \"snapshot\" of collections larger than the maximum page size." } } }, "ManagedZone": { "id": "ManagedZone", "type": "object", "description": "A zone is a subtree of the DNS namespace under one administrative responsibility. A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service.", "properties": { "creationTime": { "type": "string", "description": "The time that this resource was created on the server. This is in RFC3339 text format. Output only." }, "description": { "type": "string", "description": "A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the managed zone's function." }, "dnsName": { "type": "string", "description": "The DNS name of this managed zone, for instance \"example.com.\"." }, "id": { "type": "string", "description": "Unique identifier for the resource; defined by the server (output only)", "format": "uint64" }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#managedZone\".", "default": "dns#managedZone" }, "name": { "type": "string", "description": "User assigned name for this resource. Must be unique within the project. The name must be 1-32 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes." }, "nameServerSet": { "type": "string", "description": "Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset." }, "nameServers": { "type": "array", "description": "Delegate your managed_zone to these virtual name servers; defined by the server (output only)", "items": { "type": "string" } } } }, "ManagedZonesListResponse": { "id": "ManagedZonesListResponse", "type": "object", "properties": { "kind": { "type": "string", "description": "Type of resource.", "default": "dns#managedZonesListResponse" }, "managedZones": { "type": "array", "description": "The managed zone resources.", "items": { "$ref": "ManagedZone" } }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size." } } }, "Project": { "id": "Project", "type": "object", "description": "A project resource. The project is a top level container for resources including Cloud DNS ManagedZones. Projects can be created only in the APIs console.", "properties": { "id": { "type": "string", "description": "User assigned unique identifier for the resource (output only)." }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#project\".", "default": "dns#project" }, "number": { "type": "string", "description": "Unique numeric identifier for the resource; defined by the server (output only).", "format": "uint64" }, "quota": { "$ref": "Quota", "description": "Quotas assigned to this project (output only)." } } }, "Quota": { "id": "Quota", "type": "object", "description": "Limits associated with a Project.", "properties": { "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#quota\".", "default": "dns#quota" }, "managedZones": { "type": "integer", "description": "Maximum allowed number of managed zones in the project.", "format": "int32" }, "resourceRecordsPerRrset": { "type": "integer", "description": "Maximum allowed number of ResourceRecords per ResourceRecordSet.", "format": "int32" }, "rrsetAdditionsPerChange": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets to add per ChangesCreateRequest.", "format": "int32" }, "rrsetDeletionsPerChange": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets to delete per ChangesCreateRequest.", "format": "int32" }, "rrsetsPerManagedZone": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets per zone in the project.", "format": "int32" }, "totalRrdataSizePerChange": { "type": "integer", "description": "Maximum allowed size for total rrdata in one ChangesCreateRequest in bytes.", "format": "int32" } } }, "ResourceRecordSet": { "id": "ResourceRecordSet", "type": "object", "description": "A unit of data that will be returned by the DNS servers.", "properties": { "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#resourceRecordSet\".", "default": "dns#resourceRecordSet" }, "name": { "type": "string", "description": "For example, www.example.com." }, "rrdatas": { "type": "array", "description": "As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1).", "items": { "type": "string" } }, "ttl": { "type": "integer", "description": "Number of seconds that this ResourceRecordSet can be cached by resolvers.", "format": "int32" }, "type": { "type": "string", "description": "The identifier of a supported record type, for example, A, AAAA, MX, TXT, and so on." } } }, "ResourceRecordSetsListResponse": { "id": "ResourceRecordSetsListResponse", "type": "object", "properties": { "kind": { "type": "string", "description": "Type of resource.", "default": "dns#resourceRecordSetsListResponse" }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size." }, "rrsets": { "type": "array", "description": "The resource record set resources.", "items": { "$ref": "ResourceRecordSet" } } } } }, "resources": { "changes": { "methods": { "create": { "id": "dns.changes.create", "path": "{project}/managedZones/{managedZone}/changes", "apiVersion": "2015-01-01-preview", "httpMethod": "POST", "description": "Atomically update the ResourceRecordSet collection.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "request": { "$ref": "Change" }, "response": { "$ref": "Change" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "get": { "id": "dns.changes.get", "path": "{project}/managedZones/{managedZone}/changes/{changeId}", "apiVersion": "2015-01-01-preview", "httpMethod": "GET", "description": "Fetch the representation of an existing Change.", "parameters": { "changeId": { "type": "string", "description": "The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse.", "required": true, "location": "path" }, "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone", "changeId" ], "response": { "$ref": "Change" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "list": { "id": "dns.changes.list", "path": "{project}/managedZones/{managedZone}/changes", "apiVersion": "2015-01-01-preview", "httpMethod": "GET", "description": "Enumerate Changes to a ResourceRecordSet collection.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" }, "sortBy": { "type": "string", "description": "Sorting criterion. The only supported value is change sequence.", "default": "changeSequence", "enum": [ "changeSequence" ], "enumDescriptions": [ "" ], "location": "query" }, "sortOrder": { "type": "string", "description": "Sorting order direction: 'ascending' or 'descending'.", "location": "query" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ChangesListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "managedZones": { "methods": { "create": { "id": "dns.managedZones.create", "path": "{project}/managedZones", "apiVersion": "2015-01-01-preview", "httpMethod": "POST", "description": "Create a new ManagedZone.", "parameters": { "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "request": { "$ref": "ManagedZone" }, "response": { "$ref": "ManagedZone" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "delete": { "id": "dns.managedZones.delete", "path": "{project}/managedZones/{managedZone}", "apiVersion": "2015-01-01-preview", "httpMethod": "DELETE", "description": "Delete a previously created ManagedZone.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "get": { "id": "dns.managedZones.get", "path": "{project}/managedZones/{managedZone}", "apiVersion": "2015-01-01-preview", "httpMethod": "GET", "description": "Fetch the representation of an existing ManagedZone.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ManagedZone" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "list": { "id": "dns.managedZones.list", "path": "{project}/managedZones", "apiVersion": "2015-02-02-preview", "httpMethod": "GET", "description": "Enumerate ManagedZones that have been created but not yet deleted.", "parameters": { "dnsName": { "type": "string", "description": "Restricts the list to return only zones with this domain name.", "location": "query" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "response": { "$ref": "ManagedZonesListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "projects": { "methods": { "get": { "id": "dns.projects.get", "path": "{project}", "apiVersion": "2015-03-03-preview", "httpMethod": "GET", "description": "Fetch the representation of an existing Project.", "parameters": { "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "response": { "$ref": "Project" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "resourceRecordSets": { "methods": { "list": { "id": "dns.resourceRecordSets.list", "path": "{project}/managedZones/{managedZone}/rrsets", "apiVersion": "2015-03-03-preview", "httpMethod": "GET", "description": "Enumerate ResourceRecordSets that have been created but not yet deleted.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "name": { "type": "string", "description": "Restricts the list to return only records with this fully qualified domain name.", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" }, "type": { "type": "string", "description": "Restricts the list to return only records of this type. If present, the \"name\" parameter must also be present.", "location": "query" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ResourceRecordSetsListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } } } } apitools/gen/testdata/dns/dns_v1.json 0000644 00000056305 15025176453 0013652 0 ustar 00 { "kind": "discovery#restDescription", "discoveryVersion": "v1", "id": "dns:v1", "name": "dns", "version": "v1", "revision": "20150807", "title": "Google Cloud DNS API", "description": "The Google Cloud DNS API provides services for configuring and serving authoritative DNS records.", "ownerDomain": "google.com", "ownerName": "Google", "icons": { "x16": "http://www.google.com/images/icons/product/search-16.gif", "x32": "http://www.google.com/images/icons/product/search-32.gif" }, "documentationLink": "https://developers.google.com/cloud-dns", "protocol": "rest", "baseUrl": "https://www.googleapis.com/dns/v1/projects/", "basePath": "/dns/v1/projects/", "rootUrl": "https://www.googleapis.com/", "servicePath": "dns/v1/projects/", "batchPath": "batch", "parameters": { "alt": { "type": "string", "description": "Data format for the response.", "default": "json", "enum": [ "json" ], "enumDescriptions": [ "Responses with Content-Type of application/json" ], "location": "query" }, "fields": { "type": "string", "description": "Selector specifying which fields to include in a partial response.", "location": "query" }, "key": { "type": "string", "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", "location": "query" }, "oauth_token": { "type": "string", "description": "OAuth 2.0 token for the current user.", "location": "query" }, "prettyPrint": { "type": "boolean", "description": "Returns response with indentations and line breaks.", "default": "true", "location": "query" }, "quotaUser": { "type": "string", "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.", "location": "query" }, "userIp": { "type": "string", "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.", "location": "query" } }, "auth": { "oauth2": { "scopes": { "https://www.googleapis.com/auth/cloud-platform": { "description": "View and manage your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/cloud-platform.read-only": { "description": "MESSAGE UNDER CONSTRUCTION View your data across Google Cloud Platform services" }, "https://www.googleapis.com/auth/ndev.clouddns.readonly": { "description": "View your DNS records hosted by Google Cloud DNS" }, "https://www.googleapis.com/auth/ndev.clouddns.readwrite": { "description": "View and manage your DNS records hosted by Google Cloud DNS" } } } }, "schemas": { "Change": { "id": "Change", "type": "object", "description": "An atomic update to a collection of ResourceRecordSets.", "properties": { "additions": { "type": "array", "description": "Which ResourceRecordSets to add?", "items": { "$ref": "ResourceRecordSet" } }, "deletions": { "type": "array", "description": "Which ResourceRecordSets to remove? Must match existing data exactly.", "items": { "$ref": "ResourceRecordSet" } }, "id": { "type": "string", "description": "Unique identifier for the resource; defined by the server (output only)." }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#change\".", "default": "dns#change" }, "startTime": { "type": "string", "description": "The time that this operation was started by the server. This is in RFC3339 text format." }, "status": { "type": "string", "description": "Status of the operation (output only).", "enum": [ "done", "pending" ], "enumDescriptions": [ "", "" ] } } }, "ChangesListResponse": { "id": "ChangesListResponse", "type": "object", "description": "The response to a request to enumerate Changes to a ResourceRecordSets collection.", "properties": { "changes": { "type": "array", "description": "The requested changes.", "items": { "$ref": "Change" } }, "kind": { "type": "string", "description": "Type of resource.", "default": "dns#changesListResponse" }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a \"snapshot\" of collections larger than the maximum page size." } } }, "ManagedZone": { "id": "ManagedZone", "type": "object", "description": "A zone is a subtree of the DNS namespace under one administrative responsibility. A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service.", "properties": { "creationTime": { "type": "string", "description": "The time that this resource was created on the server. This is in RFC3339 text format. Output only." }, "description": { "type": "string", "description": "A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the managed zone's function." }, "dnsName": { "type": "string", "description": "The DNS name of this managed zone, for instance \"example.com.\"." }, "id": { "type": "string", "description": "Unique identifier for the resource; defined by the server (output only)", "format": "uint64" }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#managedZone\".", "default": "dns#managedZone" }, "name": { "type": "string", "description": "User assigned name for this resource. Must be unique within the project. The name must be 1-32 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes." }, "nameServerSet": { "type": "string", "description": "Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users will leave this field unset." }, "nameServers": { "type": "array", "description": "Delegate your managed_zone to these virtual name servers; defined by the server (output only)", "items": { "type": "string" } } } }, "ManagedZonesListResponse": { "id": "ManagedZonesListResponse", "type": "object", "properties": { "kind": { "type": "string", "description": "Type of resource.", "default": "dns#managedZonesListResponse" }, "managedZones": { "type": "array", "description": "The managed zone resources.", "items": { "$ref": "ManagedZone" } }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size." } } }, "Project": { "id": "Project", "type": "object", "description": "A project resource. The project is a top level container for resources including Cloud DNS ManagedZones. Projects can be created only in the APIs console.", "properties": { "id": { "type": "string", "description": "User assigned unique identifier for the resource (output only)." }, "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#project\".", "default": "dns#project" }, "number": { "type": "string", "description": "Unique numeric identifier for the resource; defined by the server (output only).", "format": "uint64" }, "quota": { "$ref": "Quota", "description": "Quotas assigned to this project (output only)." } } }, "Quota": { "id": "Quota", "type": "object", "description": "Limits associated with a Project.", "properties": { "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#quota\".", "default": "dns#quota" }, "managedZones": { "type": "integer", "description": "Maximum allowed number of managed zones in the project.", "format": "int32" }, "resourceRecordsPerRrset": { "type": "integer", "description": "Maximum allowed number of ResourceRecords per ResourceRecordSet.", "format": "int32" }, "rrsetAdditionsPerChange": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets to add per ChangesCreateRequest.", "format": "int32" }, "rrsetDeletionsPerChange": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets to delete per ChangesCreateRequest.", "format": "int32" }, "rrsetsPerManagedZone": { "type": "integer", "description": "Maximum allowed number of ResourceRecordSets per zone in the project.", "format": "int32" }, "totalRrdataSizePerChange": { "type": "integer", "description": "Maximum allowed size for total rrdata in one ChangesCreateRequest in bytes.", "format": "int32" } } }, "ResourceRecordSet": { "id": "ResourceRecordSet", "type": "object", "description": "A unit of data that will be returned by the DNS servers.", "properties": { "kind": { "type": "string", "description": "Identifies what kind of resource this is. Value: the fixed string \"dns#resourceRecordSet\".", "default": "dns#resourceRecordSet" }, "name": { "type": "string", "description": "For example, www.example.com." }, "rrdatas": { "type": "array", "description": "As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1).", "items": { "type": "string" } }, "ttl": { "type": "integer", "description": "Number of seconds that this ResourceRecordSet can be cached by resolvers.", "format": "int32" }, "type": { "type": "string", "description": "The identifier of a supported record type, for example, A, AAAA, MX, TXT, and so on." } } }, "ResourceRecordSetsListResponse": { "id": "ResourceRecordSetsListResponse", "type": "object", "properties": { "kind": { "type": "string", "description": "Type of resource.", "default": "dns#resourceRecordSetsListResponse" }, "nextPageToken": { "type": "string", "description": "The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token.\n\nIn this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned will be an inconsistent view of the collection. There is no way to retrieve a consistent snapshot of a collection larger than the maximum page size." }, "rrsets": { "type": "array", "description": "The resource record set resources.", "items": { "$ref": "ResourceRecordSet" } } } } }, "resources": { "changes": { "methods": { "create": { "id": "dns.changes.create", "path": "{project}/managedZones/{managedZone}/changes", "httpMethod": "POST", "description": "Atomically update the ResourceRecordSet collection.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "request": { "$ref": "Change" }, "response": { "$ref": "Change" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "get": { "id": "dns.changes.get", "path": "{project}/managedZones/{managedZone}/changes/{changeId}", "httpMethod": "GET", "description": "Fetch the representation of an existing Change.", "parameters": { "changeId": { "type": "string", "description": "The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse.", "required": true, "location": "path" }, "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone", "changeId" ], "response": { "$ref": "Change" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "list": { "id": "dns.changes.list", "path": "{project}/managedZones/{managedZone}/changes", "httpMethod": "GET", "description": "Enumerate Changes to a ResourceRecordSet collection.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" }, "sortBy": { "type": "string", "description": "Sorting criterion. The only supported value is change sequence.", "default": "changeSequence", "enum": [ "changeSequence" ], "enumDescriptions": [ "" ], "location": "query" }, "sortOrder": { "type": "string", "description": "Sorting order direction: 'ascending' or 'descending'.", "location": "query" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ChangesListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "managedZones": { "methods": { "create": { "id": "dns.managedZones.create", "path": "{project}/managedZones", "httpMethod": "POST", "description": "Create a new ManagedZone.", "parameters": { "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "request": { "$ref": "ManagedZone" }, "response": { "$ref": "ManagedZone" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "delete": { "id": "dns.managedZones.delete", "path": "{project}/managedZones/{managedZone}", "httpMethod": "DELETE", "description": "Delete a previously created ManagedZone.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "get": { "id": "dns.managedZones.get", "path": "{project}/managedZones/{managedZone}", "httpMethod": "GET", "description": "Fetch the representation of an existing ManagedZone.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ManagedZone" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] }, "list": { "id": "dns.managedZones.list", "path": "{project}/managedZones", "httpMethod": "GET", "description": "Enumerate ManagedZones that have been created but not yet deleted.", "parameters": { "dnsName": { "type": "string", "description": "Restricts the list to return only zones with this domain name.", "location": "query" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "response": { "$ref": "ManagedZonesListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "projects": { "methods": { "get": { "id": "dns.projects.get", "path": "{project}", "httpMethod": "GET", "description": "Fetch the representation of an existing Project.", "parameters": { "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" } }, "parameterOrder": [ "project" ], "response": { "$ref": "Project" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } }, "resourceRecordSets": { "methods": { "list": { "id": "dns.resourceRecordSets.list", "path": "{project}/managedZones/{managedZone}/rrsets", "httpMethod": "GET", "description": "Enumerate ResourceRecordSets that have been created but not yet deleted.", "parameters": { "managedZone": { "type": "string", "description": "Identifies the managed zone addressed by this request. Can be the managed zone name or id.", "required": true, "location": "path" }, "maxResults": { "type": "integer", "description": "Optional. Maximum number of results to be returned. If unspecified, the server will decide how many results to return.", "format": "int32", "location": "query" }, "name": { "type": "string", "description": "Restricts the list to return only records with this fully qualified domain name.", "location": "query" }, "pageToken": { "type": "string", "description": "Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request.", "location": "query" }, "project": { "type": "string", "description": "Identifies the project addressed by this request.", "required": true, "location": "path" }, "type": { "type": "string", "description": "Restricts the list to return only records of this type. If present, the \"name\" parameter must also be present.", "location": "query" } }, "parameterOrder": [ "project", "managedZone" ], "response": { "$ref": "ResourceRecordSetsListResponse" }, "scopes": [ "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.read-only", "https://www.googleapis.com/auth/ndev.clouddns.readonly", "https://www.googleapis.com/auth/ndev.clouddns.readwrite" ] } } } } } apitools/gen/__init__.py 0000644 00000001313 15025176453 0011266 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Shared __init__.py for apitools.""" from pkgutil import extend_path __path__ = extend_path(__path__, __name__) apitools/gen/client_generation_test.py 0000644 00000004144 15025176453 0014264 0 ustar 00 # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test gen_client against all the APIs we use regularly.""" import importlib import logging import os import six import subprocess import sys import tempfile import unittest from apitools.gen import gen_client from apitools.gen import test_utils _API_LIST = [ 'bigquery.v2', 'compute.v1', 'drive.v3', 'storage.v1', ] class ClientGenerationTest(unittest.TestCase): def setUp(self): super(ClientGenerationTest, self).setUp() self.gen_client_binary = 'gen_client' @test_utils.SkipOnWindows def testGeneration(self): for api in _API_LIST: with test_utils.TempDir(change_to=True): args = [ self.gen_client_binary, '--client_id=12345', '--client_secret=67890', '--discovery_url=%s' % api, '--outdir=generated', '--overwrite', 'client', ] logging.info('Testing API %s with command line: %s', api, ' '.join(args)) retcode = gen_client.main(args) if retcode == 128: logging.error('Failed to fetch discovery doc, continuing.') continue self.assertEqual(0, retcode) sys.path.insert(0, os.path.join(os.getcwd(), 'generated')) # Ensure we can import the generated client. importlib.import_module('{}_{}_client'.format( *api.split('.'))) apitools/gen/gen_client.py 0000644 00000026655 15025176453 0011656 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Command-line interface to gen_client.""" import argparse import contextlib import io import json import logging import os import pkgutil import sys from apitools.base.py import exceptions from apitools.gen import gen_client_lib from apitools.gen import util def _CopyLocalFile(filename): with contextlib.closing(io.open(filename, 'w')) as out: src_data = pkgutil.get_data( 'apitools.base.py', filename) if src_data is None: raise exceptions.GeneratedClientError( 'Could not find file %s' % filename) out.write(src_data) def _GetDiscoveryDocFromFlags(args): """Get the discovery doc from flags.""" if args.discovery_url: try: return util.FetchDiscoveryDoc(args.discovery_url) except exceptions.CommunicationError: raise exceptions.GeneratedClientError( 'Could not fetch discovery doc') infile = os.path.expanduser(args.infile) or '/dev/stdin' with io.open(infile, encoding='utf8') as f: return json.loads(util.ReplaceHomoglyphs(f.read())) def _GetCodegenFromFlags(args): """Create a codegen object from flags.""" discovery_doc = _GetDiscoveryDocFromFlags(args) names = util.Names( args.strip_prefix, args.experimental_name_convention, args.experimental_capitalize_enums) if args.client_json: try: with io.open(args.client_json, encoding='utf8') as client_json: f = json.loads(util.ReplaceHomoglyphs(client_json.read())) web = f.get('installed', f.get('web', {})) client_id = web.get('client_id') client_secret = web.get('client_secret') except IOError: raise exceptions.NotFoundError( 'Failed to open client json file: %s' % args.client_json) else: client_id = args.client_id client_secret = args.client_secret if not client_id: logging.warning('No client ID supplied') client_id = '' if not client_secret: logging.warning('No client secret supplied') client_secret = '' client_info = util.ClientInfo.Create( discovery_doc, args.scope, client_id, client_secret, args.user_agent, names, args.api_key, args.version_identifier) outdir = os.path.expanduser(args.outdir) or client_info.default_directory if os.path.exists(outdir) and not args.overwrite: raise exceptions.ConfigurationValueError( 'Output directory exists, pass --overwrite to replace ' 'the existing files.') if not os.path.exists(outdir): os.makedirs(outdir) return gen_client_lib.DescriptorGenerator( discovery_doc, client_info, names, args.root_package, outdir, base_package=args.base_package, protorpc_package=args.protorpc_package, init_wildcards_file=(args.init_file == 'wildcards'), use_proto2=args.experimental_proto2_output, unelidable_request_methods=args.unelidable_request_methods, apitools_version=args.apitools_version) # TODO(craigcitro): Delete this if we don't need this functionality. def _WriteBaseFiles(codegen): with util.Chdir(codegen.outdir): _CopyLocalFile('base_api.py') _CopyLocalFile('credentials_lib.py') _CopyLocalFile('exceptions.py') def _WriteIntermediateInit(codegen): with io.open('__init__.py', 'w') as out: codegen.WriteIntermediateInit(out) def _WriteProtoFiles(codegen): with util.Chdir(codegen.outdir): with io.open(codegen.client_info.messages_proto_file_name, 'w') as out: codegen.WriteMessagesProtoFile(out) with io.open(codegen.client_info.services_proto_file_name, 'w') as out: codegen.WriteServicesProtoFile(out) def _WriteGeneratedFiles(args, codegen): if codegen.use_proto2: _WriteProtoFiles(codegen) with util.Chdir(codegen.outdir): with io.open(codegen.client_info.messages_file_name, 'w') as out: codegen.WriteMessagesFile(out) with io.open(codegen.client_info.client_file_name, 'w') as out: codegen.WriteClientLibrary(out) def _WriteInit(codegen): with util.Chdir(codegen.outdir): with io.open('__init__.py', 'w') as out: codegen.WriteInit(out) def _WriteSetupPy(codegen): with io.open('setup.py', 'w') as out: codegen.WriteSetupPy(out) def GenerateClient(args): """Driver for client code generation.""" codegen = _GetCodegenFromFlags(args) if codegen is None: logging.error('Failed to create codegen, exiting.') return 128 _WriteGeneratedFiles(args, codegen) if args.init_file != 'none': _WriteInit(codegen) def GeneratePipPackage(args): """Generate a client as a pip-installable tarball.""" discovery_doc = _GetDiscoveryDocFromFlags(args) package = discovery_doc['name'] original_outdir = os.path.expanduser(args.outdir) args.outdir = os.path.join( args.outdir, 'apitools/clients/%s' % package) args.root_package = 'apitools.clients.%s' % package codegen = _GetCodegenFromFlags(args) if codegen is None: logging.error('Failed to create codegen, exiting.') return 1 _WriteGeneratedFiles(args, codegen) _WriteInit(codegen) with util.Chdir(original_outdir): _WriteSetupPy(codegen) with util.Chdir('apitools'): _WriteIntermediateInit(codegen) with util.Chdir('clients'): _WriteIntermediateInit(codegen) def GenerateProto(args): """Generate just the two proto files for a given API.""" codegen = _GetCodegenFromFlags(args) _WriteProtoFiles(codegen) class _SplitCommaSeparatedList(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): setattr(namespace, self.dest, values.split(',')) def main(argv=None): if argv is None: argv = sys.argv parser = argparse.ArgumentParser( description='Apitools Client Code Generator') discovery_group = parser.add_mutually_exclusive_group() discovery_group.add_argument( '--infile', help=('Filename for the discovery document. Mutually exclusive with ' '--discovery_url')) discovery_group.add_argument( '--discovery_url', help=('URL (or "name.version") of the discovery document to use. ' 'Mutually exclusive with --infile.')) parser.add_argument( '--base_package', default='apitools.base.py', help='Base package path of apitools (defaults to apitools.base.py') parser.add_argument( '--protorpc_package', default='apitools.base.protorpclite', help=('Base package path of protorpc ' '(defaults to apitools.base.protorpclite')) parser.add_argument( '--version-identifier', help=('Version identifier to use for the generated client (defaults to ' '"version" value in discovery doc). This must be a valid ' 'identifier when used in a Python module name.')) parser.add_argument( '--outdir', default='', help='Directory name for output files. (Defaults to the API name.)') parser.add_argument( '--overwrite', default=False, action='store_true', help='Only overwrite the output directory if this flag is specified.') parser.add_argument( '--root_package', default='', help=('Python import path for where these modules ' 'should be imported from.')) parser.add_argument( '--strip_prefix', nargs='*', default=[], help=('Prefix to strip from type names in the discovery document. ' '(May be specified multiple times.)')) parser.add_argument( '--api_key', help=('API key to use for API access.')) parser.add_argument( '--client_json', help=('Use the given file downloaded from the dev. console for ' 'client_id and client_secret.')) parser.add_argument( '--client_id', default='CLIENT_ID', help='Client ID to use for the generated client.') parser.add_argument( '--client_secret', default='CLIENT_SECRET', help='Client secret for the generated client.') parser.add_argument( '--scope', nargs='*', default=[], help=('Scopes to request in the generated client. ' 'May be specified more than once.')) parser.add_argument( '--user_agent', default='x_Tw5K8nnjoRAqULM9PFAC2b', help=('User agent for the generated client. ' 'Defaults to <api>-generated/0.1.')) parser.add_argument( '--generate_cli', dest='generate_cli', action='store_true', help='Ignored.') parser.add_argument( '--nogenerate_cli', dest='generate_cli', action='store_false', help='Ignored.') parser.add_argument( '--init-file', choices=['none', 'empty', 'wildcards'], type=lambda s: s.lower(), default='wildcards', help='Controls whether and how to generate package __init__.py file.') parser.add_argument( '--unelidable_request_methods', action=_SplitCommaSeparatedList, default=[], help=('Full method IDs of methods for which we should NOT try to ' 'elide the request type. (Should be a comma-separated list.')) parser.add_argument( '--apitools_version', default='', dest='apitools_version', help=('Apitools version used as a requirement in generated clients. ' 'Defaults to version of apitools used to generate the clients.')) parser.add_argument( '--experimental_capitalize_enums', default=False, action='store_true', help='Dangerous: attempt to rewrite enum values to be uppercase.') parser.add_argument( '--experimental_name_convention', choices=util.Names.NAME_CONVENTIONS, default=util.Names.DEFAULT_NAME_CONVENTION, help='Dangerous: use a particular style for generated names.') parser.add_argument( '--experimental_proto2_output', default=False, action='store_true', help='Dangerous: also output a proto2 message file.') subparsers = parser.add_subparsers(help='Type of generated code') client_parser = subparsers.add_parser( 'client', help='Generate apitools client in destination folder') client_parser.set_defaults(func=GenerateClient) pip_package_parser = subparsers.add_parser( 'pip_package', help='Generate apitools client pip package') pip_package_parser.set_defaults(func=GeneratePipPackage) proto_parser = subparsers.add_parser( 'proto', help='Generate apitools client protos') proto_parser.set_defaults(func=GenerateProto) args = parser.parse_args(argv[1:]) return args.func(args) or 0 if __name__ == '__main__': sys.exit(main()) apitools/scripts/testdata/fake_client_secrets.json 0000644 00000000677 15025176453 0016607 0 ustar 00 { "installed": { "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "", "client_id": "144169.apps.googleusercontent.com", "client_secret": "awesomesecret", "client_x509_cert_url": "", "redirect_uris": [ "urn:ietf:wg:oauth:2.0:oob", "oob" ], "token_uri": "https://oauth2.googleapis.com/token" } } apitools/scripts/testdata/noninstalled_client_secrets.json 0000644 00000000023 15025176453 0020354 0 ustar 00 { "webapp": {} } apitools/scripts/__init__.py 0000644 00000001313 15025176453 0012204 0 ustar 00 #!/usr/bin/env python # # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Shared __init__.py for apitools.""" from pkgutil import extend_path __path__ = extend_path(__path__, __name__) apitools/base/__pycache__/__init__.cpython-39.pyc 0000644 00000000421 15025176453 0015715 0 ustar 00 a vyg� � @ s d Z ddlmZ eee�ZdS )z Shared __init__.py for apitools.� )�extend_pathN)�__doc__�pkgutilr �__path__�__name__� r r �:/opt/gsutil/third_party/apitools/apitools/base/__init__.py�<module> s apitools/base/py/__pycache__/extra_types.cpython-39.pyc 0000644 00000021455 15025176453 0017167 0 ustar 00 a vyg�&