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