...

Source file src/cloud.google.com/go/storage/internal/apiv2/doc.go

Documentation: cloud.google.com/go/storage/internal/apiv2

     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 storage is an auto-generated package for the
    18  // Cloud Storage API.
    19  //
    20  // Stop. This folder is likely not what you are looking for. This folder
    21  // contains protocol buffer definitions for an API only accessible to select
    22  // customers. Customers not participating should not depend on this file.
    23  // Please contact Google Cloud sales if you are interested. Unless told
    24  // otherwise by a Google Cloud representative, do not use or otherwise rely
    25  // on any of the contents of this folder. If you would like to use Cloud
    26  // Storage, please consult our official documentation (at
    27  // https://cloud.google.com/storage/docs/apis) for details on our XML and
    28  // JSON APIs, or else consider one of our client libraries (at
    29  // https://cloud.google.com/storage/docs/reference/libraries). This API
    30  // defined in this folder is unreleased and may shut off, break, or fail at
    31  // any time for any users who are not registered as a part of a private
    32  // preview program.
    33  //
    34  // # General documentation
    35  //
    36  // For information that is relevant for all client libraries please reference
    37  // https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this
    38  // page includes:
    39  //
    40  //   - [Authentication and Authorization]
    41  //   - [Timeouts and Cancellation]
    42  //   - [Testing against Client Libraries]
    43  //   - [Debugging Client Libraries]
    44  //   - [Inspecting errors]
    45  //
    46  // # Example usage
    47  //
    48  // To get started with this package, create a client.
    49  //
    50  //	ctx := context.Background()
    51  //	// This snippet has been automatically generated and should be regarded as a code template only.
    52  //	// It will require modifications to work:
    53  //	// - It may require correct/in-range values for request initialization.
    54  //	// - It may require specifying regional endpoints when creating the service client as shown in:
    55  //	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    56  //	c, err := storage.NewClient(ctx)
    57  //	if err != nil {
    58  //		// TODO: Handle error.
    59  //	}
    60  //	defer c.Close()
    61  //
    62  // The client will use your default application credentials. Clients should be reused instead of created as needed.
    63  // The methods of Client are safe for concurrent use by multiple goroutines.
    64  // The returned client must be Closed when it is done being used.
    65  //
    66  // # Using the Client
    67  //
    68  // The following is an example of making an API call with the newly created client.
    69  //
    70  //	ctx := context.Background()
    71  //	// This snippet has been automatically generated and should be regarded as a code template only.
    72  //	// It will require modifications to work:
    73  //	// - It may require correct/in-range values for request initialization.
    74  //	// - It may require specifying regional endpoints when creating the service client as shown in:
    75  //	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
    76  //	c, err := storage.NewClient(ctx)
    77  //	if err != nil {
    78  //		// TODO: Handle error.
    79  //	}
    80  //	defer c.Close()
    81  //	stream, err := c.BidiWriteObject(ctx)
    82  //	if err != nil {
    83  //		// TODO: Handle error.
    84  //	}
    85  //	go func() {
    86  //		reqs := []*storagepb.BidiWriteObjectRequest{
    87  //			// TODO: Create requests.
    88  //		}
    89  //		for _, req := range reqs {
    90  //			if err := stream.Send(req); err != nil {
    91  //				// TODO: Handle error.
    92  //			}
    93  //		}
    94  //		stream.CloseSend()
    95  //	}()
    96  //	for {
    97  //		resp, err := stream.Recv()
    98  //		if err == io.EOF {
    99  //			break
   100  //		}
   101  //		if err != nil {
   102  //			// TODO: handle error.
   103  //		}
   104  //		// TODO: Use resp.
   105  //		_ = resp
   106  //	}
   107  //
   108  // # Use of Context
   109  //
   110  // The ctx passed to NewClient is used for authentication requests and
   111  // for creating the underlying connection, but is not used for subsequent calls.
   112  // Individual methods on the client use the ctx given to them.
   113  //
   114  // To close the open connection, use the Close() method.
   115  //
   116  // [Authentication and Authorization]: https://pkg.go.dev/cloud.google.com/go#hdr-Authentication_and_Authorization
   117  // [Timeouts and Cancellation]: https://pkg.go.dev/cloud.google.com/go#hdr-Timeouts_and_Cancellation
   118  // [Testing against Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Testing
   119  // [Debugging Client Libraries]: https://pkg.go.dev/cloud.google.com/go#hdr-Debugging
   120  // [Inspecting errors]: https://pkg.go.dev/cloud.google.com/go#hdr-Inspecting_errors
   121  package storage // import "cloud.google.com/go/storage/internal/apiv2"
   122  
   123  import (
   124  	"context"
   125  
   126  	"google.golang.org/api/option"
   127  )
   128  
   129  // For more information on implementing a client constructor hook, see
   130  // https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors.
   131  type clientHookParams struct{}
   132  type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error)
   133  
   134  var versionClient string
   135  
   136  func getVersionClient() string {
   137  	if versionClient == "" {
   138  		return "UNKNOWN"
   139  	}
   140  	return versionClient
   141  }
   142  
   143  // DefaultAuthScopes reports the default set of authentication scopes to use with this package.
   144  func DefaultAuthScopes() []string {
   145  	return []string{
   146  		"https://www.googleapis.com/auth/cloud-platform",
   147  		"https://www.googleapis.com/auth/cloud-platform.read-only",
   148  		"https://www.googleapis.com/auth/devstorage.full_control",
   149  		"https://www.googleapis.com/auth/devstorage.read_only",
   150  		"https://www.googleapis.com/auth/devstorage.read_write",
   151  	}
   152  }
   153  

View as plain text