...

Source file src/cloud.google.com/go/iam/apiv2/doc.go

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

View as plain text