# Generated with protoc-gen-openapi # https://github.com/googleapis/gnostic/tree/master/apps/protoc-gen-openapi openapi: 3.0.3 info: title: Registry description: The Registry service allows teams to manage descriptions of APIs. version: 0.0.1 paths: /v1/projects: get: summary: ListProjects returns matching projects. operationId: Registry_ListProjects parameters: - name: page_size in: query description: The maximum number of projects to return. The service may return fewer than this value. If unspecified, at most 50 values will be returned. The maximum is 1000; values above 1000 will be coerced to 1000. schema: type: string - name: page_token in: query description: A page token, received from a previous `ListProjects` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListProjects` must match the call that provided the page token. schema: type: string - name: filter in: query description: An expression that can be used to filter the list. Filters use the Common Expression Language and can refer to all message fields. schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ListProjectsResponse' post: summary: CreateProject creates a specified project. operationId: Registry_CreateProject parameters: - name: project_id in: query description: The ID to use for the project, which will become the final component of the project's resource name. This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Project' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Project' /v1/projects/{project}: get: summary: GetProject returns a specified project. operationId: Registry_GetProject parameters: - name: project in: path description: The project id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Project' delete: summary: DeleteProject removes a specified project and all of the resources that it owns. operationId: Registry_DeleteProject parameters: - name: project in: path description: The project id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Empty' patch: summary: UpdateProject can be used to modify a specified project. operationId: Registry_UpdateProject parameters: - name: project in: path description: The project id. required: true schema: type: string - name: update_mask in: query description: The list of fields to be updated. If omitted, all fields are updated that are set in the request message (fields set to default values are ignored). If a "*" is specified, all fields are updated, including fields that are unspecified/default in the request. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Project' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Project' /v1/projects/{project}/apis: get: summary: ListApis returns matching APIs. operationId: Registry_ListApis parameters: - name: project in: path description: The project id. required: true schema: type: string - name: page_size in: query description: The maximum number of APIs to return. The service may return fewer than this value. If unspecified, at most 50 values will be returned. The maximum is 1000; values above 1000 will be coerced to 1000. schema: type: string - name: page_token in: query description: A page token, received from a previous `ListApis` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListApis` must match the call that provided the page token. schema: type: string - name: filter in: query description: An expression that can be used to filter the list. Filters use the Common Expression Language and can refer to all message fields that are included in the BASIC view. schema: type: string - name: view in: query description: The level of detail to return (defaults to BASIC). schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ListApisResponse' post: summary: CreateApi creates a specified API. operationId: Registry_CreateApi parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api_id in: query description: The ID to use for the api, which will become the final component of the api's resource name. This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Api' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Api' /v1/projects/{project}/apis/{api}: get: summary: GetApi returns a specified API. operationId: Registry_GetApi parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: view in: query description: The level of detail to return (defaults to BASIC). schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Api' delete: summary: DeleteApi removes a specified API and all of the resources that it owns. operationId: Registry_DeleteApi parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Empty' patch: summary: UpdateApi can be used to modify a specified API. operationId: Registry_UpdateApi parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: update_mask in: query description: The list of fields to be updated. If omitted, all fields are updated that are set in the request message (fields set to default values are ignored). If a "*" is specified, all fields are updated, including fields that are unspecified/default in the request. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Api' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Api' /v1/projects/{project}/apis/{api}/versions: get: summary: ListApiVersions returns matching versions. operationId: Registry_ListApiVersions parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: page_size in: query description: The maximum number of versions to return. The service may return fewer than this value. If unspecified, at most 50 values will be returned. The maximum is 1000; values above 1000 will be coerced to 1000. schema: type: string - name: page_token in: query description: A page token, received from a previous `ListApiVersions` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListApiVersions` must match the call that provided the page token. schema: type: string - name: filter in: query description: An expression that can be used to filter the list. Filters use the Common Expression Language and can refer to all message fields that are included in the BASIC view. schema: type: string - name: view in: query description: The level of detail to return (defaults to BASIC). schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ListApiVersionsResponse' post: summary: CreateApiVersion creates a specified version. operationId: Registry_CreateApiVersion parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: api_version_id in: query description: The ID to use for the version, which will become the final component of the version's resource name. This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/ApiVersion' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ApiVersion' /v1/projects/{project}/apis/{api}/versions/{version}: get: summary: GetApiVersion returns a specified version. operationId: Registry_GetApiVersion parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: view in: query description: The level of detail to return (defaults to BASIC). schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ApiVersion' delete: summary: DeleteApiVersion removes a specified version and all of the resources that it owns. operationId: Registry_DeleteApiVersion parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Empty' patch: summary: UpdateApiVersion can be used to modify a specified version. operationId: Registry_UpdateApiVersion parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: update_mask in: query description: The list of fields to be updated. If omitted, all fields are updated that are set in the request message (fields set to default values are ignored). If a "*" is specified, all fields are updated, including fields that are unspecified/default in the request. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/ApiVersion' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ApiVersion' /v1/projects/{project}/apis/{api}/versions/{version}/specs: get: summary: ListApiSpecs returns matching specs. operationId: Registry_ListApiSpecs parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: page_size in: query description: The maximum number of specs to return. The service may return fewer than this value. If unspecified, at most 50 values will be returned. The maximum is 1000; values above 1000 will be coerced to 1000. schema: type: string - name: page_token in: query description: A page token, received from a previous `ListApiSpecs` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListApiSpecs` must match the call that provided the page token. schema: type: string - name: filter in: query description: An expression that can be used to filter the list. Filters use the Common Expression Language and can refer to all message fields that are included in the BASIC view. schema: type: string - name: view in: query description: The level of detail to return (defaults to BASIC). schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ListApiSpecsResponse' post: summary: CreateApiSpec creates a specified spec. operationId: Registry_CreateApiSpec parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: api_spec_id in: query description: The ID to use for the spec, which will become the final component of the spec's resource name. This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/ApiSpec' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ApiSpec' /v1/projects/{project}/apis/{api}/versions/{version}/specs/{spec}: get: summary: GetApiSpec returns a specified spec. operationId: Registry_GetApiSpec parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: spec in: path description: The spec id. required: true schema: type: string - name: view in: query description: The level of detail to return (defaults to BASIC). schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ApiSpec' delete: summary: DeleteApiSpec removes a specified spec, all revisions, and all child resources (e.g. artifacts). operationId: Registry_DeleteApiSpec parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: spec in: path description: The spec id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Empty' patch: summary: UpdateApiSpec can be used to modify a specified spec. operationId: Registry_UpdateApiSpec parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: spec in: path description: The spec id. required: true schema: type: string - name: update_mask in: query description: The list of fields to be updated. If omitted, all fields are updated that are set in the request message (fields set to default values are ignored). If a "*" is specified, all fields are updated, including fields that are unspecified/default in the request. schema: type: string - name: allow_missing in: query description: If set to true, and the spec is not found, a new spec will be created. In this situation, `update_mask` is ignored. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/ApiSpec' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ApiSpec' /v1/projects/{project}/apis/{api}/versions/{version}/specs/{spec}:deleteRevision: delete: summary: DeleteApiSpecRevision deletes a revision of a spec. operationId: Registry_DeleteApiSpecRevision parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: spec in: path description: The spec id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Empty' /v1/projects/{project}/apis/{api}/versions/{version}/specs/{spec}:listRevisions: get: summary: ListApiSpecRevisions lists all revisions of a spec. Revisions are returned in descending order of revision creation time. operationId: Registry_ListApiSpecRevisions parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: spec in: path description: The spec id. required: true schema: type: string - name: page_size in: query description: The maximum number of revisions to return per page. schema: type: string - name: page_token in: query description: The page token, received from a previous ListApiSpecRevisions call. Provide this to retrieve the subsequent page. schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ListApiSpecRevisionsResponse' /v1/projects/{project}/apis/{api}/versions/{version}/specs/{spec}:rollback: post: summary: RollbackApiSpec sets the current revision to a specified prior revision. Note that this creates a new revision with a new revision ID. operationId: Registry_RollbackApiSpec parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: spec in: path description: The spec id. required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/RollbackApiSpecRequest' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ApiSpec' /v1/projects/{project}/apis/{api}/versions/{version}/specs/{spec}:tagRevision: post: summary: TagApiSpecRevision adds a tag to a specified revision of a spec. operationId: Registry_TagApiSpecRevision parameters: - name: project in: path description: The project id. required: true schema: type: string - name: api in: path description: The api id. required: true schema: type: string - name: version in: path description: The version id. required: true schema: type: string - name: spec in: path description: The spec id. required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/TagApiSpecRevisionRequest' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ApiSpec' /v1/projects/{project}/artifacts: get: summary: ListArtifacts returns matching artifacts. operationId: Registry_ListArtifacts parameters: - name: project in: path description: The project id. required: true schema: type: string - name: page_size in: query description: The maximum number of artifacts to return. The service may return fewer than this value. If unspecified, at most 50 values will be returned. The maximum is 1000; values above 1000 will be coerced to 1000. schema: type: string - name: page_token in: query description: A page token, received from a previous `ListArtifacts` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListArtifacts` must match the call that provided the page token. schema: type: string - name: filter in: query description: An expression that can be used to filter the list. Filters use the Common Expression Language and can refer to all message fields that are included in the BASIC view. schema: type: string - name: view in: query description: The level of detail to return (defaults to BASIC). schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/ListArtifactsResponse' post: summary: CreateArtifact creates a specified artifact. operationId: Registry_CreateArtifact parameters: - name: project in: path description: The project id. required: true schema: type: string - name: artifact_id in: query description: The ID to use for the artifact, which will become the final component of the artifact's resource name. This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Artifact' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Artifact' /v1/projects/{project}/artifacts/{artifact}: get: summary: GetArtifact returns a specified artifact. operationId: Registry_GetArtifact parameters: - name: project in: path description: The project id. required: true schema: type: string - name: artifact in: path description: The artifact id. required: true schema: type: string - name: view in: query description: The level of detail to return (defaults to BASIC). schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Artifact' put: summary: ReplaceArtifact can be used to replace a specified artifact. operationId: Registry_ReplaceArtifact parameters: - name: project in: path description: The project id. required: true schema: type: string - name: artifact in: path description: The artifact id. required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Artifact' required: true responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Artifact' delete: summary: DeleteArtifact removes a specified artifact. operationId: Registry_DeleteArtifact parameters: - name: project in: path description: The project id. required: true schema: type: string - name: artifact in: path description: The artifact id. required: true schema: type: string responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Empty' /v1/status: get: summary: GetStatus returns the status of the service. GetStatus is for verifying open source deployments only and is not included in hosted versions of the API. operationId: Registry_GetStatus responses: "200": description: OK content: application/json: schema: $ref: '#/components/schemas/Status' components: schemas: Api: properties: name: type: string description: Resource name. display_name: type: string description: Human-meaningful name. description: type: string description: A detailed description. create_time: $ref: '#/components/schemas/Timestamp' update_time: $ref: '#/components/schemas/Timestamp' availability: type: string description: 'A user-definable description of the availability of this service. Format: free-form, but we expect single words that describe availability, e.g. "NONE", "TESTING", "PREVIEW", "GENERAL", "DEPRECATED", "SHUTDOWN".' recommended_version: type: string description: 'The recommended version of the API. Format: apis/{api}/versions/{version}' labels: $ref: '#/components/schemas/LabelsEntry' annotations: $ref: '#/components/schemas/AnnotationsEntry' description: An Api is a top-level description of an API. Apis are produced by producers and are commitments to provide services. ApiSpec: properties: name: type: string description: Resource name. filename: type: string description: A possibly-hierarchical name used to refer to the spec from other specs. description: type: string description: A detailed description. revision_id: readOnly: true type: string description: The revision ID of the spec. A new revision is committed whenever the spec contents are changed. The format is an 8-character hexadecimal string. create_time: $ref: '#/components/schemas/Timestamp' revision_create_time: $ref: '#/components/schemas/Timestamp' revision_update_time: $ref: '#/components/schemas/Timestamp' mime_type: type: string description: A style (format) descriptor for this spec that is specified as a Media Type (https://en.wikipedia.org/wiki/Media_type). Possible values include "application/vnd.apigee.proto", "application/vnd.apigee.openapi", and "application/vnd.apigee.graphql", with possible suffixes representing compression types. These hypothetical names are defined in the vendor tree defined in RFC6838 (https://tools.ietf.org/html/rfc6838) and are not final. size_bytes: readOnly: true type: integer description: The size of the spec file in bytes. format: int32 hash: readOnly: true type: string description: A SHA-256 hash of the spec's contents source_uri: type: string description: The original source URI of the spec (if one exists). This is an external location that can be used for reference purposes but which may not be authoritative since this external resource may change after the spec is retrieved. contents: type: string description: The contents of the spec. Returned only when the FULL view is requested. format: bytes revision_tags: readOnly: true type: array items: type: string description: The revision tags associated with this revision. labels: $ref: '#/components/schemas/LabelsEntry' annotations: $ref: '#/components/schemas/AnnotationsEntry' description: An ApiSpec describes a version of an API in a structured way. ApiSpecs provide formal descriptions that consumers can use to use a version. ApiSpec resources are intended to be fully-resolved descriptions of an ApiVersion. When specs consist of multiple files, these should be bundled together (e.g. in a zip archive) and stored as a unit. Multiple specs can exist to provide representations in different API description formats. Synchronization of these representations would be provided by tooling and background services. ApiVersion: properties: name: type: string description: Resource name. display_name: type: string description: Human-meaningful name. description: type: string description: A detailed description. create_time: $ref: '#/components/schemas/Timestamp' update_time: $ref: '#/components/schemas/Timestamp' state: type: string description: 'A user-definable description of the lifecycle phase of this API version. Format: free-form, but we expect single words that describe API maturity, e.g. "CONCEPT", "DESIGN", "DEVELOPMENT", "STAGING", "PRODUCTION", "DEPRECATED", "RETIRED".' labels: $ref: '#/components/schemas/LabelsEntry' annotations: $ref: '#/components/schemas/AnnotationsEntry' description: An ApiVersion describes a particular version of an API. ApiVersions are what consumers actually use. Artifact: properties: name: type: string description: Resource name. create_time: $ref: '#/components/schemas/Timestamp' update_time: $ref: '#/components/schemas/Timestamp' mime_type: type: string description: A content type specifier for the artifact. Content type specifiers are Media Types (https://en.wikipedia.org/wiki/Media_type) with a possible "schema" parameter that specifies a schema for the stored information. size_bytes: readOnly: true type: integer description: The size of the artifact in bytes. format: int32 hash: readOnly: true type: string description: A SHA-256 hash of the artifact's contents contents: type: string description: The contents of the artifact. Returned only when the FULL view is requested. format: bytes description: Artifacts of resources. Artifacts are unique (single-value) per resource and are used to store metadata that is too large or numerous to be stored directly on the resource. Since artifacts are stored separately from parent resources, they should generally be used for metadata that is needed infrequently, i.e. not for display in primary views of the resource but perhaps displayed or downloaded upon request. The view field of the ListArtifactsRequest message allows artifacts to be quickly enumerated and checked for presence without downloading their (potentially-large) contents. Empty: properties: {} description: '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 `{}`.' ListApiSpecRevisionsResponse: properties: specs: type: array items: $ref: '#/components/schemas/ApiSpec' description: The revisions of the spec. next_page_token: type: string description: A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. description: Response message for ListApiSpecRevisionsResponse. ListApiSpecsResponse: properties: api_specs: type: array items: $ref: '#/components/schemas/ApiSpec' description: The specs from the specified publisher. next_page_token: type: string description: A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. description: Response message for ListApiSpecs. ListApiVersionsResponse: properties: api_versions: type: array items: $ref: '#/components/schemas/ApiVersion' description: The versions from the specified publisher. next_page_token: type: string description: A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. description: Response message for ListApiVersions. ListApisResponse: properties: apis: type: array items: $ref: '#/components/schemas/Api' description: The APIs from the specified publisher. next_page_token: type: string description: A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. description: Response message for ListApis. ListArtifactsResponse: properties: artifacts: type: array items: $ref: '#/components/schemas/Artifact' description: The artifacts from the specified publisher. next_page_token: type: string description: A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. description: Response message for ListArtifacts. ListProjectsResponse: properties: projects: type: array items: $ref: '#/components/schemas/Project' description: The projects from the specified publisher. next_page_token: type: string description: A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. description: Response message for ListProjects. Project: properties: name: type: string description: Resource name. display_name: type: string description: Human-meaningful name. description: type: string description: A detailed description. create_time: $ref: '#/components/schemas/Timestamp' update_time: $ref: '#/components/schemas/Timestamp' description: 'A Project is a top-level description of a collection of APIs. Typically there would be one project for an entire organization. Note: in a Google Cloud deployment, this resource and associated methods will be omitted and its children will instead be associated with Google Cloud projects.' RollbackApiSpecRequest: properties: name: type: string description: The spec being rolled back. revision_id: type: string description: 'The revision ID to roll back to. It must be a revision of the same spec. Example: c7cfa2a8' description: Request message for RollbackApiSpec. Status: properties: message: type: string description: A string describing the status. description: Response message for GetStatus. GetStatus is not included in hosted versions of the API. TagApiSpecRevisionRequest: properties: name: type: string description: The name of the spec to be tagged, including the revision ID. tag: type: string description: The tag to apply. The tag should be at most 40 characters, and match `[a-z][a-z0-9-]{3,39}`. description: Request message for TagApiSpecRevision. Timestamp: properties: seconds: type: integer description: Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. format: int64 nanos: type: integer description: Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. format: int32 description: 'A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution. The count is relative to an epoch at UTC midnight on January 1, 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar backwards to year one. All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap second table is needed for interpretation, using a [24-hour linear smear](https://developers.google.com/time/smear). The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. # Examples Example 1: Compute Timestamp from POSIX `time()`. Timestamp timestamp; timestamp.set_seconds(time(NULL)); timestamp.set_nanos(0); Example 2: Compute Timestamp from POSIX `gettimeofday()`. struct timeval tv; gettimeofday(&tv, NULL); Timestamp timestamp; timestamp.set_seconds(tv.tv_sec); timestamp.set_nanos(tv.tv_usec * 1000); Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. FILETIME ft; GetSystemTimeAsFileTime(&ft); UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. Timestamp timestamp; timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. long millis = System.currentTimeMillis(); Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) .setNanos((int) ((millis % 1000) * 1000000)).build(); Example 5: Compute Timestamp from Java `Instant.now()`. Instant now = Instant.now(); Timestamp timestamp = Timestamp.newBuilder().setSeconds(now.getEpochSecond()) .setNanos(now.getNano()).build(); Example 6: Compute Timestamp from current time in Python. timestamp = Timestamp() timestamp.GetCurrentTime() # JSON Mapping In JSON format, the Timestamp type is encoded as a string in the [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone is required. A proto3 JSON serializer should always use UTC (as indicated by "Z") when printing the Timestamp type and a proto3 JSON parser should be able to accept both UTC and other timezones (as indicated by an offset). For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on January 15, 2017. In JavaScript, one can convert a Date object to this format using the standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) method. In Python, a standard `datetime.datetime` object can be converted to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the time format spec ''%Y-%m-%dT%H:%M:%S.%fZ''. Likewise, in Java, one can use the Joda Time''s [`ISODateTimeFormat.dateTime()`]( http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D ) to obtain a formatter capable of generating timestamps in this format.'