import {z} from 'zod' export type GetApiV1ProjectsProjectsIdLocationsLocationsIdEndpointsArgs = {projectsId: string, locationsId: string, filter?: string | undefined, gdcZone?: string | undefined, orderBy?: string | undefined, pageSize?: number | undefined, pageToken?: string | undefined, readMask?: unknown | undefined}; export type GetApiV1ProjectsProjectsIdLocationsLocationsIdEndpointsOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; export const googleCloudAiplatformV1ClientConnectionConfig = z.object({inferenceTimeout: z.string().optional()}); export const googleCloudAiplatformV1AutomaticResources = z.object({maxReplicaCount: z.number().int().optional(), minReplicaCount: z.number().int().optional()}); export const googleCloudAiplatformV1AutoscalingMetricSpec = z.object({metricName: z.string().optional(), target: z.number().int().optional()}); export const googleCloudAiplatformV1ReservationAffinity = z.object({key: z.string().optional(), reservationAffinityType: z.enum(["TYPE_UNSPECIFIED", "NO_RESERVATION", "ANY_RESERVATION", "SPECIFIC_RESERVATION"]).optional(), values: z.array(z.string()).optional()}); export const googleCloudAiplatformV1MachineSpec = z.object({acceleratorCount: z.number().int().optional(), acceleratorType: z.enum(["ACCELERATOR_TYPE_UNSPECIFIED", "NVIDIA_TESLA_K80", "NVIDIA_TESLA_P100", "NVIDIA_TESLA_V100", "NVIDIA_TESLA_P4", "NVIDIA_TESLA_T4", "NVIDIA_TESLA_A100", "NVIDIA_A100_80GB", "NVIDIA_L4", "NVIDIA_H100_80GB", "NVIDIA_H100_MEGA_80GB", "NVIDIA_H200_141GB", "NVIDIA_B200", "NVIDIA_GB200", "NVIDIA_RTX_PRO_6000", "TPU_V2", "TPU_V3", "TPU_V4_POD", "TPU_V5_LITEPOD"]).optional(), gpuPartitionSize: z.string().optional(), machineType: z.string().optional(), reservationAffinity: googleCloudAiplatformV1ReservationAffinity.optional(), tpuTopology: z.string().optional()}); export const googleCloudAiplatformV1DedicatedResources = z.object({autoscalingMetricSpecs: z.array(googleCloudAiplatformV1AutoscalingMetricSpec).optional(), machineSpec: googleCloudAiplatformV1MachineSpec.optional(), maxReplicaCount: z.number().int().optional(), minReplicaCount: z.number().int().optional(), requiredReplicaCount: z.number().int().optional(), spot: z.boolean().optional()}); export const googleCloudAiplatformV1ExplanationMetadataInputMetadataFeatureValueDomain = z.object({maxValue: z.number().optional(), minValue: z.number().optional(), originalMean: z.number().optional(), originalStddev: z.number().optional()}); export const googleCloudAiplatformV1ExplanationMetadataInputMetadataVisualization = z.object({clipPercentLowerbound: z.number().optional(), clipPercentUpperbound: z.number().optional(), colorMap: z.enum(["COLOR_MAP_UNSPECIFIED", "PINK_GREEN", "VIRIDIS", "RED", "GREEN", "RED_GREEN", "PINK_WHITE_GREEN"]).optional(), overlayType: z.enum(["OVERLAY_TYPE_UNSPECIFIED", "NONE", "ORIGINAL", "GRAYSCALE", "MASK_BLACK"]).optional(), polarity: z.enum(["POLARITY_UNSPECIFIED", "POSITIVE", "NEGATIVE", "BOTH"]).optional(), type: z.enum(["TYPE_UNSPECIFIED", "PIXELS", "OUTLINES"]).optional()}); export const googleCloudAiplatformV1ExplanationMetadataInputMetadata = z.object({denseShapeTensorName: z.string().optional(), encodedBaselines: z.array(z.unknown()).optional(), encodedTensorName: z.string().optional(), encoding: z.enum(["ENCODING_UNSPECIFIED", "IDENTITY", "BAG_OF_FEATURES", "BAG_OF_FEATURES_SPARSE", "INDICATOR", "COMBINED_EMBEDDING", "CONCAT_EMBEDDING"]).optional(), featureValueDomain: googleCloudAiplatformV1ExplanationMetadataInputMetadataFeatureValueDomain.optional(), groupName: z.string().optional(), indexFeatureMapping: z.array(z.string()).optional(), indicesTensorName: z.string().optional(), inputBaselines: z.array(z.unknown()).optional(), inputTensorName: z.string().optional(), modality: z.string().optional(), visualization: googleCloudAiplatformV1ExplanationMetadataInputMetadataVisualization.optional()}); export const googleCloudAiplatformV1ExplanationMetadataOutputMetadata = z.object({displayNameMappingKey: z.string().optional(), indexDisplayNameMapping: z.unknown(), outputTensorName: z.string().optional()}); export const googleCloudAiplatformV1ExplanationMetadata = z.object({featureAttributionsSchemaUri: z.string().optional(), inputs: z.record(z.string(), googleCloudAiplatformV1ExplanationMetadataInputMetadata).optional(), latentSpaceSource: z.string().optional(), outputs: z.record(z.string(), googleCloudAiplatformV1ExplanationMetadataOutputMetadata).optional()}); export const googleCloudAiplatformV1GcsSource = z.object({uris: z.array(z.string()).optional()}); export const googleCloudAiplatformV1ExamplesExampleGcsSource = z.object({dataFormat: z.enum(["DATA_FORMAT_UNSPECIFIED", "JSONL"]).optional(), gcsSource: googleCloudAiplatformV1GcsSource.optional()}); export const googleCloudAiplatformV1Presets = z.object({modality: z.enum(["MODALITY_UNSPECIFIED", "IMAGE", "TEXT", "TABULAR"]).optional(), query: z.enum(["PRECISE", "FAST"]).optional()}); export const googleCloudAiplatformV1Examples = z.object({exampleGcsSource: googleCloudAiplatformV1ExamplesExampleGcsSource.optional(), nearestNeighborSearchConfig: z.unknown(), neighborCount: z.number().int().optional(), presets: googleCloudAiplatformV1Presets.optional()}); export const googleCloudAiplatformV1BlurBaselineConfig = z.object({maxBlurSigma: z.number().optional()}); export const googleCloudAiplatformV1FeatureNoiseSigmaNoiseSigmaForFeature = z.object({name: z.string().optional(), sigma: z.number().optional()}); export const googleCloudAiplatformV1FeatureNoiseSigma = z.object({noiseSigma: z.array(googleCloudAiplatformV1FeatureNoiseSigmaNoiseSigmaForFeature).optional()}); export const googleCloudAiplatformV1SmoothGradConfig = z.object({featureNoiseSigma: googleCloudAiplatformV1FeatureNoiseSigma.optional(), noiseSigma: z.number().optional(), noisySampleCount: z.number().int().optional()}); export const googleCloudAiplatformV1IntegratedGradientsAttribution = z.object({blurBaselineConfig: googleCloudAiplatformV1BlurBaselineConfig.optional(), smoothGradConfig: googleCloudAiplatformV1SmoothGradConfig.optional(), stepCount: z.number().int().optional()}); export const googleCloudAiplatformV1SampledShapleyAttribution = z.object({pathCount: z.number().int().optional()}); export const googleCloudAiplatformV1XraiAttribution = z.object({blurBaselineConfig: googleCloudAiplatformV1BlurBaselineConfig.optional(), smoothGradConfig: googleCloudAiplatformV1SmoothGradConfig.optional(), stepCount: z.number().int().optional()}); export const googleCloudAiplatformV1ExplanationParameters = z.object({examples: googleCloudAiplatformV1Examples.optional(), integratedGradientsAttribution: googleCloudAiplatformV1IntegratedGradientsAttribution.optional(), outputIndices: z.array(z.unknown()).optional(), sampledShapleyAttribution: googleCloudAiplatformV1SampledShapleyAttribution.optional(), topK: z.number().int().optional(), xraiAttribution: googleCloudAiplatformV1XraiAttribution.optional()}); export const googleCloudAiplatformV1ExplanationSpec = z.object({metadata: googleCloudAiplatformV1ExplanationMetadata.optional(), parameters: googleCloudAiplatformV1ExplanationParameters.optional()}); export const googleCloudAiplatformV1FasterDeploymentConfig = z.object({fastTryoutEnabled: z.boolean().optional()}); export const googleCloudAiplatformV1PrivateEndpoints = z.object({explainHttpUri: z.string().optional(), healthHttpUri: z.string().optional(), predictHttpUri: z.string().optional(), serviceAttachment: z.string().optional()}); export const googleCloudAiplatformV1SpeculativeDecodingSpecDraftModelSpeculation = z.object({draftModel: z.string().optional()}); export const googleCloudAiplatformV1SpeculativeDecodingSpecNgramSpeculation = z.object({ngramSize: z.number().int().optional()}); export const googleCloudAiplatformV1SpeculativeDecodingSpec = z.object({draftModelSpeculation: googleCloudAiplatformV1SpeculativeDecodingSpecDraftModelSpeculation.optional(), ngramSpeculation: googleCloudAiplatformV1SpeculativeDecodingSpecNgramSpeculation.optional(), speculativeTokenCount: z.number().int().optional()}); export const googleCloudAiplatformV1DeployedModelStatus = z.object({availableReplicaCount: z.number().int().optional(), lastUpdateTime: z.string().optional(), message: z.string().optional()}); export const googleCloudAiplatformV1DeployedModel = z.object({automaticResources: googleCloudAiplatformV1AutomaticResources.optional(), checkpointId: z.string().optional(), createTime: z.string().optional(), dedicatedResources: googleCloudAiplatformV1DedicatedResources.optional(), disableContainerLogging: z.boolean().optional(), disableExplanations: z.boolean().optional(), displayName: z.string().optional(), enableAccessLogging: z.boolean().optional(), explanationSpec: googleCloudAiplatformV1ExplanationSpec.optional(), fasterDeploymentConfig: googleCloudAiplatformV1FasterDeploymentConfig.optional(), gdcConnectedModel: z.string().optional(), id: z.string().optional(), model: z.string().optional(), modelVersionId: z.string().optional(), privateEndpoints: googleCloudAiplatformV1PrivateEndpoints.optional(), serviceAccount: z.string().optional(), sharedResources: z.string().optional(), speculativeDecodingSpec: googleCloudAiplatformV1SpeculativeDecodingSpec.optional(), status: googleCloudAiplatformV1DeployedModelStatus.optional(), systemLabels: z.record(z.string(), z.string()).optional()}); export const googleCloudAiplatformV1EncryptionSpec = z.object({kmsKeyName: z.string().optional()}); export const googleCloudAiplatformV1GdcConfig = z.object({zone: z.string().optional()}); export const googleCloudAiplatformV1GenAiAdvancedFeaturesConfigRagConfig = z.object({enableRag: z.boolean().optional()}); export const googleCloudAiplatformV1GenAiAdvancedFeaturesConfig = z.object({ragConfig: googleCloudAiplatformV1GenAiAdvancedFeaturesConfigRagConfig.optional()}); export const googleCloudAiplatformV1BigQueryDestination = z.object({outputUri: z.string().optional()}); export const googleCloudAiplatformV1PredictRequestResponseLoggingConfig = z.object({bigqueryDestination: googleCloudAiplatformV1BigQueryDestination.optional(), enabled: z.boolean().optional(), samplingRate: z.number().optional()}); export const googleCloudAiplatformV1PSCAutomationConfig = z.object({errorMessage: z.string().optional(), forwardingRule: z.string().optional(), ipAddress: z.string().optional(), network: z.string().optional(), projectId: z.string().optional(), state: z.enum(["PSC_AUTOMATION_STATE_UNSPECIFIED", "PSC_AUTOMATION_STATE_SUCCESSFUL", "PSC_AUTOMATION_STATE_FAILED"]).optional()}); export const googleCloudAiplatformV1PrivateServiceConnectConfig = z.object({enablePrivateServiceConnect: z.boolean().optional(), projectAllowlist: z.array(z.string()).optional(), pscAutomationConfigs: z.array(googleCloudAiplatformV1PSCAutomationConfig).optional(), serviceAttachment: z.string().optional()}); export const googleCloudAiplatformV1Endpoint = z.object({clientConnectionConfig: googleCloudAiplatformV1ClientConnectionConfig.optional(), createTime: z.string().optional(), dedicatedEndpointDns: z.string().optional(), dedicatedEndpointEnabled: z.boolean().optional(), deployedModels: z.array(googleCloudAiplatformV1DeployedModel).optional(), description: z.string().optional(), displayName: z.string().optional(), enablePrivateServiceConnect: z.boolean().optional(), encryptionSpec: googleCloudAiplatformV1EncryptionSpec.optional(), etag: z.string().optional(), gdcConfig: googleCloudAiplatformV1GdcConfig.optional(), genAiAdvancedFeaturesConfig: googleCloudAiplatformV1GenAiAdvancedFeaturesConfig.optional(), labels: z.record(z.string(), z.string()).optional(), modelDeploymentMonitoringJob: z.string().optional(), name: z.string().optional(), network: z.string().optional(), predictRequestResponseLoggingConfig: googleCloudAiplatformV1PredictRequestResponseLoggingConfig.optional(), privateServiceConnectConfig: googleCloudAiplatformV1PrivateServiceConnectConfig.optional(), satisfiesPzi: z.boolean().optional(), satisfiesPzs: z.boolean().optional(), trafficSplit: z.record(z.string(), z.number().int()).optional(), updateTime: z.string().optional()}); export const googleCloudAiplatformV1ListEndpointsResponse = z.object({endpoints: z.array(googleCloudAiplatformV1Endpoint).optional(), nextPageToken: z.string().optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Lists Endpoints in a Location. * * GET /v1/projects/{projectsId}/locations/{locationsId}/endpoints * * Also accepts auth: Oauth2 + Oauth2c */ export const getApiV1ProjectsProjectsIdLocationsLocationsIdEndpoints = async (args: GetApiV1ProjectsProjectsIdLocationsLocationsIdEndpointsArgs, options?: GetApiV1ProjectsProjectsIdLocationsLocationsIdEndpointsOptions) => { const {baseUrl = "https://aiplatform.googleapis.com", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.filter != null) query.append("filter", String(args.filter)) if (args.gdcZone != null) query.append("gdcZone", String(args.gdcZone)) if (args.orderBy != null) query.append("orderBy", String(args.orderBy)) if (args.pageSize != null) query.append("pageSize", String(args.pageSize)) if (args.pageToken != null) query.append("pageToken", String(args.pageToken)) if (args.readMask != null) query.append("readMask", String(args.readMask)) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/projects/${encodeURIComponent(String(args.projectsId))}/locations/${encodeURIComponent(String(args.locationsId))}/endpoints${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(googleCloudAiplatformV1ListEndpointsResponse, await res.json()) };