UNPKG

3.19 kBTypeScriptView Raw
1/*!
2 * Copyright 2016 Google Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { GoogleAuth } from 'google-auth-library';
17import { ServiceContext } from '../index';
18/**
19 * Create a descriptor for Cloud Functions.
20 *
21 * @returns {object}
22 */
23export declare function getCloudFunctionDescriptor(): Promise<{
24 type: string;
25 labels: {
26 function_name: string | undefined;
27 region: string | undefined;
28 };
29}>;
30/**
31 * Create a descriptor for Cloud Run.
32 *
33 * @returns {object}
34 */
35export declare function getCloudRunDescriptor(): Promise<{
36 type: string;
37 labels: {
38 location: string | undefined;
39 service_name: string | undefined;
40 revision_name: string | undefined;
41 configuration_name: string | undefined;
42 };
43}>;
44/**
45 * Create a descriptor for Google App Engine.
46 *
47 * @returns {object}
48 */
49export declare function getGAEDescriptor(): Promise<{
50 type: string;
51 labels: {
52 module_id: string | undefined;
53 version_id: string | undefined;
54 zone: string | undefined;
55 };
56}>;
57/**
58 * Create a descriptor for Google Compute Engine.
59 * @return {object}
60 */
61export declare function getGCEDescriptor(): Promise<{
62 type: string;
63 labels: {
64 instance_id: any;
65 zone: string | undefined;
66 };
67}>;
68export declare const KUBERNETES_NAMESPACE_ID_PATH = "/var/run/secrets/kubernetes.io/serviceaccount/namespace";
69/**
70 * Create a descriptor for Google Container Engine.
71 *
72 * @return {object}
73 */
74export declare function getGKEDescriptor(): Promise<{
75 type: string;
76 labels: {
77 location: string | undefined;
78 cluster_name: any;
79 namespace_name: string;
80 pod_name: string | undefined;
81 container_name: string | undefined;
82 };
83}>;
84/**
85 * Create a global descriptor.
86 *
87 * @returns {object}
88 */
89export declare function getGlobalDescriptor(): {
90 type: string;
91};
92/**
93 * Attempt to contact the metadata service and determine,
94 * based on request success and environment variables, what type of resource
95 * the library is operating on.
96 */
97export declare function getDefaultResource(auth: GoogleAuth): Promise<{
98 type: string;
99}>;
100/**
101 * For logged errors, users can provide a service context. This enables errors
102 * to be picked up Cloud Error Reporting. For more information see
103 * [this guide]{@link
104 * https://cloud.google.com/error-reporting/docs/formatting-error-messages} and
105 * the [official documentation]{@link
106 * https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext}.
107 */
108export declare function detectServiceContext(auth: GoogleAuth): Promise<ServiceContext | null>;