1 // Copyright 2024 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 // Code generated by protoc-gen-go_gapic. DO NOT EDIT. 16 17 // Package monitoring is an auto-generated package for the 18 // Cloud Monitoring API. 19 // 20 // Manages your Cloud Monitoring data and configurations. 21 // 22 // # General documentation 23 // 24 // For information that is relevant for all client libraries please reference 25 // https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this 26 // page includes: 27 // 28 // - [Authentication and Authorization] 29 // - [Timeouts and Cancellation] 30 // - [Testing against Client Libraries] 31 // - [Debugging Client Libraries] 32 // - [Inspecting errors] 33 // 34 // # Example usage 35 // 36 // To get started with this package, create a client. 37 // 38 // ctx := context.Background() 39 // // This snippet has been automatically generated and should be regarded as a code template only. 40 // // It will require modifications to work: 41 // // - It may require correct/in-range values for request initialization. 42 // // - It may require specifying regional endpoints when creating the service client as shown in: 43 // // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 44 // c, err := monitoring.NewAlertPolicyClient(ctx) 45 // if err != nil { 46 // // TODO: Handle error. 47 // } 48 // defer c.Close() 49 // 50 // The client will use your default application credentials. Clients should be reused instead of created as needed. 51 // The methods of Client are safe for concurrent use by multiple goroutines. 52 // The returned client must be Closed when it is done being used. 53 // 54 // # Using the Client 55 // 56 // The following is an example of making an API call with the newly created client. 57 // 58 // ctx := context.Background() 59 // // This snippet has been automatically generated and should be regarded as a code template only. 60 // // It will require modifications to work: 61 // // - It may require correct/in-range values for request initialization. 62 // // - It may require specifying regional endpoints when creating the service client as shown in: 63 // // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 64 // c, err := monitoring.NewAlertPolicyClient(ctx) 65 // if err != nil { 66 // // TODO: Handle error. 67 // } 68 // defer c.Close() 69 // 70 // req := &monitoringpb.CreateAlertPolicyRequest{ 71 // // TODO: Fill request struct fields. 72 // // See https://pkg.go.dev/cloud.google.com/go/monitoring/apiv3/v2/monitoringpb#CreateAlertPolicyRequest. 73 // } 74 // resp, err := c.CreateAlertPolicy(ctx, req) 75 // if err != nil { 76 // // TODO: Handle error. 77 // } 78 // // TODO: Use resp. 79 // _ = resp 80 // 81 // # Use of Context 82 // 83 // The ctx passed to NewAlertPolicyClient is used for authentication requests and 84 // for creating the underlying connection, but is not used for subsequent calls. 85 // Individual methods on the client use the ctx given to them. 86 // 87 // To close the open connection, use the Close() method. 88 // 89 // [Authentication and Authorization]: https://pkg.go.dev/cloud.google.com/go#hdr-Authentication_and_Authorization 90 // [Timeouts and Cancellation]: https://pkg.go.dev/cloud.google.com/go#hdr-Timeouts_and_Cancellation 91 // [Testing against Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Testing 92 // [Debugging Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Debugging 93 // [Inspecting errors]: https://pkg.go.dev/cloud.google.com/go#hdr-Inspecting_errors 94 package monitoring // import "cloud.google.com/go/monitoring/apiv3/v2" 95 96 import ( 97 "context" 98 99 "google.golang.org/api/option" 100 ) 101 102 // For more information on implementing a client constructor hook, see 103 // https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. 104 type clientHookParams struct{} 105 type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) 106 107 var versionClient string 108 109 func getVersionClient() string { 110 if versionClient == "" { 111 return "UNKNOWN" 112 } 113 return versionClient 114 } 115 116 // DefaultAuthScopes reports the default set of authentication scopes to use with this package. 117 func DefaultAuthScopes() []string { 118 return []string{ 119 "https://www.googleapis.com/auth/cloud-platform", 120 "https://www.googleapis.com/auth/monitoring", 121 "https://www.googleapis.com/auth/monitoring.read", 122 "https://www.googleapis.com/auth/monitoring.write", 123 } 124 } 125