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