1 // Copyright 2020 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package monitoring is an auto-generated package for the 16 // Cloud Monitoring API. 17 // 18 // Manages your Cloud Monitoring data and configurations. Most projects must 19 // be associated with a Workspace, with a few exceptions as noted on the 20 // individual method pages. The table entries below are presented in 21 // alphabetical order, not in order of common use. For explanations of the 22 // concepts found in the table entries, read the [Cloud Monitoring 23 // documentation](https://cloud.google.com/monitoring/docs). 24 // 25 // # Use of Context 26 // 27 // The ctx passed to NewClient is used for authentication requests and 28 // for creating the underlying connection, but is not used for subsequent calls. 29 // Individual methods on the client use the ctx given to them. 30 // 31 // To close the open connection, use the Close() method. 32 // 33 // For information about setting deadlines, reusing contexts, and more 34 // please visit godoc.org/cloud.google.com/go. 35 // 36 // Deprecated: Please use cloud.google.com/go/monitoring/apiv3/v2. 37 package monitoring // import "cloud.google.com/go/monitoring/apiv3" 38 39 import ( 40 "context" 41 42 "google.golang.org/api/option" 43 "google.golang.org/grpc/metadata" 44 ) 45 46 // For more information on implementing a client constructor hook, see 47 // https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. 48 type clientHookParams struct{} 49 type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) 50 51 var versionClient = "20220222" 52 53 func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { 54 out, _ := metadata.FromOutgoingContext(ctx) 55 out = out.Copy() 56 for _, md := range mds { 57 for k, v := range md { 58 out[k] = append(out[k], v...) 59 } 60 } 61 return metadata.NewOutgoingContext(ctx, out) 62 } 63 64 // DefaultAuthScopes reports the default set of authentication scopes to use with this package. 65 func DefaultAuthScopes() []string { 66 return []string{ 67 "https://www.googleapis.com/auth/cloud-platform", 68 "https://www.googleapis.com/auth/monitoring", 69 "https://www.googleapis.com/auth/monitoring.read", 70 "https://www.googleapis.com/auth/monitoring.write", 71 } 72 } 73