// Copyright 2022 Luca Casonato. All rights reserved. MIT license. /** * Parallelstore API Client for Deno * ================================= * * * * Docs: https://cloud.google.com/ * Source: https://googleapis.deno.dev/v1/parallelstore:v1.ts */ import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts"; export { auth, GoogleAuth }; export type { CredentialsClient }; export class Parallelstore { #client: CredentialsClient | undefined; #baseUrl: string; constructor(client?: CredentialsClient, baseUrl: string = "https://parallelstore.googleapis.com/") { this.#client = client; this.#baseUrl = baseUrl; } /** * Gets information about a location. * * @param name Resource name for the location. */ async projectsLocationsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Location; } /** * Creates a Parallelstore instance in a given project and location. * * @param parent Required. The instance's project and location, in the format `projects/{project}/locations/{location}`. Locations map to Google Cloud zones; for example, `us-west1-b`. */ async projectsLocationsInstancesCreate(parent: string, req: Instance, opts: ProjectsLocationsInstancesCreateOptions = {}): Promise { req = serializeInstance(req); const url = new URL(`${this.#baseUrl}v1/${ parent }/instances`); if (opts.instanceId !== undefined) { url.searchParams.append("instanceId", String(opts.instanceId)); } if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Deletes a single instance. * * @param name Required. Name of the resource */ async projectsLocationsInstancesDelete(name: string, opts: ProjectsLocationsInstancesDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Operation; } /** * Copies data from Parallelstore to Cloud Storage. * * @param name Required. Name of the resource. */ async projectsLocationsInstancesExportData(name: string, req: ExportDataRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:exportData`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Gets details of a single instance. * * @param name Required. The instance resource name, in the format `projects/{project_id}/locations/{location}/instances/{instance_id}`. */ async projectsLocationsInstancesGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeInstance(data); } /** * Copies data from Cloud Storage to Parallelstore. * * @param name Required. Name of the resource. */ async projectsLocationsInstancesImportData(name: string, req: ImportDataRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:importData`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Lists all instances in a given project and location. * * @param parent Required. The project and location for which to retrieve instance information, in the format `projects/{project_id}/locations/{location}`. To retrieve instance information for all locations, use "-" as the value of `{location}`. */ async projectsLocationsInstancesList(parent: string, opts: ProjectsLocationsInstancesListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/instances`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.orderBy !== undefined) { url.searchParams.append("orderBy", String(opts.orderBy)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeListInstancesResponse(data); } /** * Updates the parameters of a single instance. * * @param name Identifier. The resource name of the instance, in the format `projects/{project}/locations/{location}/instances/{instance_id}`. */ async projectsLocationsInstancesPatch(name: string, req: Instance, opts: ProjectsLocationsInstancesPatchOptions = {}): Promise { req = serializeInstance(req); opts = serializeProjectsLocationsInstancesPatchOptions(opts); const url = new URL(`${this.#baseUrl}v1/${ name }`); if (opts.requestId !== undefined) { url.searchParams.append("requestId", String(opts.requestId)); } if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as Operation; } /** * Lists information about the supported locations for this service. * * @param name The resource that owns the locations collection, if applicable. */ async projectsLocationsList(name: string, opts: ProjectsLocationsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }/locations`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListLocationsResponse; } /** * Starts asynchronous cancellation on a long-running operation. The server * makes a best effort to cancel the operation, but success is not guaranteed. * If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or * other methods to check whether the cancellation succeeded or whether the * operation completed despite cancellation. On successful cancellation, the * operation is not deleted; instead, it becomes an operation with an * Operation.error value with a google.rpc.Status.code of `1`, corresponding * to `Code.CANCELLED`. * * @param name The name of the operation resource to be cancelled. */ async projectsLocationsOperationsCancel(name: string, req: CancelOperationRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:cancel`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleProtobufEmpty; } /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the * operation. If the server doesn't support this method, it returns * `google.rpc.Code.UNIMPLEMENTED`. * * @param name The name of the operation resource to be deleted. */ async projectsLocationsOperationsDelete(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as GoogleProtobufEmpty; } /** * 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. * * @param name The name of the operation resource. */ async projectsLocationsOperationsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Operation; } /** * Lists operations that match the specified filter in the request. If the * server doesn't support this method, it returns `UNIMPLEMENTED`. * * @param name The name of the operation's parent resource. */ async projectsLocationsOperationsList(name: string, opts: ProjectsLocationsOperationsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }/operations`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListOperationsResponse; } } /** * The request message for Operations.CancelOperation. */ export interface CancelOperationRequest { } /** * Cloud Storage as the destination of a data transfer. */ export interface DestinationGcsBucket { /** * Required. URI to a Cloud Storage bucket in the format: `gs:///`. The path * inside the bucket is optional. */ uri?: string; } /** * Parallelstore as the destination of a data transfer. */ export interface DestinationParallelstore { /** * Optional. Root directory path to the Paralellstore filesystem, starting * with `/`. Defaults to `/` if unset. */ path?: string; } /** * Export data from Parallelstore to Cloud Storage. */ export interface ExportDataRequest { /** * Cloud Storage destination. */ destinationGcsBucket?: DestinationGcsBucket; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and t he * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. User-specified Service Account (SA) credentials to be used when * performing the transfer. Use one of the following formats: * * `{EMAIL_ADDRESS_OR_UNIQUE_ID}` * * `projects/{PROJECT_ID_OR_NUMBER}/serviceAccounts/{EMAIL_ADDRESS_OR_UNIQUE_ID}` * * `projects/-/serviceAccounts/{EMAIL_ADDRESS_OR_UNIQUE_ID}` If unspecified, * the Parallelstore service agent is used: * `service-@gcp-sa-parallelstore.iam.gserviceaccount.com` */ serviceAccount?: string; /** * Parallelstore source. */ sourceParallelstore?: SourceParallelstore; } /** * 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); } */ export interface GoogleProtobufEmpty { } /** * Import data from Cloud Storage into a Parallelstore instance. */ export interface ImportDataRequest { /** * Parallelstore destination. */ destinationParallelstore?: DestinationParallelstore; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and t he * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Optional. User-specified service account credentials to be used when * performing the transfer. Use one of the following formats: * * `{EMAIL_ADDRESS_OR_UNIQUE_ID}` * * `projects/{PROJECT_ID_OR_NUMBER}/serviceAccounts/{EMAIL_ADDRESS_OR_UNIQUE_ID}` * * `projects/-/serviceAccounts/{EMAIL_ADDRESS_OR_UNIQUE_ID}` If unspecified, * the Parallelstore service agent is used: * `service-@gcp-sa-parallelstore.iam.gserviceaccount.com` */ serviceAccount?: string; /** * The Cloud Storage source bucket and, optionally, path inside the bucket. */ sourceGcsBucket?: SourceGcsBucket; } /** * A Parallelstore instance. */ export interface Instance { /** * Output only. A list of IPv4 addresses used for client side configuration. */ readonly accessPoints?: string[]; /** * Required. Immutable. The instance's storage capacity in Gibibytes (GiB). * Allowed values are between 12000 and 100000, in multiples of 4000; e.g., * 12000, 16000, 20000, ... */ capacityGib?: bigint; /** * Output only. The time when the instance was created. */ readonly createTime?: Date; /** * Output only. The version of DAOS software running in the instance. */ readonly daosVersion?: string; /** * Optional. The description of the instance. 2048 characters or less. */ description?: string; /** * Optional. Stripe level for directories. Allowed values are: * * `DIRECTORY_STRIPE_LEVEL_MIN`: recommended when directories contain a small * number of files. * `DIRECTORY_STRIPE_LEVEL_BALANCED`: balances performance * for workloads involving a mix of small and large directories. * * `DIRECTORY_STRIPE_LEVEL_MAX`: recommended for directories with a large * number of files. */ directoryStripeLevel?: | "DIRECTORY_STRIPE_LEVEL_UNSPECIFIED" | "DIRECTORY_STRIPE_LEVEL_MIN" | "DIRECTORY_STRIPE_LEVEL_BALANCED" | "DIRECTORY_STRIPE_LEVEL_MAX"; /** * Output only. Immutable. The ID of the IP address range being used by the * instance's VPC network. This field is populated by the service and contains * the value currently used by the service. */ readonly effectiveReservedIpRange?: string; /** * Optional. Stripe level for files. Allowed values are: * * `FILE_STRIPE_LEVEL_MIN`: offers the best performance for small size files. * * `FILE_STRIPE_LEVEL_BALANCED`: balances performance for workloads * involving a mix of small and large files. * `FILE_STRIPE_LEVEL_MAX`: higher * throughput performance for larger files. */ fileStripeLevel?: | "FILE_STRIPE_LEVEL_UNSPECIFIED" | "FILE_STRIPE_LEVEL_MIN" | "FILE_STRIPE_LEVEL_BALANCED" | "FILE_STRIPE_LEVEL_MAX"; /** * Optional. Cloud Labels are a flexible and lightweight mechanism for * organizing cloud resources into groups that reflect a customer's * organizational needs and deployment strategies. See * https://cloud.google.com/resource-manager/docs/labels-overview for details. */ labels?: { [key: string]: string }; /** * Identifier. The resource name of the instance, in the format * `projects/{project}/locations/{location}/instances/{instance_id}`. */ name?: string; /** * Optional. Immutable. The name of the Compute Engine [VPC * network](https://cloud.google.com/vpc/docs/vpc) to which the instance is * connected. */ network?: string; /** * Optional. Immutable. The ID of the IP address range being used by the * instance's VPC network. See [Configure a VPC * network](https://cloud.google.com/parallelstore/docs/vpc#create_and_configure_the_vpc). * If no ID is provided, all ranges are considered. */ reservedIpRange?: string; /** * Output only. The instance state. */ readonly state?: | "STATE_UNSPECIFIED" | "CREATING" | "ACTIVE" | "DELETING" | "FAILED" | "UPGRADING"; /** * Output only. The time when the instance was updated. */ readonly updateTime?: Date; } function serializeInstance(data: any): Instance { return { ...data, capacityGib: data["capacityGib"] !== undefined ? String(data["capacityGib"]) : undefined, }; } function deserializeInstance(data: any): Instance { return { ...data, capacityGib: data["capacityGib"] !== undefined ? BigInt(data["capacityGib"]) : undefined, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, updateTime: data["updateTime"] !== undefined ? new Date(data["updateTime"]) : undefined, }; } /** * Response from ListInstances. */ export interface ListInstancesResponse { /** * The list of Parallelstore instances. */ instances?: Instance[]; /** * A token identifying a page of results the server should return. */ nextPageToken?: string; /** * Locations that could not be reached. */ unreachable?: string[]; } function serializeListInstancesResponse(data: any): ListInstancesResponse { return { ...data, instances: data["instances"] !== undefined ? data["instances"].map((item: any) => (serializeInstance(item))) : undefined, }; } function deserializeListInstancesResponse(data: any): ListInstancesResponse { return { ...data, instances: data["instances"] !== undefined ? data["instances"].map((item: any) => (deserializeInstance(item))) : undefined, }; } /** * The response message for Locations.ListLocations. */ export interface ListLocationsResponse { /** * A list of locations that matches the specified filter in the request. */ locations?: Location[]; /** * The standard List next-page token. */ nextPageToken?: string; } /** * The response message for Operations.ListOperations. */ export interface ListOperationsResponse { /** * The standard List next-page token. */ nextPageToken?: string; /** * A list of operations that matches the specified filter in the request. */ operations?: Operation[]; } /** * A resource that represents a Google Cloud location. */ export interface Location { /** * The friendly name for this location, typically a nearby city name. For * example, "Tokyo". */ displayName?: string; /** * Cross-service attributes for the location. For example * {"cloud.googleapis.com/region": "us-east1"} */ labels?: { [key: string]: string }; /** * The canonical id for this location. For example: `"us-east1"`. */ locationId?: string; /** * Service-specific metadata. For example the available capacity at the given * location. */ metadata?: { [key: string]: any }; /** * Resource name for the location, which may vary between implementations. * For example: `"projects/example-project/locations/us-east1"` */ name?: string; } /** * This resource represents a long-running operation that is the result of a * network API call. */ export interface Operation { /** * 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. */ done?: boolean; /** * The error result of the operation in case of failure or cancellation. */ error?: Status; /** * 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. */ metadata?: { [key: string]: any }; /** * 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 be a resource name ending with `operations/{unique_id}`. */ name?: string; /** * The normal, successful response of the operation. 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`. */ response?: { [key: string]: any }; } /** * Long-running operation metadata. */ export interface OperationMetadata { /** * Output only. API version used to start the operation. */ readonly apiVersion?: string; /** * Output only. The time the operation was created. */ readonly createTime?: Date; /** * Output only. The time the operation finished running. */ readonly endTime?: Date; /** * Output only. Identifies whether the user has requested cancellation of the * operation. Operations that have been cancelled successfully have * Operation.error value with a google.rpc.Status.code of 1, corresponding to * `Code.CANCELLED`. */ readonly requestedCancellation?: boolean; /** * Output only. Human-readable status of the operation, if any. */ readonly statusMessage?: string; /** * Output only. Server-defined resource path for the target of the operation. */ readonly target?: string; /** * Output only. Name of the verb executed by the operation. */ readonly verb?: string; } /** * Additional options for Parallelstore#projectsLocationsInstancesCreate. */ export interface ProjectsLocationsInstancesCreateOptions { /** * Required. The name of the Parallelstore instance. * Must contain only * lowercase letters, numbers, and hyphens. * Must start with a letter. * Must * be between 1-63 characters. * Must end with a number or a letter. * Must be * unique within the customer project / location */ instanceId?: string; /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and t he * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; } /** * Additional options for Parallelstore#projectsLocationsInstancesDelete. */ export interface ProjectsLocationsInstancesDeleteOptions { /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes after the first request. For * example, consider a situation where you make an initial request and t he * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; } /** * Additional options for Parallelstore#projectsLocationsInstancesList. */ export interface ProjectsLocationsInstancesListOptions { /** * Optional. Filtering results. */ filter?: string; /** * Optional. Hint for how to order the results. */ orderBy?: string; /** * Optional. Requested page size. Server may return fewer items than * requested. If unspecified, the server will pick an appropriate default. */ pageSize?: number; /** * Optional. A token identifying a page of results the server should return. */ pageToken?: string; } /** * Additional options for Parallelstore#projectsLocationsInstancesPatch. */ export interface ProjectsLocationsInstancesPatchOptions { /** * Optional. An optional request ID to identify requests. Specify a unique * request ID so that if you must retry your request, the server will know to * ignore the request if it has already been completed. The server will * guarantee that for at least 60 minutes since the first request. For * example, consider a situation where you make an initial request and t he * request times out. If you make the request again with the same request ID, * the server can check if original operation with the same request ID was * received, and if so, will ignore the second request. This prevents clients * from accidentally creating duplicate commitments. The request ID must be a * valid UUID with the exception that zero UUID is not supported * (00000000-0000-0000-0000-000000000000). */ requestId?: string; /** * Required. Mask of fields to update. Field mask is used to specify the * fields to be overwritten in the Instance resource by the update. At least * one path must be supplied in this field. The fields specified in the * update_mask are relative to the resource, not the full request. */ updateMask?: string /* FieldMask */; } function serializeProjectsLocationsInstancesPatchOptions(data: any): ProjectsLocationsInstancesPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeProjectsLocationsInstancesPatchOptions(data: any): ProjectsLocationsInstancesPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Additional options for Parallelstore#projectsLocationsList. */ export interface ProjectsLocationsListOptions { /** * A filter to narrow down results to a preferred subset. The filtering * language accepts strings like `"displayName=tokyo"`, and is documented in * more detail in [AIP-160](https://google.aip.dev/160). */ filter?: string; /** * The maximum number of results to return. If not set, the service selects a * default. */ pageSize?: number; /** * A page token received from the `next_page_token` field in the response. * Send that page token to receive the subsequent page. */ pageToken?: string; } /** * Additional options for Parallelstore#projectsLocationsOperationsList. */ export interface ProjectsLocationsOperationsListOptions { /** * The standard list filter. */ filter?: string; /** * The standard list page size. */ pageSize?: number; /** * The standard list page token. */ pageToken?: string; } /** * Cloud Storage as the source of a data transfer. */ export interface SourceGcsBucket { /** * Required. URI to a Cloud Storage bucket in the format: `gs:///`. The path * inside the bucket is optional. */ uri?: string; } /** * Parallelstore as the source of a data transfer. */ export interface SourceParallelstore { /** * Optional. Root directory path to the Paralellstore filesystem, starting * with `/`. Defaults to `/` if unset. */ path?: string; } /** * 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). Each `Status` message contains three * pieces of data: error code, error message, and error details. You can find * out more about this error model and how to work with it in the [API Design * Guide](https://cloud.google.com/apis/design/errors). */ export interface Status { /** * The status code, which should be an enum value of google.rpc.Code. */ code?: number; /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. */ details?: { [key: string]: any }[]; /** * 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. */ message?: string; }