Cloud Quotas API v1 - Package cloud.google.com/go/cloudquotas/apiv1 (v1.4.0) Stay organized with collections Save and categorize content based on your preferences.
Package cloudquotas is an auto-generated package for theCloud Quotas API.
Cloud Quotas API provides Google Cloud service consumers with managementand observability for resource usage, quotas, and restrictions of theservices they consume.
General documentation
For information that is relevant for all client libraries please referencehttps://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on thispage includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/cloudquotas/apiv1@latestctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed.The methods of Client are safe for concurrent use by multiple goroutines.The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req:=&cloudquotaspb.CreateQuotaPreferenceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#CreateQuotaPreferenceRequest.}resp,err:=c.CreateQuotaPreference(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp
Use of Context
The ctx passed to NewClient is used for authentication requests andfor creating the underlying connection, but is not used for subsequent calls.Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func DefaultAuthScopes
funcDefaultAuthScopes()[]stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
CallOptions
typeCallOptionsstruct{ListQuotaInfos[]gax.CallOptionGetQuotaInfo[]gax.CallOptionListQuotaPreferences[]gax.CallOptionGetQuotaPreference[]gax.CallOptionCreateQuotaPreference[]gax.CallOptionUpdateQuotaPreference[]gax.CallOption}CallOptions contains the retry settings for each method of Client.
Client
typeClientstruct{// The call options for this service.CallOptions*CallOptions// contains filtered or unexported fields}Client is a client for interacting with Cloud Quotas API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Cloud Quotas API is an infrastructure service for Google Cloud that letsservice consumers list and manage their resource usage limits.
List/Get the metadata and current status of the quotas for a service.Create/Update quota preferencess that declare the preferred quota values.Check the status of a quota preference request.List/Get pending and historical quota preference.func NewClient
NewClient creates a new cloud quotas client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
The Cloud Quotas API is an infrastructure service for Google Cloud that letsservice consumers list and manage their resource usage limits.
List/Get the metadata and current status of the quotas for a service.Create/Update quota preferencess that declare the preferred quota values.Check the status of a quota preference request.List/Get pending and historical quota preference.Example
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewRESTClient
NewRESTClient creates a new cloud quotas rest client.
The Cloud Quotas API is an infrastructure service for Google Cloud that letsservice consumers list and manage their resource usage limits.
List/Get the metadata and current status of the quotas for a service.Create/Update quota preferencess that declare the preferred quota values.Check the status of a quota preference request.List/Get pending and historical quota preference.Example
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*Client) Close
Close closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*Client) Connection (deprecated)
func(c*Client)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*Client) CreateQuotaPreference
func(c*Client)CreateQuotaPreference(ctxcontext.Context,req*cloudquotaspb.CreateQuotaPreferenceRequest,opts...gax.CallOption)(*cloudquotaspb.QuotaPreference,error)CreateQuotaPreference creates a new QuotaPreference that declares the desired value for a quota.
Example
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1"cloudquotaspb"cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&cloudquotaspb.CreateQuotaPreferenceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#CreateQuotaPreferenceRequest.}resp,err:=c.CreateQuotaPreference(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) GetQuotaInfo
func(c*Client)GetQuotaInfo(ctxcontext.Context,req*cloudquotaspb.GetQuotaInfoRequest,opts...gax.CallOption)(*cloudquotaspb.QuotaInfo,error)GetQuotaInfo retrieve the QuotaInfo of a quota for a project, folder or organization.
Example
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1"cloudquotaspb"cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&cloudquotaspb.GetQuotaInfoRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#GetQuotaInfoRequest.}resp,err:=c.GetQuotaInfo(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) GetQuotaPreference
func(c*Client)GetQuotaPreference(ctxcontext.Context,req*cloudquotaspb.GetQuotaPreferenceRequest,opts...gax.CallOption)(*cloudquotaspb.QuotaPreference,error)GetQuotaPreference gets details of a single QuotaPreference.
Example
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1"cloudquotaspb"cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&cloudquotaspb.GetQuotaPreferenceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#GetQuotaPreferenceRequest.}resp,err:=c.GetQuotaPreference(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) ListQuotaInfos
func(c*Client)ListQuotaInfos(ctxcontext.Context,req*cloudquotaspb.ListQuotaInfosRequest,opts...gax.CallOption)*QuotaInfoIteratorListQuotaInfos lists QuotaInfos of all quotas for a given project, folder or organization.
Examples
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1"cloudquotaspb"cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&cloudquotaspb.ListQuotaInfosRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#ListQuotaInfosRequest.}it:=c.ListQuotaInfos(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*cloudquotaspb.ListQuotaInfosResponse)}}all
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1"cloudquotaspb"cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&cloudquotaspb.ListQuotaInfosRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#ListQuotaInfosRequest.}forresp,err:=rangec.ListQuotaInfos(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*Client) ListQuotaPreferences
func(c*Client)ListQuotaPreferences(ctxcontext.Context,req*cloudquotaspb.ListQuotaPreferencesRequest,opts...gax.CallOption)*QuotaPreferenceIteratorListQuotaPreferences lists QuotaPreferences in a given project, folder or organization.
Examples
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1"cloudquotaspb"cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb""google.golang.org/api/iterator")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&cloudquotaspb.ListQuotaPreferencesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#ListQuotaPreferencesRequest.}it:=c.ListQuotaPreferences(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp// If you need to access the underlying RPC response,// you can do so by casting the `Response` as below.// Otherwise, remove this line. Only populated after// first call to Next(). Not safe for concurrent access._=it.Response.(*cloudquotaspb.ListQuotaPreferencesResponse)}}all
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1"cloudquotaspb"cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&cloudquotaspb.ListQuotaPreferencesRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#ListQuotaPreferencesRequest.}forresp,err:=rangec.ListQuotaPreferences(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*Client) UpdateQuotaPreference
func(c*Client)UpdateQuotaPreference(ctxcontext.Context,req*cloudquotaspb.UpdateQuotaPreferenceRequest,opts...gax.CallOption)(*cloudquotaspb.QuotaPreference,error)UpdateQuotaPreference updates the parameters of a single QuotaPreference. It can updates theconfig in any states, not just the ones pending approval.
Example
packagemainimport("context"cloudquotas"cloud.google.com/go/cloudquotas/apiv1"cloudquotaspb"cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb")funcmain(){ctx:=context.Background()// This snippet has been automatically generated and should be regarded as a code template only.// It will require modifications to work:// - It may require correct/in-range values for request initialization.// - It may require specifying regional endpoints when creating the service client as shown in:// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Optionsc,err:=cloudquotas.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&cloudquotaspb.UpdateQuotaPreferenceRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/cloudquotas/apiv1/cloudquotaspb#UpdateQuotaPreferenceRequest.}resp,err:=c.UpdateQuotaPreference(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}QuotaInfoIterator
typeQuotaInfoIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*cloudquotaspb.QuotaInfo,nextPageTokenstring,errerror)// contains filtered or unexported fields}QuotaInfoIterator manages a stream of *cloudquotaspb.QuotaInfo.
func (*QuotaInfoIterator) All
func(it*QuotaInfoIterator)All()iter.Seq2[*cloudquotaspb.QuotaInfo,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*QuotaInfoIterator) Next
func(it*QuotaInfoIterator)Next()(*cloudquotaspb.QuotaInfo,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*QuotaInfoIterator) PageInfo
func(it*QuotaInfoIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
QuotaPreferenceIterator
typeQuotaPreferenceIteratorstruct{// Response is the raw response for the current page.// It must be cast to the RPC response type.// Calling Next() or InternalFetch() updates this value.Responseinterface{}// InternalFetch is for use by the Google Cloud Libraries only.// It is not part of the stable interface of this package.//// InternalFetch returns results from a single call to the underlying RPC.// The number of results is no greater than pageSize.// If there are no more results, nextPageToken is empty and err is nil.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*cloudquotaspb.QuotaPreference,nextPageTokenstring,errerror)// contains filtered or unexported fields}QuotaPreferenceIterator manages a stream of *cloudquotaspb.QuotaPreference.
func (*QuotaPreferenceIterator) All
func(it*QuotaPreferenceIterator)All()iter.Seq2[*cloudquotaspb.QuotaPreference,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*QuotaPreferenceIterator) Next
func(it*QuotaPreferenceIterator)Next()(*cloudquotaspb.QuotaPreference,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*QuotaPreferenceIterator) PageInfo
func(it*QuotaPreferenceIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.