diff --git a/accessapproval/apiv1/access_approval_client.go b/accessapproval/apiv1/access_approval_client.go index 46dd206e6e4..82fcd943262 100644 --- a/accessapproval/apiv1/access_approval_client.go +++ b/accessapproval/apiv1/access_approval_client.go @@ -128,12 +128,12 @@ type internalClient interface { // This API allows a customer to manage accesses to cloud resources by // Google personnel. It defines the following resource model: // -// The API has a collection of -// ApprovalRequest -// resources, named approvalRequests/{approval_request} +// The API has a collection of +// ApprovalRequest +// resources, named approvalRequests/{approval_request} // -// The API has top-level settings per Project/Folder/Organization, named -// accessApprovalSettings +// The API has top-level settings per Project/Folder/Organization, named +// accessApprovalSettings // // The service also periodically emails a list of recipients, defined at the // Project/Folder/Organization level in the accessApprovalSettings, when there @@ -288,12 +288,12 @@ type gRPCClient struct { // This API allows a customer to manage accesses to cloud resources by // Google personnel. It defines the following resource model: // -// The API has a collection of -// ApprovalRequest -// resources, named approvalRequests/{approval_request} +// The API has a collection of +// ApprovalRequest +// resources, named approvalRequests/{approval_request} // -// The API has top-level settings per Project/Folder/Organization, named -// accessApprovalSettings +// The API has top-level settings per Project/Folder/Organization, named +// accessApprovalSettings // // The service also periodically emails a list of recipients, defined at the // Project/Folder/Organization level in the accessApprovalSettings, when there diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go index 6a7f344b583..53d562bdba8 100644 --- a/accessapproval/apiv1/doc.go +++ b/accessapproval/apiv1/doc.go @@ -19,49 +19,50 @@ // // An API for controlling access to data by Google personnel. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := accessapproval.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := accessapproval.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := accessapproval.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &accessapprovalpb.ListApprovalRequestsMessage{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/accessapproval/v1#ListApprovalRequestsMessage. -// } -// it := c.ListApprovalRequests(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := accessapproval.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &accessapprovalpb.ListApprovalRequestsMessage{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/accessapproval/v1#ListApprovalRequestsMessage. +// } +// it := c.ListApprovalRequests(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/accesscontextmanager/apiv1/doc.go b/accesscontextmanager/apiv1/doc.go index 56c910a4e85..f595212d86c 100644 --- a/accesscontextmanager/apiv1/doc.go +++ b/accesscontextmanager/apiv1/doc.go @@ -20,49 +20,50 @@ // An API for setting attribute based access control to requests to GCP // services. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := accesscontextmanager.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := accesscontextmanager.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := accesscontextmanager.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &accesscontextmanagerpb.ListAccessPoliciesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1#ListAccessPoliciesRequest. -// } -// it := c.ListAccessPolicies(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := accesscontextmanager.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &accesscontextmanagerpb.ListAccessPoliciesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1#ListAccessPoliciesRequest. +// } +// it := c.ListAccessPolicies(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/aiplatform/apiv1/doc.go b/aiplatform/apiv1/doc.go index cf849b21628..f71a548b78a 100644 --- a/aiplatform/apiv1/doc.go +++ b/aiplatform/apiv1/doc.go @@ -20,48 +20,49 @@ // Train high-quality custom machine learning models with minimal machine // learning expertise and effort. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := aiplatform.NewDatasetClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := aiplatform.NewDatasetClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := aiplatform.NewDatasetClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &aiplatformpb.CreateDatasetRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateDatasetRequest. -// } -// op, err := c.CreateDataset(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := aiplatform.NewDatasetClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &aiplatformpb.CreateDatasetRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1#CreateDatasetRequest. +// } +// op, err := c.CreateDataset(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/aiplatform/apiv1/featurestore_client.go b/aiplatform/apiv1/featurestore_client.go index b448d23fdcd..ce6973f9c0b 100644 --- a/aiplatform/apiv1/featurestore_client.go +++ b/aiplatform/apiv1/featurestore_client.go @@ -352,15 +352,15 @@ func (c *FeaturestoreClient) DeleteFeatureOperation(name string) *DeleteFeatureO // // There are also scenarios where the caller can cause inconsistency. // -// Source data for import contains multiple distinct Feature values for -// the same entity ID and timestamp. +// Source data for import contains multiple distinct Feature values for +// the same entity ID and timestamp. // -// Source is modified during an import. This includes adding, updating, or -// removing source data and/or metadata. Examples of updating metadata -// include but are not limited to changing storage location, storage class, -// or retention policy. +// Source is modified during an import. This includes adding, updating, or +// removing source data and/or metadata. Examples of updating metadata +// include but are not limited to changing storage location, storage class, +// or retention policy. // -// Online serving cluster is under-provisioned. +// Online serving cluster is under-provisioned. func (c *FeaturestoreClient) ImportFeatureValues(ctx context.Context, req *aiplatformpb.ImportFeatureValuesRequest, opts ...gax.CallOption) (*ImportFeatureValuesOperation, error) { return c.internalClient.ImportFeatureValues(ctx, req, opts...) } diff --git a/aiplatform/apiv1/prediction_client.go b/aiplatform/apiv1/prediction_client.go index abe706291a7..4a165e7d2b8 100644 --- a/aiplatform/apiv1/prediction_client.go +++ b/aiplatform/apiv1/prediction_client.go @@ -149,11 +149,11 @@ func (c *PredictionClient) Predict(ctx context.Context, req *aiplatformpb.Predic // // The response includes the following HTTP headers: // -// X-Vertex-AI-Endpoint-Id: ID of the Endpoint that served this -// prediction. +// X-Vertex-AI-Endpoint-Id: ID of the Endpoint that served this +// prediction. // -// X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint’s DeployedModel -// that served this prediction. +// X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint’s DeployedModel +// that served this prediction. func (c *PredictionClient) RawPredict(ctx context.Context, req *aiplatformpb.RawPredictRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error) { return c.internalClient.RawPredict(ctx, req, opts...) } diff --git a/aiplatform/apiv1beta1/doc.go b/aiplatform/apiv1beta1/doc.go index cae573cb585..849515a9ab2 100644 --- a/aiplatform/apiv1beta1/doc.go +++ b/aiplatform/apiv1beta1/doc.go @@ -20,50 +20,51 @@ // Train high-quality custom machine learning models with minimal machine // learning expertise and effort. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := aiplatform.NewDatasetClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := aiplatform.NewDatasetClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := aiplatform.NewDatasetClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &aiplatformpb.CreateDatasetRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1#CreateDatasetRequest. -// } -// op, err := c.CreateDataset(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := aiplatform.NewDatasetClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &aiplatformpb.CreateDatasetRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1#CreateDatasetRequest. +// } +// op, err := c.CreateDataset(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/aiplatform/apiv1beta1/featurestore_client.go b/aiplatform/apiv1beta1/featurestore_client.go index af470caf8e4..b771c97a4e3 100644 --- a/aiplatform/apiv1beta1/featurestore_client.go +++ b/aiplatform/apiv1beta1/featurestore_client.go @@ -352,15 +352,15 @@ func (c *FeaturestoreClient) DeleteFeatureOperation(name string) *DeleteFeatureO // // There are also scenarios where the caller can cause inconsistency. // -// Source data for import contains multiple distinct Feature values for -// the same entity ID and timestamp. +// Source data for import contains multiple distinct Feature values for +// the same entity ID and timestamp. // -// Source is modified during an import. This includes adding, updating, or -// removing source data and/or metadata. Examples of updating metadata -// include but are not limited to changing storage location, storage class, -// or retention policy. +// Source is modified during an import. This includes adding, updating, or +// removing source data and/or metadata. Examples of updating metadata +// include but are not limited to changing storage location, storage class, +// or retention policy. // -// Online serving cluster is under-provisioned. +// Online serving cluster is under-provisioned. func (c *FeaturestoreClient) ImportFeatureValues(ctx context.Context, req *aiplatformpb.ImportFeatureValuesRequest, opts ...gax.CallOption) (*ImportFeatureValuesOperation, error) { return c.internalClient.ImportFeatureValues(ctx, req, opts...) } diff --git a/aiplatform/apiv1beta1/prediction_client.go b/aiplatform/apiv1beta1/prediction_client.go index f3daada9561..b43f9a5f5b1 100644 --- a/aiplatform/apiv1beta1/prediction_client.go +++ b/aiplatform/apiv1beta1/prediction_client.go @@ -150,11 +150,11 @@ func (c *PredictionClient) Predict(ctx context.Context, req *aiplatformpb.Predic // // The response includes the following HTTP headers: // -// X-Vertex-AI-Endpoint-Id: ID of the Endpoint that served this -// prediction. +// X-Vertex-AI-Endpoint-Id: ID of the Endpoint that served this +// prediction. // -// X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint’s DeployedModel -// that served this prediction. +// X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint’s DeployedModel +// that served this prediction. func (c *PredictionClient) RawPredict(ctx context.Context, req *aiplatformpb.RawPredictRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error) { return c.internalClient.RawPredict(ctx, req, opts...) } diff --git a/analytics/admin/apiv1alpha/analytics_admin_client.go b/analytics/admin/apiv1alpha/analytics_admin_client.go index c0a0f8a1942..f206706d387 100644 --- a/analytics/admin/apiv1alpha/analytics_admin_client.go +++ b/analytics/admin/apiv1alpha/analytics_admin_client.go @@ -2416,10 +2416,10 @@ func (c *AnalyticsAdminClient) ApproveDisplayVideo360AdvertiserLinkProposal(ctx // CancelDisplayVideo360AdvertiserLinkProposal cancels a DisplayVideo360AdvertiserLinkProposal. // Cancelling can mean either: // -// Declining a proposal initiated from Display & Video 360 +// Declining a proposal initiated from Display & Video 360 // -// Withdrawing a proposal initiated from Google Analytics -// After being cancelled, a proposal will eventually be deleted automatically. +// Withdrawing a proposal initiated from Google Analytics +// After being cancelled, a proposal will eventually be deleted automatically. func (c *AnalyticsAdminClient) CancelDisplayVideo360AdvertiserLinkProposal(ctx context.Context, req *adminpb.CancelDisplayVideo360AdvertiserLinkProposalRequest, opts ...gax.CallOption) (*adminpb.DisplayVideo360AdvertiserLinkProposal, error) { return c.internalClient.CancelDisplayVideo360AdvertiserLinkProposal(ctx, req, opts...) } @@ -8068,10 +8068,10 @@ func (c *analyticsAdminRESTClient) ApproveDisplayVideo360AdvertiserLinkProposal( // CancelDisplayVideo360AdvertiserLinkProposal cancels a DisplayVideo360AdvertiserLinkProposal. // Cancelling can mean either: // -// Declining a proposal initiated from Display & Video 360 +// Declining a proposal initiated from Display & Video 360 // -// Withdrawing a proposal initiated from Google Analytics -// After being cancelled, a proposal will eventually be deleted automatically. +// Withdrawing a proposal initiated from Google Analytics +// After being cancelled, a proposal will eventually be deleted automatically. func (c *analyticsAdminRESTClient) CancelDisplayVideo360AdvertiserLinkProposal(ctx context.Context, req *adminpb.CancelDisplayVideo360AdvertiserLinkProposalRequest, opts ...gax.CallOption) (*adminpb.DisplayVideo360AdvertiserLinkProposal, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/analytics/admin/apiv1alpha/doc.go b/analytics/admin/apiv1alpha/doc.go index f11b4c761a2..f7322268667 100644 --- a/analytics/admin/apiv1alpha/doc.go +++ b/analytics/admin/apiv1alpha/doc.go @@ -17,45 +17,46 @@ // Package admin is an auto-generated package for the // Google Analytics Admin API. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := admin.NewAnalyticsAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := admin.NewAnalyticsAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := admin.NewAnalyticsAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &adminpb.GetAccountRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#GetAccountRequest. -// } -// resp, err := c.GetAccount(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := admin.NewAnalyticsAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &adminpb.GetAccountRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/analytics/admin/v1alpha#GetAccountRequest. +// } +// resp, err := c.GetAccount(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/apigateway/apiv1/doc.go b/apigateway/apiv1/doc.go index 8c071ead515..489b6016768 100644 --- a/apigateway/apiv1/doc.go +++ b/apigateway/apiv1/doc.go @@ -17,49 +17,50 @@ // Package apigateway is an auto-generated package for the // API Gateway API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := apigateway.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := apigateway.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := apigateway.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := apigateway.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &apigatewaypb.ListGatewaysRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/apigateway/v1#ListGatewaysRequest. -// } -// it := c.ListGateways(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } +// req := &apigatewaypb.ListGatewaysRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/apigateway/v1#ListGatewaysRequest. +// } +// it := c.ListGateways(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/apigeeconnect/apiv1/doc.go b/apigeeconnect/apiv1/doc.go index 496baad0512..788e3272540 100644 --- a/apigeeconnect/apiv1/doc.go +++ b/apigeeconnect/apiv1/doc.go @@ -17,49 +17,50 @@ // Package apigeeconnect is an auto-generated package for the // Apigee Connect API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := apigeeconnect.NewConnectionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := apigeeconnect.NewConnectionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := apigeeconnect.NewConnectionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := apigeeconnect.NewConnectionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &apigeeconnectpb.ListConnectionsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/apigeeconnect/v1#ListConnectionsRequest. -// } -// it := c.ListConnections(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } +// req := &apigeeconnectpb.ListConnectionsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/apigeeconnect/v1#ListConnectionsRequest. +// } +// it := c.ListConnections(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/apigeeregistry/apiv1/doc.go b/apigeeregistry/apiv1/doc.go index d3dcd844e68..641cfa82c21 100644 --- a/apigeeregistry/apiv1/doc.go +++ b/apigeeregistry/apiv1/doc.go @@ -17,50 +17,51 @@ // Package apigeeregistry is an auto-generated package for the // Apigee Registry API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := apigeeregistry.NewProvisioningClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := apigeeregistry.NewProvisioningClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := apigeeregistry.NewProvisioningClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &apigeeregistrypb.CreateInstanceRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1#CreateInstanceRequest. -// } -// op, err := c.CreateInstance(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := apigeeregistry.NewProvisioningClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &apigeeregistrypb.CreateInstanceRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1#CreateInstanceRequest. +// } +// op, err := c.CreateInstance(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/appengine/apiv1/applications_client.go b/appengine/apiv1/applications_client.go index b26d785f145..d2f0cf587da 100644 --- a/appengine/apiv1/applications_client.go +++ b/appengine/apiv1/applications_client.go @@ -127,9 +127,9 @@ func (c *ApplicationsClient) GetApplication(ctx context.Context, req *appenginep // CreateApplication creates an App Engine application for a Google Cloud Platform project. // Required fields: // -// id - The ID of the target Cloud Platform project. +// id - The ID of the target Cloud Platform project. // -// location - The region (at https://cloud.google.com/appengine/docs/locations) where you want the App Engine application located. +// location - The region (at https://cloud.google.com/appengine/docs/locations) where you want the App Engine application located. // // For more information about App Engine applications, see Managing Projects, Applications, and Billing (at https://cloud.google.com/appengine/docs/standard/python/console/). func (c *ApplicationsClient) CreateApplication(ctx context.Context, req *appenginepb.CreateApplicationRequest, opts ...gax.CallOption) (*CreateApplicationOperation, error) { @@ -145,11 +145,11 @@ func (c *ApplicationsClient) CreateApplicationOperation(name string) *CreateAppl // UpdateApplication updates the specified Application resource. // You can update the following fields: // -// auth_domain - Google authentication domain for controlling user access to the application. +// auth_domain - Google authentication domain for controlling user access to the application. // -// default_cookie_expiration - Cookie expiration policy for the application. +// default_cookie_expiration - Cookie expiration policy for the application. // -// iap - Identity-Aware Proxy properties for the application. +// iap - Identity-Aware Proxy properties for the application. func (c *ApplicationsClient) UpdateApplication(ctx context.Context, req *appenginepb.UpdateApplicationRequest, opts ...gax.CallOption) (*UpdateApplicationOperation, error) { return c.internalClient.UpdateApplication(ctx, req, opts...) } diff --git a/appengine/apiv1/doc.go b/appengine/apiv1/doc.go index d85f7e80eee..278072434f5 100644 --- a/appengine/apiv1/doc.go +++ b/appengine/apiv1/doc.go @@ -19,43 +19,44 @@ // // Provisions and manages developers’ App Engine applications. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := appengine.NewApplicationsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := appengine.NewApplicationsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := appengine.NewApplicationsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &appenginepb.GetApplicationRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/appengine/v1#GetApplicationRequest. -// } -// resp, err := c.GetApplication(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := appengine.NewApplicationsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &appenginepb.GetApplicationRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/appengine/v1#GetApplicationRequest. +// } +// resp, err := c.GetApplication(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/appengine/apiv1/versions_client.go b/appengine/apiv1/versions_client.go index 06c42085853..2d5a2b0d344 100644 --- a/appengine/apiv1/versions_client.go +++ b/appengine/apiv1/versions_client.go @@ -153,45 +153,45 @@ func (c *VersionsClient) CreateVersionOperation(name string) *CreateVersionOpera // // Standard environment // -// instance_class (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class) +// instance_class (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.instance_class) // // automatic scaling in the standard environment: // -// automatic_scaling.min_idle_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) +// automatic_scaling.min_idle_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) // -// automatic_scaling.max_idle_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) +// automatic_scaling.max_idle_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) // -// automaticScaling.standard_scheduler_settings.max_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) +// automaticScaling.standard_scheduler_settings.max_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) // -// automaticScaling.standard_scheduler_settings.min_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) +// automaticScaling.standard_scheduler_settings.min_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) // -// automaticScaling.standard_scheduler_settings.target_cpu_utilization (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) +// automaticScaling.standard_scheduler_settings.target_cpu_utilization (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) // -// automaticScaling.standard_scheduler_settings.target_throughput_utilization (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) +// automaticScaling.standard_scheduler_settings.target_throughput_utilization (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#StandardSchedulerSettings) // // basic scaling or manual scaling in the standard environment: // -// serving_status (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status) +// serving_status (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status) // -// manual_scaling.instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling) +// manual_scaling.instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling) // // Flexible environment // -// serving_status (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status) +// serving_status (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.serving_status) // // automatic scaling in the flexible environment: // -// automatic_scaling.min_total_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) +// automatic_scaling.min_total_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) // -// automatic_scaling.max_total_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) +// automatic_scaling.max_total_instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) // -// automatic_scaling.cool_down_period_sec (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) +// automatic_scaling.cool_down_period_sec (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) // -// automatic_scaling.cpu_utilization.target_utilization (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) +// automatic_scaling.cpu_utilization.target_utilization (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#Version.FIELDS.automatic_scaling) // // manual scaling in the flexible environment: // -// manual_scaling.instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling) +// manual_scaling.instances (at https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#manualscaling) func (c *VersionsClient) UpdateVersion(ctx context.Context, req *appenginepb.UpdateVersionRequest, opts ...gax.CallOption) (*UpdateVersionOperation, error) { return c.internalClient.UpdateVersion(ctx, req, opts...) } diff --git a/area120/tables/apiv1alpha1/doc.go b/area120/tables/apiv1alpha1/doc.go index 3f852c638aa..a482653e1d5 100644 --- a/area120/tables/apiv1alpha1/doc.go +++ b/area120/tables/apiv1alpha1/doc.go @@ -17,45 +17,46 @@ // Package tables is an auto-generated package for the // Area120 Tables API. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := tables.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := tables.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := tables.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &tablespb.GetTableRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/area120/tables/v1alpha1#GetTableRequest. -// } -// resp, err := c.GetTable(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := tables.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &tablespb.GetTableRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/area120/tables/v1alpha1#GetTableRequest. +// } +// resp, err := c.GetTable(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/area120/tables/apiv1alpha1/tables_client.go b/area120/tables/apiv1alpha1/tables_client.go index b8f457c9006..3cf787ba83e 100644 --- a/area120/tables/apiv1alpha1/tables_client.go +++ b/area120/tables/apiv1alpha1/tables_client.go @@ -129,15 +129,15 @@ type internalClient interface { // The Tables Service provides an API for reading and updating tables. // It defines the following resource model: // -// The API has a collection of [Table][google.area120.tables.v1alpha1.Table] -// resources, named tables/* +// The API has a collection of [Table][google.area120.tables.v1alpha1.Table] +// resources, named tables/* // -// Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row] -// resources, named tables/*/rows/* +// Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row] +// resources, named tables/*/rows/* // -// The API has a collection of -// [Workspace][google.area120.tables.v1alpha1.Workspace] -// resources, named workspaces/*. +// The API has a collection of +// [Workspace][google.area120.tables.v1alpha1.Workspace] +// resources, named workspaces/*. type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -254,15 +254,15 @@ type gRPCClient struct { // The Tables Service provides an API for reading and updating tables. // It defines the following resource model: // -// The API has a collection of [Table][google.area120.tables.v1alpha1.Table] -// resources, named tables/* +// The API has a collection of [Table][google.area120.tables.v1alpha1.Table] +// resources, named tables/* // -// Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row] -// resources, named tables/*/rows/* +// Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row] +// resources, named tables/*/rows/* // -// The API has a collection of -// [Workspace][google.area120.tables.v1alpha1.Workspace] -// resources, named workspaces/*. +// The API has a collection of +// [Workspace][google.area120.tables.v1alpha1.Workspace] +// resources, named workspaces/*. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { @@ -339,15 +339,15 @@ type restClient struct { // The Tables Service provides an API for reading and updating tables. // It defines the following resource model: // -// The API has a collection of [Table][google.area120.tables.v1alpha1.Table] -// resources, named tables/* +// The API has a collection of [Table][google.area120.tables.v1alpha1.Table] +// resources, named tables/* // -// Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row] -// resources, named tables/*/rows/* +// Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row] +// resources, named tables/*/rows/* // -// The API has a collection of -// [Workspace][google.area120.tables.v1alpha1.Workspace] -// resources, named workspaces/*. +// The API has a collection of +// [Workspace][google.area120.tables.v1alpha1.Workspace] +// resources, named workspaces/*. func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := append(defaultRESTClientOptions(), opts...) httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) diff --git a/artifactregistry/apiv1/artifact_registry_client.go b/artifactregistry/apiv1/artifact_registry_client.go index ccfbcab1873..a2c10589f98 100644 --- a/artifactregistry/apiv1/artifact_registry_client.go +++ b/artifactregistry/apiv1/artifact_registry_client.go @@ -165,16 +165,16 @@ type internalClient interface { // // The resources managed by this API are: // -// Repositories, which group packages and their data. +// Repositories, which group packages and their data. // -// Packages, which group versions and their tags. +// Packages, which group versions and their tags. // -// Versions, which are specific forms of a package. +// Versions, which are specific forms of a package. // -// Tags, which represent alternative names for versions. +// Tags, which represent alternative names for versions. // -// Files, which contain content and are optionally associated with a Package -// or Version. +// Files, which contain content and are optionally associated with a Package +// or Version. type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -427,16 +427,16 @@ type gRPCClient struct { // // The resources managed by this API are: // -// Repositories, which group packages and their data. +// Repositories, which group packages and their data. // -// Packages, which group versions and their tags. +// Packages, which group versions and their tags. // -// Versions, which are specific forms of a package. +// Versions, which are specific forms of a package. // -// Tags, which represent alternative names for versions. +// Tags, which represent alternative names for versions. // -// Files, which contain content and are optionally associated with a Package -// or Version. +// Files, which contain content and are optionally associated with a Package +// or Version. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { diff --git a/artifactregistry/apiv1/doc.go b/artifactregistry/apiv1/doc.go index e03d37a878a..a5d39265bee 100644 --- a/artifactregistry/apiv1/doc.go +++ b/artifactregistry/apiv1/doc.go @@ -20,51 +20,52 @@ // Store and manage build artifacts in a scalable and integrated service // built on Google infrastructure. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := artifactregistry.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := artifactregistry.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := artifactregistry.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &artifactregistrypb.ListDockerImagesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/artifactregistry/v1#ListDockerImagesRequest. -// } -// it := c.ListDockerImages(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := artifactregistry.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &artifactregistrypb.ListDockerImagesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/artifactregistry/v1#ListDockerImagesRequest. +// } +// it := c.ListDockerImages(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/artifactregistry/apiv1beta2/artifact_registry_client.go b/artifactregistry/apiv1beta2/artifact_registry_client.go index 6702bee6b51..5495c7609d3 100644 --- a/artifactregistry/apiv1beta2/artifact_registry_client.go +++ b/artifactregistry/apiv1beta2/artifact_registry_client.go @@ -310,16 +310,16 @@ type internalClient interface { // // The resources managed by this API are: // -// Repositories, which group packages and their data. +// Repositories, which group packages and their data. // -// Packages, which group versions and their tags. +// Packages, which group versions and their tags. // -// Versions, which are specific forms of a package. +// Versions, which are specific forms of a package. // -// Tags, which represent alternative names for versions. +// Tags, which represent alternative names for versions. // -// Files, which contain content and are optionally associated with a Package -// or Version. +// Files, which contain content and are optionally associated with a Package +// or Version. type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -562,16 +562,16 @@ type gRPCClient struct { // // The resources managed by this API are: // -// Repositories, which group packages and their data. +// Repositories, which group packages and their data. // -// Packages, which group versions and their tags. +// Packages, which group versions and their tags. // -// Versions, which are specific forms of a package. +// Versions, which are specific forms of a package. // -// Tags, which represent alternative names for versions. +// Tags, which represent alternative names for versions. // -// Files, which contain content and are optionally associated with a Package -// or Version. +// Files, which contain content and are optionally associated with a Package +// or Version. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { diff --git a/artifactregistry/apiv1beta2/doc.go b/artifactregistry/apiv1beta2/doc.go index eb679ef17c1..a83702e9b21 100644 --- a/artifactregistry/apiv1beta2/doc.go +++ b/artifactregistry/apiv1beta2/doc.go @@ -20,48 +20,49 @@ // Store and manage build artifacts in a scalable and integrated service // built on Google infrastructure. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := artifactregistry.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := artifactregistry.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := artifactregistry.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &artifactregistrypb.ImportAptArtifactsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2#ImportAptArtifactsRequest. -// } -// op, err := c.ImportAptArtifacts(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := artifactregistry.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &artifactregistrypb.ImportAptArtifactsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2#ImportAptArtifactsRequest. +// } +// op, err := c.ImportAptArtifacts(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/asset/apiv1/doc.go b/asset/apiv1/doc.go index 1323d8084f7..811f3faa7a0 100644 --- a/asset/apiv1/doc.go +++ b/asset/apiv1/doc.go @@ -19,48 +19,49 @@ // // The cloud asset API manages the history and inventory of cloud resources. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := asset.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := asset.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := asset.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &assetpb.ExportAssetsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/asset/v1#ExportAssetsRequest. -// } -// op, err := c.ExportAssets(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := asset.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &assetpb.ExportAssetsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/asset/v1#ExportAssetsRequest. +// } +// op, err := c.ExportAssets(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/asset/apiv1p2beta1/doc.go b/asset/apiv1p2beta1/doc.go index b481cc8d3a3..55611ac6058 100644 --- a/asset/apiv1p2beta1/doc.go +++ b/asset/apiv1p2beta1/doc.go @@ -19,45 +19,46 @@ // // The cloud asset API manages the history and inventory of cloud resources. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := asset.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := asset.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := asset.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &assetpb.CreateFeedRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1#CreateFeedRequest. -// } -// resp, err := c.CreateFeed(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := asset.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &assetpb.CreateFeedRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1#CreateFeedRequest. +// } +// resp, err := c.CreateFeed(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/asset/apiv1p5beta1/doc.go b/asset/apiv1p5beta1/doc.go index 0ae7b8b98b0..d7787b2b245 100644 --- a/asset/apiv1p5beta1/doc.go +++ b/asset/apiv1p5beta1/doc.go @@ -19,51 +19,52 @@ // // The cloud asset API manages the history and inventory of cloud resources. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := asset.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := asset.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := asset.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &assetpb.ListAssetsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1#ListAssetsRequest. -// } -// it := c.ListAssets(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := asset.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &assetpb.ListAssetsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1#ListAssetsRequest. +// } +// it := c.ListAssets(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/assuredworkloads/apiv1/doc.go b/assuredworkloads/apiv1/doc.go index 7f5e1ad9fe7..dcd8e14d33b 100644 --- a/assuredworkloads/apiv1/doc.go +++ b/assuredworkloads/apiv1/doc.go @@ -17,48 +17,49 @@ // Package assuredworkloads is an auto-generated package for the // Assured Workloads API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := assuredworkloads.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := assuredworkloads.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := assuredworkloads.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &assuredworkloadspb.CreateWorkloadRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1#CreateWorkloadRequest. -// } -// op, err := c.CreateWorkload(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := assuredworkloads.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &assuredworkloadspb.CreateWorkloadRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1#CreateWorkloadRequest. +// } +// op, err := c.CreateWorkload(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/assuredworkloads/apiv1beta1/doc.go b/assuredworkloads/apiv1beta1/doc.go index b0d529cac14..8491b5fbc70 100644 --- a/assuredworkloads/apiv1beta1/doc.go +++ b/assuredworkloads/apiv1beta1/doc.go @@ -17,50 +17,51 @@ // Package assuredworkloads is an auto-generated package for the // Assured Workloads API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := assuredworkloads.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := assuredworkloads.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := assuredworkloads.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &assuredworkloadspb.CreateWorkloadRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1beta1#CreateWorkloadRequest. -// } -// op, err := c.CreateWorkload(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := assuredworkloads.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &assuredworkloadspb.CreateWorkloadRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1beta1#CreateWorkloadRequest. +// } +// op, err := c.CreateWorkload(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/automl/apiv1/auto_ml_client.go b/automl/apiv1/auto_ml_client.go index a1442f25af5..117d7a7bf57 100644 --- a/automl/apiv1/auto_ml_client.go +++ b/automl/apiv1/auto_ml_client.go @@ -328,11 +328,11 @@ func (c *Client) DeleteDatasetOperation(name string) *DeleteDatasetOperation { // // For Tables: // -// A -// schema_inference_version -// parameter must be explicitly set. -// Returns an empty response in the -// response field when it completes. +// A +// schema_inference_version +// parameter must be explicitly set. +// Returns an empty response in the +// response field when it completes. func (c *Client) ImportData(ctx context.Context, req *automlpb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error) { return c.internalClient.ImportData(ctx, req, opts...) } diff --git a/automl/apiv1/doc.go b/automl/apiv1/doc.go index 23f5f976094..ca2e00d30f7 100644 --- a/automl/apiv1/doc.go +++ b/automl/apiv1/doc.go @@ -20,43 +20,44 @@ // Train high-quality custom machine learning models with minimum effort and // machine learning expertise. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := automl.NewPredictionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := automl.NewPredictionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := automl.NewPredictionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &automlpb.PredictRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/automl/v1#PredictRequest. -// } -// resp, err := c.Predict(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := automl.NewPredictionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &automlpb.PredictRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/automl/v1#PredictRequest. +// } +// resp, err := c.Predict(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/automl/apiv1/prediction_client.go b/automl/apiv1/prediction_client.go index f1d87569bd3..abc9b6879cc 100644 --- a/automl/apiv1/prediction_client.go +++ b/automl/apiv1/prediction_client.go @@ -120,36 +120,36 @@ func (c *PredictionClient) Connection() *grpc.ClientConn { // // AutoML Vision Classification // -// An image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB. +// An image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB. // // AutoML Vision Object Detection // -// An image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB. +// An image in .JPEG, .GIF or .PNG format, image_bytes up to 30MB. // // AutoML Natural Language Classification // -// A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in -// .PDF, .TIF or .TIFF format with size upto 2MB. +// A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in +// .PDF, .TIF or .TIFF format with size upto 2MB. // // AutoML Natural Language Entity Extraction // -// A TextSnippet up to 10,000 characters, UTF-8 NFC encoded or a document -// in .PDF, .TIF or .TIFF format with size upto 20MB. +// A TextSnippet up to 10,000 characters, UTF-8 NFC encoded or a document +// in .PDF, .TIF or .TIFF format with size upto 20MB. // // AutoML Natural Language Sentiment Analysis // -// A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in -// .PDF, .TIF or .TIFF format with size upto 2MB. +// A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in +// .PDF, .TIF or .TIFF format with size upto 2MB. // // AutoML Translation // -// A TextSnippet up to 25,000 characters, UTF-8 encoded. +// A TextSnippet up to 25,000 characters, UTF-8 encoded. // // AutoML Tables // -// A row with column values matching -// the columns of the model, up to 5MB. Not available for FORECASTING -// prediction_type. +// A row with column values matching +// the columns of the model, up to 5MB. Not available for FORECASTING +// prediction_type. func (c *PredictionClient) Predict(ctx context.Context, req *automlpb.PredictRequest, opts ...gax.CallOption) (*automlpb.PredictResponse, error) { return c.internalClient.Predict(ctx, req, opts...) } @@ -162,19 +162,19 @@ func (c *PredictionClient) Predict(ctx context.Context, req *automlpb.PredictReq // the response field. // Available for following ML scenarios: // -// AutoML Vision Classification +// AutoML Vision Classification // -// AutoML Vision Object Detection +// AutoML Vision Object Detection // -// AutoML Video Intelligence Classification +// AutoML Video Intelligence Classification // -// AutoML Video Intelligence Object Tracking * AutoML Natural Language Classification +// AutoML Video Intelligence Object Tracking * AutoML Natural Language Classification // -// AutoML Natural Language Entity Extraction +// AutoML Natural Language Entity Extraction // -// AutoML Natural Language Sentiment Analysis +// AutoML Natural Language Sentiment Analysis // -// AutoML Tables +// AutoML Tables func (c *PredictionClient) BatchPredict(ctx context.Context, req *automlpb.BatchPredictRequest, opts ...gax.CallOption) (*BatchPredictOperation, error) { return c.internalClient.BatchPredict(ctx, req, opts...) } diff --git a/automl/apiv1beta1/auto_ml_client.go b/automl/apiv1beta1/auto_ml_client.go index 94534d85588..9698defcec8 100644 --- a/automl/apiv1beta1/auto_ml_client.go +++ b/automl/apiv1beta1/auto_ml_client.go @@ -528,11 +528,11 @@ func (c *Client) DeleteDatasetOperation(name string) *DeleteDatasetOperation { // // For Tables: // -// A -// schema_inference_version -// parameter must be explicitly set. -// Returns an empty response in the -// response field when it completes. +// A +// schema_inference_version +// parameter must be explicitly set. +// Returns an empty response in the +// response field when it completes. func (c *Client) ImportData(ctx context.Context, req *automlpb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error) { return c.internalClient.ImportData(ctx, req, opts...) } @@ -1924,11 +1924,11 @@ func (c *restClient) DeleteDataset(ctx context.Context, req *automlpb.DeleteData // // For Tables: // -// A -// schema_inference_version -// parameter must be explicitly set. -// Returns an empty response in the -// response field when it completes. +// A +// schema_inference_version +// parameter must be explicitly set. +// Returns an empty response in the +// response field when it completes. func (c *restClient) ImportData(ctx context.Context, req *automlpb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/automl/apiv1beta1/doc.go b/automl/apiv1beta1/doc.go index c999819da9a..64808d2eb8c 100644 --- a/automl/apiv1beta1/doc.go +++ b/automl/apiv1beta1/doc.go @@ -20,45 +20,46 @@ // Train high-quality custom machine learning models with minimum effort and // machine learning expertise. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := automl.NewPredictionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := automl.NewPredictionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := automl.NewPredictionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &automlpb.PredictRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/automl/v1beta1#PredictRequest. -// } -// resp, err := c.Predict(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := automl.NewPredictionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &automlpb.PredictRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/automl/v1beta1#PredictRequest. +// } +// resp, err := c.Predict(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/automl/apiv1beta1/prediction_client.go b/automl/apiv1beta1/prediction_client.go index 589970a681f..bc7df6b88a2 100644 --- a/automl/apiv1beta1/prediction_client.go +++ b/automl/apiv1beta1/prediction_client.go @@ -131,28 +131,28 @@ func (c *PredictionClient) Connection() *grpc.ClientConn { // returned in the response. // Available for following ML problems, and their expected request payloads: // -// Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes -// up to 30MB. +// Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes +// up to 30MB. // -// Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes -// up to 30MB. +// Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes +// up to 30MB. // -// Text Classification - TextSnippet, content up to 60,000 characters, -// UTF-8 encoded. +// Text Classification - TextSnippet, content up to 60,000 characters, +// UTF-8 encoded. // -// Text Extraction - TextSnippet, content up to 30,000 characters, -// UTF-8 NFC encoded. +// Text Extraction - TextSnippet, content up to 30,000 characters, +// UTF-8 NFC encoded. // -// Translation - TextSnippet, content up to 25,000 characters, UTF-8 -// encoded. +// Translation - TextSnippet, content up to 25,000 characters, UTF-8 +// encoded. // -// Tables - Row, with column values matching the columns of the model, -// up to 5MB. Not available for FORECASTING +// Tables - Row, with column values matching the columns of the model, +// up to 5MB. Not available for FORECASTING // // prediction_type. // -// Text Sentiment - TextSnippet, content up 500 characters, UTF-8 -// encoded. +// Text Sentiment - TextSnippet, content up 500 characters, UTF-8 +// encoded. func (c *PredictionClient) Predict(ctx context.Context, req *automlpb.PredictRequest, opts ...gax.CallOption) (*automlpb.PredictResponse, error) { return c.internalClient.Predict(ctx, req, opts...) } @@ -165,15 +165,15 @@ func (c *PredictionClient) Predict(ctx context.Context, req *automlpb.PredictReq // the response field. // Available for following ML problems: // -// Image Classification +// Image Classification // -// Image Object Detection +// Image Object Detection // -// Video Classification +// Video Classification // -// Video Object Tracking * Text Extraction +// Video Object Tracking * Text Extraction // -// Tables +// Tables func (c *PredictionClient) BatchPredict(ctx context.Context, req *automlpb.BatchPredictRequest, opts ...gax.CallOption) (*BatchPredictOperation, error) { return c.internalClient.BatchPredict(ctx, req, opts...) } @@ -419,28 +419,28 @@ func (c *predictionGRPCClient) BatchPredict(ctx context.Context, req *automlpb.B // returned in the response. // Available for following ML problems, and their expected request payloads: // -// Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes -// up to 30MB. +// Image Classification - Image in .JPEG, .GIF or .PNG format, image_bytes +// up to 30MB. // -// Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes -// up to 30MB. +// Image Object Detection - Image in .JPEG, .GIF or .PNG format, image_bytes +// up to 30MB. // -// Text Classification - TextSnippet, content up to 60,000 characters, -// UTF-8 encoded. +// Text Classification - TextSnippet, content up to 60,000 characters, +// UTF-8 encoded. // -// Text Extraction - TextSnippet, content up to 30,000 characters, -// UTF-8 NFC encoded. +// Text Extraction - TextSnippet, content up to 30,000 characters, +// UTF-8 NFC encoded. // -// Translation - TextSnippet, content up to 25,000 characters, UTF-8 -// encoded. +// Translation - TextSnippet, content up to 25,000 characters, UTF-8 +// encoded. // -// Tables - Row, with column values matching the columns of the model, -// up to 5MB. Not available for FORECASTING +// Tables - Row, with column values matching the columns of the model, +// up to 5MB. Not available for FORECASTING // // prediction_type. // -// Text Sentiment - TextSnippet, content up 500 characters, UTF-8 -// encoded. +// Text Sentiment - TextSnippet, content up 500 characters, UTF-8 +// encoded. func (c *predictionRESTClient) Predict(ctx context.Context, req *automlpb.PredictRequest, opts ...gax.CallOption) (*automlpb.PredictResponse, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -507,15 +507,15 @@ func (c *predictionRESTClient) Predict(ctx context.Context, req *automlpb.Predic // the response field. // Available for following ML problems: // -// Image Classification +// Image Classification // -// Image Object Detection +// Image Object Detection // -// Video Classification +// Video Classification // -// Video Object Tracking * Text Extraction +// Video Object Tracking * Text Extraction // -// Tables +// Tables func (c *predictionRESTClient) BatchPredict(ctx context.Context, req *automlpb.BatchPredictRequest, opts ...gax.CallOption) (*BatchPredictOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/baremetalsolution/apiv2/doc.go b/baremetalsolution/apiv2/doc.go index 0183853cb72..75ff5b303e2 100644 --- a/baremetalsolution/apiv2/doc.go +++ b/baremetalsolution/apiv2/doc.go @@ -20,51 +20,52 @@ // Provides ways to manage Bare Metal Solution hardware installed in a // regional extension located near a Google Cloud data center. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := baremetalsolution.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := baremetalsolution.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := baremetalsolution.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &baremetalsolutionpb.ListInstancesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/baremetalsolution/v2#ListInstancesRequest. -// } -// it := c.ListInstances(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := baremetalsolution.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &baremetalsolutionpb.ListInstancesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/baremetalsolution/v2#ListInstancesRequest. +// } +// it := c.ListInstances(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/batch/apiv1/doc.go b/batch/apiv1/doc.go index fa9880757c5..b7b4105e6dd 100644 --- a/batch/apiv1/doc.go +++ b/batch/apiv1/doc.go @@ -19,45 +19,46 @@ // // An API to manage the running of batch jobs on Google Cloud Platform. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := batch.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := batch.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := batch.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &batchpb.CreateJobRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/batch/v1#CreateJobRequest. -// } -// resp, err := c.CreateJob(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := batch.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &batchpb.CreateJobRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/batch/v1#CreateJobRequest. +// } +// resp, err := c.CreateJob(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/beyondcorp/appconnections/apiv1/app_connections_client.go b/beyondcorp/appconnections/apiv1/app_connections_client.go index aa13e1835a6..9a976b11ce1 100644 --- a/beyondcorp/appconnections/apiv1/app_connections_client.go +++ b/beyondcorp/appconnections/apiv1/app_connections_client.go @@ -125,8 +125,8 @@ type internalClient interface { // // Data ModelThe AppConnectionsService exposes the following resources: // -// AppConnections, named as follows: -// projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}. +// AppConnections, named as follows: +// projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}. // // The AppConnectionsService service provides methods to manage // (create/read/update/delete) BeyondCorp AppConnections. @@ -310,8 +310,8 @@ type gRPCClient struct { // // Data ModelThe AppConnectionsService exposes the following resources: // -// AppConnections, named as follows: -// projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}. +// AppConnections, named as follows: +// projects/{project_id}/locations/{location_id}/appConnections/{app_connection_id}. // // The AppConnectionsService service provides methods to manage // (create/read/update/delete) BeyondCorp AppConnections. diff --git a/beyondcorp/appconnections/apiv1/doc.go b/beyondcorp/appconnections/apiv1/doc.go index 2605eba9021..ecff83f7fb5 100644 --- a/beyondcorp/appconnections/apiv1/doc.go +++ b/beyondcorp/appconnections/apiv1/doc.go @@ -22,51 +22,52 @@ // Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem // connectivity using the App Connector hybrid connectivity solution. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := appconnections.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := appconnections.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := appconnections.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &appconnectionspb.ListAppConnectionsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnections/v1#ListAppConnectionsRequest. -// } -// it := c.ListAppConnections(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := appconnections.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &appconnectionspb.ListAppConnectionsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnections/v1#ListAppConnectionsRequest. +// } +// it := c.ListAppConnections(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/beyondcorp/appconnectors/apiv1/app_connectors_client.go b/beyondcorp/appconnectors/apiv1/app_connectors_client.go index 1df1011a87a..4c5aa216363 100644 --- a/beyondcorp/appconnectors/apiv1/app_connectors_client.go +++ b/beyondcorp/appconnectors/apiv1/app_connectors_client.go @@ -126,8 +126,8 @@ type internalClient interface { // // Data ModelThe AppConnectorsService exposes the following resource: // -// AppConnectors, named as follows: -// projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}. +// AppConnectors, named as follows: +// projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}. // // The AppConnectorsService provides methods to manage // (create/read/update/delete) BeyondCorp AppConnectors. @@ -315,8 +315,8 @@ type gRPCClient struct { // // Data ModelThe AppConnectorsService exposes the following resource: // -// AppConnectors, named as follows: -// projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}. +// AppConnectors, named as follows: +// projects/{project_id}/locations/{location_id}/appConnectors/{app_connector_id}. // // The AppConnectorsService provides methods to manage // (create/read/update/delete) BeyondCorp AppConnectors. diff --git a/beyondcorp/appconnectors/apiv1/doc.go b/beyondcorp/appconnectors/apiv1/doc.go index ce397bbadbb..9d4195a9d62 100644 --- a/beyondcorp/appconnectors/apiv1/doc.go +++ b/beyondcorp/appconnectors/apiv1/doc.go @@ -22,51 +22,52 @@ // Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem // connectivity using the App Connector hybrid connectivity solution. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := appconnectors.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := appconnectors.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := appconnectors.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &appconnectorspb.ListAppConnectorsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnectors/v1#ListAppConnectorsRequest. -// } -// it := c.ListAppConnectors(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := appconnectors.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &appconnectorspb.ListAppConnectorsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnectors/v1#ListAppConnectorsRequest. +// } +// it := c.ListAppConnectors(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/beyondcorp/appgateways/apiv1/app_gateways_client.go b/beyondcorp/appgateways/apiv1/app_gateways_client.go index f0d6d4f64a7..d058595e030 100644 --- a/beyondcorp/appgateways/apiv1/app_gateways_client.go +++ b/beyondcorp/appgateways/apiv1/app_gateways_client.go @@ -118,8 +118,8 @@ type internalClient interface { // // Data ModelThe AppGatewaysService exposes the following resources: // -// AppGateways, named as follows: -// projects/{project_id}/locations/{location_id}/appGateways/{app_gateway_id}. +// AppGateways, named as follows: +// projects/{project_id}/locations/{location_id}/appGateways/{app_gateway_id}. // // The AppGatewaysService service provides methods to manage // (create/read/update/delete) BeyondCorp AppGateways. @@ -285,8 +285,8 @@ type gRPCClient struct { // // Data ModelThe AppGatewaysService exposes the following resources: // -// AppGateways, named as follows: -// projects/{project_id}/locations/{location_id}/appGateways/{app_gateway_id}. +// AppGateways, named as follows: +// projects/{project_id}/locations/{location_id}/appGateways/{app_gateway_id}. // // The AppGatewaysService service provides methods to manage // (create/read/update/delete) BeyondCorp AppGateways. diff --git a/beyondcorp/appgateways/apiv1/doc.go b/beyondcorp/appgateways/apiv1/doc.go index 31de203ad24..d8e75b2923c 100644 --- a/beyondcorp/appgateways/apiv1/doc.go +++ b/beyondcorp/appgateways/apiv1/doc.go @@ -22,51 +22,52 @@ // Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem // connectivity using the App Connector hybrid connectivity solution. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := appgateways.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := appgateways.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := appgateways.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &appgatewayspb.ListAppGatewaysRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/appgateways/v1#ListAppGatewaysRequest. -// } -// it := c.ListAppGateways(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := appgateways.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &appgatewayspb.ListAppGatewaysRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/appgateways/v1#ListAppGatewaysRequest. +// } +// it := c.ListAppGateways(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/beyondcorp/clientconnectorservices/apiv1/client_connector_services_client.go b/beyondcorp/clientconnectorservices/apiv1/client_connector_services_client.go index 313025f1cb2..f294223d6b2 100644 --- a/beyondcorp/clientconnectorservices/apiv1/client_connector_services_client.go +++ b/beyondcorp/clientconnectorservices/apiv1/client_connector_services_client.go @@ -122,8 +122,8 @@ type internalClient interface { // // Data ModelThe ClientConnectorServicesService exposes the following resources: // -// Client Connector Services, named as follows: -// projects/{project_id}/locations/{location_id}/client_connector_services/{client_connector_service_id}. +// Client Connector Services, named as follows: +// projects/{project_id}/locations/{location_id}/client_connector_services/{client_connector_service_id}. type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -297,8 +297,8 @@ type gRPCClient struct { // // Data ModelThe ClientConnectorServicesService exposes the following resources: // -// Client Connector Services, named as follows: -// projects/{project_id}/locations/{location_id}/client_connector_services/{client_connector_service_id}. +// Client Connector Services, named as follows: +// projects/{project_id}/locations/{location_id}/client_connector_services/{client_connector_service_id}. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { diff --git a/beyondcorp/clientconnectorservices/apiv1/doc.go b/beyondcorp/clientconnectorservices/apiv1/doc.go index 21b0fbb657c..1521b056035 100644 --- a/beyondcorp/clientconnectorservices/apiv1/doc.go +++ b/beyondcorp/clientconnectorservices/apiv1/doc.go @@ -22,51 +22,52 @@ // Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem // connectivity using the App Connector hybrid connectivity solution. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := clientconnectorservices.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := clientconnectorservices.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := clientconnectorservices.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &clientconnectorservicespb.ListClientConnectorServicesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/clientconnectorservices/v1#ListClientConnectorServicesRequest. -// } -// it := c.ListClientConnectorServices(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := clientconnectorservices.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &clientconnectorservicespb.ListClientConnectorServicesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/clientconnectorservices/v1#ListClientConnectorServicesRequest. +// } +// it := c.ListClientConnectorServices(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/beyondcorp/clientgateways/apiv1/client_gateways_client.go b/beyondcorp/clientgateways/apiv1/client_gateways_client.go index 59fae42944a..877bd2fc750 100644 --- a/beyondcorp/clientgateways/apiv1/client_gateways_client.go +++ b/beyondcorp/clientgateways/apiv1/client_gateways_client.go @@ -118,8 +118,8 @@ type internalClient interface { // // Data ModelThe ClientGatewaysService exposes the following resources: // -// Client Gateways, named as follows: -// projects/{project_id}/locations/{location_id}/clientGateways/{client_gateway_id}. +// Client Gateways, named as follows: +// projects/{project_id}/locations/{location_id}/clientGateways/{client_gateway_id}. type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -282,8 +282,8 @@ type gRPCClient struct { // // Data ModelThe ClientGatewaysService exposes the following resources: // -// Client Gateways, named as follows: -// projects/{project_id}/locations/{location_id}/clientGateways/{client_gateway_id}. +// Client Gateways, named as follows: +// projects/{project_id}/locations/{location_id}/clientGateways/{client_gateway_id}. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { diff --git a/beyondcorp/clientgateways/apiv1/doc.go b/beyondcorp/clientgateways/apiv1/doc.go index e2f3200347f..d0f360af14c 100644 --- a/beyondcorp/clientgateways/apiv1/doc.go +++ b/beyondcorp/clientgateways/apiv1/doc.go @@ -22,51 +22,52 @@ // Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem // connectivity using the App Connector hybrid connectivity solution. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := clientgateways.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := clientgateways.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := clientgateways.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &clientgatewayspb.ListClientGatewaysRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/clientgateways/v1#ListClientGatewaysRequest. -// } -// it := c.ListClientGateways(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := clientgateways.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &clientgatewayspb.ListClientGatewaysRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/beyondcorp/clientgateways/v1#ListClientGatewaysRequest. +// } +// it := c.ListClientGateways(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/connection/apiv1/doc.go b/bigquery/connection/apiv1/doc.go index 4013bc7ef3d..2b2f964f167 100644 --- a/bigquery/connection/apiv1/doc.go +++ b/bigquery/connection/apiv1/doc.go @@ -19,43 +19,44 @@ // // Allows users to manage BigQuery connections to external data sources. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := connection.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := connection.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := connection.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &connectionpb.CreateConnectionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1#CreateConnectionRequest. -// } -// resp, err := c.CreateConnection(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := connection.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &connectionpb.CreateConnectionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1#CreateConnectionRequest. +// } +// resp, err := c.CreateConnection(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/connection/apiv1beta1/doc.go b/bigquery/connection/apiv1beta1/doc.go index bc451786a80..dc79cdc986b 100644 --- a/bigquery/connection/apiv1beta1/doc.go +++ b/bigquery/connection/apiv1beta1/doc.go @@ -19,45 +19,46 @@ // // Allows users to manage BigQuery connections to external data sources. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := connection.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := connection.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := connection.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &connectionpb.CreateConnectionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1beta1#CreateConnectionRequest. -// } -// resp, err := c.CreateConnection(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := connection.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &connectionpb.CreateConnectionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1beta1#CreateConnectionRequest. +// } +// resp, err := c.CreateConnection(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/dataexchange/apiv1beta1/doc.go b/bigquery/dataexchange/apiv1beta1/doc.go index 6ab6ef5d6be..a3dd8b6acae 100644 --- a/bigquery/dataexchange/apiv1beta1/doc.go +++ b/bigquery/dataexchange/apiv1beta1/doc.go @@ -19,51 +19,52 @@ // // Exchange data and analytics assets securely and efficiently. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dataexchange.NewAnalyticsHubClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dataexchange.NewAnalyticsHubClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dataexchange.NewAnalyticsHubClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dataexchangepb.ListDataExchangesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#ListDataExchangesRequest. -// } -// it := c.ListDataExchanges(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := dataexchange.NewAnalyticsHubClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dataexchangepb.ListDataExchangesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#ListDataExchangesRequest. +// } +// it := c.ListDataExchanges(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/datatransfer/apiv1/doc.go b/bigquery/datatransfer/apiv1/doc.go index 56b259d4f30..dbbf92c3478 100644 --- a/bigquery/datatransfer/apiv1/doc.go +++ b/bigquery/datatransfer/apiv1/doc.go @@ -20,43 +20,44 @@ // Schedule queries or transfer external data from SaaS applications to // Google BigQuery on a regular basis. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := datatransfer.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := datatransfer.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := datatransfer.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &datatransferpb.GetDataSourceRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1#GetDataSourceRequest. -// } -// resp, err := c.GetDataSource(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := datatransfer.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &datatransferpb.GetDataSourceRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1#GetDataSourceRequest. +// } +// resp, err := c.GetDataSource(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/datatransfer/apiv1/path_funcs.go b/bigquery/datatransfer/apiv1/path_funcs.go index 89eb5bb17c1..c49b5d88582 100644 --- a/bigquery/datatransfer/apiv1/path_funcs.go +++ b/bigquery/datatransfer/apiv1/path_funcs.go @@ -17,7 +17,9 @@ package datatransfer // ProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func ProjectPath(project string) string { return "" + @@ -29,7 +31,9 @@ func ProjectPath(project string) string { // LocationPath returns the path for the location resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/locations/%s", project, location) +// +// fmt.Sprintf("projects/%s/locations/%s", project, location) +// // instead. func LocationPath(project, location string) string { return "" + @@ -43,7 +47,9 @@ func LocationPath(project, location string) string { // LocationDataSourcePath returns the path for the location data source resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/locations/%s/dataSources/%s", project, location, dataSource) +// +// fmt.Sprintf("projects/%s/locations/%s/dataSources/%s", project, location, dataSource) +// // instead. func LocationDataSourcePath(project, location, dataSource string) string { return "" + @@ -59,7 +65,9 @@ func LocationDataSourcePath(project, location, dataSource string) string { // LocationTransferConfigPath returns the path for the location transfer config resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/locations/%s/transferConfigs/%s", project, location, transferConfig) +// +// fmt.Sprintf("projects/%s/locations/%s/transferConfigs/%s", project, location, transferConfig) +// // instead. func LocationTransferConfigPath(project, location, transferConfig string) string { return "" + @@ -75,7 +83,9 @@ func LocationTransferConfigPath(project, location, transferConfig string) string // LocationRunPath returns the path for the location run resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/locations/%s/transferConfigs/%s/runs/%s", project, location, transferConfig, run) +// +// fmt.Sprintf("projects/%s/locations/%s/transferConfigs/%s/runs/%s", project, location, transferConfig, run) +// // instead. func LocationRunPath(project, location, transferConfig, run string) string { return "" + @@ -93,7 +103,9 @@ func LocationRunPath(project, location, transferConfig, run string) string { // DataSourcePath returns the path for the data source resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/dataSources/%s", project, dataSource) +// +// fmt.Sprintf("projects/%s/dataSources/%s", project, dataSource) +// // instead. func DataSourcePath(project, dataSource string) string { return "" + @@ -107,7 +119,9 @@ func DataSourcePath(project, dataSource string) string { // TransferConfigPath returns the path for the transfer config resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/transferConfigs/%s", project, transferConfig) +// +// fmt.Sprintf("projects/%s/transferConfigs/%s", project, transferConfig) +// // instead. func TransferConfigPath(project, transferConfig string) string { return "" + @@ -121,7 +135,9 @@ func TransferConfigPath(project, transferConfig string) string { // RunPath returns the path for the run resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", project, transferConfig, run) +// +// fmt.Sprintf("projects/%s/transferConfigs/%s/runs/%s", project, transferConfig, run) +// // instead. func RunPath(project, transferConfig, run string) string { return "" + diff --git a/bigquery/doc.go b/bigquery/doc.go index 4ddae05e5f1..c1525b02d53 100644 --- a/bigquery/doc.go +++ b/bigquery/doc.go @@ -21,153 +21,152 @@ See https://cloud.google.com/bigquery/docs. See https://godoc.org/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package. - -Creating a Client +# Creating a Client To start working with this package, create a client: - ctx := context.Background() - client, err := bigquery.NewClient(ctx, projectID) - if err != nil { - // TODO: Handle error. - } + ctx := context.Background() + client, err := bigquery.NewClient(ctx, projectID) + if err != nil { + // TODO: Handle error. + } -Querying +# Querying To query existing tables, create a Query and call its Read method: - q := client.Query(` - SELECT year, SUM(number) as num - FROM ` + "`bigquery-public-data.usa_names.usa_1910_2013`" + ` - WHERE name = "William" - GROUP BY year - ORDER BY year - `) - it, err := q.Read(ctx) - if err != nil { - // TODO: Handle error. - } + q := client.Query(` + SELECT year, SUM(number) as num + FROM ` + "`bigquery-public-data.usa_names.usa_1910_2013`" + ` + WHERE name = "William" + GROUP BY year + ORDER BY year + `) + it, err := q.Read(ctx) + if err != nil { + // TODO: Handle error. + } Then iterate through the resulting rows. You can store a row using anything that implements the ValueLoader interface, or with a slice or map of bigquery.Value. A slice is simplest: - for { - var values []bigquery.Value - err := it.Next(&values) - if err == iterator.Done { - break - } - if err != nil { - // TODO: Handle error. - } - fmt.Println(values) - } + for { + var values []bigquery.Value + err := it.Next(&values) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(values) + } You can also use a struct whose exported fields match the query: - type Count struct { - Year int - Num int - } - for { - var c Count - err := it.Next(&c) - if err == iterator.Done { - break - } - if err != nil { - // TODO: Handle error. - } - fmt.Println(c) - } + type Count struct { + Year int + Num int + } + for { + var c Count + err := it.Next(&c) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + fmt.Println(c) + } You can also start the query running and get the results later. Create the query as above, but call Run instead of Read. This returns a Job, which represents an asynchronous operation. - job, err := q.Run(ctx) - if err != nil { - // TODO: Handle error. - } + job, err := q.Run(ctx) + if err != nil { + // TODO: Handle error. + } Get the job's ID, a printable string. You can save this string to retrieve the results at a later time, even in another process. - jobID := job.ID() - fmt.Printf("The job ID is %s\n", jobID) + jobID := job.ID() + fmt.Printf("The job ID is %s\n", jobID) To retrieve the job's results from the ID, first look up the Job: - job, err = client.JobFromID(ctx, jobID) - if err != nil { - // TODO: Handle error. - } + job, err = client.JobFromID(ctx, jobID) + if err != nil { + // TODO: Handle error. + } Use the Job.Read method to obtain an iterator, and loop over the rows. Query.Read is just a convenience method that combines Query.Run and Job.Read. - it, err = job.Read(ctx) - if err != nil { - // TODO: Handle error. - } - // Proceed with iteration as above. + it, err = job.Read(ctx) + if err != nil { + // TODO: Handle error. + } + // Proceed with iteration as above. -Datasets and Tables +# Datasets and Tables You can refer to datasets in the client's project with the Dataset method, and in other projects with the DatasetInProject method: - myDataset := client.Dataset("my_dataset") - yourDataset := client.DatasetInProject("your-project-id", "your_dataset") + myDataset := client.Dataset("my_dataset") + yourDataset := client.DatasetInProject("your-project-id", "your_dataset") These methods create references to datasets, not the datasets themselves. You can have a dataset reference even if the dataset doesn't exist yet. Use Dataset.Create to create a dataset from a reference: - if err := myDataset.Create(ctx, nil); err != nil { - // TODO: Handle error. - } + if err := myDataset.Create(ctx, nil); err != nil { + // TODO: Handle error. + } You can refer to tables with Dataset.Table. Like bigquery.Dataset, bigquery.Table is a reference to an object in BigQuery that may or may not exist. - table := myDataset.Table("my_table") + table := myDataset.Table("my_table") You can create, delete and update the metadata of tables with methods on Table. For instance, you could create a temporary table with: - err = myDataset.Table("temp").Create(ctx, &bigquery.TableMetadata{ - ExpirationTime: time.Now().Add(1*time.Hour)}) - if err != nil { - // TODO: Handle error. - } + err = myDataset.Table("temp").Create(ctx, &bigquery.TableMetadata{ + ExpirationTime: time.Now().Add(1*time.Hour)}) + if err != nil { + // TODO: Handle error. + } We'll see how to create a table with a schema in the next section. -Schemas +# Schemas There are two ways to construct schemas with this package. You can build a schema by hand, like so: - schema1 := bigquery.Schema{ - {Name: "Name", Required: true, Type: bigquery.StringFieldType}, - {Name: "Grades", Repeated: true, Type: bigquery.IntegerFieldType}, - {Name: "Optional", Required: false, Type: bigquery.IntegerFieldType}, - } + schema1 := bigquery.Schema{ + {Name: "Name", Required: true, Type: bigquery.StringFieldType}, + {Name: "Grades", Repeated: true, Type: bigquery.IntegerFieldType}, + {Name: "Optional", Required: false, Type: bigquery.IntegerFieldType}, + } Or you can infer the schema from a struct: - type student struct { - Name string - Grades []int - Optional bigquery.NullInt64 - } - schema2, err := bigquery.InferSchema(student{}) - if err != nil { - // TODO: Handle error. - } - // schema1 and schema2 are identical. + type student struct { + Name string + Grades []int + Optional bigquery.NullInt64 + } + schema2, err := bigquery.InferSchema(student{}) + if err != nil { + // TODO: Handle error. + } + // schema1 and schema2 are identical. Struct inference supports tags like those of the encoding/json package, so you can change names, ignore fields, or mark a field as nullable (non-required). Fields @@ -176,68 +175,68 @@ NullTimestamp, NullDate, NullTime, NullDateTime, and NullGeography) are automatically inferred as nullable, so the "nullable" tag is only needed for []byte, *big.Rat and pointer-to-struct fields. - type student2 struct { - Name string `bigquery:"full_name"` - Grades []int - Secret string `bigquery:"-"` - Optional []byte `bigquery:",nullable"` - } - schema3, err := bigquery.InferSchema(student2{}) - if err != nil { - // TODO: Handle error. - } - // schema3 has required fields "full_name" and "Grade", and nullable BYTES field "Optional". + type student2 struct { + Name string `bigquery:"full_name"` + Grades []int + Secret string `bigquery:"-"` + Optional []byte `bigquery:",nullable"` + } + schema3, err := bigquery.InferSchema(student2{}) + if err != nil { + // TODO: Handle error. + } + // schema3 has required fields "full_name" and "Grade", and nullable BYTES field "Optional". Having constructed a schema, you can create a table with it like so: - if err := table.Create(ctx, &bigquery.TableMetadata{Schema: schema1}); err != nil { - // TODO: Handle error. - } + if err := table.Create(ctx, &bigquery.TableMetadata{Schema: schema1}); err != nil { + // TODO: Handle error. + } -Copying +# Copying You can copy one or more tables to another table. Begin by constructing a Copier describing the copy. Then set any desired copy options, and finally call Run to get a Job: - copier := myDataset.Table("dest").CopierFrom(myDataset.Table("src")) - copier.WriteDisposition = bigquery.WriteTruncate - job, err = copier.Run(ctx) - if err != nil { - // TODO: Handle error. - } + copier := myDataset.Table("dest").CopierFrom(myDataset.Table("src")) + copier.WriteDisposition = bigquery.WriteTruncate + job, err = copier.Run(ctx) + if err != nil { + // TODO: Handle error. + } You can chain the call to Run if you don't want to set options: - job, err = myDataset.Table("dest").CopierFrom(myDataset.Table("src")).Run(ctx) - if err != nil { - // TODO: Handle error. - } + job, err = myDataset.Table("dest").CopierFrom(myDataset.Table("src")).Run(ctx) + if err != nil { + // TODO: Handle error. + } You can wait for your job to complete: - status, err := job.Wait(ctx) - if err != nil { - // TODO: Handle error. - } + status, err := job.Wait(ctx) + if err != nil { + // TODO: Handle error. + } Job.Wait polls with exponential backoff. You can also poll yourself, if you wish: - for { - status, err := job.Status(ctx) - if err != nil { - // TODO: Handle error. - } - if status.Done() { - if status.Err() != nil { - log.Fatalf("Job failed with error %v", status.Err()) - } - break - } - time.Sleep(pollInterval) - } - -Loading and Uploading + for { + status, err := job.Status(ctx) + if err != nil { + // TODO: Handle error. + } + if status.Done() { + if status.Err() != nil { + log.Fatalf("Job failed with error %v", status.Err()) + } + break + } + time.Sleep(pollInterval) + } + +# Loading and Uploading There are two ways to populate a table with this package: load the data from a Google Cloud Storage object, or upload rows directly from your program. @@ -245,73 +244,72 @@ object, or upload rows directly from your program. For loading, first create a GCSReference, configuring it if desired. Then make a Loader, optionally configure it as well, and call its Run method. - gcsRef := bigquery.NewGCSReference("gs://my-bucket/my-object") - gcsRef.AllowJaggedRows = true - loader := myDataset.Table("dest").LoaderFrom(gcsRef) - loader.CreateDisposition = bigquery.CreateNever - job, err = loader.Run(ctx) - // Poll the job for completion if desired, as above. + gcsRef := bigquery.NewGCSReference("gs://my-bucket/my-object") + gcsRef.AllowJaggedRows = true + loader := myDataset.Table("dest").LoaderFrom(gcsRef) + loader.CreateDisposition = bigquery.CreateNever + job, err = loader.Run(ctx) + // Poll the job for completion if desired, as above. To upload, first define a type that implements the ValueSaver interface, which has a single method named Save. Then create an Inserter, and call its Put method with a slice of values. - u := table.Inserter() - // Item implements the ValueSaver interface. - items := []*Item{ - {Name: "n1", Size: 32.6, Count: 7}, - {Name: "n2", Size: 4, Count: 2}, - {Name: "n3", Size: 101.5, Count: 1}, - } - if err := u.Put(ctx, items); err != nil { - // TODO: Handle error. - } + u := table.Inserter() + // Item implements the ValueSaver interface. + items := []*Item{ + {Name: "n1", Size: 32.6, Count: 7}, + {Name: "n2", Size: 4, Count: 2}, + {Name: "n3", Size: 101.5, Count: 1}, + } + if err := u.Put(ctx, items); err != nil { + // TODO: Handle error. + } You can also upload a struct that doesn't implement ValueSaver. Use the StructSaver type to specify the schema and insert ID by hand, or just supply the struct or struct pointer directly and the schema will be inferred: - type Item2 struct { - Name string - Size float64 - Count int - } - // Item implements the ValueSaver interface. - items2 := []*Item2{ - {Name: "n1", Size: 32.6, Count: 7}, - {Name: "n2", Size: 4, Count: 2}, - {Name: "n3", Size: 101.5, Count: 1}, - } - if err := u.Put(ctx, items2); err != nil { - // TODO: Handle error. - } + type Item2 struct { + Name string + Size float64 + Count int + } + // Item implements the ValueSaver interface. + items2 := []*Item2{ + {Name: "n1", Size: 32.6, Count: 7}, + {Name: "n2", Size: 4, Count: 2}, + {Name: "n3", Size: 101.5, Count: 1}, + } + if err := u.Put(ctx, items2); err != nil { + // TODO: Handle error. + } BigQuery allows for higher throughput when omitting insertion IDs. To enable this, specify the sentinel `NoDedupeID` value for the insertion ID when implementing a ValueSaver. -Extracting +# Extracting If you've been following so far, extracting data from a BigQuery table into a Google Cloud Storage object will feel familiar. First create an Extractor, then optionally configure it, and lastly call its Run method. - extractor := table.ExtractorTo(gcsRef) - extractor.DisableHeader = true - job, err = extractor.Run(ctx) - // Poll the job for completion if desired, as above. + extractor := table.ExtractorTo(gcsRef) + extractor.DisableHeader = true + job, err = extractor.Run(ctx) + // Poll the job for completion if desired, as above. -Errors +# Errors Errors returned by this client are often of the type googleapi.Error: https://godoc.org/google.golang.org/api/googleapi#Error These errors can be introspected for more information by using `xerrors.As` with the richer *googleapi.Error type. For example: - var e *googleapi.Error - if ok := xerrors.As(err, &e); ok { - if e.Code == 409 { ... } - } + var e *googleapi.Error + if ok := xerrors.As(err, &e); ok { + if e.Code == 409 { ... } + } In some cases, your client may received unstructured googleapi.Error error responses. In such cases, it is likely that you have exceeded BigQuery request limits, documented at: https://cloud.google.com/bigquery/quotas - */ package bigquery // import "cloud.google.com/go/bigquery" diff --git a/bigquery/iterator.go b/bigquery/iterator.go index ac6bdd17d2c..ac41193f26b 100644 --- a/bigquery/iterator.go +++ b/bigquery/iterator.go @@ -105,15 +105,15 @@ type pageFetcher func(ctx context.Context, _ *rowSource, _ Schema, startIndex ui // Each BigQuery column type corresponds to one or more Go types; a matching struct // field must be of the correct type. The correspondences are: // -// STRING string -// BOOL bool -// INTEGER int, int8, int16, int32, int64, uint8, uint16, uint32 -// FLOAT float32, float64 -// BYTES []byte -// TIMESTAMP time.Time -// DATE civil.Date -// TIME civil.Time -// DATETIME civil.DateTime +// STRING string +// BOOL bool +// INTEGER int, int8, int16, int32, int64, uint8, uint16, uint32 +// FLOAT float32, float64 +// BYTES []byte +// TIMESTAMP time.Time +// DATE civil.Date +// TIME civil.Time +// DATETIME civil.DateTime // // A repeated field corresponds to a slice or array of the element type. A STRUCT // type (RECORD or nested schema) corresponds to a nested struct or struct pointer. @@ -184,12 +184,12 @@ func (it *RowIterator) fetch(pageSize int, pageToken string) (string, error) { // fast execution query path which can return status, rows, and schema all at // once. Our cache data expectations are as follows: // -// * We can only cache data from the start of a source. -// * We need to cache schema, rows, and next page token to effective service -// a request from cache. -// * cache references are destroyed as soon as they're interrogated. We don't -// want to retain the data unnecessarily, and we expect that the backend -// can always provide them if needed. +// - We can only cache data from the start of a source. +// - We need to cache schema, rows, and next page token to effective service +// a request from cache. +// - cache references are destroyed as soon as they're interrogated. We don't +// want to retain the data unnecessarily, and we expect that the backend +// can always provide them if needed. type rowSource struct { j *Job t *Table diff --git a/bigquery/job.go b/bigquery/job.go index 7ef6d3dec85..52f3b63876c 100644 --- a/bigquery/job.go +++ b/bigquery/job.go @@ -694,18 +694,18 @@ func bqToScriptStatistics(bs *bq.ScriptStatistics) *ScriptStatistics { // // Line and column numbers are defined as follows: // -// - Line and column numbers start with one. That is, line 1 column 1 denotes -// the start of the script. -// - When inside a stored procedure, all line/column numbers are relative -// to the procedure body, not the script in which the procedure was defined. -// - Start/end positions exclude leading/trailing comments and whitespace. -// The end position always ends with a ";", when present. -// - Multi-byte Unicode characters are treated as just one column. -// - If the original script (or procedure definition) contains TAB characters, -// a tab "snaps" the indentation forward to the nearest multiple of 8 -// characters, plus 1. For example, a TAB on column 1, 2, 3, 4, 5, 6 , or 8 -// will advance the next character to column 9. A TAB on column 9, 10, 11, -// 12, 13, 14, 15, or 16 will advance the next character to column 17. +// - Line and column numbers start with one. That is, line 1 column 1 denotes +// the start of the script. +// - When inside a stored procedure, all line/column numbers are relative +// to the procedure body, not the script in which the procedure was defined. +// - Start/end positions exclude leading/trailing comments and whitespace. +// The end position always ends with a ";", when present. +// - Multi-byte Unicode characters are treated as just one column. +// - If the original script (or procedure definition) contains TAB characters, +// a tab "snaps" the indentation forward to the nearest multiple of 8 +// characters, plus 1. For example, a TAB on column 1, 2, 3, 4, 5, 6 , or 8 +// will advance the next character to column 9. A TAB on column 9, 10, 11, +// 12, 13, 14, 15, or 16 will advance the next character to column 17. type ScriptStackFrame struct { StartLine int64 StartColumn int64 diff --git a/bigquery/migration/apiv2/doc.go b/bigquery/migration/apiv2/doc.go index aa967b43166..902d1184339 100644 --- a/bigquery/migration/apiv2/doc.go +++ b/bigquery/migration/apiv2/doc.go @@ -20,45 +20,46 @@ // The migration service, exposing apis for migration jobs operations, and // agent management. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := migration.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := migration.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := migration.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &migrationpb.CreateMigrationWorkflowRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2#CreateMigrationWorkflowRequest. -// } -// resp, err := c.CreateMigrationWorkflow(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := migration.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &migrationpb.CreateMigrationWorkflowRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2#CreateMigrationWorkflowRequest. +// } +// resp, err := c.CreateMigrationWorkflow(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/migration/apiv2alpha/doc.go b/bigquery/migration/apiv2alpha/doc.go index 4751349db1b..1b300c5eb22 100644 --- a/bigquery/migration/apiv2alpha/doc.go +++ b/bigquery/migration/apiv2alpha/doc.go @@ -20,45 +20,46 @@ // The migration service, exposing apis for migration jobs operations, and // agent management. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := migration.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := migration.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := migration.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &migrationpb.CreateMigrationWorkflowRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#CreateMigrationWorkflowRequest. -// } -// resp, err := c.CreateMigrationWorkflow(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := migration.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &migrationpb.CreateMigrationWorkflowRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha#CreateMigrationWorkflowRequest. +// } +// resp, err := c.CreateMigrationWorkflow(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/reservation/apiv1/doc.go b/bigquery/reservation/apiv1/doc.go index b1bd0f88110..ae2a5fec245 100644 --- a/bigquery/reservation/apiv1/doc.go +++ b/bigquery/reservation/apiv1/doc.go @@ -19,43 +19,44 @@ // // A service to modify your BigQuery flat-rate reservations. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := reservation.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := reservation.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := reservation.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &reservationpb.CreateReservationRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1#CreateReservationRequest. -// } -// resp, err := c.CreateReservation(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := reservation.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &reservationpb.CreateReservationRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1#CreateReservationRequest. +// } +// resp, err := c.CreateReservation(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/reservation/apiv1/reservation_client.go b/bigquery/reservation/apiv1/reservation_client.go index c38b960d3ce..f8df1656e72 100644 --- a/bigquery/reservation/apiv1/reservation_client.go +++ b/bigquery/reservation/apiv1/reservation_client.go @@ -387,12 +387,12 @@ func (c *Client) MergeCapacityCommitments(ctx context.Context, req *reservationp // // Example: // -// The organization organizationA contains two projects, project1 -// and project2. +// The organization organizationA contains two projects, project1 +// and project2. // -// Assignments for all three entities (organizationA, project1, and -// project2) could all be created and mapped to the same or different -// reservations. +// Assignments for all three entities (organizationA, project1, and +// project2) could all be created and mapped to the same or different +// reservations. // // “None” assignments represent an absence of the assignment. Projects // assigned to None use on-demand pricing. To create a “None” assignment, use @@ -415,14 +415,14 @@ func (c *Client) CreateAssignment(ctx context.Context, req *reservationpb.Create // // Example: // -// Organization organizationA contains two projects, project1 and -// project2. +// Organization organizationA contains two projects, project1 and +// project2. // -// Reservation res1 exists and was created previously. +// Reservation res1 exists and was created previously. // -// CreateAssignment was used previously to define the following -// associations between entities and reservations: -// and +// CreateAssignment was used previously to define the following +// associations between entities and reservations: +// and // // In this example, ListAssignments will just return the above two assignments // for reservation res1, and no expansion/merge will happen. @@ -440,14 +440,14 @@ func (c *Client) ListAssignments(ctx context.Context, req *reservationpb.ListAss // // Example: // -// Organization organizationA contains two projects, project1 and -// project2. +// Organization organizationA contains two projects, project1 and +// project2. // -// Reservation res1 exists and was created previously. +// Reservation res1 exists and was created previously. // -// CreateAssignment was used previously to define the following -// associations between entities and reservations: -// and +// CreateAssignment was used previously to define the following +// associations between entities and reservations: +// and // // In this example, deletion of the assignment won’t // affect the other assignment . After said deletion, diff --git a/bigquery/reservation/apiv1beta1/doc.go b/bigquery/reservation/apiv1beta1/doc.go index 084fcc1a09d..17e47201f29 100644 --- a/bigquery/reservation/apiv1beta1/doc.go +++ b/bigquery/reservation/apiv1beta1/doc.go @@ -19,45 +19,46 @@ // // A service to modify your BigQuery flat-rate reservations. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := reservation.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := reservation.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := reservation.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &reservationpb.CreateReservationRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1beta1#CreateReservationRequest. -// } -// resp, err := c.CreateReservation(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := reservation.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &reservationpb.CreateReservationRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1beta1#CreateReservationRequest. +// } +// resp, err := c.CreateReservation(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/reservation/apiv1beta1/reservation_client.go b/bigquery/reservation/apiv1beta1/reservation_client.go index e6a67e70240..f83d874f905 100644 --- a/bigquery/reservation/apiv1beta1/reservation_client.go +++ b/bigquery/reservation/apiv1beta1/reservation_client.go @@ -384,12 +384,12 @@ func (c *Client) MergeCapacityCommitments(ctx context.Context, req *reservationp // // Example: // -// The organization organizationA contains two projects, project1 -// and project2. +// The organization organizationA contains two projects, project1 +// and project2. // -// Assignments for all three entities (organizationA, project1, and -// project2) could all be created and mapped to the same or different -// reservations. +// Assignments for all three entities (organizationA, project1, and +// project2) could all be created and mapped to the same or different +// reservations. // // Returns google.rpc.Code.PERMISSION_DENIED if user does not have // ‘bigquery.admin’ permissions on the project using the reservation @@ -407,14 +407,14 @@ func (c *Client) CreateAssignment(ctx context.Context, req *reservationpb.Create // // Example: // -// Organization organizationA contains two projects, project1 and -// project2. +// Organization organizationA contains two projects, project1 and +// project2. // -// Reservation res1 exists and was created previously. +// Reservation res1 exists and was created previously. // -// CreateAssignment was used previously to define the following -// associations between entities and reservations: -// and +// CreateAssignment was used previously to define the following +// associations between entities and reservations: +// and // // In this example, ListAssignments will just return the above two assignments // for reservation res1, and no expansion/merge will happen. @@ -432,14 +432,14 @@ func (c *Client) ListAssignments(ctx context.Context, req *reservationpb.ListAss // // Example: // -// Organization organizationA contains two projects, project1 and -// project2. +// Organization organizationA contains two projects, project1 and +// project2. // -// Reservation res1 exists and was created previously. +// Reservation res1 exists and was created previously. // -// CreateAssignment was used previously to define the following -// associations between entities and reservations: -// and +// CreateAssignment was used previously to define the following +// associations between entities and reservations: +// and // // In this example, deletion of the assignment won’t // affect the other assignment . After said deletion, diff --git a/bigquery/routine_test.go b/bigquery/routine_test.go index 59210ff9a01..5527a751101 100644 --- a/bigquery/routine_test.go +++ b/bigquery/routine_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/bigquery/schema.go b/bigquery/schema.go index 559f68f65c4..aa9efe36e57 100644 --- a/bigquery/schema.go +++ b/bigquery/schema.go @@ -287,16 +287,16 @@ var typeOfByteSlice = reflect.TypeOf([]byte{}) // (This is the same mapping as that used for RowIterator.Next.) Fields inferred // from these types are marked required (non-nullable). // -// STRING string -// BOOL bool -// INTEGER int, int8, int16, int32, int64, uint8, uint16, uint32 -// FLOAT float32, float64 -// BYTES []byte -// TIMESTAMP time.Time -// DATE civil.Date -// TIME civil.Time -// DATETIME civil.DateTime -// NUMERIC *big.Rat +// STRING string +// BOOL bool +// INTEGER int, int8, int16, int32, int64, uint8, uint16, uint32 +// FLOAT float32, float64 +// BYTES []byte +// TIMESTAMP time.Time +// DATE civil.Date +// TIME civil.Time +// DATETIME civil.DateTime +// NUMERIC *big.Rat // // The big.Rat type supports numbers of arbitrary size and precision. Values // will be rounded to 9 digits after the decimal point before being transmitted @@ -311,15 +311,15 @@ var typeOfByteSlice = reflect.TypeOf([]byte{}) // // Nullable fields are inferred from the NullXXX types, declared in this package: // -// STRING NullString -// BOOL NullBool -// INTEGER NullInt64 -// FLOAT NullFloat64 -// TIMESTAMP NullTimestamp -// DATE NullDate -// TIME NullTime -// DATETIME NullDateTime -// GEOGRAPHY NullGeography +// STRING NullString +// BOOL NullBool +// INTEGER NullInt64 +// FLOAT NullFloat64 +// TIMESTAMP NullTimestamp +// DATE NullDate +// TIME NullTime +// DATETIME NullDateTime +// GEOGRAPHY NullGeography // // For a nullable BYTES field, use the type []byte and tag the field "nullable" (see below). // For a nullable NUMERIC field, use the type *big.Rat and tag the field "nullable". @@ -337,15 +337,20 @@ var typeOfByteSlice = reflect.TypeOf([]byte{}) // // Struct fields may be tagged in a way similar to the encoding/json package. // A tag of the form -// bigquery:"name" +// +// bigquery:"name" +// // uses "name" instead of the struct field name as the BigQuery field name. // A tag of the form -// bigquery:"-" +// +// bigquery:"-" +// // omits the field from the inferred schema. // The "nullable" option marks the field as nullable (not required). It is only // needed for []byte, *big.Rat and pointer-to-struct fields, and cannot appear on other // fields. In this example, the Go name of the field is retained: -// bigquery:",nullable" +// +// bigquery:",nullable" func InferSchema(st interface{}) (Schema, error) { return inferSchemaReflectCached(reflect.TypeOf(st)) } diff --git a/bigquery/storage/apiv1/big_query_write_client.go b/bigquery/storage/apiv1/big_query_write_client.go index 72b6723b93e..169a7aad499 100644 --- a/bigquery/storage/apiv1/big_query_write_client.go +++ b/bigquery/storage/apiv1/big_query_write_client.go @@ -218,15 +218,15 @@ func (c *BigQueryWriteClient) CreateWriteStream(ctx context.Context, req *storag // The specifics of when successfully appended data is made visible to the // table are governed by the type of stream: // -// For COMMITTED streams (which includes the default stream), data is -// visible immediately upon successful append. +// For COMMITTED streams (which includes the default stream), data is +// visible immediately upon successful append. // -// For BUFFERED streams, data is made visible via a subsequent FlushRows -// rpc which advances a cursor to a newer offset in the stream. +// For BUFFERED streams, data is made visible via a subsequent FlushRows +// rpc which advances a cursor to a newer offset in the stream. // -// For PENDING streams, data is not made visible until the stream itself is -// finalized (via the FinalizeWriteStream rpc), and the stream is explicitly -// committed via the BatchCommitWriteStreams rpc. +// For PENDING streams, data is not made visible until the stream itself is +// finalized (via the FinalizeWriteStream rpc), and the stream is explicitly +// committed via the BatchCommitWriteStreams rpc. // // Note: For users coding against the gRPC api directly, it may be // necessary to supply the x-goog-request-params system parameter diff --git a/bigquery/storage/apiv1/doc.go b/bigquery/storage/apiv1/doc.go index 53df6933ce8..c4261b7150e 100644 --- a/bigquery/storage/apiv1/doc.go +++ b/bigquery/storage/apiv1/doc.go @@ -17,43 +17,44 @@ // Package storage is an auto-generated package for the // BigQuery Storage API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := storage.NewBigQueryReadClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := storage.NewBigQueryReadClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := storage.NewBigQueryReadClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := storage.NewBigQueryReadClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &storagepb.CreateReadSessionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1#CreateReadSessionRequest. -// } -// resp, err := c.CreateReadSession(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &storagepb.CreateReadSessionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1#CreateReadSessionRequest. +// } +// resp, err := c.CreateReadSession(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/storage/apiv1beta1/doc.go b/bigquery/storage/apiv1beta1/doc.go index 3611141094c..ad97f94adb2 100644 --- a/bigquery/storage/apiv1beta1/doc.go +++ b/bigquery/storage/apiv1beta1/doc.go @@ -17,45 +17,46 @@ // Package storage is an auto-generated package for the // BigQuery Storage API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := storage.NewBigQueryStorageClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := storage.NewBigQueryStorageClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := storage.NewBigQueryStorageClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &storagepb.CreateReadSessionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1#CreateReadSessionRequest. -// } -// resp, err := c.CreateReadSession(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := storage.NewBigQueryStorageClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &storagepb.CreateReadSessionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1#CreateReadSessionRequest. +// } +// resp, err := c.CreateReadSession(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigquery/storage/apiv1beta2/doc.go b/bigquery/storage/apiv1beta2/doc.go index a1809f91a18..6f50eaae692 100644 --- a/bigquery/storage/apiv1beta2/doc.go +++ b/bigquery/storage/apiv1beta2/doc.go @@ -17,45 +17,46 @@ // Package storage is an auto-generated package for the // BigQuery Storage API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := storage.NewBigQueryReadClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := storage.NewBigQueryReadClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := storage.NewBigQueryReadClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &storagepb.CreateReadSessionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta2#CreateReadSessionRequest. -// } -// resp, err := c.CreateReadSession(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := storage.NewBigQueryReadClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &storagepb.CreateReadSessionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta2#CreateReadSessionRequest. +// } +// resp, err := c.CreateReadSession(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/bigtable/admin.go b/bigtable/admin.go index 933eabc81e3..167966e7a47 100644 --- a/bigtable/admin.go +++ b/bigtable/admin.go @@ -927,12 +927,12 @@ func (iac *InstanceAdminClient) updateInstance(ctx context.Context, conf *Instan // UpdateInstanceWithClusters updates an instance and its clusters. Updateable // fields are instance display name, instance type and cluster size. // The provided InstanceWithClustersConfig is used as follows: -// - InstanceID is required -// - DisplayName and InstanceType are updated only if they are not empty -// - ClusterID is required for any provided cluster -// - All other cluster fields are ignored except for NumNodes and -// AutoscalingConfig, which if set will be updated. If both are provided, -// AutoscalingConfig takes precedence. +// - InstanceID is required +// - DisplayName and InstanceType are updated only if they are not empty +// - ClusterID is required for any provided cluster +// - All other cluster fields are ignored except for NumNodes and +// AutoscalingConfig, which if set will be updated. If both are provided, +// AutoscalingConfig takes precedence. // // This method may return an error after partially succeeding, for example if the instance is updated // but a cluster update fails. If an error is returned, InstanceInfo and Clusters may be called to @@ -1608,19 +1608,19 @@ func max(x, y int) int { // UpdateInstanceAndSyncClusters updates an instance and its clusters, and will synchronize the // clusters in the instance with the provided clusters, creating and deleting them as necessary. // The provided InstanceWithClustersConfig is used as follows: -// - InstanceID is required -// - DisplayName and InstanceType are updated only if they are not empty -// - ClusterID is required for any provided cluster -// - Any cluster present in conf.Clusters but not part of the instance will be created using CreateCluster -// and the given ClusterConfig. -// - Any cluster missing from conf.Clusters but present in the instance will be removed from the instance -// using DeleteCluster. -// - Any cluster in conf.Clusters that also exists in the instance will be -// updated either to contain the provided number of nodes or to use the -// provided autoscaling config. If both the number of nodes and autoscaling -// are configured, autoscaling takes precedence. If the number of nodes is zero -// and autoscaling is not provided in InstanceWithClustersConfig, the cluster -// is not updated. +// - InstanceID is required +// - DisplayName and InstanceType are updated only if they are not empty +// - ClusterID is required for any provided cluster +// - Any cluster present in conf.Clusters but not part of the instance will be created using CreateCluster +// and the given ClusterConfig. +// - Any cluster missing from conf.Clusters but present in the instance will be removed from the instance +// using DeleteCluster. +// - Any cluster in conf.Clusters that also exists in the instance will be +// updated either to contain the provided number of nodes or to use the +// provided autoscaling config. If both the number of nodes and autoscaling +// are configured, autoscaling takes precedence. If the number of nodes is zero +// and autoscaling is not provided in InstanceWithClustersConfig, the cluster +// is not updated. // // This method may return an error after partially succeeding, for example if the instance is updated // but a cluster update fails. If an error is returned, InstanceInfo and Clusters may be called to diff --git a/bigtable/bttest/example_test.go b/bigtable/bttest/example_test.go index 6348c7c485e..5854a221eca 100644 --- a/bigtable/bttest/example_test.go +++ b/bigtable/bttest/example_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/bigtable/bttest/inmem.go b/bigtable/bttest/inmem.go index 5f4b2400652..6839c92e5fc 100644 --- a/bigtable/bttest/inmem.go +++ b/bigtable/bttest/inmem.go @@ -19,6 +19,7 @@ Package bttest contains test helpers for working with the bigtable package. To use a Server, create it, and then connect to it with no security: (The project/instance values are ignored.) + srv, err := bttest.NewServer("localhost:0") ... conn, err := grpc.Dial(srv.Addr, grpc.WithInsecure()) diff --git a/bigtable/bttest/timestamp_test.go b/bigtable/bttest/timestamp_test.go index 7f0d93e7a60..306254ef67e 100644 --- a/bigtable/bttest/timestamp_test.go +++ b/bigtable/bttest/timestamp_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/bigtable/bttest/validation.go b/bigtable/bttest/validation.go index 352a80b8982..7c4a0094b6e 100644 --- a/bigtable/bttest/validation.go +++ b/bigtable/bttest/validation.go @@ -25,12 +25,12 @@ import ( ) // validateRowRanges returns a status.Error for req if: -// * both start_qualifier_closed and start_qualifier_open are set -// * both end_qualifier_closed and end_qualifier_open are set -// * start_qualifier_closed > end_qualifier_closed -// * start_qualifier_closed > end_qualifier_open -// * start_qualifier_open > end_qualifier_closed -// * start_qualifier_open > end_qualifier_open +// - both start_qualifier_closed and start_qualifier_open are set +// - both end_qualifier_closed and end_qualifier_open are set +// - start_qualifier_closed > end_qualifier_closed +// - start_qualifier_closed > end_qualifier_open +// - start_qualifier_open > end_qualifier_closed +// - start_qualifier_open > end_qualifier_open func validateRowRanges(req *btpb.ReadRowsRequest) error { rowRanges := req.GetRows().GetRowRanges() if len(rowRanges) == 0 { diff --git a/bigtable/doc.go b/bigtable/doc.go index e02ead3e372..5b27e47e055 100644 --- a/bigtable/doc.go +++ b/bigtable/doc.go @@ -22,8 +22,7 @@ See https://cloud.google.com/bigtable/docs/ for general product documentation. See https://godoc.org/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package. - -Reading +# Reading The principal way to read from a Bigtable is to use the ReadRows method on *Table. A RowRange specifies a contiguous portion of a table. A Filter may be @@ -49,8 +48,7 @@ To read a single row, use the ReadRow helper method: } // TODO: use r. - -Writing +# Writing This API exposes two distinct forms of writing to a Bigtable: a Mutation and a ReadModifyWrite. The former expresses idempotent operations. The latter @@ -88,8 +86,7 @@ To increment an encoded value in one cell: } // TODO: use r. - -Retries +# Retries If a read or write operation encounters a transient error it will be retried until a successful response, an unretryable error or the context deadline is diff --git a/bigtable/gc_test.go b/bigtable/gc_test.go index 81e80bef2d0..0bc12130d64 100644 --- a/bigtable/gc_test.go +++ b/bigtable/gc_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/bigtable/retry_test.go b/bigtable/retry_test.go index 8e7f82aea39..3df436e93ec 100644 --- a/bigtable/retry_test.go +++ b/bigtable/retry_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/billing/apiv1/doc.go b/billing/apiv1/doc.go index bc1c0f46e44..d7da6107253 100644 --- a/billing/apiv1/doc.go +++ b/billing/apiv1/doc.go @@ -20,43 +20,44 @@ // Allows developers to manage billing for their Google Cloud Platform // projects programmatically. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := billing.NewCloudBillingClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := billing.NewCloudBillingClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := billing.NewCloudBillingClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &billingpb.GetBillingAccountRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/billing/v1#GetBillingAccountRequest. -// } -// resp, err := c.GetBillingAccount(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := billing.NewCloudBillingClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &billingpb.GetBillingAccountRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/billing/v1#GetBillingAccountRequest. +// } +// resp, err := c.GetBillingAccount(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/billing/budgets/apiv1/doc.go b/billing/budgets/apiv1/doc.go index b8e19dfdfb0..cd81282bdcd 100644 --- a/billing/budgets/apiv1/doc.go +++ b/billing/budgets/apiv1/doc.go @@ -21,43 +21,44 @@ // budget plan and the rules to execute as spend is tracked against that // plan. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := budgets.NewBudgetClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := budgets.NewBudgetClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := budgets.NewBudgetClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &budgetspb.CreateBudgetRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/billing/budgets/v1#CreateBudgetRequest. -// } -// resp, err := c.CreateBudget(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := budgets.NewBudgetClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &budgetspb.CreateBudgetRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/billing/budgets/v1#CreateBudgetRequest. +// } +// resp, err := c.CreateBudget(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/billing/budgets/apiv1beta1/doc.go b/billing/budgets/apiv1beta1/doc.go index d5f0f160944..5bb71965411 100644 --- a/billing/budgets/apiv1beta1/doc.go +++ b/billing/budgets/apiv1beta1/doc.go @@ -21,45 +21,46 @@ // budget plan and the rules to execute as spend is tracked against that // plan. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := budgets.NewBudgetClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := budgets.NewBudgetClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := budgets.NewBudgetClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &budgetspb.CreateBudgetRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/billing/budgets/v1beta1#CreateBudgetRequest. -// } -// resp, err := c.CreateBudget(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := budgets.NewBudgetClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &budgetspb.CreateBudgetRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/billing/budgets/v1beta1#CreateBudgetRequest. +// } +// resp, err := c.CreateBudget(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/binaryauthorization/apiv1/binauthz_management_client.go b/binaryauthorization/apiv1/binauthz_management_client.go index a0fd5336ae2..2ba4fb79a80 100644 --- a/binaryauthorization/apiv1/binauthz_management_client.go +++ b/binaryauthorization/apiv1/binauthz_management_client.go @@ -160,9 +160,9 @@ type internalBinauthzManagementClient interface { // // This API implements a REST model with the following objects: // -// Policy +// Policy // -// Attestor +// Attestor type BinauthzManagementClient struct { // The internal transport-dependent client. internalClient internalBinauthzManagementClient @@ -273,9 +273,9 @@ type binauthzManagementGRPCClient struct { // // This API implements a REST model with the following objects: // -// Policy +// Policy // -// Attestor +// Attestor func NewBinauthzManagementClient(ctx context.Context, opts ...option.ClientOption) (*BinauthzManagementClient, error) { clientOpts := defaultBinauthzManagementGRPCClientOptions() if newBinauthzManagementClientHook != nil { diff --git a/binaryauthorization/apiv1/doc.go b/binaryauthorization/apiv1/doc.go index fbcea458e39..4ee77040887 100644 --- a/binaryauthorization/apiv1/doc.go +++ b/binaryauthorization/apiv1/doc.go @@ -21,43 +21,44 @@ // policy control for images deployed to Kubernetes Engine clusters, Anthos // clusters on VMware, and Cloud Run. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := binaryauthorization.NewBinauthzManagementClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := binaryauthorization.NewBinauthzManagementClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := binaryauthorization.NewBinauthzManagementClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &binaryauthorizationpb.GetPolicyRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1#GetPolicyRequest. -// } -// resp, err := c.GetPolicy(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := binaryauthorization.NewBinauthzManagementClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &binaryauthorizationpb.GetPolicyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1#GetPolicyRequest. +// } +// resp, err := c.GetPolicy(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go b/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go index 19f5d2b20a6..2913e569d7c 100644 --- a/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go +++ b/binaryauthorization/apiv1beta1/binauthz_management_service_v1_beta1_client.go @@ -238,9 +238,9 @@ type internalBinauthzManagementServiceV1Beta1Client interface { // // This API implements a REST model with the following objects: // -// Policy +// Policy // -// Attestor +// Attestor type BinauthzManagementServiceV1Beta1Client struct { // The internal transport-dependent client. internalClient internalBinauthzManagementServiceV1Beta1Client @@ -351,9 +351,9 @@ type binauthzManagementServiceV1Beta1GRPCClient struct { // // This API implements a REST model with the following objects: // -// Policy +// Policy // -// Attestor +// Attestor func NewBinauthzManagementServiceV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*BinauthzManagementServiceV1Beta1Client, error) { clientOpts := defaultBinauthzManagementServiceV1Beta1GRPCClientOptions() if newBinauthzManagementServiceV1Beta1ClientHook != nil { @@ -432,9 +432,9 @@ type binauthzManagementServiceV1Beta1RESTClient struct { // // This API implements a REST model with the following objects: // -// Policy +// Policy // -// Attestor +// Attestor func NewBinauthzManagementServiceV1Beta1RESTClient(ctx context.Context, opts ...option.ClientOption) (*BinauthzManagementServiceV1Beta1Client, error) { clientOpts := append(defaultBinauthzManagementServiceV1Beta1RESTClientOptions(), opts...) httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) diff --git a/binaryauthorization/apiv1beta1/doc.go b/binaryauthorization/apiv1beta1/doc.go index e28c87dcb20..2bf47e5ec23 100644 --- a/binaryauthorization/apiv1beta1/doc.go +++ b/binaryauthorization/apiv1beta1/doc.go @@ -21,45 +21,46 @@ // policy control for images deployed to Kubernetes Engine clusters, Anthos // clusters on VMware, and Cloud Run. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &binaryauthorizationpb.GetPolicyRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1#GetPolicyRequest. -// } -// resp, err := c.GetPolicy(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := binaryauthorization.NewBinauthzManagementServiceV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &binaryauthorizationpb.GetPolicyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1#GetPolicyRequest. +// } +// resp, err := c.GetPolicy(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/certificatemanager/apiv1/certificate_manager_client.go b/certificatemanager/apiv1/certificate_manager_client.go index 2de3791f6bd..e96dee7bc98 100644 --- a/certificatemanager/apiv1/certificate_manager_client.go +++ b/certificatemanager/apiv1/certificate_manager_client.go @@ -422,7 +422,7 @@ type internalClient interface { // Client is a client for interacting with Certificate Manager API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// API Overview +// # API Overview // // Certificates Manager API allows customers to see and manage all their TLS // certificates. @@ -431,25 +431,25 @@ type internalClient interface { // group them into collections, and create serving configuration that can be // easily applied to other Cloud resources e.g. Target Proxies. // -// Data Model +// # Data Model // // The Certificates Manager service exposes the following resources: // -// Certificate which describes a single TLS certificate. +// Certificate which describes a single TLS certificate. // -// CertificateMap which describes a collection of certificates that can be -// attached to a target resource. +// CertificateMap which describes a collection of certificates that can be +// attached to a target resource. // -// CertificateMapEntry which describes a single configuration entry that -// consists of a SNI and a group of certificates. It’s a subresource of -// CertificateMap. +// CertificateMapEntry which describes a single configuration entry that +// consists of a SNI and a group of certificates. It’s a subresource of +// CertificateMap. // // Certificate, CertificateMap and CertificateMapEntry IDs // have to match “^[a-z0-9-]{1,63}$” regexp, which means that // -// only lower case letters, digits, and hyphen are allowed +// only lower case letters, digits, and hyphen are allowed // -// length of the resource ID has to be in [1,63] range. +// length of the resource ID has to be in [1,63] range. // // Provides methods to manage Cloud Certificate Manager entities. type Client struct { @@ -723,7 +723,7 @@ type gRPCClient struct { // NewClient creates a new certificate manager client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// API Overview +// # API Overview // // Certificates Manager API allows customers to see and manage all their TLS // certificates. @@ -732,25 +732,25 @@ type gRPCClient struct { // group them into collections, and create serving configuration that can be // easily applied to other Cloud resources e.g. Target Proxies. // -// Data Model +// # Data Model // // The Certificates Manager service exposes the following resources: // -// Certificate which describes a single TLS certificate. +// Certificate which describes a single TLS certificate. // -// CertificateMap which describes a collection of certificates that can be -// attached to a target resource. +// CertificateMap which describes a collection of certificates that can be +// attached to a target resource. // -// CertificateMapEntry which describes a single configuration entry that -// consists of a SNI and a group of certificates. It’s a subresource of -// CertificateMap. +// CertificateMapEntry which describes a single configuration entry that +// consists of a SNI and a group of certificates. It’s a subresource of +// CertificateMap. // // Certificate, CertificateMap and CertificateMapEntry IDs // have to match “^[a-z0-9-]{1,63}$” regexp, which means that // -// only lower case letters, digits, and hyphen are allowed +// only lower case letters, digits, and hyphen are allowed // -// length of the resource ID has to be in [1,63] range. +// length of the resource ID has to be in [1,63] range. // // Provides methods to manage Cloud Certificate Manager entities. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { diff --git a/certificatemanager/apiv1/doc.go b/certificatemanager/apiv1/doc.go index 4c81e40d343..62e3ab709c8 100644 --- a/certificatemanager/apiv1/doc.go +++ b/certificatemanager/apiv1/doc.go @@ -17,51 +17,52 @@ // Package certificatemanager is an auto-generated package for the // Certificate Manager API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := certificatemanager.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := certificatemanager.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := certificatemanager.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &certificatemanagerpb.ListCertificatesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/certificatemanager/v1#ListCertificatesRequest. -// } -// it := c.ListCertificates(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := certificatemanager.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &certificatemanagerpb.ListCertificatesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/certificatemanager/v1#ListCertificatesRequest. +// } +// it := c.ListCertificates(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/channel/apiv1/cloud_channel_client.go b/channel/apiv1/cloud_channel_client.go index 044a63009cb..6b55452f0d7 100644 --- a/channel/apiv1/cloud_channel_client.go +++ b/channel/apiv1/cloud_channel_client.go @@ -583,15 +583,15 @@ type internalCloudChannelClient interface { // // CloudChannelService exposes the following resources: // -// Customers: An entity—usually an enterprise—managed by a reseller or -// distributor. +// Customers: An entity—usually an enterprise—managed by a reseller or +// distributor. // -// Entitlements: An entity that provides a customer with the means to use -// a service. Entitlements are created or updated as a result of a successful -// fulfillment. +// Entitlements: An entity that provides a customer with the means to use +// a service. Entitlements are created or updated as a result of a successful +// fulfillment. // -// ChannelPartnerLinks: An entity that identifies links between -// distributors and their indirect resellers in a channel. +// ChannelPartnerLinks: An entity that identifies links between +// distributors and their indirect resellers in a channel. type CloudChannelClient struct { // The internal transport-dependent client. internalClient internalCloudChannelClient @@ -631,10 +631,10 @@ func (c *CloudChannelClient) Connection() *grpc.ClientConn { // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // // Return value: // List of Customers, or an empty list if there are no customers. @@ -646,13 +646,13 @@ func (c *CloudChannelClient) ListCustomers(ctx context.Context, req *channelpb.L // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: The customer resource doesn’t exist. Usually the result of an -// invalid name parameter. +// NOT_FOUND: The customer resource doesn’t exist. Usually the result of an +// invalid name parameter. // // Return value: // The Customer resource. @@ -665,12 +665,12 @@ func (c *CloudChannelClient) GetCustomer(ctx context.Context, req *channelpb.Get // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// INVALID_VALUE: Invalid domain value in the request. +// INVALID_VALUE: Invalid domain value in the request. // // Return value: // A list of CloudIdentityCustomerAccount resources for the domain (may be @@ -687,14 +687,14 @@ func (c *CloudChannelClient) CheckCloudIdentityAccountsExist(ctx context.Context // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: +// INVALID_ARGUMENT: // -// Required request parameters are missing or invalid. +// Required request parameters are missing or invalid. // -// Domain field value doesn’t match the primary email domain. +// Domain field value doesn’t match the primary email domain. // // Return value: // The newly created Customer resource. @@ -707,12 +707,12 @@ func (c *CloudChannelClient) CreateCustomer(ctx context.Context, req *channelpb. // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: No Customer resource found for the name in the request. +// NOT_FOUND: No Customer resource found for the name in the request. // // Return value: // The updated Customer resource. @@ -724,14 +724,14 @@ func (c *CloudChannelClient) UpdateCustomer(ctx context.Context, req *channelpb. // // Possible error codes: // -// PERMISSION_DENIED: The account making the request does not own -// this customer. +// PERMISSION_DENIED: The account making the request does not own +// this customer. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// FAILED_PRECONDITION: The customer has existing entitlements. +// FAILED_PRECONDITION: The customer has existing entitlements. // -// NOT_FOUND: No Customer resource found for the name in the request. +// NOT_FOUND: No Customer resource found for the name in the request. func (c *CloudChannelClient) DeleteCustomer(ctx context.Context, req *channelpb.DeleteCustomerRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteCustomer(ctx, req, opts...) } @@ -743,16 +743,16 @@ func (c *CloudChannelClient) DeleteCustomer(ctx context.Context, req *channelpb. // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// NOT_FOUND: Cloud Identity doesn’t exist or was deleted. +// NOT_FOUND: Cloud Identity doesn’t exist or was deleted. // -// INVALID_ARGUMENT: Required parameters are missing, or the auth_token is -// expired or invalid. +// INVALID_ARGUMENT: Required parameters are missing, or the auth_token is +// expired or invalid. // -// ALREADY_EXISTS: A customer already exists and has conflicting critical -// fields. Requires an overwrite. +// ALREADY_EXISTS: A customer already exists and has conflicting critical +// fields. Requires an overwrite. // // Return value: // The Customer. @@ -765,20 +765,20 @@ func (c *CloudChannelClient) ImportCustomer(ctx context.Context, req *channelpb. // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: The customer was not found. +// NOT_FOUND: The customer was not found. // -// ALREADY_EXISTS: The customer’s primary email already exists. Retry -// after changing the customer’s primary contact email. +// ALREADY_EXISTS: The customer’s primary email already exists. Retry +// after changing the customer’s primary contact email. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -800,9 +800,9 @@ func (c *CloudChannelClient) ProvisionCloudIdentityOperation(name string) *Provi // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // // Return value: // A list of the customer’s Entitlements. @@ -819,16 +819,16 @@ func (c *CloudChannelClient) ListEntitlements(ctx context.Context, req *channelp // // Possible error codes: // -// PERMISSION_DENIED: +// PERMISSION_DENIED: // -// The customer doesn’t belong to the reseller and has no auth token. +// The customer doesn’t belong to the reseller and has no auth token. // -// The supplied auth token is invalid. +// The supplied auth token is invalid. // -// The reseller account making the request is different -// from the reseller account in the query. +// The reseller account making the request is different +// from the reseller account in the query. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // // Return value: // A list of the customer’s TransferableSku. @@ -845,16 +845,16 @@ func (c *CloudChannelClient) ListTransferableSkus(ctx context.Context, req *chan // // Possible error codes: // -// PERMISSION_DENIED: +// PERMISSION_DENIED: // -// The customer doesn’t belong to the reseller and has no auth token. +// The customer doesn’t belong to the reseller and has no auth token. // -// The supplied auth token is invalid. +// The supplied auth token is invalid. // -// The reseller account making the request is different -// from the reseller account in the query. +// The reseller account making the request is different +// from the reseller account in the query. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // // Return value: // List of TransferableOffer for the given customer and SKU. @@ -866,11 +866,11 @@ func (c *CloudChannelClient) ListTransferableOffers(ctx context.Context, req *ch // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: The customer entitlement was not found. +// NOT_FOUND: The customer entitlement was not found. // // Return value: // The requested Entitlement resource. @@ -882,47 +882,47 @@ func (c *CloudChannelClient) GetEntitlement(ctx context.Context, req *channelpb. // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: +// INVALID_ARGUMENT: // -// Required request parameters are missing or invalid. +// Required request parameters are missing or invalid. // -// There is already a customer entitlement for a SKU from the same -// product family. +// There is already a customer entitlement for a SKU from the same +// product family. // -// INVALID_VALUE: Make sure the OfferId is valid. If it is, contact -// Google Channel support for further troubleshooting. +// INVALID_VALUE: Make sure the OfferId is valid. If it is, contact +// Google Channel support for further troubleshooting. // -// NOT_FOUND: The customer or offer resource was not found. +// NOT_FOUND: The customer or offer resource was not found. // -// ALREADY_EXISTS: +// ALREADY_EXISTS: // -// The SKU was already purchased for the customer. +// The SKU was already purchased for the customer. // -// The customer’s primary email already exists. Retry -// after changing the customer’s primary contact email. +// The customer’s primary email already exists. Retry +// after changing the customer’s primary contact email. // -// CONDITION_NOT_MET or FAILED_PRECONDITION: +// CONDITION_NOT_MET or FAILED_PRECONDITION: // -// The domain required for purchasing a SKU has not been verified. +// The domain required for purchasing a SKU has not been verified. // -// A pre-requisite SKU required to purchase an Add-On SKU is missing. -// For example, Google Workspace Business Starter is required to purchase -// Vault or Drive. +// A pre-requisite SKU required to purchase an Add-On SKU is missing. +// For example, Google Workspace Business Starter is required to purchase +// Vault or Drive. // -// (Developer accounts only) Reseller and resold domain must meet the -// following naming requirements: +// (Developer accounts only) Reseller and resold domain must meet the +// following naming requirements: // -// Domain names must start with goog-test. +// Domain names must start with goog-test. // -// Domain names must include the reseller domain. +// Domain names must include the reseller domain. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -947,19 +947,19 @@ func (c *CloudChannelClient) CreateEntitlementOperation(name string) *CreateEnti // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. -// For example, the number of seats being changed is greater than the allowed -// number of max seats, or decreasing seats for a commitment based plan. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// For example, the number of seats being changed is greater than the allowed +// number of max seats, or decreasing seats for a commitment based plan. // -// NOT_FOUND: Entitlement resource not found. +// NOT_FOUND: Entitlement resource not found. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -984,20 +984,20 @@ func (c *CloudChannelClient) ChangeParametersOperation(name string) *ChangeParam // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: Entitlement resource not found. +// NOT_FOUND: Entitlement resource not found. // -// NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for a -// commitment plan. Can’t enable or disable renewals for non-commitment plans. +// NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for a +// commitment plan. Can’t enable or disable renewals for non-commitment plans. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -1022,17 +1022,17 @@ func (c *CloudChannelClient) ChangeRenewalSettingsOperation(name string) *Change // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: Offer or Entitlement resource not found. +// NOT_FOUND: Offer or Entitlement resource not found. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -1058,20 +1058,20 @@ func (c *CloudChannelClient) ChangeOfferOperation(name string) *ChangeOfferOpera // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: Entitlement resource not found. +// NOT_FOUND: Entitlement resource not found. // -// FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for -// entitlement on trial plans. +// FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for +// entitlement on trial plans. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -1095,19 +1095,19 @@ func (c *CloudChannelClient) StartPaidServiceOperation(name string) *StartPaidSe // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: Entitlement resource not found. +// NOT_FOUND: Entitlement resource not found. // -// NOT_ACTIVE: Entitlement is not active. +// NOT_ACTIVE: Entitlement is not active. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -1131,24 +1131,24 @@ func (c *CloudChannelClient) SuspendEntitlementOperation(name string) *SuspendEn // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// FAILED_PRECONDITION: There are Google Cloud projects linked to the -// Google Cloud entitlement’s Cloud Billing subaccount. +// FAILED_PRECONDITION: There are Google Cloud projects linked to the +// Google Cloud entitlement’s Cloud Billing subaccount. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: Entitlement resource not found. +// NOT_FOUND: Entitlement resource not found. // -// DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google Workspace -// add-ons, or entitlements for Google Cloud’s development platform. +// DELETION_TYPE_NOT_ALLOWED: Cancel is only allowed for Google Workspace +// add-ons, or entitlements for Google Cloud’s development platform. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -1175,24 +1175,24 @@ func (c *CloudChannelClient) CancelEntitlementOperation(name string) *CancelEnti // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: Entitlement resource not found. +// NOT_FOUND: Entitlement resource not found. // -// SUSPENSION_NOT_RESELLER_INITIATED: Can only activate reseller-initiated -// suspensions and entitlements that have accepted the TOS. +// SUSPENSION_NOT_RESELLER_INITIATED: Can only activate reseller-initiated +// suspensions and entitlements that have accepted the TOS. // -// NOT_SUSPENDED: Can only activate suspended entitlements not in an ACTIVE -// state. +// NOT_SUSPENDED: Can only activate suspended entitlements not in an ACTIVE +// state. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -1214,36 +1214,36 @@ func (c *CloudChannelClient) ActivateEntitlementOperation(name string) *Activate // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: The customer or offer resource was not found. +// NOT_FOUND: The customer or offer resource was not found. // -// ALREADY_EXISTS: The SKU was already transferred for the customer. +// ALREADY_EXISTS: The SKU was already transferred for the customer. // -// CONDITION_NOT_MET or FAILED_PRECONDITION: +// CONDITION_NOT_MET or FAILED_PRECONDITION: // -// The SKU requires domain verification to transfer, but the domain is -// not verified. +// The SKU requires domain verification to transfer, but the domain is +// not verified. // -// An Add-On SKU (example, Vault or Drive) is missing the -// pre-requisite SKU (example, G Suite Basic). +// An Add-On SKU (example, Vault or Drive) is missing the +// pre-requisite SKU (example, G Suite Basic). // -// (Developer accounts only) Reseller and resold domain must meet the -// following naming requirements: +// (Developer accounts only) Reseller and resold domain must meet the +// following naming requirements: // -// Domain names must start with goog-test. +// Domain names must start with goog-test. // -// Domain names must include the reseller domain. +// Domain names must include the reseller domain. // -// Specify all transferring entitlements. +// Specify all transferring entitlements. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -1265,34 +1265,34 @@ func (c *CloudChannelClient) TransferEntitlementsOperation(name string) *Transfe // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: The customer or offer resource was not found. +// NOT_FOUND: The customer or offer resource was not found. // -// ALREADY_EXISTS: The SKU was already transferred for the customer. +// ALREADY_EXISTS: The SKU was already transferred for the customer. // -// CONDITION_NOT_MET or FAILED_PRECONDITION: +// CONDITION_NOT_MET or FAILED_PRECONDITION: // -// The SKU requires domain verification to transfer, but the domain is -// not verified. +// The SKU requires domain verification to transfer, but the domain is +// not verified. // -// An Add-On SKU (example, Vault or Drive) is missing the -// pre-requisite SKU (example, G Suite Basic). +// An Add-On SKU (example, Vault or Drive) is missing the +// pre-requisite SKU (example, G Suite Basic). // -// (Developer accounts only) Reseller and resold domain must meet the -// following naming requirements: +// (Developer accounts only) Reseller and resold domain must meet the +// following naming requirements: // -// Domain names must start with goog-test. +// Domain names must start with goog-test. // -// Domain names must include the reseller domain. +// Domain names must include the reseller domain. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The ID of a long-running operation. @@ -1316,10 +1316,10 @@ func (c *CloudChannelClient) TransferEntitlementsToGoogleOperation(name string) // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // // Return value: // The list of the distributor account’s ChannelPartnerLink resources. @@ -1332,13 +1332,13 @@ func (c *CloudChannelClient) ListChannelPartnerLinks(ctx context.Context, req *c // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: ChannelPartnerLink resource not found because of an -// invalid channel partner link name. +// NOT_FOUND: ChannelPartnerLink resource not found because of an +// invalid channel partner link name. // // Return value: // The ChannelPartnerLink resource. @@ -1355,21 +1355,21 @@ func (c *CloudChannelClient) GetChannelPartnerLink(ctx context.Context, req *cha // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// ALREADY_EXISTS: The ChannelPartnerLink sent in the request already -// exists. +// ALREADY_EXISTS: The ChannelPartnerLink sent in the request already +// exists. // -// NOT_FOUND: No Cloud Identity customer exists for provided domain. +// NOT_FOUND: No Cloud Identity customer exists for provided domain. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The new ChannelPartnerLink resource. @@ -1383,25 +1383,25 @@ func (c *CloudChannelClient) CreateChannelPartnerLink(ctx context.Context, req * // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request is different -// from the reseller account in the API request. +// PERMISSION_DENIED: The reseller account making the request is different +// from the reseller account in the API request. // -// INVALID_ARGUMENT: +// INVALID_ARGUMENT: // -// Required request parameters are missing or invalid. +// Required request parameters are missing or invalid. // -// Link state cannot change from invited to active or suspended. +// Link state cannot change from invited to active or suspended. // -// Cannot send reseller_cloud_identity_id, invite_url, or name in update -// mask. +// Cannot send reseller_cloud_identity_id, invite_url, or name in update +// mask. // -// NOT_FOUND: ChannelPartnerLink resource not found. +// NOT_FOUND: ChannelPartnerLink resource not found. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The updated ChannelPartnerLink resource. @@ -1414,13 +1414,13 @@ func (c *CloudChannelClient) UpdateChannelPartnerLink(ctx context.Context, req * // // Possible Error Codes: // -// PERMISSION_DENIED: If the account making the request and the account -// being queried are different. +// PERMISSION_DENIED: If the account making the request and the account +// being queried are different. // -// NOT_FOUND: The CustomerRepricingConfig was not found. +// NOT_FOUND: The CustomerRepricingConfig was not found. // -// INTERNAL: Any non-user error related to technical issues in the -// backend. In this case, contact Cloud Channel support. +// INTERNAL: Any non-user error related to technical issues in the +// backend. In this case, contact Cloud Channel support. // // Return Value: // If successful, the CustomerRepricingConfig resource, otherwise returns @@ -1434,26 +1434,26 @@ func (c *CloudChannelClient) GetCustomerRepricingConfig(ctx context.Context, req // // Possible Error Codes: // -// PERMISSION_DENIED: If the account making the request and the account -// being queried are different. +// PERMISSION_DENIED: If the account making the request and the account +// being queried are different. // -// NOT_FOUND: The CustomerRepricingConfig specified does not exist or is -// not associated with the given account. +// NOT_FOUND: The CustomerRepricingConfig specified does not exist or is +// not associated with the given account. // -// INTERNAL: Any non-user error related to technical issues in the -// backend. In this case, contact Cloud Channel support. +// INTERNAL: Any non-user error related to technical issues in the +// backend. In this case, contact Cloud Channel support. // // Return Value: // If successful, the CustomerRepricingConfig resources. The // data for each resource is displayed in the ascending order of: // -// customer ID +// customer ID // -// RepricingConfig.EntitlementGranularity.entitlement +// RepricingConfig.EntitlementGranularity.entitlement // -// RepricingConfig.effective_invoice_month +// RepricingConfig.effective_invoice_month // -// CustomerRepricingConfig.update_time +// CustomerRepricingConfig.update_time // // If unsuccessful, returns an error. func (c *CloudChannelClient) ListCustomerRepricingConfigs(ctx context.Context, req *channelpb.ListCustomerRepricingConfigsRequest, opts ...gax.CallOption) *CustomerRepricingConfigIterator { @@ -1472,34 +1472,34 @@ func (c *CloudChannelClient) ListCustomerRepricingConfigs(ctx context.Context, r // // The following restrictions are for creating configs in the current month. // -// This functionality is reserved for recovering from an erroneous config, -// and should not be used for regular business cases. +// This functionality is reserved for recovering from an erroneous config, +// and should not be used for regular business cases. // -// The new config will not modify exports used with other configs. -// Changes to the config may be immediate, but may take up to 24 hours. +// The new config will not modify exports used with other configs. +// Changes to the config may be immediate, but may take up to 24 hours. // -// There is a limit of ten configs for any -// RepricingConfig.EntitlementGranularity.entitlement -// or RepricingConfig.effective_invoice_month. +// There is a limit of ten configs for any +// RepricingConfig.EntitlementGranularity.entitlement +// or RepricingConfig.effective_invoice_month. // -// The contained CustomerRepricingConfig.repricing_config vaule must be -// different from the value used in the current config for a -// RepricingConfig.EntitlementGranularity.entitlement. +// The contained CustomerRepricingConfig.repricing_config vaule must be +// different from the value used in the current config for a +// RepricingConfig.EntitlementGranularity.entitlement. // // Possible Error Codes: // -// PERMISSION_DENIED: If the account making the request and the account -// being queried are different. +// PERMISSION_DENIED: If the account making the request and the account +// being queried are different. // -// INVALID_ARGUMENT: Missing or invalid required parameters in the -// request. Also displays if the updated config is for the current month or -// past months. +// INVALID_ARGUMENT: Missing or invalid required parameters in the +// request. Also displays if the updated config is for the current month or +// past months. // -// NOT_FOUND: The CustomerRepricingConfig specified does not exist or is -// not associated with the given account. +// NOT_FOUND: The CustomerRepricingConfig specified does not exist or is +// not associated with the given account. // -// INTERNAL: Any non-user error related to technical issues in the -// backend. In this case, contact Cloud Channel support. +// INTERNAL: Any non-user error related to technical issues in the +// backend. In this case, contact Cloud Channel support. // // Return Value: // If successful, the updated CustomerRepricingConfig resource, otherwise @@ -1520,22 +1520,22 @@ func (c *CloudChannelClient) CreateCustomerRepricingConfig(ctx context.Context, // // When updating a config in the future: // -// This config must already exist. +// This config must already exist. // // Possible Error Codes: // -// PERMISSION_DENIED: If the account making the request and the account -// being queried are different. +// PERMISSION_DENIED: If the account making the request and the account +// being queried are different. // -// INVALID_ARGUMENT: Missing or invalid required parameters in the -// request. Also displays if the updated config is for the current month or -// past months. +// INVALID_ARGUMENT: Missing or invalid required parameters in the +// request. Also displays if the updated config is for the current month or +// past months. // -// NOT_FOUND: The CustomerRepricingConfig specified does not exist or is -// not associated with the given account. +// NOT_FOUND: The CustomerRepricingConfig specified does not exist or is +// not associated with the given account. // -// INTERNAL: Any non-user error related to technical issues in the -// backend. In this case, contact Cloud Channel support. +// INTERNAL: Any non-user error related to technical issues in the +// backend. In this case, contact Cloud Channel support. // // Return Value: // If successful, the updated CustomerRepricingConfig resource, otherwise @@ -1550,16 +1550,16 @@ func (c *CloudChannelClient) UpdateCustomerRepricingConfig(ctx context.Context, // // Possible error codes: // -// PERMISSION_DENIED: The account making the request does not own -// this customer. +// PERMISSION_DENIED: The account making the request does not own +// this customer. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// FAILED_PRECONDITION: The CustomerRepricingConfig is active or in the -// past. +// FAILED_PRECONDITION: The CustomerRepricingConfig is active or in the +// past. // -// NOT_FOUND: No CustomerRepricingConfig found for the name in the -// request. +// NOT_FOUND: No CustomerRepricingConfig found for the name in the +// request. func (c *CloudChannelClient) DeleteCustomerRepricingConfig(ctx context.Context, req *channelpb.DeleteCustomerRepricingConfigRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteCustomerRepricingConfig(ctx, req, opts...) } @@ -1569,13 +1569,13 @@ func (c *CloudChannelClient) DeleteCustomerRepricingConfig(ctx context.Context, // // Possible Error Codes: // -// PERMISSION_DENIED: If the account making the request and the account -// being queried are different. +// PERMISSION_DENIED: If the account making the request and the account +// being queried are different. // -// NOT_FOUND: The ChannelPartnerRepricingConfig was not found. +// NOT_FOUND: The ChannelPartnerRepricingConfig was not found. // -// INTERNAL: Any non-user error related to technical issues in the -// backend. In this case, contact Cloud Channel support. +// INTERNAL: Any non-user error related to technical issues in the +// backend. In this case, contact Cloud Channel support. // // Return Value: // If successful, the ChannelPartnerRepricingConfig resource, otherwise @@ -1589,24 +1589,24 @@ func (c *CloudChannelClient) GetChannelPartnerRepricingConfig(ctx context.Contex // // Possible Error Codes: // -// PERMISSION_DENIED: If the account making the request and the account -// being queried are different. +// PERMISSION_DENIED: If the account making the request and the account +// being queried are different. // -// NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist -// or is not associated with the given account. +// NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist +// or is not associated with the given account. // -// INTERNAL: Any non-user error related to technical issues in the -// backend. In this case, contact Cloud Channel support. +// INTERNAL: Any non-user error related to technical issues in the +// backend. In this case, contact Cloud Channel support. // // Return Value: // If successful, the ChannelPartnerRepricingConfig resources. // The data for each resource is displayed in the ascending order of: // -// channel partner ID +// channel partner ID // -// RepricingConfig.effective_invoice_month +// RepricingConfig.effective_invoice_month // -// ChannelPartnerRepricingConfig.update_time +// ChannelPartnerRepricingConfig.update_time // // If unsuccessful, returns an error. func (c *CloudChannelClient) ListChannelPartnerRepricingConfigs(ctx context.Context, req *channelpb.ListChannelPartnerRepricingConfigsRequest, opts ...gax.CallOption) *ChannelPartnerRepricingConfigIterator { @@ -1625,33 +1625,33 @@ func (c *CloudChannelClient) ListChannelPartnerRepricingConfigs(ctx context.Cont // // The following restrictions are for creating configs in the current month. // -// This functionality is reserved for recovering from an erroneous config, -// and should not be used for regular business cases. +// This functionality is reserved for recovering from an erroneous config, +// and should not be used for regular business cases. // -// The new config will not modify exports used with other configs. -// Changes to the config may be immediate, but may take up to 24 hours. +// The new config will not modify exports used with other configs. +// Changes to the config may be immediate, but may take up to 24 hours. // -// There is a limit of ten configs for any ChannelPartner or -// RepricingConfig.effective_invoice_month. +// There is a limit of ten configs for any ChannelPartner or +// RepricingConfig.effective_invoice_month. // -// The contained ChannelPartnerRepricingConfig.repricing_config vaule -// must be different from the value used in the current config for a -// ChannelPartner. +// The contained ChannelPartnerRepricingConfig.repricing_config vaule +// must be different from the value used in the current config for a +// ChannelPartner. // // Possible Error Codes: // -// PERMISSION_DENIED: If the account making the request and the account -// being queried are different. +// PERMISSION_DENIED: If the account making the request and the account +// being queried are different. // -// INVALID_ARGUMENT: Missing or invalid required parameters in the -// request. Also displays if the updated config is for the current month or -// past months. +// INVALID_ARGUMENT: Missing or invalid required parameters in the +// request. Also displays if the updated config is for the current month or +// past months. // -// NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist -// or is not associated with the given account. +// NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist +// or is not associated with the given account. // -// INTERNAL: Any non-user error related to technical issues in the -// backend. In this case, contact Cloud Channel support. +// INTERNAL: Any non-user error related to technical issues in the +// backend. In this case, contact Cloud Channel support. // // Return Value: // If successful, the updated ChannelPartnerRepricingConfig resource, @@ -1672,22 +1672,22 @@ func (c *CloudChannelClient) CreateChannelPartnerRepricingConfig(ctx context.Con // // When updating a config in the future: // -// This config must already exist. +// This config must already exist. // // Possible Error Codes: // -// PERMISSION_DENIED: If the account making the request and the account -// being queried are different. +// PERMISSION_DENIED: If the account making the request and the account +// being queried are different. // -// INVALID_ARGUMENT: Missing or invalid required parameters in the -// request. Also displays if the updated config is for the current month or -// past months. +// INVALID_ARGUMENT: Missing or invalid required parameters in the +// request. Also displays if the updated config is for the current month or +// past months. // -// NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist -// or is not associated with the given account. +// NOT_FOUND: The ChannelPartnerRepricingConfig specified does not exist +// or is not associated with the given account. // -// INTERNAL: Any non-user error related to technical issues in the -// backend. In this case, contact Cloud Channel support. +// INTERNAL: Any non-user error related to technical issues in the +// backend. In this case, contact Cloud Channel support. // // Return Value: // If successful, the updated ChannelPartnerRepricingConfig resource, @@ -1702,16 +1702,16 @@ func (c *CloudChannelClient) UpdateChannelPartnerRepricingConfig(ctx context.Con // // Possible error codes: // -// PERMISSION_DENIED: The account making the request does not own -// this customer. +// PERMISSION_DENIED: The account making the request does not own +// this customer. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// FAILED_PRECONDITION: The ChannelPartnerRepricingConfig is active or -// in the past. +// FAILED_PRECONDITION: The ChannelPartnerRepricingConfig is active or +// in the past. // -// NOT_FOUND: No ChannelPartnerRepricingConfig found for the name in the -// request. +// NOT_FOUND: No ChannelPartnerRepricingConfig found for the name in the +// request. func (c *CloudChannelClient) DeleteChannelPartnerRepricingConfig(ctx context.Context, req *channelpb.DeleteChannelPartnerRepricingConfigRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteChannelPartnerRepricingConfig(ctx, req, opts...) } @@ -1720,11 +1720,11 @@ func (c *CloudChannelClient) DeleteChannelPartnerRepricingConfig(ctx context.Con // // Possible error codes: // -// PERMISSION_DENIED: The entitlement doesn’t belong to the reseller. +// PERMISSION_DENIED: The entitlement doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: Entitlement or offer was not found. +// NOT_FOUND: Entitlement or offer was not found. // // Return value: // The Offer resource. @@ -1736,7 +1736,7 @@ func (c *CloudChannelClient) LookupOffer(ctx context.Context, req *channelpb.Loo // // Possible error codes: // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. func (c *CloudChannelClient) ListProducts(ctx context.Context, req *channelpb.ListProductsRequest, opts ...gax.CallOption) *ProductIterator { return c.internalClient.ListProducts(ctx, req, opts...) } @@ -1745,7 +1745,7 @@ func (c *CloudChannelClient) ListProducts(ctx context.Context, req *channelpb.Li // // Possible error codes: // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. func (c *CloudChannelClient) ListSkus(ctx context.Context, req *channelpb.ListSkusRequest, opts ...gax.CallOption) *SkuIterator { return c.internalClient.ListSkus(ctx, req, opts...) } @@ -1754,37 +1754,37 @@ func (c *CloudChannelClient) ListSkus(ctx context.Context, req *channelpb.ListSk // // Possible error codes: // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. func (c *CloudChannelClient) ListOffers(ctx context.Context, req *channelpb.ListOffersRequest, opts ...gax.CallOption) *OfferIterator { return c.internalClient.ListOffers(ctx, req, opts...) } // ListPurchasableSkus lists the following: // -// SKUs that you can purchase for a customer +// SKUs that you can purchase for a customer // -// SKUs that you can upgrade or downgrade for an entitlement. +// SKUs that you can upgrade or downgrade for an entitlement. // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller. +// PERMISSION_DENIED: The customer doesn’t belong to the reseller. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. func (c *CloudChannelClient) ListPurchasableSkus(ctx context.Context, req *channelpb.ListPurchasableSkusRequest, opts ...gax.CallOption) *PurchasableSkuIterator { return c.internalClient.ListPurchasableSkus(ctx, req, opts...) } // ListPurchasableOffers lists the following: // -// Offers that you can purchase for a customer. +// Offers that you can purchase for a customer. // -// Offers that you can change for an entitlement. +// Offers that you can change for an entitlement. // // Possible error codes: // -// PERMISSION_DENIED: The customer doesn’t belong to the reseller +// PERMISSION_DENIED: The customer doesn’t belong to the reseller // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. func (c *CloudChannelClient) ListPurchasableOffers(ctx context.Context, req *channelpb.ListPurchasableOffersRequest, opts ...gax.CallOption) *PurchasableOfferIterator { return c.internalClient.ListPurchasableOffers(ctx, req, opts...) } @@ -1795,17 +1795,17 @@ func (c *CloudChannelClient) ListPurchasableOffers(ctx context.Context, req *cha // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request and the -// provided reseller account are different, or the impersonated user -// is not a super admin. +// PERMISSION_DENIED: The reseller account making the request and the +// provided reseller account are different, or the impersonated user +// is not a super admin. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The topic name with the registered service email address. @@ -1820,19 +1820,19 @@ func (c *CloudChannelClient) RegisterSubscriber(ctx context.Context, req *channe // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request and the -// provided reseller account are different, or the impersonated user -// is not a super admin. +// PERMISSION_DENIED: The reseller account making the request and the +// provided reseller account are different, or the impersonated user +// is not a super admin. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: The topic resource doesn’t exist. +// NOT_FOUND: The topic resource doesn’t exist. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // The topic name that unregistered the service email address. @@ -1847,19 +1847,19 @@ func (c *CloudChannelClient) UnregisterSubscriber(ctx context.Context, req *chan // // Possible error codes: // -// PERMISSION_DENIED: The reseller account making the request and the -// provided reseller account are different, or the impersonated user -// is not a super admin. +// PERMISSION_DENIED: The reseller account making the request and the +// provided reseller account are different, or the impersonated user +// is not a super admin. // -// INVALID_ARGUMENT: Required request parameters are missing or invalid. +// INVALID_ARGUMENT: Required request parameters are missing or invalid. // -// NOT_FOUND: The topic resource doesn’t exist. +// NOT_FOUND: The topic resource doesn’t exist. // -// INTERNAL: Any non-user error related to a technical issue in the -// backend. Contact Cloud Channel support. +// INTERNAL: Any non-user error related to a technical issue in the +// backend. Contact Cloud Channel support. // -// UNKNOWN: Any non-user error related to a technical issue in the backend. -// Contact Cloud Channel support. +// UNKNOWN: Any non-user error related to a technical issue in the backend. +// Contact Cloud Channel support. // // Return value: // A list of service email addresses. @@ -1931,15 +1931,15 @@ type cloudChannelGRPCClient struct { // // CloudChannelService exposes the following resources: // -// Customers: An entity—usually an enterprise—managed by a reseller or -// distributor. +// Customers: An entity—usually an enterprise—managed by a reseller or +// distributor. // -// Entitlements: An entity that provides a customer with the means to use -// a service. Entitlements are created or updated as a result of a successful -// fulfillment. +// Entitlements: An entity that provides a customer with the means to use +// a service. Entitlements are created or updated as a result of a successful +// fulfillment. // -// ChannelPartnerLinks: An entity that identifies links between -// distributors and their indirect resellers in a channel. +// ChannelPartnerLinks: An entity that identifies links between +// distributors and their indirect resellers in a channel. func NewCloudChannelClient(ctx context.Context, opts ...option.ClientOption) (*CloudChannelClient, error) { clientOpts := defaultCloudChannelGRPCClientOptions() if newCloudChannelClientHook != nil { diff --git a/channel/apiv1/doc.go b/channel/apiv1/doc.go index 13dd8796248..dd24d024ef0 100644 --- a/channel/apiv1/doc.go +++ b/channel/apiv1/doc.go @@ -21,49 +21,50 @@ // unified resale platform and APIs across all of Google Cloud including GCP, // Workspace, Maps and Chrome. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := channel.NewCloudChannelClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := channel.NewCloudChannelClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := channel.NewCloudChannelClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &channelpb.ListCustomersRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/channel/v1#ListCustomersRequest. -// } -// it := c.ListCustomers(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := channel.NewCloudChannelClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &channelpb.ListCustomersRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/channel/v1#ListCustomersRequest. +// } +// it := c.ListCustomers(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/civil/civil.go b/civil/civil.go index 5329c2a9dbb..454deab4af1 100644 --- a/civil/civil.go +++ b/civil/civil.go @@ -66,9 +66,13 @@ func (d Date) IsValid() bool { // // In is always consistent with time.Date, even when time.Date returns a time // on a different day. For example, if loc is America/Indiana/Vincennes, then both -// time.Date(1955, time.May, 1, 0, 0, 0, 0, loc) +// +// time.Date(1955, time.May, 1, 0, 0, 0, 0, loc) +// // and -// civil.Date{Year: 1955, Month: time.May, Day: 1}.In(loc) +// +// civil.Date{Year: 1955, Month: time.May, Day: 1}.In(loc) +// // return 23:00:00 on April 30, 1955. // // In panics if loc is nil. @@ -242,7 +246,9 @@ func DateTimeOf(t time.Time) DateTime { // ParseDateTime accepts a variant of the RFC3339 date-time format that omits // the time offset but includes an optional fractional time, as described in // ParseTime. Informally, the accepted format is -// YYYY-MM-DDTHH:MM:SS[.FFFFFFFFF] +// +// YYYY-MM-DDTHH:MM:SS[.FFFFFFFFF] +// // where the 'T' may be a lower-case 't'. func ParseDateTime(s string) (DateTime, error) { t, err := time.Parse("2006-01-02T15:04:05.999999999", s) @@ -270,11 +276,15 @@ func (dt DateTime) IsValid() bool { // If the time is missing or ambigous at the location, In returns the same // result as time.Date. For example, if loc is America/Indiana/Vincennes, then // both -// time.Date(1955, time.May, 1, 0, 30, 0, 0, loc) +// +// time.Date(1955, time.May, 1, 0, 30, 0, 0, loc) +// // and -// civil.DateTime{ -// civil.Date{Year: 1955, Month: time.May, Day: 1}}, -// civil.Time{Minute: 30}}.In(loc) +// +// civil.DateTime{ +// civil.Date{Year: 1955, Month: time.May, Day: 1}}, +// civil.Time{Minute: 30}}.In(loc) +// // return 23:30:00 on April 30, 1955. // // In panics if loc is nil. diff --git a/cloudbuild/apiv1/cloud_build_client.go b/cloudbuild/apiv1/cloud_build_client.go index 79e4b689d3d..be3414a8c7c 100644 --- a/cloudbuild/apiv1/cloud_build_client.go +++ b/cloudbuild/apiv1/cloud_build_client.go @@ -387,28 +387,28 @@ func (c *Client) RunBuildTrigger(ctx context.Context, req *cloudbuildpb.RunBuild // // For triggered builds: // -// Triggered builds resolve to a precise revision; therefore a retry of a -// triggered build will result in a build that uses the same revision. +// Triggered builds resolve to a precise revision; therefore a retry of a +// triggered build will result in a build that uses the same revision. // // For non-triggered builds that specify RepoSource: // -// If the original build built from the tip of a branch, the retried build -// will build from the tip of that branch, which may not be the same revision -// as the original build. +// If the original build built from the tip of a branch, the retried build +// will build from the tip of that branch, which may not be the same revision +// as the original build. // -// If the original build specified a commit sha or revision ID, the retried -// build will use the identical source. +// If the original build specified a commit sha or revision ID, the retried +// build will use the identical source. // // For builds that specify StorageSource: // -// If the original build pulled source from Google Cloud Storage without -// specifying the generation of the object, the new build will use the current -// object, which may be different from the original build source. +// If the original build pulled source from Google Cloud Storage without +// specifying the generation of the object, the new build will use the current +// object, which may be different from the original build source. // -// If the original build pulled source from Cloud Storage and specified the -// generation of the object, the new build will attempt to use the same -// object, which may or may not be available depending on the bucket's -// lifecycle management settings. +// If the original build pulled source from Cloud Storage and specified the +// generation of the object, the new build will attempt to use the same +// object, which may or may not be available depending on the bucket's +// lifecycle management settings. func (c *Client) RetryBuild(ctx context.Context, req *cloudbuildpb.RetryBuildRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { ctx = insertMetadata(ctx, c.xGoogMetadata) opts = append(c.CallOptions.RetryBuild[0:len(c.CallOptions.RetryBuild):len(c.CallOptions.RetryBuild)], opts...) diff --git a/cloudbuild/apiv1/doc.go b/cloudbuild/apiv1/doc.go index 881ef7c2a40..1e9c2502c42 100644 --- a/cloudbuild/apiv1/doc.go +++ b/cloudbuild/apiv1/doc.go @@ -17,10 +17,9 @@ // Package cloudbuild is an auto-generated package for the // Cloud Build API. -// // Creates and manages builds on Google Cloud Platform. // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/cloudbuild/apiv1/v2/cloud_build_client.go b/cloudbuild/apiv1/v2/cloud_build_client.go index b6b7dc3ba15..870537e5c7c 100644 --- a/cloudbuild/apiv1/v2/cloud_build_client.go +++ b/cloudbuild/apiv1/v2/cloud_build_client.go @@ -295,28 +295,28 @@ func (c *Client) CancelBuild(ctx context.Context, req *cloudbuildpb.CancelBuildR // // For triggered builds: // -// Triggered builds resolve to a precise revision; therefore a retry of a -// triggered build will result in a build that uses the same revision. +// Triggered builds resolve to a precise revision; therefore a retry of a +// triggered build will result in a build that uses the same revision. // // For non-triggered builds that specify RepoSource: // -// If the original build built from the tip of a branch, the retried build -// will build from the tip of that branch, which may not be the same revision -// as the original build. +// If the original build built from the tip of a branch, the retried build +// will build from the tip of that branch, which may not be the same revision +// as the original build. // -// If the original build specified a commit sha or revision ID, the retried -// build will use the identical source. +// If the original build specified a commit sha or revision ID, the retried +// build will use the identical source. // // For builds that specify StorageSource: // -// If the original build pulled source from Google Cloud Storage without -// specifying the generation of the object, the new build will use the current -// object, which may be different from the original build source. +// If the original build pulled source from Google Cloud Storage without +// specifying the generation of the object, the new build will use the current +// object, which may be different from the original build source. // -// If the original build pulled source from Cloud Storage and specified the -// generation of the object, the new build will attempt to use the same -// object, which may or may not be available depending on the bucket’s -// lifecycle management settings. +// If the original build pulled source from Cloud Storage and specified the +// generation of the object, the new build will attempt to use the same +// object, which may or may not be available depending on the bucket’s +// lifecycle management settings. func (c *Client) RetryBuild(ctx context.Context, req *cloudbuildpb.RetryBuildRequest, opts ...gax.CallOption) (*RetryBuildOperation, error) { return c.internalClient.RetryBuild(ctx, req, opts...) } diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go index 8cbd0adb59c..73483a39f0b 100644 --- a/cloudbuild/apiv1/v2/doc.go +++ b/cloudbuild/apiv1/v2/doc.go @@ -19,48 +19,49 @@ // // Creates and manages builds on Google Cloud Platform. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := cloudbuild.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := cloudbuild.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := cloudbuild.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &cloudbuildpb.CreateBuildRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/cloudbuild/v1#CreateBuildRequest. -// } -// op, err := c.CreateBuild(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := cloudbuild.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &cloudbuildpb.CreateBuildRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/cloudbuild/v1#CreateBuildRequest. +// } +// op, err := c.CreateBuild(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/clouddms/apiv1/doc.go b/clouddms/apiv1/doc.go index 208ca891c26..049295b40cb 100644 --- a/clouddms/apiv1/doc.go +++ b/clouddms/apiv1/doc.go @@ -20,49 +20,50 @@ // Manage Cloud Database Migration Service resources on Google Cloud // Platform. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := clouddms.NewDataMigrationClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := clouddms.NewDataMigrationClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := clouddms.NewDataMigrationClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &clouddmspb.ListMigrationJobsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/clouddms/v1#ListMigrationJobsRequest. -// } -// it := c.ListMigrationJobs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := clouddms.NewDataMigrationClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &clouddmspb.ListMigrationJobsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/clouddms/v1#ListMigrationJobsRequest. +// } +// it := c.ListMigrationJobs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/cloudtasks/apiv2/cloud_tasks_client.go b/cloudtasks/apiv2/cloud_tasks_client.go index a6dee9ce9c6..448382002c8 100644 --- a/cloudtasks/apiv2/cloud_tasks_client.go +++ b/cloudtasks/apiv2/cloud_tasks_client.go @@ -347,7 +347,7 @@ func (c *Client) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueReques // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.getIamPolicy +// cloudtasks.queues.getIamPolicy func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.GetIamPolicy(ctx, req, opts...) } @@ -362,7 +362,7 @@ func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyReques // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.setIamPolicy +// cloudtasks.queues.setIamPolicy func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.SetIamPolicy(ctx, req, opts...) } @@ -400,7 +400,7 @@ func (c *Client) GetTask(ctx context.Context, req *taskspb.GetTaskRequest, opts // // Tasks cannot be updated after creation; there is no UpdateTask command. // -// The maximum task size is 100KB. +// The maximum task size is 100KB. func (c *Client) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { return c.internalClient.CreateTask(ctx, req, opts...) } diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go index ca538c15ba9..6dc2c6182be 100644 --- a/cloudtasks/apiv2/doc.go +++ b/cloudtasks/apiv2/doc.go @@ -19,49 +19,50 @@ // // Manages the execution of large numbers of distributed requests. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := cloudtasks.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := cloudtasks.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := cloudtasks.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &taskspb.ListQueuesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/tasks/v2#ListQueuesRequest. -// } -// it := c.ListQueues(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := cloudtasks.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &taskspb.ListQueuesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/tasks/v2#ListQueuesRequest. +// } +// it := c.ListQueues(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/cloudtasks/apiv2beta2/cloud_tasks_client.go b/cloudtasks/apiv2beta2/cloud_tasks_client.go index 2b032b1c777..483cb2162df 100644 --- a/cloudtasks/apiv2beta2/cloud_tasks_client.go +++ b/cloudtasks/apiv2beta2/cloud_tasks_client.go @@ -470,7 +470,7 @@ func (c *Client) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueReques // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.getIamPolicy +// cloudtasks.queues.getIamPolicy func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.GetIamPolicy(ctx, req, opts...) } @@ -485,7 +485,7 @@ func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyReques // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.setIamPolicy +// cloudtasks.queues.setIamPolicy func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.SetIamPolicy(ctx, req, opts...) } @@ -523,10 +523,10 @@ func (c *Client) GetTask(ctx context.Context, req *taskspb.GetTaskRequest, opts // // Tasks cannot be updated after creation; there is no UpdateTask command. // -// For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum task size is -// 100KB. +// For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum task size is +// 100KB. // -// For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum task size is 1MB. +// For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum task size is 1MB. func (c *Client) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { return c.internalClient.CreateTask(ctx, req, opts...) } @@ -1819,7 +1819,7 @@ func (c *restClient) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueRe // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.getIamPolicy +// cloudtasks.queues.getIamPolicy func (c *restClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -1888,7 +1888,7 @@ func (c *restClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRe // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.setIamPolicy +// cloudtasks.queues.setIamPolicy func (c *restClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -2174,10 +2174,10 @@ func (c *restClient) GetTask(ctx context.Context, req *taskspb.GetTaskRequest, o // // Tasks cannot be updated after creation; there is no UpdateTask command. // -// For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum task size is -// 100KB. +// For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum task size is +// 100KB. // -// For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum task size is 1MB. +// For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum task size is 1MB. func (c *restClient) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go index 9c7d920d1d8..6e4da137a42 100644 --- a/cloudtasks/apiv2beta2/doc.go +++ b/cloudtasks/apiv2beta2/doc.go @@ -19,51 +19,52 @@ // // Manages the execution of large numbers of distributed requests. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := cloudtasks.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := cloudtasks.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := cloudtasks.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &taskspb.ListQueuesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/tasks/v2beta2#ListQueuesRequest. -// } -// it := c.ListQueues(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := cloudtasks.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &taskspb.ListQueuesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/tasks/v2beta2#ListQueuesRequest. +// } +// it := c.ListQueues(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/cloudtasks/apiv2beta3/cloud_tasks_client.go b/cloudtasks/apiv2beta3/cloud_tasks_client.go index 6994c0c7543..8bea31b5944 100644 --- a/cloudtasks/apiv2beta3/cloud_tasks_client.go +++ b/cloudtasks/apiv2beta3/cloud_tasks_client.go @@ -454,7 +454,7 @@ func (c *Client) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueReques // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.getIamPolicy +// cloudtasks.queues.getIamPolicy func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.GetIamPolicy(ctx, req, opts...) } @@ -469,7 +469,7 @@ func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyReques // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.setIamPolicy +// cloudtasks.queues.setIamPolicy func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.SetIamPolicy(ctx, req, opts...) } @@ -507,7 +507,7 @@ func (c *Client) GetTask(ctx context.Context, req *taskspb.GetTaskRequest, opts // // Tasks cannot be updated after creation; there is no UpdateTask command. // -// The maximum task size is 100KB. +// The maximum task size is 100KB. func (c *Client) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { return c.internalClient.CreateTask(ctx, req, opts...) } @@ -1651,7 +1651,7 @@ func (c *restClient) ResumeQueue(ctx context.Context, req *taskspb.ResumeQueueRe // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.getIamPolicy +// cloudtasks.queues.getIamPolicy func (c *restClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -1720,7 +1720,7 @@ func (c *restClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRe // Google IAM (at https://cloud.google.com/iam) permission on the specified // resource parent: // -// cloudtasks.queues.setIamPolicy +// cloudtasks.queues.setIamPolicy func (c *restClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -2006,7 +2006,7 @@ func (c *restClient) GetTask(ctx context.Context, req *taskspb.GetTaskRequest, o // // Tasks cannot be updated after creation; there is no UpdateTask command. // -// The maximum task size is 100KB. +// The maximum task size is 100KB. func (c *restClient) CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest, opts ...gax.CallOption) (*taskspb.Task, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go index 67a93a5de3e..5cb3c7d49e9 100644 --- a/cloudtasks/apiv2beta3/doc.go +++ b/cloudtasks/apiv2beta3/doc.go @@ -19,51 +19,52 @@ // // Manages the execution of large numbers of distributed requests. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := cloudtasks.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := cloudtasks.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := cloudtasks.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &taskspb.ListQueuesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/tasks/v2beta3#ListQueuesRequest. -// } -// it := c.ListQueues(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := cloudtasks.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &taskspb.ListQueuesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/tasks/v2beta3#ListQueuesRequest. +// } +// it := c.ListQueues(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/cmd/go-cloud-debug-agent/internal/debug/dwarf/entry.go b/cmd/go-cloud-debug-agent/internal/debug/dwarf/entry.go index fc24c4cb881..302ecd3afdb 100644 --- a/cmd/go-cloud-debug-agent/internal/debug/dwarf/entry.go +++ b/cmd/go-cloud-debug-agent/internal/debug/dwarf/entry.go @@ -122,8 +122,8 @@ type Field struct { // // A common idiom is to merge the check for nil return with // the check that the value has the expected dynamic type, as in: -// v, ok := e.Val(AttrSibling).(int64); // +// v, ok := e.Val(AttrSibling).(int64); func (e *Entry) Val(a Attr) interface{} { for _, f := range e.Field { if f.Attr == a { @@ -280,7 +280,7 @@ func (b *buf) entry(atab abbrevTable, ubase Offset) *Entry { return e } -// A Reader allows reading Entry structures from a DWARF ``info'' section. +// A Reader allows reading Entry structures from a DWARF “info” section. // The Entry structures are arranged in a tree. The Reader's Next function // return successive entries from a pre-order traversal of the tree. // If an entry has children, its Children field will be true, and the children @@ -295,7 +295,7 @@ type Reader struct { } // Reader returns a new Reader for Data. -// The reader is positioned at byte offset 0 in the DWARF ``info'' section. +// The reader is positioned at byte offset 0 in the DWARF “info” section. func (d *Data) Reader() *Reader { r := &Reader{d: d} r.Seek(0) diff --git a/cmd/go-cloud-debug-agent/internal/debug/dwarf/type.go b/cmd/go-cloud-debug-agent/internal/debug/dwarf/type.go index c63b2b0f51b..d6534ae10fe 100644 --- a/cmd/go-cloud-debug-agent/internal/debug/dwarf/type.go +++ b/cmd/go-cloud-debug-agent/internal/debug/dwarf/type.go @@ -352,7 +352,7 @@ type typeReader interface { AddressSize() int } -// Type reads the type at off in the DWARF ``info'' section. +// Type reads the type at off in the DWARF “info” section. func (d *Data) Type(off Offset) (Type, error) { return d.readType("info", d.Reader(), off, d.typeCache) } diff --git a/cmd/go-cloud-debug-agent/internal/debug/server/eval.go b/cmd/go-cloud-debug-agent/internal/debug/server/eval.go index 1d0ead28771..874ba0d79a3 100644 --- a/cmd/go-cloud-debug-agent/internal/debug/server/eval.go +++ b/cmd/go-cloud-debug-agent/internal/debug/server/eval.go @@ -206,6 +206,7 @@ func (e *evaluator) setNode(node ast.Node) (old ast.Node) { // err saves an error that occurred during evaluation. // It returns a zero result, so that functions can exit and set an error with +// // return e.err(...) func (e *evaluator) err(s string) result { if e.evalError != nil { diff --git a/compute/apiv1/accelerator_types_client.go b/compute/apiv1/accelerator_types_client.go index 6681aca5787..708ed42e26d 100644 --- a/compute/apiv1/accelerator_types_client.go +++ b/compute/apiv1/accelerator_types_client.go @@ -68,7 +68,7 @@ type internalAcceleratorTypesClient interface { // AcceleratorTypesClient is a client for interacting with Google Compute Engine API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Services +// # Services // // The AcceleratorTypes API. type AcceleratorTypesClient struct { @@ -133,7 +133,7 @@ type acceleratorTypesRESTClient struct { // NewAcceleratorTypesRESTClient creates a new accelerator types rest client. // -// Services +// # Services // // The AcceleratorTypes API. func NewAcceleratorTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (*AcceleratorTypesClient, error) { diff --git a/compute/apiv1/doc.go b/compute/apiv1/doc.go index 75ef1bd0ba9..5b4704a95ff 100644 --- a/compute/apiv1/doc.go +++ b/compute/apiv1/doc.go @@ -17,49 +17,50 @@ // Package compute is an auto-generated package for the // Google Compute Engine API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := compute.NewAcceleratorTypesClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := compute.NewAcceleratorTypesClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := compute.NewAcceleratorTypesRESTClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := compute.NewAcceleratorTypesRESTClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &computepb.AggregatedListAcceleratorTypesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#AggregatedListAcceleratorTypesRequest. -// } -// it := c.AggregatedList(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } +// req := &computepb.AggregatedListAcceleratorTypesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/compute/v1#AggregatedListAcceleratorTypesRequest. +// } +// it := c.AggregatedList(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/contactcenterinsights/apiv1/doc.go b/contactcenterinsights/apiv1/doc.go index 1acec889988..4a9cd23d0ea 100644 --- a/contactcenterinsights/apiv1/doc.go +++ b/contactcenterinsights/apiv1/doc.go @@ -17,43 +17,44 @@ // Package contactcenterinsights is an auto-generated package for the // Contact Center AI Insights API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := contactcenterinsights.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := contactcenterinsights.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := contactcenterinsights.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := contactcenterinsights.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &contactcenterinsightspb.CreateConversationRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1#CreateConversationRequest. -// } -// resp, err := c.CreateConversation(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &contactcenterinsightspb.CreateConversationRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1#CreateConversationRequest. +// } +// resp, err := c.CreateConversation(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/container/apiv1/doc.go b/container/apiv1/doc.go index 6086f3969d8..7d6106b5dea 100644 --- a/container/apiv1/doc.go +++ b/container/apiv1/doc.go @@ -20,43 +20,44 @@ // Builds and manages container-based applications, powered by the open // source Kubernetes technology. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := container.NewClusterManagerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := container.NewClusterManagerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := container.NewClusterManagerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &containerpb.ListClustersRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/container/v1#ListClustersRequest. -// } -// resp, err := c.ListClusters(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := container.NewClusterManagerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &containerpb.ListClustersRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/container/v1#ListClustersRequest. +// } +// resp, err := c.ListClusters(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/containeranalysis/apiv1/doc.go b/containeranalysis/apiv1/doc.go index ec58aae665b..9fff15ed725 100644 --- a/containeranalysis/apiv1/doc.go +++ b/containeranalysis/apiv1/doc.go @@ -17,12 +17,12 @@ // Package containeranalysis is an auto-generated package for the // Container Analysis API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // // An implementation of the Grafeas API, which stores, and enables querying // and retrieval of critical metadata about all of your software artifacts. // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/containeranalysis/apiv1beta1/doc.go b/containeranalysis/apiv1beta1/doc.go index be02efa7540..fc7538e38c0 100644 --- a/containeranalysis/apiv1beta1/doc.go +++ b/containeranalysis/apiv1beta1/doc.go @@ -20,45 +20,46 @@ // An implementation of the Grafeas API, which stores, and enables querying // and retrieval of critical metadata about all of your software artifacts. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &grafeaspb.GetOccurrenceRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#GetOccurrenceRequest. -// } -// resp, err := c.GetOccurrence(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := containeranalysis.NewGrafeasV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &grafeaspb.GetOccurrenceRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#GetOccurrenceRequest. +// } +// resp, err := c.GetOccurrence(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/datacatalog/apiv1/data_catalog_client.go b/datacatalog/apiv1/data_catalog_client.go index b4779de6d6d..bdc89fe7dc1 100644 --- a/datacatalog/apiv1/data_catalog_client.go +++ b/datacatalog/apiv1/data_catalog_client.go @@ -306,11 +306,11 @@ func (c *Client) SearchCatalog(ctx context.Context, req *datacatalogpb.SearchCat // Data Catalog automatically creates entry groups with names that start with // the @ symbol for the following resources: // -// BigQuery entries (@bigquery) +// BigQuery entries (@bigquery) // -// Pub/Sub topics (@pubsub) +// Pub/Sub topics (@pubsub) // -// Dataproc Metastore services (@dataproc_metastore_{SERVICE_NAME_HASH}) +// Dataproc Metastore services (@dataproc_metastore_{SERVICE_NAME_HASH}) // // You can create your own entry groups for Cloud Storage fileset entries // and custom entries together with the corresponding IAM policies. @@ -523,11 +523,11 @@ func (c *Client) DeleteTagTemplateField(ctx context.Context, req *datacatalogpb. // CreateTag creates a tag and assigns it to: // -// An Entry if the method name is -// projects.locations.entryGroups.entries.tags.create. +// An Entry if the method name is +// projects.locations.entryGroups.entries.tags.create. // -// Or EntryGroupif the method -// name is projects.locations.entryGroups.tags.create. +// Or EntryGroupif the method +// name is projects.locations.entryGroups.tags.create. // // Note: The project identified by the parent parameter for the [tag] // (https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters (at https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries.tags/create#path-parameters)) @@ -572,9 +572,9 @@ func (c *Client) UnstarEntry(ctx context.Context, req *datacatalogpb.UnstarEntry // // Supported resources are: // -// Tag templates +// Tag templates // -// Entry groups +// Entry groups // // Note: This method sets policies only within Data Catalog and can’t be // used to manage policies in BigQuery, Pub/Sub, Dataproc Metastore, and any @@ -582,10 +582,10 @@ func (c *Client) UnstarEntry(ctx context.Context, req *datacatalogpb.UnstarEntry // // To call this method, you must have the following Google IAM permissions: // -// datacatalog.tagTemplates.setIamPolicy to set policies on tag -// templates. +// datacatalog.tagTemplates.setIamPolicy to set policies on tag +// templates. // -// datacatalog.entryGroups.setIamPolicy to set policies on entry groups. +// datacatalog.entryGroups.setIamPolicy to set policies on entry groups. func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.SetIamPolicy(ctx, req, opts...) } @@ -594,26 +594,26 @@ func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyReques // // May return: // -// ANOT_FOUND error if the resource doesn’t exist or you don’t have the -// permission to view it. +// ANOT_FOUND error if the resource doesn’t exist or you don’t have the +// permission to view it. // -// An empty policy if the resource exists but doesn’t have a set policy. +// An empty policy if the resource exists but doesn’t have a set policy. // // Supported resources are: // -// Tag templates +// Tag templates // -// Entry groups +// Entry groups // // Note: This method doesn’t get policies from Google Cloud Platform // resources ingested into Data Catalog. // // To call this method, you must have the following Google IAM permissions: // -// datacatalog.tagTemplates.getIamPolicy to get policies on tag -// templates. +// datacatalog.tagTemplates.getIamPolicy to get policies on tag +// templates. // -// datacatalog.entryGroups.getIamPolicy to get policies on entry groups. +// datacatalog.entryGroups.getIamPolicy to get policies on entry groups. func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.GetIamPolicy(ctx, req, opts...) } @@ -624,9 +624,9 @@ func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyReques // // Supported resources are: // -// Tag templates +// Tag templates // -// Entry groups +// Entry groups // // Note: This method gets policies only within Data Catalog and can’t be // used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any diff --git a/datacatalog/apiv1/doc.go b/datacatalog/apiv1/doc.go index a472c99bbb9..0dfca9cc8c8 100644 --- a/datacatalog/apiv1/doc.go +++ b/datacatalog/apiv1/doc.go @@ -20,49 +20,50 @@ // A fully managed and highly scalable data discovery and metadata management // service. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := datacatalog.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := datacatalog.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := datacatalog.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &datacatalogpb.SearchCatalogRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datacatalog/v1#SearchCatalogRequest. -// } -// it := c.SearchCatalog(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := datacatalog.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &datacatalogpb.SearchCatalogRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datacatalog/v1#SearchCatalogRequest. +// } +// it := c.SearchCatalog(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/datacatalog/apiv1/policy_tag_manager_client.go b/datacatalog/apiv1/policy_tag_manager_client.go index bec7c6bb5c5..4854a28bad9 100644 --- a/datacatalog/apiv1/policy_tag_manager_client.go +++ b/datacatalog/apiv1/policy_tag_manager_client.go @@ -181,12 +181,12 @@ func (c *PolicyTagManagerClient) CreatePolicyTag(ctx context.Context, req *datac // DeletePolicyTag deletes a policy tag together with the following: // -// All of its descendant policy tags, if any +// All of its descendant policy tags, if any // -// Policies associated with the policy tag and its descendants +// Policies associated with the policy tag and its descendants // -// References from BigQuery table schema of the policy tag and its -// descendants +// References from BigQuery table schema of the policy tag and its +// descendants func (c *PolicyTagManagerClient) DeletePolicyTag(ctx context.Context, req *datacatalogpb.DeletePolicyTagRequest, opts ...gax.CallOption) error { return c.internalClient.DeletePolicyTag(ctx, req, opts...) } diff --git a/datacatalog/apiv1/policy_tag_manager_serialization_client.go b/datacatalog/apiv1/policy_tag_manager_serialization_client.go index 13a906cbfe4..45b624fba1c 100644 --- a/datacatalog/apiv1/policy_tag_manager_serialization_client.go +++ b/datacatalog/apiv1/policy_tag_manager_serialization_client.go @@ -116,13 +116,13 @@ func (c *PolicyTagManagerSerializationClient) Connection() *grpc.ClientConn { // // This operation automatically does the following: // -// Deletes the existing policy tags that are missing from the -// SerializedPolicyTag. +// Deletes the existing policy tags that are missing from the +// SerializedPolicyTag. // -// Creates policy tags that don’t have resource names. They are considered -// new. +// Creates policy tags that don’t have resource names. They are considered +// new. // -// Updates policy tags with valid resources names accordingly. +// Updates policy tags with valid resources names accordingly. func (c *PolicyTagManagerSerializationClient) ReplaceTaxonomy(ctx context.Context, req *datacatalogpb.ReplaceTaxonomyRequest, opts ...gax.CallOption) (*datacatalogpb.Taxonomy, error) { return c.internalClient.ReplaceTaxonomy(ctx, req, opts...) } diff --git a/datacatalog/apiv1beta1/data_catalog_client.go b/datacatalog/apiv1beta1/data_catalog_client.go index ae5702e901a..c8d89614375 100644 --- a/datacatalog/apiv1beta1/data_catalog_client.go +++ b/datacatalog/apiv1beta1/data_catalog_client.go @@ -501,22 +501,22 @@ func (c *Client) ListTags(ctx context.Context, req *datacatalogpb.ListTagsReques // policy. // Supported resources are: // -// Tag templates. +// Tag templates. // -// Entries. +// Entries. // -// Entry groups. -// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub -// and any external Google Cloud Platform resources synced to Data Catalog. +// Entry groups. +// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub +// and any external Google Cloud Platform resources synced to Data Catalog. // // Callers must have following Google IAM permission // -// datacatalog.tagTemplates.setIamPolicy to set policies on tag -// templates. +// datacatalog.tagTemplates.setIamPolicy to set policies on tag +// templates. // -// datacatalog.entries.setIamPolicy to set policies on entries. +// datacatalog.entries.setIamPolicy to set policies on entries. // -// datacatalog.entryGroups.setIamPolicy to set policies on entry groups. +// datacatalog.entryGroups.setIamPolicy to set policies on entry groups. func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.SetIamPolicy(ctx, req, opts...) } @@ -527,22 +527,22 @@ func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyReques // // Supported resources are: // -// Tag templates. +// Tag templates. // -// Entries. +// Entries. // -// Entry groups. -// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub -// and any external Google Cloud Platform resources synced to Data Catalog. +// Entry groups. +// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub +// and any external Google Cloud Platform resources synced to Data Catalog. // // Callers must have following Google IAM permission // -// datacatalog.tagTemplates.getIamPolicy to get policies on tag -// templates. +// datacatalog.tagTemplates.getIamPolicy to get policies on tag +// templates. // -// datacatalog.entries.getIamPolicy to get policies on entries. +// datacatalog.entries.getIamPolicy to get policies on entries. // -// datacatalog.entryGroups.getIamPolicy to get policies on entry groups. +// datacatalog.entryGroups.getIamPolicy to get policies on entry groups. func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.GetIamPolicy(ctx, req, opts...) } @@ -553,13 +553,13 @@ func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyReques // // Supported resources are: // -// Tag templates. +// Tag templates. // -// Entries. +// Entries. // -// Entry groups. -// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub -// and any external Google Cloud Platform resources synced to Data Catalog. +// Entry groups. +// Note, this method cannot be used to manage policies for BigQuery, Pub/Sub +// and any external Google Cloud Platform resources synced to Data Catalog. // // A caller is not required to have Google IAM permission to make this // request. diff --git a/datacatalog/apiv1beta1/doc.go b/datacatalog/apiv1beta1/doc.go index e99ec7ec73b..9379470788f 100644 --- a/datacatalog/apiv1beta1/doc.go +++ b/datacatalog/apiv1beta1/doc.go @@ -20,51 +20,52 @@ // A fully managed and highly scalable data discovery and metadata management // service. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := datacatalog.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := datacatalog.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := datacatalog.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &datacatalogpb.SearchCatalogRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1#SearchCatalogRequest. -// } -// it := c.SearchCatalog(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := datacatalog.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &datacatalogpb.SearchCatalogRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1#SearchCatalogRequest. +// } +// it := c.SearchCatalog(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dataflow/apiv1beta3/doc.go b/dataflow/apiv1beta3/doc.go index 3895a70c8bc..bb9b35fd7b6 100644 --- a/dataflow/apiv1beta3/doc.go +++ b/dataflow/apiv1beta3/doc.go @@ -19,45 +19,46 @@ // // Manages Google Cloud Dataflow projects on Google Cloud Platform. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dataflowpb.GetSnapshotRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/dataflow/v1beta3#GetSnapshotRequest. -// } -// resp, err := c.GetSnapshot(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := dataflow.NewSnapshotsV1Beta3Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dataflowpb.GetSnapshotRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/dataflow/v1beta3#GetSnapshotRequest. +// } +// resp, err := c.GetSnapshot(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dataform/apiv1alpha2/doc.go b/dataform/apiv1alpha2/doc.go index 5b8c125d38e..917fd4d4f44 100644 --- a/dataform/apiv1alpha2/doc.go +++ b/dataform/apiv1alpha2/doc.go @@ -17,51 +17,52 @@ // Package dataform is an auto-generated package for the // Dataform API. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dataform.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dataform.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dataform.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dataformpb.ListRepositoriesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataform/v1alpha2#ListRepositoriesRequest. -// } -// it := c.ListRepositories(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := dataform.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dataformpb.ListRepositoriesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataform/v1alpha2#ListRepositoriesRequest. +// } +// it := c.ListRepositories(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/datafusion/apiv1/doc.go b/datafusion/apiv1/doc.go index ccf67f769d1..5cbacb2dbd1 100644 --- a/datafusion/apiv1/doc.go +++ b/datafusion/apiv1/doc.go @@ -25,49 +25,50 @@ // prepare, blend, transfer and transform data without having to wrestle with // infrastructure. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := datafusion.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := datafusion.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := datafusion.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &datafusionpb.ListAvailableVersionsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datafusion/v1#ListAvailableVersionsRequest. -// } -// it := c.ListAvailableVersions(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := datafusion.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &datafusionpb.ListAvailableVersionsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datafusion/v1#ListAvailableVersionsRequest. +// } +// it := c.ListAvailableVersions(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/datalabeling/apiv1beta1/doc.go b/datalabeling/apiv1beta1/doc.go index 25b40c7bcb3..2ab5f6defd4 100644 --- a/datalabeling/apiv1beta1/doc.go +++ b/datalabeling/apiv1beta1/doc.go @@ -19,45 +19,46 @@ // // Public API for Google Cloud AI Data Labeling Service. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := datalabeling.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := datalabeling.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := datalabeling.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &datalabelingpb.CreateDatasetRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#CreateDatasetRequest. -// } -// resp, err := c.CreateDataset(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := datalabeling.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &datalabelingpb.CreateDatasetRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#CreateDatasetRequest. +// } +// resp, err := c.CreateDataset(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dataplex/apiv1/doc.go b/dataplex/apiv1/doc.go index 638a504ab78..e892c0bb07a 100644 --- a/dataplex/apiv1/doc.go +++ b/dataplex/apiv1/doc.go @@ -19,43 +19,44 @@ // // Dataplex API is used to manage the lifecycle of data lakes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dataplex.NewContentClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dataplex.NewContentClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dataplex.NewContentClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dataplexpb.CreateContentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataplex/v1#CreateContentRequest. -// } -// resp, err := c.CreateContent(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := dataplex.NewContentClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dataplexpb.CreateContentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataplex/v1#CreateContentRequest. +// } +// resp, err := c.CreateContent(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go index 720f8e14f60..c74251cf129 100644 --- a/dataproc/apiv1/doc.go +++ b/dataproc/apiv1/doc.go @@ -19,43 +19,44 @@ // // Manages Hadoop-based clusters and jobs on Google Cloud Platform. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dataproc.NewAutoscalingPolicyClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dataproc.NewAutoscalingPolicyClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dataproc.NewAutoscalingPolicyClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dataprocpb.CreateAutoscalingPolicyRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#CreateAutoscalingPolicyRequest. -// } -// resp, err := c.CreateAutoscalingPolicy(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := dataproc.NewAutoscalingPolicyClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dataprocpb.CreateAutoscalingPolicyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataproc/v1#CreateAutoscalingPolicyRequest. +// } +// resp, err := c.CreateAutoscalingPolicy(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dataqna/apiv1alpha/doc.go b/dataqna/apiv1alpha/doc.go index 7b90fbc5d95..23912ad78f0 100644 --- a/dataqna/apiv1alpha/doc.go +++ b/dataqna/apiv1alpha/doc.go @@ -20,45 +20,46 @@ // Data QnA is a natural language question and answer service for BigQuery // data. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dataqna.NewAutoSuggestionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dataqna.NewAutoSuggestionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dataqna.NewAutoSuggestionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dataqnapb.SuggestQueriesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha#SuggestQueriesRequest. -// } -// resp, err := c.SuggestQueries(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := dataqna.NewAutoSuggestionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dataqnapb.SuggestQueriesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha#SuggestQueriesRequest. +// } +// resp, err := c.SuggestQueries(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/datastore/admin/apiv1/datastore_admin_client.go b/datastore/admin/apiv1/datastore_admin_client.go index 9acf8cb0ab9..cce47f01a93 100644 --- a/datastore/admin/apiv1/datastore_admin_client.go +++ b/datastore/admin/apiv1/datastore_admin_client.go @@ -127,7 +127,7 @@ type internalDatastoreAdminClient interface { // DatastoreAdminClient is a client for interacting with Cloud Datastore API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Google Cloud Datastore Admin API +// # Google Cloud Datastore Admin API // // The Datastore Admin API provides several admin services for Cloud Datastore. // @@ -349,7 +349,7 @@ type datastoreAdminGRPCClient struct { // NewDatastoreAdminClient creates a new datastore admin client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Google Cloud Datastore Admin API +// # Google Cloud Datastore Admin API // // The Datastore Admin API provides several admin services for Cloud Datastore. // diff --git a/datastore/admin/apiv1/doc.go b/datastore/admin/apiv1/doc.go index d687f2834de..661108f0511 100644 --- a/datastore/admin/apiv1/doc.go +++ b/datastore/admin/apiv1/doc.go @@ -20,50 +20,51 @@ // Accesses the schemaless NoSQL database to provide fully managed, robust, // scalable storage for your application. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := admin.NewDatastoreAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := admin.NewDatastoreAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := admin.NewDatastoreAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &adminpb.ExportEntitiesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/datastore/admin/v1#ExportEntitiesRequest. -// } -// op, err := c.ExportEntities(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := admin.NewDatastoreAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &adminpb.ExportEntitiesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/datastore/admin/v1#ExportEntitiesRequest. +// } +// op, err := c.ExportEntities(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/datastore/doc.go b/datastore/doc.go index d11046cfcfa..453fb8106f2 100644 --- a/datastore/doc.go +++ b/datastore/doc.go @@ -18,8 +18,7 @@ Package datastore provides a client for Google Cloud Datastore. See https://godoc.org/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package. - -Basic Operations +# Basic Operations Entities are the unit of storage and are associated with a key. A key consists of an optional parent key, a string application ID, a string kind @@ -95,8 +94,7 @@ NewUpsert and NewDelete and applies them. Datastore.Mutate uses non-transactional mode; if atomicity is required, use Transaction.Mutate instead. - -Properties +# Properties An entity's contents can be represented by a variety of types. These are typically struct pointers, but can also be any type that implements the @@ -164,8 +162,7 @@ Example code: J int `datastore:",noindex" json:"j"` } - -Slice Fields +# Slice Fields A field of slice type corresponds to a Datastore array property, except for []byte, which corresponds to a Datastore blob. @@ -177,14 +174,14 @@ the slice field remains unchanged. If a non-array value is loaded into a slice field, the result will be a slice with one element, containing the value. -Loading Nulls +# Loading Nulls Loading a Datastore Null into a basic type (int, float, etc.) results in a zero value. Loading a Null into a slice of basic type results in a slice of size 1 containing the zero value. Loading a Null into a pointer field results in nil. Loading a Null into a field of struct type is an error. -Pointer Fields +# Pointer Fields A struct field can be a pointer to a signed integer, floating-point number, string or bool. Putting a non-nil pointer will store its dereferenced value. Putting a nil @@ -194,8 +191,7 @@ in which case no property will be stored. Loading a Null into a pointer field sets the pointer to nil. Loading any other value allocates new storage with the value, and sets the field to point to it. - -Key Field +# Key Field If the struct contains a *datastore.Key field tagged with the name "__key__", its value will be ignored on Put. When reading the Entity back into the Go struct, @@ -233,9 +229,7 @@ Example code: // Prints {12 /Entity,stringID} } - - -Structured Properties +# Structured Properties If the struct pointed to contains other structs, then the nested or embedded structs are themselves saved as Entity values. For example, given these definitions: @@ -326,8 +320,7 @@ Note that the "flatten" option cannot be used for Entity value fields or PropertyLoadSaver implementers. The server will reject any dotted field names for an Entity value. - -The PropertyLoadSaver Interface +# The PropertyLoadSaver Interface An entity's contents can also be represented by any type that implements the PropertyLoadSaver interface. This type may be a struct pointer, but it does @@ -377,7 +370,7 @@ Example code: The *PropertyList type implements PropertyLoadSaver, and can therefore hold an arbitrary entity's contents. -The KeyLoader Interface +# The KeyLoader Interface If a type implements the PropertyLoadSaver interface, it may also want to implement the KeyLoader interface. @@ -411,8 +404,7 @@ Example code: To load a Key into a struct which does not implement the PropertyLoadSaver interface, see the "Key Field" section above. - -Queries +# Queries Queries retrieve entities based on their properties or key's ancestry. Running a query yields an iterator of results: either keys or (key, entity) pairs. @@ -462,8 +454,7 @@ Example code: } } - -Transactions +# Transactions Client.RunInTransaction runs a function in a transaction. @@ -499,7 +490,7 @@ Example code: Pass the ReadOnly option to RunInTransaction if your transaction is used only for Get, GetMulti or queries. Read-only transactions are more efficient. -Google Cloud Datastore Emulator +# Google Cloud Datastore Emulator This package supports the Cloud Datastore emulator, which is useful for testing and development. Environment variables are used to indicate that datastore traffic should be diff --git a/datastore/query.go b/datastore/query.go index c2ed359eeaf..196fd11aa9e 100644 --- a/datastore/query.go +++ b/datastore/query.go @@ -521,7 +521,7 @@ func (c *Client) Count(ctx context.Context, q *Query) (n int, err error) { // The keys returned by GetAll will be in a 1-1 correspondence with the entities // added to dst. // -// If q is a ``keys-only'' query, GetAll ignores dst and only returns the keys. +// If q is a “keys-only” query, GetAll ignores dst and only returns the keys. // // The running time and number of API calls made by GetAll scale linearly with // with the sum of the query's offset and limit. Unless the result count is diff --git a/datastream/apiv1/doc.go b/datastream/apiv1/doc.go index e27d6146039..544acbea19c 100644 --- a/datastream/apiv1/doc.go +++ b/datastream/apiv1/doc.go @@ -17,49 +17,50 @@ // Package datastream is an auto-generated package for the // Datastream API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := datastream.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := datastream.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := datastream.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := datastream.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &datastreampb.ListConnectionProfilesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1#ListConnectionProfilesRequest. -// } -// it := c.ListConnectionProfiles(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } +// req := &datastreampb.ListConnectionProfilesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1#ListConnectionProfilesRequest. +// } +// it := c.ListConnectionProfiles(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/datastream/apiv1alpha1/doc.go b/datastream/apiv1alpha1/doc.go index 374a068a1ee..fe220280076 100644 --- a/datastream/apiv1alpha1/doc.go +++ b/datastream/apiv1alpha1/doc.go @@ -17,51 +17,52 @@ // Package datastream is an auto-generated package for the // Datastream API. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := datastream.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := datastream.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := datastream.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &datastreampb.ListConnectionProfilesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1#ListConnectionProfilesRequest. -// } -// it := c.ListConnectionProfiles(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := datastream.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &datastreampb.ListConnectionProfilesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1#ListConnectionProfilesRequest. +// } +// it := c.ListConnectionProfiles(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go index 15cbd53792a..e524d0b23de 100644 --- a/debugger/apiv2/doc.go +++ b/debugger/apiv2/doc.go @@ -20,43 +20,44 @@ // Examines the call stack and variables of a running application without // stopping or slowing it down. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := debugger.NewController2Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := debugger.NewController2Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := debugger.NewController2Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &clouddebuggerpb.RegisterDebuggeeRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouddebugger/v2#RegisterDebuggeeRequest. -// } -// resp, err := c.RegisterDebuggee(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := debugger.NewController2Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &clouddebuggerpb.RegisterDebuggeeRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouddebugger/v2#RegisterDebuggeeRequest. +// } +// resp, err := c.RegisterDebuggee(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/deploy/apiv1/doc.go b/deploy/apiv1/doc.go index f366a6bf8ef..a623b455703 100644 --- a/deploy/apiv1/doc.go +++ b/deploy/apiv1/doc.go @@ -17,49 +17,50 @@ // Package deploy is an auto-generated package for the // Google Cloud Deploy API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := deploy.NewCloudDeployClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := deploy.NewCloudDeployClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := deploy.NewCloudDeployClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := deploy.NewCloudDeployClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &deploypb.ListDeliveryPipelinesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/deploy/v1#ListDeliveryPipelinesRequest. -// } -// it := c.ListDeliveryPipelines(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } +// req := &deploypb.ListDeliveryPipelinesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/deploy/v1#ListDeliveryPipelinesRequest. +// } +// it := c.ListDeliveryPipelines(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dialogflow/apiv2/agents_client.go b/dialogflow/apiv2/agents_client.go index 9fbabbbbc71..9f063beb1e1 100644 --- a/dialogflow/apiv2/agents_client.go +++ b/dialogflow/apiv2/agents_client.go @@ -281,11 +281,11 @@ func (c *AgentsClient) SearchAgents(ctx context.Context, req *dialogflowpb.Searc // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train an agent prior to sending it queries. See the // training @@ -306,10 +306,10 @@ func (c *AgentsClient) TrainAgentOperation(name string) *TrainAgentOperation { // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ExportAgentResponse +// response: ExportAgentResponse func (c *AgentsClient) ExportAgent(ctx context.Context, req *dialogflowpb.ExportAgentRequest, opts ...gax.CallOption) (*ExportAgentOperation, error) { return c.internalClient.ExportAgent(ctx, req, opts...) } @@ -334,11 +334,11 @@ func (c *AgentsClient) ExportAgentOperation(name string) *ExportAgentOperation { // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // The operation only tracks when importing is complete, not when it is done // training. @@ -369,11 +369,11 @@ func (c *AgentsClient) ImportAgentOperation(name string) *ImportAgentOperation { // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // The operation only tracks when restoring is complete, not when it is done // training. diff --git a/dialogflow/apiv2/conversation_datasets_client.go b/dialogflow/apiv2/conversation_datasets_client.go index 276e7f1ebef..8540b6332bd 100644 --- a/dialogflow/apiv2/conversation_datasets_client.go +++ b/dialogflow/apiv2/conversation_datasets_client.go @@ -200,9 +200,9 @@ func (c *ConversationDatasetsClient) Connection() *grpc.ClientConn { // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: CreateConversationDatasetOperationMetadata +// metadata: CreateConversationDatasetOperationMetadata // -// response: ConversationDataset +// response: ConversationDataset func (c *ConversationDatasetsClient) CreateConversationDataset(ctx context.Context, req *dialogflowpb.CreateConversationDatasetRequest, opts ...gax.CallOption) (*CreateConversationDatasetOperation, error) { return c.internalClient.CreateConversationDataset(ctx, req, opts...) } @@ -230,10 +230,10 @@ func (c *ConversationDatasetsClient) ListConversationDatasets(ctx context.Contex // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: DeleteConversationDatasetOperationMetadata +// metadata: DeleteConversationDatasetOperationMetadata // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) func (c *ConversationDatasetsClient) DeleteConversationDataset(ctx context.Context, req *dialogflowpb.DeleteConversationDatasetRequest, opts ...gax.CallOption) (*DeleteConversationDatasetOperation, error) { return c.internalClient.DeleteConversationDataset(ctx, req, opts...) } @@ -252,9 +252,9 @@ func (c *ConversationDatasetsClient) DeleteConversationDatasetOperation(name str // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: ImportConversationDataOperationMetadata +// metadata: ImportConversationDataOperationMetadata // -// response: ImportConversationDataOperationResponse +// response: ImportConversationDataOperationResponse func (c *ConversationDatasetsClient) ImportConversationData(ctx context.Context, req *dialogflowpb.ImportConversationDataRequest, opts ...gax.CallOption) (*ImportConversationDataOperation, error) { return c.internalClient.ImportConversationData(ctx, req, opts...) } diff --git a/dialogflow/apiv2/conversation_models_client.go b/dialogflow/apiv2/conversation_models_client.go index ded82187658..6a499b45931 100644 --- a/dialogflow/apiv2/conversation_models_client.go +++ b/dialogflow/apiv2/conversation_models_client.go @@ -251,9 +251,9 @@ func (c *ConversationModelsClient) Connection() *grpc.ClientConn { // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: CreateConversationModelOperationMetadata +// metadata: CreateConversationModelOperationMetadata // -// response: ConversationModel +// response: ConversationModel func (c *ConversationModelsClient) CreateConversationModel(ctx context.Context, req *dialogflowpb.CreateConversationModelRequest, opts ...gax.CallOption) (*CreateConversationModelOperation, error) { return c.internalClient.CreateConversationModel(ctx, req, opts...) } @@ -280,10 +280,10 @@ func (c *ConversationModelsClient) ListConversationModels(ctx context.Context, r // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: DeleteConversationModelOperationMetadata +// metadata: DeleteConversationModelOperationMetadata // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) func (c *ConversationModelsClient) DeleteConversationModel(ctx context.Context, req *dialogflowpb.DeleteConversationModelRequest, opts ...gax.CallOption) (*DeleteConversationModelOperation, error) { return c.internalClient.DeleteConversationModel(ctx, req, opts...) } @@ -303,10 +303,10 @@ func (c *ConversationModelsClient) DeleteConversationModelOperation(name string) // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: DeployConversationModelOperationMetadata +// metadata: DeployConversationModelOperationMetadata // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) func (c *ConversationModelsClient) DeployConversationModel(ctx context.Context, req *dialogflowpb.DeployConversationModelRequest, opts ...gax.CallOption) (*DeployConversationModelOperation, error) { return c.internalClient.DeployConversationModel(ctx, req, opts...) } @@ -320,17 +320,17 @@ func (c *ConversationModelsClient) DeployConversationModelOperation(name string) // UndeployConversationModel undeploys a model. If the model is not deployed this method has no effect. // If the model is currently being used: // -// For article suggestion, article suggestion will fallback to the default -// model if model is undeployed. +// For article suggestion, article suggestion will fallback to the default +// model if model is undeployed. // // This method is a long-running // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: UndeployConversationModelOperationMetadata +// metadata: UndeployConversationModelOperationMetadata // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) func (c *ConversationModelsClient) UndeployConversationModel(ctx context.Context, req *dialogflowpb.UndeployConversationModelRequest, opts ...gax.CallOption) (*UndeployConversationModelOperation, error) { return c.internalClient.UndeployConversationModel(ctx, req, opts...) } diff --git a/dialogflow/apiv2/conversation_profiles_client.go b/dialogflow/apiv2/conversation_profiles_client.go index ffb2bc07512..ed092f8a8ed 100644 --- a/dialogflow/apiv2/conversation_profiles_client.go +++ b/dialogflow/apiv2/conversation_profiles_client.go @@ -258,9 +258,9 @@ func (c *ConversationProfilesClient) DeleteConversationProfile(ctx context.Conte // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: SetSuggestionFeatureConfigOperationMetadata +// metadata: SetSuggestionFeatureConfigOperationMetadata // -// response: ConversationProfile +// response: ConversationProfile // // If a long running operation to add or update suggestion feature // config for the same conversation profile, participant role and suggestion @@ -283,9 +283,9 @@ func (c *ConversationProfilesClient) SetSuggestionFeatureConfigOperation(name st // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: ClearSuggestionFeatureConfigOperationMetadata +// metadata: ClearSuggestionFeatureConfigOperationMetadata // -// response: ConversationProfile +// response: ConversationProfile func (c *ConversationProfilesClient) ClearSuggestionFeatureConfig(ctx context.Context, req *dialogflowpb.ClearSuggestionFeatureConfigRequest, opts ...gax.CallOption) (*ClearSuggestionFeatureConfigOperation, error) { return c.internalClient.ClearSuggestionFeatureConfig(ctx, req, opts...) } diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go index f3f9d84fbb3..ecb4b747cb5 100644 --- a/dialogflow/apiv2/doc.go +++ b/dialogflow/apiv2/doc.go @@ -20,43 +20,44 @@ // Builds conversational interfaces (for example, chatbots, and voice-powered // apps and devices). // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dialogflow.NewAgentsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dialogflow.NewAgentsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dialogflow.NewAgentsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dialogflowpb.GetAgentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/v2#GetAgentRequest. -// } -// resp, err := c.GetAgent(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := dialogflow.NewAgentsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dialogflowpb.GetAgentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/v2#GetAgentRequest. +// } +// resp, err := c.GetAgent(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dialogflow/apiv2/documents_client.go b/dialogflow/apiv2/documents_client.go index 63057a7b3df..6f546d292a1 100644 --- a/dialogflow/apiv2/documents_client.go +++ b/dialogflow/apiv2/documents_client.go @@ -249,9 +249,9 @@ func (c *DocumentsClient) GetDocument(ctx context.Context, req *dialogflowpb.Get // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: KnowledgeOperationMetadata +// metadata: KnowledgeOperationMetadata // -// response: Document +// response: Document func (c *DocumentsClient) CreateDocument(ctx context.Context, req *dialogflowpb.CreateDocumentRequest, opts ...gax.CallOption) (*CreateDocumentOperation, error) { return c.internalClient.CreateDocument(ctx, req, opts...) } @@ -270,9 +270,9 @@ func (c *DocumentsClient) CreateDocumentOperation(name string) *CreateDocumentOp // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: KnowledgeOperationMetadata +// metadata: KnowledgeOperationMetadata // -// response: ImportDocumentsResponse +// response: ImportDocumentsResponse func (c *DocumentsClient) ImportDocuments(ctx context.Context, req *dialogflowpb.ImportDocumentsRequest, opts ...gax.CallOption) (*ImportDocumentsOperation, error) { return c.internalClient.ImportDocuments(ctx, req, opts...) } @@ -289,10 +289,10 @@ func (c *DocumentsClient) ImportDocumentsOperation(name string) *ImportDocuments // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: KnowledgeOperationMetadata +// metadata: KnowledgeOperationMetadata // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) func (c *DocumentsClient) DeleteDocument(ctx context.Context, req *dialogflowpb.DeleteDocumentRequest, opts ...gax.CallOption) (*DeleteDocumentOperation, error) { return c.internalClient.DeleteDocument(ctx, req, opts...) } @@ -309,9 +309,9 @@ func (c *DocumentsClient) DeleteDocumentOperation(name string) *DeleteDocumentOp // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: KnowledgeOperationMetadata +// metadata: KnowledgeOperationMetadata // -// response: Document +// response: Document func (c *DocumentsClient) UpdateDocument(ctx context.Context, req *dialogflowpb.UpdateDocumentRequest, opts ...gax.CallOption) (*UpdateDocumentOperation, error) { return c.internalClient.UpdateDocument(ctx, req, opts...) } @@ -331,9 +331,9 @@ func (c *DocumentsClient) UpdateDocumentOperation(name string) *UpdateDocumentOp // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: KnowledgeOperationMetadata +// metadata: KnowledgeOperationMetadata // -// response: Document +// response: Document // // Note: The projects.agent.knowledgeBases.documents resource is deprecated; // only use projects.knowledgeBases.documents. @@ -354,9 +354,9 @@ func (c *DocumentsClient) ReloadDocumentOperation(name string) *ReloadDocumentOp // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: KnowledgeOperationMetadata +// metadata: KnowledgeOperationMetadata // -// response: Document +// response: Document func (c *DocumentsClient) ExportDocument(ctx context.Context, req *dialogflowpb.ExportDocumentRequest, opts ...gax.CallOption) (*ExportDocumentOperation, error) { return c.internalClient.ExportDocument(ctx, req, opts...) } diff --git a/dialogflow/apiv2/entity_types_client.go b/dialogflow/apiv2/entity_types_client.go index 9844f7be20c..f70f401dec8 100644 --- a/dialogflow/apiv2/entity_types_client.go +++ b/dialogflow/apiv2/entity_types_client.go @@ -302,10 +302,10 @@ func (c *EntityTypesClient) DeleteEntityType(ctx context.Context, req *dialogflo // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: BatchUpdateEntityTypesResponse +// response: BatchUpdateEntityTypesResponse // // Note: You should always train an agent prior to sending it queries. See the // training @@ -326,11 +326,11 @@ func (c *EntityTypesClient) BatchUpdateEntityTypesOperation(name string) *BatchU // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train an agent prior to sending it queries. See the // training @@ -351,11 +351,11 @@ func (c *EntityTypesClient) BatchDeleteEntityTypesOperation(name string) *BatchD // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train an agent prior to sending it queries. See the // training @@ -378,11 +378,11 @@ func (c *EntityTypesClient) BatchCreateEntitiesOperation(name string) *BatchCrea // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train an agent prior to sending it queries. See the // training @@ -403,11 +403,11 @@ func (c *EntityTypesClient) BatchUpdateEntitiesOperation(name string) *BatchUpda // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train an agent prior to sending it queries. See the // training diff --git a/dialogflow/apiv2/intents_client.go b/dialogflow/apiv2/intents_client.go index da9e57efbfa..89a88b73422 100644 --- a/dialogflow/apiv2/intents_client.go +++ b/dialogflow/apiv2/intents_client.go @@ -260,10 +260,10 @@ func (c *IntentsClient) DeleteIntent(ctx context.Context, req *dialogflowpb.Dele // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: BatchUpdateIntentsResponse +// response: BatchUpdateIntentsResponse // // Note: You should always train an agent prior to sending it queries. See the // training @@ -284,11 +284,11 @@ func (c *IntentsClient) BatchUpdateIntentsOperation(name string) *BatchUpdateInt // operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train an agent prior to sending it queries. See the // training diff --git a/dialogflow/cx/apiv3/agents_client.go b/dialogflow/cx/apiv3/agents_client.go index 72e76988510..d646bdbea4d 100644 --- a/dialogflow/cx/apiv3/agents_client.go +++ b/dialogflow/cx/apiv3/agents_client.go @@ -282,10 +282,10 @@ func (c *AgentsClient) DeleteAgent(ctx context.Context, req *cxpb.DeleteAgentReq // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ExportAgentResponse +// response: ExportAgentResponse func (c *AgentsClient) ExportAgent(ctx context.Context, req *cxpb.ExportAgentRequest, opts ...gax.CallOption) (*ExportAgentOperation, error) { return c.internalClient.ExportAgent(ctx, req, opts...) } @@ -305,11 +305,11 @@ func (c *AgentsClient) ExportAgentOperation(name string) *ExportAgentOperation { // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train flows prior to sending them queries. See the // training diff --git a/dialogflow/cx/apiv3/doc.go b/dialogflow/cx/apiv3/doc.go index 4cb0f40db7f..45707f2b720 100644 --- a/dialogflow/cx/apiv3/doc.go +++ b/dialogflow/cx/apiv3/doc.go @@ -20,49 +20,50 @@ // Builds conversational interfaces (for example, chatbots, and voice-powered // apps and devices). // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := cx.NewPagesClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := cx.NewPagesClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := cx.NewPagesClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &cxpb.ListPagesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#ListPagesRequest. -// } -// it := c.ListPages(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := cx.NewPagesClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &cxpb.ListPagesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#ListPagesRequest. +// } +// it := c.ListPages(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dialogflow/cx/apiv3/environments_client.go b/dialogflow/cx/apiv3/environments_client.go index 654d4b62146..304ba47a3fa 100644 --- a/dialogflow/cx/apiv3/environments_client.go +++ b/dialogflow/cx/apiv3/environments_client.go @@ -261,10 +261,10 @@ func (c *EnvironmentsClient) GetEnvironment(ctx context.Context, req *cxpb.GetEn // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: Environment +// response: Environment func (c *EnvironmentsClient) CreateEnvironment(ctx context.Context, req *cxpb.CreateEnvironmentRequest, opts ...gax.CallOption) (*CreateEnvironmentOperation, error) { return c.internalClient.CreateEnvironment(ctx, req, opts...) } @@ -281,10 +281,10 @@ func (c *EnvironmentsClient) CreateEnvironmentOperation(name string) *CreateEnvi // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: Environment +// response: Environment func (c *EnvironmentsClient) UpdateEnvironment(ctx context.Context, req *cxpb.UpdateEnvironmentRequest, opts ...gax.CallOption) (*UpdateEnvironmentOperation, error) { return c.internalClient.UpdateEnvironment(ctx, req, opts...) } @@ -311,9 +311,9 @@ func (c *EnvironmentsClient) LookupEnvironmentHistory(ctx context.Context, req * // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: RunContinuousTestMetadata +// metadata: RunContinuousTestMetadata // -// response: RunContinuousTestResponse +// response: RunContinuousTestResponse func (c *EnvironmentsClient) RunContinuousTest(ctx context.Context, req *cxpb.RunContinuousTestRequest, opts ...gax.CallOption) (*RunContinuousTestOperation, error) { return c.internalClient.RunContinuousTest(ctx, req, opts...) } @@ -335,9 +335,9 @@ func (c *EnvironmentsClient) ListContinuousTestResults(ctx context.Context, req // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: DeployFlowMetadata +// metadata: DeployFlowMetadata // -// response: DeployFlowResponse +// response: DeployFlowResponse func (c *EnvironmentsClient) DeployFlow(ctx context.Context, req *cxpb.DeployFlowRequest, opts ...gax.CallOption) (*DeployFlowOperation, error) { return c.internalClient.DeployFlow(ctx, req, opts...) } diff --git a/dialogflow/cx/apiv3/flows_client.go b/dialogflow/cx/apiv3/flows_client.go index 1397c066b12..ee10fc0362e 100644 --- a/dialogflow/cx/apiv3/flows_client.go +++ b/dialogflow/cx/apiv3/flows_client.go @@ -297,11 +297,11 @@ func (c *FlowsClient) UpdateFlow(ctx context.Context, req *cxpb.UpdateFlowReques // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train a flow prior to sending it queries. See the // training @@ -335,10 +335,10 @@ func (c *FlowsClient) GetFlowValidationResult(ctx context.Context, req *cxpb.Get // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ImportFlowResponse +// response: ImportFlowResponse // // Note: You should always train a flow prior to sending it queries. See the // training @@ -359,10 +359,10 @@ func (c *FlowsClient) ImportFlowOperation(name string) *ImportFlowOperation { // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ExportFlowResponse +// response: ExportFlowResponse // // Note that resources (e.g. intents, entities, webhooks) that the flow // references will also be exported. diff --git a/dialogflow/cx/apiv3/test_cases_client.go b/dialogflow/cx/apiv3/test_cases_client.go index a3de964d017..62d1449a69b 100644 --- a/dialogflow/cx/apiv3/test_cases_client.go +++ b/dialogflow/cx/apiv3/test_cases_client.go @@ -315,9 +315,9 @@ func (c *TestCasesClient) UpdateTestCase(ctx context.Context, req *cxpb.UpdateTe // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: RunTestCaseMetadata +// metadata: RunTestCaseMetadata // -// response: RunTestCaseResponse +// response: RunTestCaseResponse func (c *TestCasesClient) RunTestCase(ctx context.Context, req *cxpb.RunTestCaseRequest, opts ...gax.CallOption) (*RunTestCaseOperation, error) { return c.internalClient.RunTestCase(ctx, req, opts...) } @@ -334,9 +334,9 @@ func (c *TestCasesClient) RunTestCaseOperation(name string) *RunTestCaseOperatio // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: BatchRunTestCasesMetadata +// metadata: BatchRunTestCasesMetadata // -// response: BatchRunTestCasesResponse +// response: BatchRunTestCasesResponse func (c *TestCasesClient) BatchRunTestCases(ctx context.Context, req *cxpb.BatchRunTestCasesRequest, opts ...gax.CallOption) (*BatchRunTestCasesOperation, error) { return c.internalClient.BatchRunTestCases(ctx, req, opts...) } @@ -360,9 +360,9 @@ func (c *TestCasesClient) CalculateCoverage(ctx context.Context, req *cxpb.Calcu // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: ImportTestCasesMetadata +// metadata: ImportTestCasesMetadata // -// response: ImportTestCasesResponse +// response: ImportTestCasesResponse func (c *TestCasesClient) ImportTestCases(ctx context.Context, req *cxpb.ImportTestCasesRequest, opts ...gax.CallOption) (*ImportTestCasesOperation, error) { return c.internalClient.ImportTestCases(ctx, req, opts...) } @@ -380,9 +380,9 @@ func (c *TestCasesClient) ImportTestCasesOperation(name string) *ImportTestCases // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: ExportTestCasesMetadata +// metadata: ExportTestCasesMetadata // -// response: ExportTestCasesResponse +// response: ExportTestCasesResponse func (c *TestCasesClient) ExportTestCases(ctx context.Context, req *cxpb.ExportTestCasesRequest, opts ...gax.CallOption) (*ExportTestCasesOperation, error) { return c.internalClient.ExportTestCases(ctx, req, opts...) } diff --git a/dialogflow/cx/apiv3/versions_client.go b/dialogflow/cx/apiv3/versions_client.go index 305ddd38a9f..ef99cead08b 100644 --- a/dialogflow/cx/apiv3/versions_client.go +++ b/dialogflow/cx/apiv3/versions_client.go @@ -233,9 +233,9 @@ func (c *VersionsClient) GetVersion(ctx context.Context, req *cxpb.GetVersionReq // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: CreateVersionOperationMetadata +// metadata: CreateVersionOperationMetadata // -// response: Version +// response: Version func (c *VersionsClient) CreateVersion(ctx context.Context, req *cxpb.CreateVersionRequest, opts ...gax.CallOption) (*CreateVersionOperation, error) { return c.internalClient.CreateVersion(ctx, req, opts...) } @@ -262,11 +262,11 @@ func (c *VersionsClient) DeleteVersion(ctx context.Context, req *cxpb.DeleteVers // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) func (c *VersionsClient) LoadVersion(ctx context.Context, req *cxpb.LoadVersionRequest, opts ...gax.CallOption) (*LoadVersionOperation, error) { return c.internalClient.LoadVersion(ctx, req, opts...) } diff --git a/dialogflow/cx/apiv3beta1/agents_client.go b/dialogflow/cx/apiv3beta1/agents_client.go index aacd2a56d24..e2646f64455 100644 --- a/dialogflow/cx/apiv3beta1/agents_client.go +++ b/dialogflow/cx/apiv3beta1/agents_client.go @@ -388,10 +388,10 @@ func (c *AgentsClient) DeleteAgent(ctx context.Context, req *cxpb.DeleteAgentReq // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ExportAgentResponse +// response: ExportAgentResponse func (c *AgentsClient) ExportAgent(ctx context.Context, req *cxpb.ExportAgentRequest, opts ...gax.CallOption) (*ExportAgentOperation, error) { return c.internalClient.ExportAgent(ctx, req, opts...) } @@ -411,11 +411,11 @@ func (c *AgentsClient) ExportAgentOperation(name string) *ExportAgentOperation { // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train a flow prior to sending it queries. See the // training @@ -1327,10 +1327,10 @@ func (c *agentsRESTClient) DeleteAgent(ctx context.Context, req *cxpb.DeleteAgen // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ExportAgentResponse +// response: ExportAgentResponse func (c *agentsRESTClient) ExportAgent(ctx context.Context, req *cxpb.ExportAgentRequest, opts ...gax.CallOption) (*ExportAgentOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -1402,11 +1402,11 @@ func (c *agentsRESTClient) ExportAgent(ctx context.Context, req *cxpb.ExportAgen // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train a flow prior to sending it queries. See the // training diff --git a/dialogflow/cx/apiv3beta1/doc.go b/dialogflow/cx/apiv3beta1/doc.go index 65062f219ca..50e3dbcbc9f 100644 --- a/dialogflow/cx/apiv3beta1/doc.go +++ b/dialogflow/cx/apiv3beta1/doc.go @@ -20,51 +20,52 @@ // Builds conversational interfaces (for example, chatbots, and voice-powered // apps and devices). // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := cx.NewPagesClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := cx.NewPagesClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := cx.NewPagesClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &cxpb.ListPagesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1#ListPagesRequest. -// } -// it := c.ListPages(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := cx.NewPagesClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &cxpb.ListPagesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1#ListPagesRequest. +// } +// it := c.ListPages(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/dialogflow/cx/apiv3beta1/environments_client.go b/dialogflow/cx/apiv3beta1/environments_client.go index d9c14ece5b4..f631733305f 100644 --- a/dialogflow/cx/apiv3beta1/environments_client.go +++ b/dialogflow/cx/apiv3beta1/environments_client.go @@ -367,10 +367,10 @@ func (c *EnvironmentsClient) GetEnvironment(ctx context.Context, req *cxpb.GetEn // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: Environment +// response: Environment func (c *EnvironmentsClient) CreateEnvironment(ctx context.Context, req *cxpb.CreateEnvironmentRequest, opts ...gax.CallOption) (*CreateEnvironmentOperation, error) { return c.internalClient.CreateEnvironment(ctx, req, opts...) } @@ -387,10 +387,10 @@ func (c *EnvironmentsClient) CreateEnvironmentOperation(name string) *CreateEnvi // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: Environment +// response: Environment func (c *EnvironmentsClient) UpdateEnvironment(ctx context.Context, req *cxpb.UpdateEnvironmentRequest, opts ...gax.CallOption) (*UpdateEnvironmentOperation, error) { return c.internalClient.UpdateEnvironment(ctx, req, opts...) } @@ -417,9 +417,9 @@ func (c *EnvironmentsClient) LookupEnvironmentHistory(ctx context.Context, req * // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: RunContinuousTestMetadata +// metadata: RunContinuousTestMetadata // -// response: RunContinuousTestResponse +// response: RunContinuousTestResponse func (c *EnvironmentsClient) RunContinuousTest(ctx context.Context, req *cxpb.RunContinuousTestRequest, opts ...gax.CallOption) (*RunContinuousTestOperation, error) { return c.internalClient.RunContinuousTest(ctx, req, opts...) } @@ -441,9 +441,9 @@ func (c *EnvironmentsClient) ListContinuousTestResults(ctx context.Context, req // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: DeployFlowMetadata +// metadata: DeployFlowMetadata // -// response: DeployFlowResponse +// response: DeployFlowResponse func (c *EnvironmentsClient) DeployFlow(ctx context.Context, req *cxpb.DeployFlowRequest, opts ...gax.CallOption) (*DeployFlowOperation, error) { return c.internalClient.DeployFlow(ctx, req, opts...) } @@ -1218,10 +1218,10 @@ func (c *environmentsRESTClient) GetEnvironment(ctx context.Context, req *cxpb.G // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: Environment +// response: Environment func (c *environmentsRESTClient) CreateEnvironment(ctx context.Context, req *cxpb.CreateEnvironmentRequest, opts ...gax.CallOption) (*CreateEnvironmentOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetEnvironment() @@ -1291,10 +1291,10 @@ func (c *environmentsRESTClient) CreateEnvironment(ctx context.Context, req *cxp // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: Environment +// response: Environment func (c *environmentsRESTClient) UpdateEnvironment(ctx context.Context, req *cxpb.UpdateEnvironmentRequest, opts ...gax.CallOption) (*UpdateEnvironmentOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetEnvironment() @@ -1493,9 +1493,9 @@ func (c *environmentsRESTClient) LookupEnvironmentHistory(ctx context.Context, r // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: RunContinuousTestMetadata +// metadata: RunContinuousTestMetadata // -// response: RunContinuousTestResponse +// response: RunContinuousTestResponse func (c *environmentsRESTClient) RunContinuousTest(ctx context.Context, req *cxpb.RunContinuousTestRequest, opts ...gax.CallOption) (*RunContinuousTestOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -1651,9 +1651,9 @@ func (c *environmentsRESTClient) ListContinuousTestResults(ctx context.Context, // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: DeployFlowMetadata +// metadata: DeployFlowMetadata // -// response: DeployFlowResponse +// response: DeployFlowResponse func (c *environmentsRESTClient) DeployFlow(ctx context.Context, req *cxpb.DeployFlowRequest, opts ...gax.CallOption) (*DeployFlowOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/dialogflow/cx/apiv3beta1/flows_client.go b/dialogflow/cx/apiv3beta1/flows_client.go index bc1f5eb6ce0..83340f05b15 100644 --- a/dialogflow/cx/apiv3beta1/flows_client.go +++ b/dialogflow/cx/apiv3beta1/flows_client.go @@ -413,11 +413,11 @@ func (c *FlowsClient) UpdateFlow(ctx context.Context, req *cxpb.UpdateFlowReques // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train a flow prior to sending it queries. See the // training @@ -451,10 +451,10 @@ func (c *FlowsClient) GetFlowValidationResult(ctx context.Context, req *cxpb.Get // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ImportFlowResponse +// response: ImportFlowResponse // // Note: You should always train a flow prior to sending it queries. See the // training @@ -475,10 +475,10 @@ func (c *FlowsClient) ImportFlowOperation(name string) *ImportFlowOperation { // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ExportFlowResponse +// response: ExportFlowResponse // // Note that resources (e.g. intents, entities, webhooks) that the flow // references will also be exported. @@ -1428,11 +1428,11 @@ func (c *flowsRESTClient) UpdateFlow(ctx context.Context, req *cxpb.UpdateFlowRe // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) // // Note: You should always train a flow prior to sending it queries. See the // training @@ -1627,10 +1627,10 @@ func (c *flowsRESTClient) GetFlowValidationResult(ctx context.Context, req *cxpb // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ImportFlowResponse +// response: ImportFlowResponse // // Note: You should always train a flow prior to sending it queries. See the // training @@ -1703,10 +1703,10 @@ func (c *flowsRESTClient) ImportFlow(ctx context.Context, req *cxpb.ImportFlowRe // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: ExportFlowResponse +// response: ExportFlowResponse // // Note that resources (e.g. intents, entities, webhooks) that the flow // references will also be exported. diff --git a/dialogflow/cx/apiv3beta1/test_cases_client.go b/dialogflow/cx/apiv3beta1/test_cases_client.go index bc050b498c5..b69799bcc7f 100644 --- a/dialogflow/cx/apiv3beta1/test_cases_client.go +++ b/dialogflow/cx/apiv3beta1/test_cases_client.go @@ -451,9 +451,9 @@ func (c *TestCasesClient) UpdateTestCase(ctx context.Context, req *cxpb.UpdateTe // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: RunTestCaseMetadata +// metadata: RunTestCaseMetadata // -// response: RunTestCaseResponse +// response: RunTestCaseResponse func (c *TestCasesClient) RunTestCase(ctx context.Context, req *cxpb.RunTestCaseRequest, opts ...gax.CallOption) (*RunTestCaseOperation, error) { return c.internalClient.RunTestCase(ctx, req, opts...) } @@ -470,9 +470,9 @@ func (c *TestCasesClient) RunTestCaseOperation(name string) *RunTestCaseOperatio // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: BatchRunTestCasesMetadata +// metadata: BatchRunTestCasesMetadata // -// response: BatchRunTestCasesResponse +// response: BatchRunTestCasesResponse func (c *TestCasesClient) BatchRunTestCases(ctx context.Context, req *cxpb.BatchRunTestCasesRequest, opts ...gax.CallOption) (*BatchRunTestCasesOperation, error) { return c.internalClient.BatchRunTestCases(ctx, req, opts...) } @@ -496,9 +496,9 @@ func (c *TestCasesClient) CalculateCoverage(ctx context.Context, req *cxpb.Calcu // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: ImportTestCasesMetadata +// metadata: ImportTestCasesMetadata // -// response: ImportTestCasesResponse +// response: ImportTestCasesResponse func (c *TestCasesClient) ImportTestCases(ctx context.Context, req *cxpb.ImportTestCasesRequest, opts ...gax.CallOption) (*ImportTestCasesOperation, error) { return c.internalClient.ImportTestCases(ctx, req, opts...) } @@ -516,9 +516,9 @@ func (c *TestCasesClient) ImportTestCasesOperation(name string) *ImportTestCases // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: ExportTestCasesMetadata +// metadata: ExportTestCasesMetadata // -// response: ExportTestCasesResponse +// response: ExportTestCasesResponse func (c *TestCasesClient) ExportTestCases(ctx context.Context, req *cxpb.ExportTestCasesRequest, opts ...gax.CallOption) (*ExportTestCasesOperation, error) { return c.internalClient.ExportTestCases(ctx, req, opts...) } @@ -1519,9 +1519,9 @@ func (c *testCasesRESTClient) UpdateTestCase(ctx context.Context, req *cxpb.Upda // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: RunTestCaseMetadata +// metadata: RunTestCaseMetadata // -// response: RunTestCaseResponse +// response: RunTestCaseResponse func (c *testCasesRESTClient) RunTestCase(ctx context.Context, req *cxpb.RunTestCaseRequest, opts ...gax.CallOption) (*RunTestCaseOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -1590,9 +1590,9 @@ func (c *testCasesRESTClient) RunTestCase(ctx context.Context, req *cxpb.RunTest // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: BatchRunTestCasesMetadata +// metadata: BatchRunTestCasesMetadata // -// response: BatchRunTestCasesResponse +// response: BatchRunTestCasesResponse func (c *testCasesRESTClient) BatchRunTestCases(ctx context.Context, req *cxpb.BatchRunTestCasesRequest, opts ...gax.CallOption) (*BatchRunTestCasesOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -1721,9 +1721,9 @@ func (c *testCasesRESTClient) CalculateCoverage(ctx context.Context, req *cxpb.C // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: ImportTestCasesMetadata +// metadata: ImportTestCasesMetadata // -// response: ImportTestCasesResponse +// response: ImportTestCasesResponse func (c *testCasesRESTClient) ImportTestCases(ctx context.Context, req *cxpb.ImportTestCasesRequest, opts ...gax.CallOption) (*ImportTestCasesOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) @@ -1793,9 +1793,9 @@ func (c *testCasesRESTClient) ImportTestCases(ctx context.Context, req *cxpb.Imp // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: ExportTestCasesMetadata +// metadata: ExportTestCasesMetadata // -// response: ExportTestCasesResponse +// response: ExportTestCasesResponse func (c *testCasesRESTClient) ExportTestCases(ctx context.Context, req *cxpb.ExportTestCasesRequest, opts ...gax.CallOption) (*ExportTestCasesOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/dialogflow/cx/apiv3beta1/versions_client.go b/dialogflow/cx/apiv3beta1/versions_client.go index 43cbbe15ce2..ef2097d7c20 100644 --- a/dialogflow/cx/apiv3beta1/versions_client.go +++ b/dialogflow/cx/apiv3beta1/versions_client.go @@ -319,9 +319,9 @@ func (c *VersionsClient) GetVersion(ctx context.Context, req *cxpb.GetVersionReq // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: CreateVersionOperationMetadata +// metadata: CreateVersionOperationMetadata // -// response: Version +// response: Version func (c *VersionsClient) CreateVersion(ctx context.Context, req *cxpb.CreateVersionRequest, opts ...gax.CallOption) (*CreateVersionOperation, error) { return c.internalClient.CreateVersion(ctx, req, opts...) } @@ -348,11 +348,11 @@ func (c *VersionsClient) DeleteVersion(ctx context.Context, req *cxpb.DeleteVers // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) func (c *VersionsClient) LoadVersion(ctx context.Context, req *cxpb.LoadVersionRequest, opts ...gax.CallOption) (*LoadVersionOperation, error) { return c.internalClient.LoadVersion(ctx, req, opts...) } @@ -1038,9 +1038,9 @@ func (c *versionsRESTClient) GetVersion(ctx context.Context, req *cxpb.GetVersio // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: CreateVersionOperationMetadata +// metadata: CreateVersionOperationMetadata // -// response: Version +// response: Version func (c *versionsRESTClient) CreateVersion(ctx context.Context, req *cxpb.CreateVersionRequest, opts ...gax.CallOption) (*CreateVersionOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetVersion() @@ -1212,11 +1212,11 @@ func (c *versionsRESTClient) DeleteVersion(ctx context.Context, req *cxpb.Delete // operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). // The returned Operation type has the following method-specific fields: // -// metadata: An empty Struct -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) +// metadata: An empty Struct +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) // -// response: An Empty -// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) +// response: An Empty +// message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) func (c *versionsRESTClient) LoadVersion(ctx context.Context, req *cxpb.LoadVersionRequest, opts ...gax.CallOption) (*LoadVersionOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go index 8a743951ed0..26932f20d81 100644 --- a/dlp/apiv2/doc.go +++ b/dlp/apiv2/doc.go @@ -21,43 +21,44 @@ // privacy-sensitive fragments in text, images, and Google Cloud Platform // storage repositories. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dlp.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dlp.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dlp.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dlppb.InspectContentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/privacy/dlp/v2#InspectContentRequest. -// } -// resp, err := c.InspectContent(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := dlp.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dlppb.InspectContentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/privacy/dlp/v2#InspectContentRequest. +// } +// resp, err := c.InspectContent(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/doc.go b/doc.go index 06463833e3e..871645ef111 100644 --- a/doc.go +++ b/doc.go @@ -17,14 +17,12 @@ Package cloud is the root of the packages used to access Google Cloud Services. See https://godoc.org/cloud.google.com/go for a full list of sub-packages. - -Client Options +# Client Options All clients in sub-packages are configurable via client options. These options are described here: https://godoc.org/google.golang.org/api/option. - -Authentication and Authorization +# Authentication and Authorization All the clients in sub-packages support authentication via Google Application Default Credentials (see https://cloud.google.com/docs/authentication/production), or @@ -35,11 +33,12 @@ and authenticate clients. For information on how to create and obtain Application Default Credentials, see https://cloud.google.com/docs/authentication/production. Here is an example of a client using ADC to authenticate: - client, err := secretmanager.NewClient(context.Background()) - if err != nil { - // TODO: handle error. - } - _ = client // Use the client. + + client, err := secretmanager.NewClient(context.Background()) + if err != nil { + // TODO: handle error. + } + _ = client // Use the client. You can use a file with credentials to authenticate and authorize, such as a JSON key file associated with a Google service account. Service Account keys can be @@ -47,12 +46,13 @@ created and downloaded from https://console.cloud.google.com/iam-admin/serviceaccounts. This example uses the Secret Manger client, but the same steps apply to the other client libraries underneath this package. Example: - client, err := secretmanager.NewClient(context.Background(), - option.WithCredentialsFile("/path/to/service-account-key.json")) - if err != nil { - // TODO: handle error. - } - _ = client // Use the client. + + client, err := secretmanager.NewClient(context.Background(), + option.WithCredentialsFile("/path/to/service-account-key.json")) + if err != nil { + // TODO: handle error. + } + _ = client // Use the client. In some cases (for instance, you don't want to store secrets on disk), you can create credentials from in-memory JSON and use the WithCredentials option. @@ -62,19 +62,19 @@ the other client libraries underneath this package. Note that scopes can be found at https://developers.google.com/identity/protocols/oauth2/scopes, and are also provided in all auto-generated libraries: for example, cloud.google.com/go/secretmanager/apiv1 provides DefaultAuthScopes. Example: - ctx := context.Background() - creds, err := google.CredentialsFromJSON(ctx, []byte("JSON creds"), secretmanager.DefaultAuthScopes()...) - if err != nil { - // TODO: handle error. - } - client, err := secretmanager.NewClient(ctx, option.WithCredentials(creds)) - if err != nil { - // TODO: handle error. - } - _ = client // Use the client. + ctx := context.Background() + creds, err := google.CredentialsFromJSON(ctx, []byte("JSON creds"), secretmanager.DefaultAuthScopes()...) + if err != nil { + // TODO: handle error. + } + client, err := secretmanager.NewClient(ctx, option.WithCredentials(creds)) + if err != nil { + // TODO: handle error. + } + _ = client // Use the client. -Timeouts and Cancellation +# Timeouts and Cancellation By default, non-streaming methods, like Create or Get, will have a default deadline applied to the context provided at call time, unless a context deadline is already set. Streaming @@ -83,40 +83,42 @@ arrange for cancellation, use contexts. Transient errors will be retried when correctness allows. Here is an example of how to set a timeout for an RPC, use context.WithTimeout: - ctx := context.Background() - // Do not set a timeout on the context passed to NewClient: dialing happens - // asynchronously, and the context is used to refresh credentials in the - // background. - client, err := secretmanager.NewClient(ctx) - if err != nil { - // TODO: handle error. - } - // Time out if it takes more than 10 seconds to create a dataset. - tctx, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() // Always call cancel. - - req := &secretmanagerpb.DeleteSecretRequest{Name: "projects/project-id/secrets/name"} - if err := client.DeleteSecret(tctx, req); err != nil { - // TODO: handle error. - } + + ctx := context.Background() + // Do not set a timeout on the context passed to NewClient: dialing happens + // asynchronously, and the context is used to refresh credentials in the + // background. + client, err := secretmanager.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + // Time out if it takes more than 10 seconds to create a dataset. + tctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() // Always call cancel. + + req := &secretmanagerpb.DeleteSecretRequest{Name: "projects/project-id/secrets/name"} + if err := client.DeleteSecret(tctx, req); err != nil { + // TODO: handle error. + } Here is an example of how to arrange for an RPC to be canceled, use context.WithCancel: - ctx := context.Background() - // Do not cancel the context passed to NewClient: dialing happens asynchronously, - // and the context is used to refresh credentials in the background. - client, err := secretmanager.NewClient(ctx) - if err != nil { - // TODO: handle error. - } - cctx, cancel := context.WithCancel(ctx) - defer cancel() // Always call cancel. - - // TODO: Make the cancel function available to whatever might want to cancel the - // call--perhaps a GUI button. - req := &secretmanagerpb.DeleteSecretRequest{Name: "projects/proj/secrets/name"} - if err := client.DeleteSecret(cctx, req); err != nil { - // TODO: handle error. - } + + ctx := context.Background() + // Do not cancel the context passed to NewClient: dialing happens asynchronously, + // and the context is used to refresh credentials in the background. + client, err := secretmanager.NewClient(ctx) + if err != nil { + // TODO: handle error. + } + cctx, cancel := context.WithCancel(ctx) + defer cancel() // Always call cancel. + + // TODO: Make the cancel function available to whatever might want to cancel the + // call--perhaps a GUI button. + req := &secretmanagerpb.DeleteSecretRequest{Name: "projects/proj/secrets/name"} + if err := client.DeleteSecret(cctx, req); err != nil { + // TODO: handle error. + } To opt out of default deadlines, set the temporary environment variable GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE to "true" prior to client @@ -130,8 +132,7 @@ timeout on the context passed to NewClient. Dialing is non-blocking, so timeouts would be ineffective and would only interfere with credential refreshing, which uses the same context. - -Connection Pooling +# Connection Pooling Connection pooling differs in clients based on their transport. Cloud clients either rely on HTTP or gRPC transports to communicate @@ -147,23 +148,20 @@ of cloud client libraries may specify option.WithGRPCConnectionPool(n) as a clie option to NewClient calls. This configures the underlying gRPC connections to be pooled and addressed in a round robin fashion. - -Using the Libraries with Docker +# Using the Libraries with Docker Minimal docker images like Alpine lack CA certificates. This causes RPCs to appear to hang, because gRPC retries indefinitely. See https://github.com/googleapis/google-cloud-go/issues/928 for more information. - -Debugging +# Debugging To see gRPC logs, set the environment variable GRPC_GO_LOG_SEVERITY_LEVEL. See https://godoc.org/google.golang.org/grpc/grpclog for more information. For HTTP logging, set the GODEBUG environment variable to "http2debug=1" or "http2debug=2". - -Inspecting errors +# Inspecting errors Most of the errors returned by the generated clients are wrapped in an `apierror.APIError` (https://pkg.go.dev/github.com/googleapis/gax-go/v2/apierror) @@ -175,35 +173,38 @@ while debugging. `apierror.APIError` gives access to specific details in the error. The transport-specific errors can still be unwrapped using the `apierror.APIError`. - if err != nil { - var ae *apierror.APIError - if errors.As(err, &ae) { - log.Println(ae.Reason()) - log.Println(ae.Details().Help.GetLinks()) - } - } + + if err != nil { + var ae *apierror.APIError + if errors.As(err, &ae) { + log.Println(ae.Reason()) + log.Println(ae.Details().Help.GetLinks()) + } + } If the gRPC transport was used, the `grpc.Status` can still be parsed using the `status.FromError` function. - if err != nil { - if s, ok := status.FromError(err); ok { - log.Println(s.Message()) - for _, d := range s.Proto().Details { - log.Println(d) - } - } - } + + if err != nil { + if s, ok := status.FromError(err); ok { + log.Println(s.Message()) + for _, d := range s.Proto().Details { + log.Println(d) + } + } + } If the REST transport was used, the `googleapi.Error` can be parsed in a similar way. - if err != nil { - var gerr *googleapi.Error - if errors.As(err, &gerr) { - log.Println(gerr.Message) - } - } - -Client Stability + + if err != nil { + var gerr *googleapi.Error + if errors.As(err, &gerr) { + log.Println(gerr.Message) + } + } + +# Client Stability Clients in this repository are considered alpha or beta unless otherwise marked as stable in the README.md. Semver is not used to communicate stability diff --git a/documentai/apiv1/doc.go b/documentai/apiv1/doc.go index 52d742f226b..7398900c77a 100644 --- a/documentai/apiv1/doc.go +++ b/documentai/apiv1/doc.go @@ -21,43 +21,44 @@ // semi-structured documents using state-of-the-art Google AI such as natural // language, computer vision, translation, and AutoML. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := documentai.NewDocumentProcessorClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := documentai.NewDocumentProcessorClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := documentai.NewDocumentProcessorClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &documentaipb.ProcessRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/documentai/v1#ProcessRequest. -// } -// resp, err := c.ProcessDocument(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := documentai.NewDocumentProcessorClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &documentaipb.ProcessRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/documentai/v1#ProcessRequest. +// } +// resp, err := c.ProcessDocument(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/documentai/apiv1beta3/doc.go b/documentai/apiv1beta3/doc.go index 1792fd16142..d7ef7417136 100644 --- a/documentai/apiv1beta3/doc.go +++ b/documentai/apiv1beta3/doc.go @@ -21,45 +21,46 @@ // semi-structured documents using state-of-the-art Google AI such as natural // language, computer vision, translation, and AutoML. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := documentai.NewDocumentProcessorClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := documentai.NewDocumentProcessorClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := documentai.NewDocumentProcessorClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &documentaipb.ProcessRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/documentai/v1beta3#ProcessRequest. -// } -// resp, err := c.ProcessDocument(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := documentai.NewDocumentProcessorClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &documentaipb.ProcessRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/documentai/v1beta3#ProcessRequest. +// } +// resp, err := c.ProcessDocument(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/domains/apiv1beta1/doc.go b/domains/apiv1beta1/doc.go index cee913b3787..856c86abb55 100644 --- a/domains/apiv1beta1/doc.go +++ b/domains/apiv1beta1/doc.go @@ -19,45 +19,46 @@ // // Enables management and configuration of domain names. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := domains.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := domains.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := domains.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &domainspb.SearchDomainsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/domains/v1beta1#SearchDomainsRequest. -// } -// resp, err := c.SearchDomains(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := domains.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &domainspb.SearchDomainsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/domains/v1beta1#SearchDomainsRequest. +// } +// resp, err := c.SearchDomains(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/domains/apiv1beta1/domains_client.go b/domains/apiv1beta1/domains_client.go index ee7e0d80d20..76e07e20ddc 100644 --- a/domains/apiv1beta1/domains_client.go +++ b/domains/apiv1beta1/domains_client.go @@ -275,11 +275,11 @@ func (c *Client) GetRegistration(ctx context.Context, req *domainspb.GetRegistra // UpdateRegistration updates select fields of a Registration resource, notably labels. To // update other fields, use the appropriate custom update method: // -// To update management settings, see ConfigureManagementSettings +// To update management settings, see ConfigureManagementSettings // -// To update DNS configuration, see ConfigureDnsSettings +// To update DNS configuration, see ConfigureDnsSettings // -// To update contact information, see ConfigureContactSettings +// To update contact information, see ConfigureContactSettings func (c *Client) UpdateRegistration(ctx context.Context, req *domainspb.UpdateRegistrationRequest, opts ...gax.CallOption) (*UpdateRegistrationOperation, error) { return c.internalClient.UpdateRegistration(ctx, req, opts...) } @@ -352,11 +352,11 @@ func (c *Client) ExportRegistrationOperation(name string) *ExportRegistrationOpe // For Registration resources using // Monthly billing (at /domains/pricing#billing-models), this method works if: // -// state is EXPORTED with expire_time in the past +// state is EXPORTED with expire_time in the past // -// state is REGISTRATION_FAILED +// state is REGISTRATION_FAILED // -// state is TRANSFER_FAILED +// state is TRANSFER_FAILED // // When an active registration is successfully deleted, you can continue to // use the domain in Google Domains (at https://domains.google/) until it @@ -1355,11 +1355,11 @@ func (c *restClient) GetRegistration(ctx context.Context, req *domainspb.GetRegi // UpdateRegistration updates select fields of a Registration resource, notably labels. To // update other fields, use the appropriate custom update method: // -// To update management settings, see ConfigureManagementSettings +// To update management settings, see ConfigureManagementSettings // -// To update DNS configuration, see ConfigureDnsSettings +// To update DNS configuration, see ConfigureDnsSettings // -// To update contact information, see ConfigureContactSettings +// To update contact information, see ConfigureContactSettings func (c *restClient) UpdateRegistration(ctx context.Context, req *domainspb.UpdateRegistrationRequest, opts ...gax.CallOption) (*UpdateRegistrationOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} body := req.GetRegistration() @@ -1700,11 +1700,11 @@ func (c *restClient) ExportRegistration(ctx context.Context, req *domainspb.Expo // For Registration resources using // Monthly billing (at /domains/pricing#billing-models), this method works if: // -// state is EXPORTED with expire_time in the past +// state is EXPORTED with expire_time in the past // -// state is REGISTRATION_FAILED +// state is REGISTRATION_FAILED // -// state is TRANSFER_FAILED +// state is TRANSFER_FAILED // // When an active registration is successfully deleted, you can continue to // use the domain in Google Domains (at https://domains.google/) until it diff --git a/errorreporting/apiv1beta1/doc.go b/errorreporting/apiv1beta1/doc.go index 00e0176e3be..4b18fc96254 100644 --- a/errorreporting/apiv1beta1/doc.go +++ b/errorreporting/apiv1beta1/doc.go @@ -21,45 +21,46 @@ // reports new errors, and provides access to error groups and their // associated errors. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := errorreporting.NewErrorGroupClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := errorreporting.NewErrorGroupClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := errorreporting.NewErrorGroupClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &clouderrorreportingpb.GetGroupRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#GetGroupRequest. -// } -// resp, err := c.GetGroup(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := errorreporting.NewErrorGroupClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &clouderrorreportingpb.GetGroupRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1#GetGroupRequest. +// } +// resp, err := c.GetGroup(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/errorreporting/apiv1beta1/path_funcs.go b/errorreporting/apiv1beta1/path_funcs.go index 5ca5e9272fd..6a1a66be2fd 100644 --- a/errorreporting/apiv1beta1/path_funcs.go +++ b/errorreporting/apiv1beta1/path_funcs.go @@ -17,7 +17,9 @@ package errorreporting // ResultPath returns the path for the result resource. // // Deprecated: Use -// fmt.Sprintf("inspect/results/%s", result) +// +// fmt.Sprintf("inspect/results/%s", result) +// // instead. func ResultPath(result string) string { return "" + @@ -29,7 +31,9 @@ func ResultPath(result string) string { // ErrorStatsProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func ErrorStatsProjectPath(project string) string { return "" + @@ -41,7 +45,9 @@ func ErrorStatsProjectPath(project string) string { // ReportErrorsProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func ReportErrorsProjectPath(project string) string { return "" + diff --git a/essentialcontacts/apiv1/doc.go b/essentialcontacts/apiv1/doc.go index 4271d8b5c79..17bd8701724 100644 --- a/essentialcontacts/apiv1/doc.go +++ b/essentialcontacts/apiv1/doc.go @@ -17,43 +17,44 @@ // Package essentialcontacts is an auto-generated package for the // Essential Contacts API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := essentialcontacts.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := essentialcontacts.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := essentialcontacts.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := essentialcontacts.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &essentialcontactspb.CreateContactRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1#CreateContactRequest. -// } -// resp, err := c.CreateContact(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &essentialcontactspb.CreateContactRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1#CreateContactRequest. +// } +// resp, err := c.CreateContact(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/eventarc/apiv1/doc.go b/eventarc/apiv1/doc.go index 1111aa21084..91f36b42db4 100644 --- a/eventarc/apiv1/doc.go +++ b/eventarc/apiv1/doc.go @@ -17,43 +17,44 @@ // Package eventarc is an auto-generated package for the // Eventarc API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := eventarc.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := eventarc.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := eventarc.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := eventarc.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &eventarcpb.GetTriggerRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/eventarc/v1#GetTriggerRequest. -// } -// resp, err := c.GetTrigger(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &eventarcpb.GetTriggerRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/eventarc/v1#GetTriggerRequest. +// } +// resp, err := c.GetTrigger(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/eventarc/publishing/apiv1/doc.go b/eventarc/publishing/apiv1/doc.go index db3a099817a..db3e4f78ef7 100644 --- a/eventarc/publishing/apiv1/doc.go +++ b/eventarc/publishing/apiv1/doc.go @@ -17,45 +17,46 @@ // Package publishing is an auto-generated package for the // Eventarc Publishing API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := publishing.NewPublisherClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := publishing.NewPublisherClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := publishing.NewPublisherClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &publisherpb.PublishChannelConnectionEventsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/eventarc/publishing/v1#PublishChannelConnectionEventsRequest. -// } -// resp, err := c.PublishChannelConnectionEvents(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := publishing.NewPublisherClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &publisherpb.PublishChannelConnectionEventsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/eventarc/publishing/v1#PublishChannelConnectionEventsRequest. +// } +// resp, err := c.PublishChannelConnectionEvents(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/filestore/apiv1/cloud_filestore_manager_client.go b/filestore/apiv1/cloud_filestore_manager_client.go index d0ed779d35c..897e073ed7d 100644 --- a/filestore/apiv1/cloud_filestore_manager_client.go +++ b/filestore/apiv1/cloud_filestore_manager_client.go @@ -159,24 +159,24 @@ type internalCloudFilestoreManagerClient interface { // The file.googleapis.com service implements the Cloud Filestore API and // defines the following resource model for managing instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of instances and backups, named: -// /instances/* and /backups/* respectively. +// Each location has a collection of instances and backups, named: +// /instances/* and /backups/* respectively. // -// As such, Cloud Filestore instances are resources of the form: -// /projects/{project_number}/locations/{location_id}/instances/{instance_id} -// and backups are resources of the form: -// /projects/{project_number}/locations/{location_id}/backup/{backup_id} +// As such, Cloud Filestore instances are resources of the form: +// /projects/{project_number}/locations/{location_id}/instances/{instance_id} +// and backups are resources of the form: +// /projects/{project_number}/locations/{location_id}/backup/{backup_id} // // Note that location_id must be a GCP zone for instances and but to a GCP // region for backups; for example: // -// projects/12345/locations/us-central1-c/instances/my-filestore +// projects/12345/locations/us-central1-c/instances/my-filestore // -// projects/12345/locations/us-central1/backups/my-backup +// projects/12345/locations/us-central1/backups/my-backup type CloudFilestoreManagerClient struct { // The internal transport-dependent client. internalClient internalCloudFilestoreManagerClient @@ -353,24 +353,24 @@ type cloudFilestoreManagerGRPCClient struct { // The file.googleapis.com service implements the Cloud Filestore API and // defines the following resource model for managing instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of instances and backups, named: -// /instances/* and /backups/* respectively. +// Each location has a collection of instances and backups, named: +// /instances/* and /backups/* respectively. // -// As such, Cloud Filestore instances are resources of the form: -// /projects/{project_number}/locations/{location_id}/instances/{instance_id} -// and backups are resources of the form: -// /projects/{project_number}/locations/{location_id}/backup/{backup_id} +// As such, Cloud Filestore instances are resources of the form: +// /projects/{project_number}/locations/{location_id}/instances/{instance_id} +// and backups are resources of the form: +// /projects/{project_number}/locations/{location_id}/backup/{backup_id} // // Note that location_id must be a GCP zone for instances and but to a GCP // region for backups; for example: // -// projects/12345/locations/us-central1-c/instances/my-filestore +// projects/12345/locations/us-central1-c/instances/my-filestore // -// projects/12345/locations/us-central1/backups/my-backup +// projects/12345/locations/us-central1/backups/my-backup func NewCloudFilestoreManagerClient(ctx context.Context, opts ...option.ClientOption) (*CloudFilestoreManagerClient, error) { clientOpts := defaultCloudFilestoreManagerGRPCClientOptions() if newCloudFilestoreManagerClientHook != nil { diff --git a/filestore/apiv1/doc.go b/filestore/apiv1/doc.go index 1d7e23d5bce..ec925a9cd14 100644 --- a/filestore/apiv1/doc.go +++ b/filestore/apiv1/doc.go @@ -20,49 +20,50 @@ // The Cloud Filestore API is used for creating and managing cloud file // servers. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := filestore.NewCloudFilestoreManagerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := filestore.NewCloudFilestoreManagerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := filestore.NewCloudFilestoreManagerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &filestorepb.ListInstancesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#ListInstancesRequest. -// } -// it := c.ListInstances(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := filestore.NewCloudFilestoreManagerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &filestorepb.ListInstancesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/filestore/v1#ListInstancesRequest. +// } +// it := c.ListInstances(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/firestore/apiv1/admin/doc.go b/firestore/apiv1/admin/doc.go index 0923e8850c1..98fb23ddf7f 100644 --- a/firestore/apiv1/admin/doc.go +++ b/firestore/apiv1/admin/doc.go @@ -20,48 +20,49 @@ // Accesses the NoSQL document database built for automatic scaling, high // performance, and ease of application development. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := apiv1.NewFirestoreAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := apiv1.NewFirestoreAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := apiv1.NewFirestoreAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &adminpb.CreateIndexRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/firestore/admin/v1#CreateIndexRequest. -// } -// op, err := c.CreateIndex(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := apiv1.NewFirestoreAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &adminpb.CreateIndexRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/firestore/admin/v1#CreateIndexRequest. +// } +// op, err := c.CreateIndex(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/firestore/apiv1/doc.go b/firestore/apiv1/doc.go index 7e4339bf86f..60ad12231dd 100644 --- a/firestore/apiv1/doc.go +++ b/firestore/apiv1/doc.go @@ -20,43 +20,44 @@ // Accesses the NoSQL document database built for automatic scaling, high // performance, and ease of application development. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := firestore.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := firestore.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := firestore.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &firestorepb.GetDocumentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/firestore/v1#GetDocumentRequest. -// } -// resp, err := c.GetDocument(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := firestore.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &firestorepb.GetDocumentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/firestore/v1#GetDocumentRequest. +// } +// resp, err := c.GetDocument(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/firestore/apiv1beta1/doc.go b/firestore/apiv1beta1/doc.go index cc55867e193..98a6bb42bbd 100644 --- a/firestore/apiv1beta1/doc.go +++ b/firestore/apiv1beta1/doc.go @@ -20,9 +20,9 @@ // Accesses the NoSQL document database built for automatic scaling, high // performance, and ease of application development. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/firestore/apiv1beta1/firestore_client.go b/firestore/apiv1beta1/firestore_client.go index cd551d92fee..bfdb2aa08a0 100644 --- a/firestore/apiv1beta1/firestore_client.go +++ b/firestore/apiv1beta1/firestore_client.go @@ -201,21 +201,21 @@ type Client struct { // // This service exposes several types of comparable timestamps: // -// create_time - The time at which a document was created. Changes only -// when a document is deleted, then re-created. Increases in a strict -// monotonic fashion. +// create_time - The time at which a document was created. Changes only +// when a document is deleted, then re-created. Increases in a strict +// monotonic fashion. // -// update_time - The time at which a document was last updated. Changes -// every time a document is modified. Does not change when a write results -// in no modifications. Increases in a strict monotonic fashion. +// update_time - The time at which a document was last updated. Changes +// every time a document is modified. Does not change when a write results +// in no modifications. Increases in a strict monotonic fashion. // -// read_time - The time at which a particular state was observed. Used -// to denote a consistent snapshot of the database or the time at which a -// Document was observed to not exist. +// read_time - The time at which a particular state was observed. Used +// to denote a consistent snapshot of the database or the time at which a +// Document was observed to not exist. // -// commit_time - The time at which the writes in a transaction were -// committed. Any read with an equal or greater read_time is guaranteed -// to see the effects of the transaction. +// commit_time - The time at which the writes in a transaction were +// committed. Any read with an equal or greater read_time is guaranteed +// to see the effects of the transaction. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...) if err != nil { diff --git a/firestore/doc.go b/firestore/doc.go index c3272cd634d..1cb5ebf95e8 100644 --- a/firestore/doc.go +++ b/firestore/doc.go @@ -27,7 +27,7 @@ connection pooling and similar aspects of this package. Note: you can't use both Cloud Firestore and Cloud Datastore in the same project. -Creating a Client +# Creating a Client To start working with this package, create a client with a project ID: @@ -37,7 +37,7 @@ To start working with this package, create a client with a project ID: // TODO: Handle error. } -CollectionRefs and DocumentRefs +# CollectionRefs and DocumentRefs In Firestore, documents are sets of key-value pairs, and collections are groups of documents. A Firestore database consists of a hierarchy of alternating collections @@ -53,7 +53,7 @@ entities. Creating a ref does not involve any network traffic. // Or, in a single call: ny = client.Doc("States/NewYork") -Reading +# Reading Use DocumentRef.Get to read a document. The result is a DocumentSnapshot. Call its Data method to obtain the entire document contents as a map. @@ -97,8 +97,7 @@ Client.GetAll. _ = ds // TODO: Use ds. } - -Writing +# Writing For writing individual documents, use the methods on DocumentReference. Create creates a new document. @@ -133,7 +132,7 @@ Use DocumentRef.Delete to delete a document. _, err = ny.Delete(ctx) -Preconditions +# Preconditions You can condition Deletes or Updates on when a document was last changed. Specify these preconditions as an option to a Delete or Update method. The check and the @@ -162,7 +161,7 @@ atomically. Delete(client.Doc("States/WestDakota")). Commit(ctx) -Queries +# Queries You can use SQL to select documents from a collection. Begin with the collection, and build up a query using Select, Where and other methods of Query. @@ -193,7 +192,7 @@ as a query. iter = client.Collection("States").Documents(ctx) -Collection Group Partition Queries +# Collection Group Partition Queries You can partition the documents of a Collection Group allowing for smaller subqueries. @@ -216,7 +215,7 @@ queries elsewhere; another process or machine for instance. ... } -Transactions +# Transactions Use a transaction to execute reads and writes atomically. All reads must happen before any writes. Transaction creation, commit, rollback and retry are handled for @@ -239,7 +238,7 @@ read and write methods of the Transaction passed to it. // TODO: Handle error. } -Google Cloud Firestore Emulator +# Google Cloud Firestore Emulator This package supports the Cloud Firestore emulator, which is useful for testing and development. Environment variables are used to indicate that Firestore traffic should be diff --git a/firestore/docref.go b/firestore/docref.go index fe5b2edd687..55d518d2e03 100644 --- a/firestore/docref.go +++ b/firestore/docref.go @@ -65,7 +65,9 @@ func (d *DocumentRef) Collection(id string) *CollectionRef { // Get retrieves the document. If the document does not exist, Get return a NotFound error, which // can be checked with -// status.Code(err) == codes.NotFound +// +// status.Code(err) == codes.NotFound +// // In that case, Get returns a non-nil DocumentSnapshot whose Exists method return false and whose // ReadTime is the time of the failed read operation. func (d *DocumentRef) Get(ctx context.Context) (_ *DocumentSnapshot, err error) { @@ -490,9 +492,9 @@ type transform struct { // // The supported values are: // -// int, int8, int16, int32, int64 -// uint8, uint16, uint32 -// float32, float64 +// int, int8, int16, int32, int64 +// uint8, uint16, uint32 +// float32, float64 // // If the field does not yet exist, the transformation will set the field to // the given value. @@ -519,9 +521,9 @@ func Increment(n interface{}) transform { // // The supported values are: // -// int, int8, int16, int32, int64 -// uint8, uint16, uint32 -// float32, float64 +// int, int8, int16, int32, int64 +// uint8, uint16, uint32 +// float32, float64 // // If the field is not an integer or double, or if the field does not yet // exist, the transformation will set the field to the given value. If a @@ -549,9 +551,9 @@ func FieldTransformMaximum(n interface{}) transform { // // The supported values are: // -// int, int8, int16, int32, int64 -// uint8, uint16, uint32 -// float32, float64 +// int, int8, int16, int32, int64 +// uint8, uint16, uint32 +// float32, float64 // // If the field is not an integer or double, or if the field does not yet // exist, the transformation will set the field to the given value. If a diff --git a/firestore/document.go b/firestore/document.go index ed664fbbff1..37183e4b5be 100644 --- a/firestore/document.go +++ b/firestore/document.go @@ -60,8 +60,10 @@ func (d *DocumentSnapshot) Exists() bool { // Data returns the DocumentSnapshot's fields as a map. // It is equivalent to -// var m map[string]interface{} -// d.DataTo(&m) +// +// var m map[string]interface{} +// d.DataTo(&m) +// // except that it returns nil if the document does not exist. func (d *DocumentSnapshot) Data() map[string]interface{} { if !d.Exists() { diff --git a/firestore/fieldpath.go b/firestore/fieldpath.go index b9c13999062..13b7aa15333 100644 --- a/firestore/fieldpath.go +++ b/firestore/fieldpath.go @@ -34,11 +34,17 @@ import ( // one of the runes ".˜*/[]". Most methods accept a simpler form of field path // as a string in which the individual fields are separated by dots. // For example, -// []string{"a", "b"} +// +// []string{"a", "b"} +// // is equivalent to the string form -// "a.b" +// +// "a.b" +// // but -// []string{"*"} +// +// []string{"*"} +// // has no equivalent string form. type FieldPath []string diff --git a/firestore/query.go b/firestore/query.go index 6981c1521dd..d9bb471e5bc 100644 --- a/firestore/query.go +++ b/firestore/query.go @@ -211,14 +211,16 @@ func (q Query) LimitToLast(n int) Query { // // Otherwise, StartAt should be called with one field value for each OrderBy clause, // in the order that they appear. For example, in -// q.OrderBy("X", Asc).OrderBy("Y", Desc).StartAt(1, 2) +// +// q.OrderBy("X", Asc).OrderBy("Y", Desc).StartAt(1, 2) +// // results will begin at the first document where X = 1 and Y = 2. // // If an OrderBy call uses the special DocumentID field path, the corresponding value // should be the document ID relative to the query's collection. For example, to // start at the document "NewYork" in the "States" collection, write // -// client.Collection("States").OrderBy(DocumentID, firestore.Asc).StartAt("NewYork") +// client.Collection("States").OrderBy(DocumentID, firestore.Asc).StartAt("NewYork") // // Calling StartAt overrides a previous call to StartAt or StartAfter. func (q Query) StartAt(docSnapshotOrFieldValues ...interface{}) Query { diff --git a/firestore/to_value.go b/firestore/to_value.go index 4916da94e17..458c2af6bb9 100644 --- a/firestore/to_value.go +++ b/firestore/to_value.go @@ -39,13 +39,13 @@ var ( // toProtoValue converts a Go value to a Firestore Value protobuf. // Some corner cases: -// - All nils (nil interface, nil slice, nil map, nil pointer) are converted to -// a NullValue (not a nil *pb.Value). toProtoValue never returns (nil, false, nil). -// It returns (nil, true, nil) if everything in the value is ServerTimestamp. -// - An error is returned for uintptr, uint, and uint64, because Firestore uses -// an int64 to represent integral values, and those types can't be properly -// represented in an int64. -// - An error is returned for the special Delete value. +// - All nils (nil interface, nil slice, nil map, nil pointer) are converted to +// a NullValue (not a nil *pb.Value). toProtoValue never returns (nil, false, nil). +// It returns (nil, true, nil) if everything in the value is ServerTimestamp. +// - An error is returned for uintptr, uint, and uint64, because Firestore uses +// an int64 to represent integral values, and those types can't be properly +// represented in an int64. +// - An error is returned for the special Delete value. // // toProtoValue also reports whether it recursively encountered a transform. func toProtoValue(v reflect.Value) (pbv *pb.Value, sawTransform bool, err error) { diff --git a/firestore/transaction.go b/firestore/transaction.go index a62e9a66c05..4cda4704625 100644 --- a/firestore/transaction.go +++ b/firestore/transaction.go @@ -197,7 +197,8 @@ func (t *Transaction) rollback() { // Get gets the document in the context of the transaction. The transaction holds a // pessimistic lock on the returned document. If the document does not exist, Get // returns a NotFound error, which can be checked with -// status.Code(err) == codes.NotFound +// +// status.Code(err) == codes.NotFound func (t *Transaction) Get(dr *DocumentRef) (*DocumentSnapshot, error) { docsnaps, err := t.GetAll([]*DocumentRef{dr}) if err != nil { diff --git a/functions/apiv1/cloud_functions_client.go b/functions/apiv1/cloud_functions_client.go index 3eb3c1e3ad5..0ccb872633d 100644 --- a/functions/apiv1/cloud_functions_client.go +++ b/functions/apiv1/cloud_functions_client.go @@ -253,24 +253,24 @@ func (c *CloudFunctionsClient) CallFunction(ctx context.Context, req *functionsp // When uploading source code to the generated signed URL, please follow // these restrictions: // -// Source file type should be a zip file. +// Source file type should be a zip file. // -// Source file size should not exceed 100MB limit. +// Source file size should not exceed 100MB limit. // -// No credentials should be attached - the signed URLs provide access to the -// target bucket using internal service identity; if credentials were -// attached, the identity from the credentials would be used, but that -// identity does not have permissions to upload files to the URL. +// No credentials should be attached - the signed URLs provide access to the +// target bucket using internal service identity; if credentials were +// attached, the identity from the credentials would be used, but that +// identity does not have permissions to upload files to the URL. // // When making a HTTP PUT request, these two headers need to be specified: // -// content-type: application/zip +// content-type: application/zip // -// x-goog-content-length-range: 0,104857600 +// x-goog-content-length-range: 0,104857600 // // And this header SHOULD NOT be specified: // -// Authorization: Bearer YOUR_TOKEN +// Authorization: Bearer YOUR_TOKEN func (c *CloudFunctionsClient) GenerateUploadUrl(ctx context.Context, req *functionspb.GenerateUploadUrlRequest, opts ...gax.CallOption) (*functionspb.GenerateUploadUrlResponse, error) { return c.internalClient.GenerateUploadUrl(ctx, req, opts...) } diff --git a/functions/apiv1/doc.go b/functions/apiv1/doc.go index 13d193c739c..0a785d36a95 100644 --- a/functions/apiv1/doc.go +++ b/functions/apiv1/doc.go @@ -20,49 +20,50 @@ // Manages lightweight user-provided functions executed in response to // events. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := functions.NewCloudFunctionsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := functions.NewCloudFunctionsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := functions.NewCloudFunctionsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &functionspb.ListFunctionsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/functions/v1#ListFunctionsRequest. -// } -// it := c.ListFunctions(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := functions.NewCloudFunctionsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &functionspb.ListFunctionsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/functions/v1#ListFunctionsRequest. +// } +// it := c.ListFunctions(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/functions/apiv2/doc.go b/functions/apiv2/doc.go index 7a0ac4b8632..db3bc05d874 100644 --- a/functions/apiv2/doc.go +++ b/functions/apiv2/doc.go @@ -20,45 +20,46 @@ // Manages lightweight user-provided functions executed in response to // events. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := functions.NewFunctionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := functions.NewFunctionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := functions.NewFunctionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &functionspb.GetFunctionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/functions/v2#GetFunctionRequest. -// } -// resp, err := c.GetFunction(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := functions.NewFunctionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &functionspb.GetFunctionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/functions/v2#GetFunctionRequest. +// } +// resp, err := c.GetFunction(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/functions/apiv2/function_client.go b/functions/apiv2/function_client.go index f59264b2385..a7fa40b49e1 100644 --- a/functions/apiv2/function_client.go +++ b/functions/apiv2/function_client.go @@ -215,20 +215,20 @@ func (c *FunctionClient) DeleteFunctionOperation(name string) *DeleteFunctionOpe // When uploading source code to the generated signed URL, please follow // these restrictions: // -// Source file type should be a zip file. +// Source file type should be a zip file. // -// No credentials should be attached - the signed URLs provide access to the -// target bucket using internal service identity; if credentials were -// attached, the identity from the credentials would be used, but that -// identity does not have permissions to upload files to the URL. +// No credentials should be attached - the signed URLs provide access to the +// target bucket using internal service identity; if credentials were +// attached, the identity from the credentials would be used, but that +// identity does not have permissions to upload files to the URL. // // When making a HTTP PUT request, these two headers need to be specified: // -// content-type: application/zip +// content-type: application/zip // // And this header SHOULD NOT be specified: // -// Authorization: Bearer YOUR_TOKEN +// Authorization: Bearer YOUR_TOKEN func (c *FunctionClient) GenerateUploadUrl(ctx context.Context, req *functionspb.GenerateUploadUrlRequest, opts ...gax.CallOption) (*functionspb.GenerateUploadUrlResponse, error) { return c.internalClient.GenerateUploadUrl(ctx, req, opts...) } diff --git a/functions/apiv2beta/doc.go b/functions/apiv2beta/doc.go index 58028c9cd7e..ca10c912e18 100644 --- a/functions/apiv2beta/doc.go +++ b/functions/apiv2beta/doc.go @@ -20,45 +20,46 @@ // Manages lightweight user-provided functions executed in response to // events. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := functions.NewFunctionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := functions.NewFunctionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := functions.NewFunctionClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &functionspb.GetFunctionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/functions/v2beta#GetFunctionRequest. -// } -// resp, err := c.GetFunction(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := functions.NewFunctionClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &functionspb.GetFunctionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/functions/v2beta#GetFunctionRequest. +// } +// resp, err := c.GetFunction(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/functions/apiv2beta/function_client.go b/functions/apiv2beta/function_client.go index 7bfe590c24a..ac007e6df54 100644 --- a/functions/apiv2beta/function_client.go +++ b/functions/apiv2beta/function_client.go @@ -240,20 +240,20 @@ func (c *FunctionClient) DeleteFunctionOperation(name string) *DeleteFunctionOpe // When uploading source code to the generated signed URL, please follow // these restrictions: // -// Source file type should be a zip file. +// Source file type should be a zip file. // -// No credentials should be attached - the signed URLs provide access to the -// target bucket using internal service identity; if credentials were -// attached, the identity from the credentials would be used, but that -// identity does not have permissions to upload files to the URL. +// No credentials should be attached - the signed URLs provide access to the +// target bucket using internal service identity; if credentials were +// attached, the identity from the credentials would be used, but that +// identity does not have permissions to upload files to the URL. // // When making a HTTP PUT request, these two headers need to be specified: // -// content-type: application/zip +// content-type: application/zip // // And this header SHOULD NOT be specified: // -// Authorization: Bearer YOUR_TOKEN +// Authorization: Bearer YOUR_TOKEN func (c *FunctionClient) GenerateUploadUrl(ctx context.Context, req *functionspb.GenerateUploadUrlRequest, opts ...gax.CallOption) (*functionspb.GenerateUploadUrlResponse, error) { return c.internalClient.GenerateUploadUrl(ctx, req, opts...) } @@ -1198,20 +1198,20 @@ func (c *functionRESTClient) DeleteFunction(ctx context.Context, req *functionsp // When uploading source code to the generated signed URL, please follow // these restrictions: // -// Source file type should be a zip file. +// Source file type should be a zip file. // -// No credentials should be attached - the signed URLs provide access to the -// target bucket using internal service identity; if credentials were -// attached, the identity from the credentials would be used, but that -// identity does not have permissions to upload files to the URL. +// No credentials should be attached - the signed URLs provide access to the +// target bucket using internal service identity; if credentials were +// attached, the identity from the credentials would be used, but that +// identity does not have permissions to upload files to the URL. // // When making a HTTP PUT request, these two headers need to be specified: // -// content-type: application/zip +// content-type: application/zip // // And this header SHOULD NOT be specified: // -// Authorization: Bearer YOUR_TOKEN +// Authorization: Bearer YOUR_TOKEN func (c *functionRESTClient) GenerateUploadUrl(ctx context.Context, req *functionspb.GenerateUploadUrlRequest, opts ...gax.CallOption) (*functionspb.GenerateUploadUrlResponse, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/gaming/apiv1/doc.go b/gaming/apiv1/doc.go index d234dc588c3..779592440da 100644 --- a/gaming/apiv1/doc.go +++ b/gaming/apiv1/doc.go @@ -20,49 +20,50 @@ // Deploy and manage infrastructure for global multiplayer gaming // experiences. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := gaming.NewGameServerClustersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := gaming.NewGameServerClustersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := gaming.NewGameServerClustersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &gamingpb.ListGameServerClustersRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gaming/v1#ListGameServerClustersRequest. -// } -// it := c.ListGameServerClusters(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := gaming.NewGameServerClustersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &gamingpb.ListGameServerClustersRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gaming/v1#ListGameServerClustersRequest. +// } +// it := c.ListGameServerClusters(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/gaming/apiv1beta/doc.go b/gaming/apiv1beta/doc.go index 34da0d8cd3f..0d9720126e1 100644 --- a/gaming/apiv1beta/doc.go +++ b/gaming/apiv1beta/doc.go @@ -20,51 +20,52 @@ // Deploy and manage infrastructure for global multiplayer gaming // experiences. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := gaming.NewGameServerClustersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := gaming.NewGameServerClustersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := gaming.NewGameServerClustersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &gamingpb.ListGameServerClustersRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gaming/v1beta#ListGameServerClustersRequest. -// } -// it := c.ListGameServerClusters(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := gaming.NewGameServerClustersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &gamingpb.ListGameServerClustersRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gaming/v1beta#ListGameServerClustersRequest. +// } +// it := c.ListGameServerClusters(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/gkebackup/apiv1/doc.go b/gkebackup/apiv1/doc.go index f32d0e32fb3..28698aaa6f6 100644 --- a/gkebackup/apiv1/doc.go +++ b/gkebackup/apiv1/doc.go @@ -20,50 +20,51 @@ // Backup for GKE is a managed Kubernetes workload backup and restore service // for GKE clusters. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := gkebackup.NewBackupForGKEClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := gkebackup.NewBackupForGKEClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := gkebackup.NewBackupForGKEClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &gkebackuppb.CreateBackupPlanRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gkebackup/v1#CreateBackupPlanRequest. -// } -// op, err := c.CreateBackupPlan(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := gkebackup.NewBackupForGKEClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &gkebackuppb.CreateBackupPlanRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gkebackup/v1#CreateBackupPlanRequest. +// } +// op, err := c.CreateBackupPlan(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/gkeconnect/gateway/apiv1beta1/doc.go b/gkeconnect/gateway/apiv1beta1/doc.go index 4917e4cc83c..1c28a05b13c 100644 --- a/gkeconnect/gateway/apiv1beta1/doc.go +++ b/gkeconnect/gateway/apiv1beta1/doc.go @@ -20,45 +20,46 @@ // The Connect Gateway service allows connectivity from external parties to // connected Kubernetes clusters. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := gateway.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := gateway.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := gateway.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &httpbodypb.HttpBody{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/httpbody#HttpBody. -// } -// resp, err := c.GetResource(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := gateway.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &httpbodypb.HttpBody{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/httpbody#HttpBody. +// } +// resp, err := c.GetResource(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/gkehub/apiv1beta1/doc.go b/gkehub/apiv1beta1/doc.go index 490cd37d909..c524bc17df7 100644 --- a/gkehub/apiv1beta1/doc.go +++ b/gkehub/apiv1beta1/doc.go @@ -17,51 +17,52 @@ // Package gkehub is an auto-generated package for the // GKE Hub API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := gkehub.NewGkeHubMembershipClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := gkehub.NewGkeHubMembershipClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := gkehub.NewGkeHubMembershipClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &gkehubpb.ListMembershipsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gkehub/v1beta1#ListMembershipsRequest. -// } -// it := c.ListMemberships(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := gkehub.NewGkeHubMembershipClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &gkehubpb.ListMembershipsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gkehub/v1beta1#ListMembershipsRequest. +// } +// it := c.ListMemberships(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/gkemulticloud/apiv1/doc.go b/gkemulticloud/apiv1/doc.go index 709f9d1aa4c..b0c1d789553 100644 --- a/gkemulticloud/apiv1/doc.go +++ b/gkemulticloud/apiv1/doc.go @@ -25,50 +25,51 @@ // on your behalf. You can deploy workloads with the Anthos Multi-Cloud API // or the gcloud and kubectl command-line tools. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := gkemulticloud.NewAwsClustersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := gkemulticloud.NewAwsClustersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := gkemulticloud.NewAwsClustersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &gkemulticloudpb.CreateAwsClusterRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gkemulticloud/v1#CreateAwsClusterRequest. -// } -// op, err := c.CreateAwsCluster(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := gkemulticloud.NewAwsClustersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &gkemulticloudpb.CreateAwsClusterRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gkemulticloud/v1#CreateAwsClusterRequest. +// } +// op, err := c.CreateAwsCluster(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/grafeas/apiv1/doc.go b/grafeas/apiv1/doc.go index 7203bb6857e..04271fc430c 100644 --- a/grafeas/apiv1/doc.go +++ b/grafeas/apiv1/doc.go @@ -17,13 +17,13 @@ // Package grafeas is an auto-generated package for the // Container Analysis API. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // // An implementation of the Grafeas API, which stores, and enables querying // and // retrieval of critical metadata about all of your software artifacts. // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/gsuiteaddons/apiv1/doc.go b/gsuiteaddons/apiv1/doc.go index c3956823c0a..74aa5f6164d 100644 --- a/gsuiteaddons/apiv1/doc.go +++ b/gsuiteaddons/apiv1/doc.go @@ -17,43 +17,44 @@ // Package gsuiteaddons is an auto-generated package for the // Google Workspace Add-ons API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := gsuiteaddons.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := gsuiteaddons.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := gsuiteaddons.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := gsuiteaddons.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &gsuiteaddonspb.GetAuthorizationRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1#GetAuthorizationRequest. -// } -// resp, err := c.GetAuthorization(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &gsuiteaddonspb.GetAuthorizationRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1#GetAuthorizationRequest. +// } +// resp, err := c.GetAuthorization(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/httpreplay/httpreplay.go b/httpreplay/httpreplay.go index d684599d695..6fd80c2b23d 100644 --- a/httpreplay/httpreplay.go +++ b/httpreplay/httpreplay.go @@ -16,16 +16,16 @@ // from HTTP-based Google API clients. // // To record: -// 1. Call NewRecorder to get a Recorder. -// 2. Use its Client method to obtain an HTTP client to use when making API calls. -// 3. Close the Recorder when you're done. That will save the log of interactions -// to the file you provided to NewRecorder. +// 1. Call NewRecorder to get a Recorder. +// 2. Use its Client method to obtain an HTTP client to use when making API calls. +// 3. Close the Recorder when you're done. That will save the log of interactions +// to the file you provided to NewRecorder. // // To replay: -// 1. Call NewReplayer with the same filename you used to record to get a Replayer. -// 2. Call its Client method and use the client to make the same API calls. -// You will get back the recorded responses. -// 3. Close the Replayer when you're done. +// 1. Call NewReplayer with the same filename you used to record to get a Replayer. +// 2. Call its Client method and use the client to make the same API calls. +// You will get back the recorded responses. +// 3. Close the Replayer when you're done. // // This package is EXPERIMENTAL and is subject to change or removal without notice. // It requires Go version 1.8 or higher. diff --git a/iam/admin/apiv1/doc.go b/iam/admin/apiv1/doc.go index 7e701477403..6b4ffee8b50 100644 --- a/iam/admin/apiv1/doc.go +++ b/iam/admin/apiv1/doc.go @@ -17,13 +17,13 @@ // Package admin is an auto-generated package for the // Google Identity and Access Management (IAM) API. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // // Manages identity and access control for Google Cloud Platform resources, // including the creation of service accounts, which you can use to // authenticate to Google and make API calls. // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go index 5fa6c81576e..faa6cea3aa8 100644 --- a/iam/credentials/apiv1/doc.go +++ b/iam/credentials/apiv1/doc.go @@ -20,43 +20,44 @@ // Creates short-lived, limited-privilege credentials for IAM service // accounts. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := credentials.NewIamCredentialsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := credentials.NewIamCredentialsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := credentials.NewIamCredentialsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &credentialspb.GenerateAccessTokenRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/credentials/v1#GenerateAccessTokenRequest. -// } -// resp, err := c.GenerateAccessToken(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := credentials.NewIamCredentialsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &credentialspb.GenerateAccessTokenRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/credentials/v1#GenerateAccessTokenRequest. +// } +// resp, err := c.GenerateAccessToken(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/iap/apiv1/doc.go b/iap/apiv1/doc.go index 0333d7e2d23..c463b2c7fd5 100644 --- a/iap/apiv1/doc.go +++ b/iap/apiv1/doc.go @@ -19,43 +19,44 @@ // // Controls access to cloud applications running on Google Cloud Platform. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := iap.NewIdentityAwareProxyAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := iap.NewIdentityAwareProxyAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := iap.NewIdentityAwareProxyAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &iampb.SetIamPolicyRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#SetIamPolicyRequest. -// } -// resp, err := c.SetIamPolicy(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := iap.NewIdentityAwareProxyAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &iampb.SetIamPolicyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#SetIamPolicyRequest. +// } +// resp, err := c.SetIamPolicy(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/ids/apiv1/doc.go b/ids/apiv1/doc.go index 82048366f78..78d5d5ec49f 100644 --- a/ids/apiv1/doc.go +++ b/ids/apiv1/doc.go @@ -23,49 +23,50 @@ // When you use this product, your organization name and consumption levels // will be shared with Palo Alto Networks. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := ids.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := ids.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := ids.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &idspb.ListEndpointsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/ids/v1#ListEndpointsRequest. -// } -// it := c.ListEndpoints(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := ids.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &idspb.ListEndpointsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/ids/v1#ListEndpointsRequest. +// } +// it := c.ListEndpoints(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/internal/annotate.go b/internal/annotate.go index 6435695ba34..30d7bcf77ac 100644 --- a/internal/annotate.go +++ b/internal/annotate.go @@ -31,7 +31,8 @@ import ( // - "google.golang.org/api/googleapi".Error // If the error is not one of these types, Annotate behaves // like -// fmt.Errorf("%s: %v", msg, err) +// +// fmt.Errorf("%s: %v", msg, err) func Annotate(err error, msg string) error { if err == nil { panic("Annotate called with nil") diff --git a/internal/btree/btree.go b/internal/btree/btree.go index b494d9c05e9..ddfaa490857 100644 --- a/internal/btree/btree.go +++ b/internal/btree/btree.go @@ -26,7 +26,9 @@ // It has a flatter structure than an equivalent red-black or other binary tree, // which in some cases yields better memory usage and/or performance. // See some discussion on the matter here: -// http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html +// +// http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html +// // Note, though, that this project is in no way related to the C++ B-Tree // implementation written about there. // @@ -34,13 +36,14 @@ // slice of children. For basic numeric values or raw structs, this can cause // efficiency differences when compared to equivalent C++ template code that // stores values in arrays within the node: -// * Due to the overhead of storing values as interfaces (each +// - Due to the overhead of storing values as interfaces (each // value needs to be stored as the value itself, then 2 words for the // interface pointing to that value and its type), resulting in higher // memory use. -// * Since interfaces can point to values anywhere in memory, values are +// - Since interfaces can point to values anywhere in memory, values are // most likely not stored in contiguous blocks, resulting in a higher // number of cache misses. +// // These issues don't tend to matter, though, when working with strings or other // heap-allocated structures, since C++-equivalent structures also must store // pointers and also distribute their values across the heap. @@ -188,8 +191,8 @@ func (s *children) truncate(index int) { // node is an internal node in a tree. // // It must at all times maintain the invariant that either -// * len(children) == 0, len(items) unconstrained -// * len(children) == len(items) + 1 +// - len(children) == 0, len(items) unconstrained +// - len(children) == len(items) + 1 type node struct { items items children children @@ -478,15 +481,20 @@ func (n *node) remove(key Key, minItems int, typ toRemove, less lessFunc) (item, // remove it. // // Most documentation says we have to do two sets of special casing: -// 1) item is in this node -// 2) item is in child +// 1. item is in this node +// 2. item is in child +// // In both cases, we need to handle the two subcases: -// A) node has enough values that it can spare one -// B) node doesn't have enough values +// +// A) node has enough values that it can spare one +// B) node doesn't have enough values +// // For the latter, we have to check: -// a) left sibling has node to spare -// b) right sibling has node to spare -// c) we must merge +// +// a) left sibling has node to spare +// b) right sibling has node to spare +// c) we must merge +// // To simplify our code here, we handle cases #1 and #2 the same: // If a node doesn't have enough items, we make sure it does (using a,b,c). // We then simply redo our remove call, and the second time (regardless of diff --git a/internal/detect/detect.go b/internal/detect/detect.go index e1ed5ac18ad..91b8980fc80 100644 --- a/internal/detect/detect.go +++ b/internal/detect/detect.go @@ -38,9 +38,9 @@ var ( // ProjectID tries to detect the project ID from the environment if the sentinel // value, "*detect-project-id*", is sent. It looks in the following order: -// 1. GOOGLE_CLOUD_PROJECT envvar -// 2. ADC creds.ProjectID -// 3. A static value if the environment is emulated. +// 1. GOOGLE_CLOUD_PROJECT envvar +// 2. ADC creds.ProjectID +// 3. A static value if the environment is emulated. func ProjectID(ctx context.Context, projectID string, emulatorEnvVar string, opts ...option.ClientOption) (string, error) { if projectID != projectIDSentinel { return projectID, nil diff --git a/internal/fields/fields.go b/internal/fields/fields.go index 6d7cabb1811..12539043818 100644 --- a/internal/fields/fields.go +++ b/internal/fields/fields.go @@ -15,11 +15,11 @@ // Package fields provides a view of the fields of a struct that follows the Go // rules, amended to consider tags and case insensitivity. // -// Usage +// # Usage // // First define a function that interprets tags: // -// func parseTag(st reflect.StructTag) (name string, keep bool, other interface{}, err error) { ... } +// func parseTag(st reflect.StructTag) (name string, keep bool, other interface{}, err error) { ... } // // The function's return values describe whether to ignore the field // completely or provide an alternate name, as well as other data from the @@ -27,29 +27,29 @@ // // Then define a function to validate the type: // -// func validate(t reflect.Type) error { ... } +// func validate(t reflect.Type) error { ... } // // Then, if necessary, define a function to specify leaf types - types // which should be considered one field and not be recursed into: // -// func isLeafType(t reflect.Type) bool { ... } +// func isLeafType(t reflect.Type) bool { ... } // // eg: // -// func isLeafType(t reflect.Type) bool { -// return t == reflect.TypeOf(time.Time{}) -// } +// func isLeafType(t reflect.Type) bool { +// return t == reflect.TypeOf(time.Time{}) +// } // // Next, construct a Cache, passing your functions. As its name suggests, a // Cache remembers validation and field information for a type, so subsequent // calls with the same type are very fast. // -// cache := fields.NewCache(parseTag, validate, isLeafType) +// cache := fields.NewCache(parseTag, validate, isLeafType) // // To get the fields of a struct type as determined by the above rules, call // the Fields method: // -// fields, err := cache.Fields(reflect.TypeOf(MyStruct{})) +// fields, err := cache.Fields(reflect.TypeOf(MyStruct{})) // // The return value can be treated as a slice of Fields. // @@ -57,7 +57,7 @@ // call Match on the list of fields to find a field whose name is the best // match: // -// field := fields.Match(name) +// field := fields.Match(name) // // Match looks for an exact match first, then falls back to a case-insensitive // comparison. @@ -459,10 +459,12 @@ func dominantField(fs []Field) (Field, bool) { // ParseStandardTag extracts the sub-tag named by key, then parses it using the // de facto standard format introduced in encoding/json: -// "-" means "ignore this tag". It must occur by itself. (parseStandardTag returns an error -// in this case, whereas encoding/json accepts the "-" even if it is not alone.) -// "" provides an alternative name for the field -// ",opt1,opt2,..." specifies options after the name. +// +// "-" means "ignore this tag". It must occur by itself. (parseStandardTag returns an error +// in this case, whereas encoding/json accepts the "-" even if it is not alone.) +// "" provides an alternative name for the field +// ",opt1,opt2,..." specifies options after the name. +// // The options are returned as a []string. func ParseStandardTag(key string, t reflect.StructTag) (name string, keep bool, options []string, err error) { s := t.Get(key) diff --git a/internal/fields/fold.go b/internal/fields/fold.go index 5d895df2d16..dff59f22bb3 100644 --- a/internal/fields/fold.go +++ b/internal/fields/fold.go @@ -37,8 +37,9 @@ const ( // 4) simpleLetterEqualFold, no specials, no non-letters. // // The letters S and K are special because they map to 3 runes, not just 2: -// * S maps to s and to U+017F 'ſ' Latin small letter long s -// * k maps to K and to U+212A 'K' Kelvin sign +// - S maps to s and to U+017F 'ſ' Latin small letter long s +// - k maps to K and to U+212A 'K' Kelvin sign +// // See https://play.golang.org/p/tTxjOc0OGo // // The returned function is specialized for matching against s and diff --git a/internal/gapicgen/generator/genproto.go b/internal/gapicgen/generator/genproto.go index 8d4f70e57b9..582da268a47 100644 --- a/internal/gapicgen/generator/genproto.go +++ b/internal/gapicgen/generator/genproto.go @@ -257,7 +257,7 @@ func (g *GenprotoGenerator) getAllPackages() (map[string][]string, error) { } // moveAndCleanupGeneratedSrc moves all generated src to their correct locations -// in the repository, because protoc puts it in a folder called `generated/``. +// in the repository, because protoc puts it in a folder called `generated/“. func (g *GenprotoGenerator) moveAndCleanupGeneratedSrc() error { log.Println("moving generated code") // The period at the end is analogous to * (copy everything in this dir). diff --git a/internal/godocfx/main.go b/internal/godocfx/main.go index 0f2ef6b613b..b80b0cc2bd8 100644 --- a/internal/godocfx/main.go +++ b/internal/godocfx/main.go @@ -15,20 +15,21 @@ //go:build go1.15 // +build go1.15 -/*Command godocfx generates DocFX YAML for Go code. +/* +Command godocfx generates DocFX YAML for Go code. Usage: - godocfx [flags] path + godocfx [flags] path - # New modules with the given prefix. Delete any previous output. - godocfx -rm -project my-project -new-modules cloud.google.com/go - # Process a single module @latest. - godocfx cloud.google.com/go - # Process and print, instead of save. - godocfx -print cloud.google.com/go/storage@latest - # Change output directory. - godocfx -out custom/output/dir cloud.google.com/go + # New modules with the given prefix. Delete any previous output. + godocfx -rm -project my-project -new-modules cloud.google.com/go + # Process a single module @latest. + godocfx cloud.google.com/go + # Process and print, instead of save. + godocfx -print cloud.google.com/go/storage@latest + # Change output directory. + godocfx -out custom/output/dir cloud.google.com/go See: * https://dotnet.github.io/docfx/spec/metadata_format_spec.html diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go index c1908fd2b1c..374f6c8bc37 100644 --- a/iot/apiv1/doc.go +++ b/iot/apiv1/doc.go @@ -20,43 +20,44 @@ // Registers and manages IoT (Internet of Things) devices that connect to the // Google Cloud Platform. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := iot.NewDeviceManagerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := iot.NewDeviceManagerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := iot.NewDeviceManagerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &iotpb.CreateDeviceRegistryRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iot/v1#CreateDeviceRegistryRequest. -// } -// resp, err := c.CreateDeviceRegistry(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := iot.NewDeviceManagerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &iotpb.CreateDeviceRegistryRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iot/v1#CreateDeviceRegistryRequest. +// } +// resp, err := c.CreateDeviceRegistry(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go index 5993df68fd3..32f97ef507a 100644 --- a/kms/apiv1/doc.go +++ b/kms/apiv1/doc.go @@ -20,49 +20,50 @@ // Manages keys and performs cryptographic operations in a central cloud // service, for direct use by other cloud resources and applications. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := kms.NewEkmClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := kms.NewEkmClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := kms.NewEkmClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &kmspb.ListEkmConnectionsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/kms/v1#ListEkmConnectionsRequest. -// } -// it := c.ListEkmConnections(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := kms.NewEkmClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &kmspb.ListEkmConnectionsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/kms/v1#ListEkmConnectionsRequest. +// } +// it := c.ListEkmConnections(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/kms/apiv1/ekm_client.go b/kms/apiv1/ekm_client.go index 7b8cf18511f..2333f0d7d38 100644 --- a/kms/apiv1/ekm_client.go +++ b/kms/apiv1/ekm_client.go @@ -134,12 +134,12 @@ type internalEkmClient interface { // EkmClient is a client for interacting with Cloud Key Management Service (KMS) API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Google Cloud Key Management EKM Service +// # Google Cloud Key Management EKM Service // // Manages external cryptographic keys and operations using those keys. // Implements a REST model with the following objects: // -// EkmConnection +// EkmConnection type EkmClient struct { // The internal transport-dependent client. internalClient internalEkmClient @@ -243,12 +243,12 @@ type ekmGRPCClient struct { // NewEkmClient creates a new ekm service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Google Cloud Key Management EKM Service +// # Google Cloud Key Management EKM Service // // Manages external cryptographic keys and operations using those keys. // Implements a REST model with the following objects: // -// EkmConnection +// EkmConnection func NewEkmClient(ctx context.Context, opts ...option.ClientOption) (*EkmClient, error) { clientOpts := defaultEkmGRPCClientOptions() if newEkmClientHook != nil { diff --git a/kms/apiv1/key_management_client.go b/kms/apiv1/key_management_client.go index ddc40762e67..9ea51ecb7b2 100644 --- a/kms/apiv1/key_management_client.go +++ b/kms/apiv1/key_management_client.go @@ -420,18 +420,18 @@ type internalKeyManagementClient interface { // KeyManagementClient is a client for interacting with Cloud Key Management Service (KMS) API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Google Cloud Key Management Service +// # Google Cloud Key Management Service // // Manages cryptographic keys and operations using those keys. Implements a REST // model with the following objects: // -// KeyRing +// KeyRing // -// CryptoKey +// CryptoKey // -// CryptoKeyVersion +// CryptoKeyVersion // -// ImportJob +// ImportJob // // If you are using manual gRPC libraries, see // Using gRPC with Cloud KMS (at https://cloud.google.com/kms/docs/grpc). @@ -740,18 +740,18 @@ type keyManagementGRPCClient struct { // NewKeyManagementClient creates a new key management service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Google Cloud Key Management Service +// # Google Cloud Key Management Service // // Manages cryptographic keys and operations using those keys. Implements a REST // model with the following objects: // -// KeyRing +// KeyRing // -// CryptoKey +// CryptoKey // -// CryptoKeyVersion +// CryptoKeyVersion // -// ImportJob +// ImportJob // // If you are using manual gRPC libraries, see // Using gRPC with Cloud KMS (at https://cloud.google.com/kms/docs/grpc). diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go index 9b89fc609de..f1b3b326a93 100644 --- a/language/apiv1/doc.go +++ b/language/apiv1/doc.go @@ -21,43 +21,44 @@ // analysis, entity recognition, entity sentiment analysis, and other text // annotations, to developers. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := language.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := language.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := language.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &languagepb.AnalyzeSentimentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/language/v1#AnalyzeSentimentRequest. -// } -// resp, err := c.AnalyzeSentiment(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := language.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &languagepb.AnalyzeSentimentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/language/v1#AnalyzeSentimentRequest. +// } +// resp, err := c.AnalyzeSentiment(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go index 9b5ba08b2fd..d02f914bf47 100644 --- a/language/apiv1beta2/doc.go +++ b/language/apiv1beta2/doc.go @@ -21,45 +21,46 @@ // technologies to developers. Examples include sentiment analysis, entity // recognition, and text annotations. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := language.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := language.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := language.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &languagepb.AnalyzeSentimentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/language/v1beta2#AnalyzeSentimentRequest. -// } -// resp, err := c.AnalyzeSentiment(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := language.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &languagepb.AnalyzeSentimentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/language/v1beta2#AnalyzeSentimentRequest. +// } +// resp, err := c.AnalyzeSentiment(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/lifesciences/apiv2beta/doc.go b/lifesciences/apiv2beta/doc.go index ec242eb6934..b0fc143a160 100644 --- a/lifesciences/apiv2beta/doc.go +++ b/lifesciences/apiv2beta/doc.go @@ -20,50 +20,51 @@ // Cloud Life Sciences is a suite of services and tools for managing, // processing, and transforming life sciences data. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := lifesciences.NewWorkflowsServiceV2BetaClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := lifesciences.NewWorkflowsServiceV2BetaClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := lifesciences.NewWorkflowsServiceV2BetaClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &lifesciencespb.RunPipelineRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/lifesciences/v2beta#RunPipelineRequest. -// } -// op, err := c.RunPipeline(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := lifesciences.NewWorkflowsServiceV2BetaClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &lifesciencespb.RunPipelineRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/lifesciences/v2beta#RunPipelineRequest. +// } +// op, err := c.RunPipeline(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/lifesciences/apiv2beta/workflows_service_v2_beta_client.go b/lifesciences/apiv2beta/workflows_service_v2_beta_client.go index da133f5de96..66ff6f1d462 100644 --- a/lifesciences/apiv2beta/workflows_service_v2_beta_client.go +++ b/lifesciences/apiv2beta/workflows_service_v2_beta_client.go @@ -137,7 +137,7 @@ func (c *WorkflowsServiceV2BetaClient) Connection() *grpc.ClientConn { // Authorization requires the following Google // IAM (at https://cloud.google.com/iam/) permission: // -// lifesciences.workflows.run +// lifesciences.workflows.run func (c *WorkflowsServiceV2BetaClient) RunPipeline(ctx context.Context, req *lifesciencespb.RunPipelineRequest, opts ...gax.CallOption) (*RunPipelineOperation, error) { return c.internalClient.RunPipeline(ctx, req, opts...) } @@ -369,7 +369,7 @@ func (c *workflowsServiceV2BetaGRPCClient) RunPipeline(ctx context.Context, req // Authorization requires the following Google // IAM (at https://cloud.google.com/iam/) permission: // -// lifesciences.workflows.run +// lifesciences.workflows.run func (c *workflowsServiceV2BetaRESTClient) RunPipeline(ctx context.Context, req *lifesciencespb.RunPipelineRequest, opts ...gax.CallOption) (*RunPipelineOperation, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go index 4fcf15399b6..0cac3214af3 100644 --- a/logging/apiv2/doc.go +++ b/logging/apiv2/doc.go @@ -19,41 +19,42 @@ // // Writes log entries and manages your Cloud Logging configuration. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := logging.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := logging.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := logging.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &loggingpb.DeleteLogRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#DeleteLogRequest. -// } -// err = c.DeleteLog(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// Use of Context +// ctx := context.Background() +// c, err := logging.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &loggingpb.DeleteLogRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#DeleteLogRequest. +// } +// err = c.DeleteLog(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/logging/apiv2/path_funcs.go b/logging/apiv2/path_funcs.go index 37bbe9d4f44..722a2004752 100644 --- a/logging/apiv2/path_funcs.go +++ b/logging/apiv2/path_funcs.go @@ -17,7 +17,9 @@ package logging // ConfigProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func ConfigProjectPath(project string) string { return "" + @@ -29,7 +31,9 @@ func ConfigProjectPath(project string) string { // ConfigSinkPath returns the path for the sink resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/sinks/%s", project, sink) +// +// fmt.Sprintf("projects/%s/sinks/%s", project, sink) +// // instead. func ConfigSinkPath(project, sink string) string { return "" + @@ -43,7 +47,9 @@ func ConfigSinkPath(project, sink string) string { // ConfigExclusionPath returns the path for the exclusion resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/exclusions/%s", project, exclusion) +// +// fmt.Sprintf("projects/%s/exclusions/%s", project, exclusion) +// // instead. func ConfigExclusionPath(project, exclusion string) string { return "" + @@ -57,7 +63,9 @@ func ConfigExclusionPath(project, exclusion string) string { // ProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func ProjectPath(project string) string { return "" + @@ -69,7 +77,9 @@ func ProjectPath(project string) string { // LogPath returns the path for the log resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/logs/%s", project, log) +// +// fmt.Sprintf("projects/%s/logs/%s", project, log) +// // instead. func LogPath(project, log string) string { return "" + @@ -83,7 +93,9 @@ func LogPath(project, log string) string { // MetricsProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func MetricsProjectPath(project string) string { return "" + @@ -95,7 +107,9 @@ func MetricsProjectPath(project string) string { // MetricsMetricPath returns the path for the metric resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/metrics/%s", project, metric) +// +// fmt.Sprintf("projects/%s/metrics/%s", project, metric) +// // instead. func MetricsMetricPath(project, metric string) string { return "" + diff --git a/logging/doc.go b/logging/doc.go index e3a9afdff1e..343d99e0c64 100644 --- a/logging/doc.go +++ b/logging/doc.go @@ -20,8 +20,7 @@ see package cloud.google.com/go/logging/logadmin. This client uses Logging API v2. See https://cloud.google.com/logging/docs/api/v2/ for an introduction to the API. - -Creating a Client +# Creating a Client Use a Client to interact with the Cloud Logging API. @@ -32,8 +31,7 @@ Use a Client to interact with the Cloud Logging API. // TODO: Handle error. } - -Basic Usage +# Basic Usage For most use cases, you'll want to add log entries to a buffer to be periodically flushed (automatically and asynchronously) to the Cloud Logging service. @@ -44,8 +42,7 @@ flushed (automatically and asynchronously) to the Cloud Logging service. // Add entry to log buffer lg.Log(logging.Entry{Payload: "something happened!"}) - -Closing your Client +# Closing your Client You should call Client.Close before your program exits to flush any buffered log entries to the Cloud Logging service. @@ -55,8 +52,7 @@ You should call Client.Close before your program exits to flush any buffered log // TODO: Handle error. } - -Synchronous Logging +# Synchronous Logging For critical errors, you may want to send your log entries immediately. LogSync is slow and will block until the log entry has been sent, so it is @@ -67,8 +63,7 @@ not recommended for normal use. // TODO: Handle error. } - -Redirecting log ingestion +# Redirecting log ingestion For cases when runtime environment supports out-of-process log ingestion, like logging agent, you can opt-in to write log entries to io.Writer instead of @@ -78,12 +73,10 @@ The entries will be Jsonified and wrote as one line strings following the struct See https://cloud.google.com/logging/docs/structured-logging#special-payload-fields for the format description. To instruct Logger to redirect log entries add RedirectAsJSON() LoggerOption`s. - // Create a logger to print structured logs formatted as a single line Json to stdout loggger := client.Logger("test-log", RedirectAsJSON(os.Stdout)) - -Payloads +# Payloads An entry payload can be a string, as in the examples above. It can also be any value that can be marshaled to a JSON object, like a map[string]interface{} or a struct: @@ -101,16 +94,16 @@ If you have a []byte of JSON, wrap it in json.RawMessage: If you have proto.Message and want to send it as a protobuf payload, marshal it to anypb.Any: - // import - func logMessage (m proto.Message) { - var payload anypb.Any - err := anypb.MarshalFrom(&payload, m) - if err != nil { - lg.Log(logging.Entry{Payload: payload}) + // import + func logMessage (m proto.Message) { + var payload anypb.Any + err := anypb.MarshalFrom(&payload, m) + if err != nil { + lg.Log(logging.Entry{Payload: payload}) + } } - } -The Standard Logger +# The Standard Logger You may want use a standard log.Logger in your program. @@ -118,8 +111,7 @@ You may want use a standard log.Logger in your program. stdlg := lg.StandardLogger(logging.Info) stdlg.Println("some info") - -Log Levels +# Log Levels An Entry may have one of a number of severity levels associated with it. @@ -128,8 +120,7 @@ An Entry may have one of a number of severity levels associated with it. Severity: logging.Critical, } - -Viewing Logs +# Viewing Logs You can view Cloud logs for projects at https://console.cloud.google.com/logs/viewer. Use the dropdown at the top left. When @@ -137,15 +128,14 @@ running from a Google Cloud Platform VM, select "GCE VM Instance". Otherwise, se "Google Project" and then the project ID. Logs for organizations, folders and billing accounts can be viewed on the command line with the "gcloud logging read" command. - -Grouping Logs by Request +# Grouping Logs by Request To group all the log entries written during a single HTTP request, create two Loggers, a "parent" and a "child," with different log IDs. Both should be in the same project, and have the same MonitoredResource type and labels. -- Parent entries must have HTTPRequest.Request (strictly speaking, only Method and URL are necessary), - and HTTPRequest.Status populated. + - Parent entries must have HTTPRequest.Request (strictly speaking, only Method and URL are necessary), + and HTTPRequest.Status populated. - A child entry's timestamp must be within the time interval covered by the parent request. (i.e., before the parent.Timestamp and after the parent.Timestamp - parent.HTTPRequest.Latency. This assumes the diff --git a/logging/logging.go b/logging/logging.go index 4f26a19342a..bbd9a4fcbc8 100644 --- a/logging/logging.go +++ b/logging/logging.go @@ -134,10 +134,12 @@ type Client struct { // NewClient returns a new logging client associated with the provided parent. // A parent can take any of the following forms: -// projects/PROJECT_ID -// folders/FOLDER_ID -// billingAccounts/ACCOUNT_ID -// organizations/ORG_ID +// +// projects/PROJECT_ID +// folders/FOLDER_ID +// billingAccounts/ACCOUNT_ID +// organizations/ORG_ID +// // for backwards compatibility, a string with no '/' is also allowed and is interpreted // as a project ID. // @@ -804,10 +806,12 @@ func deconstructXCloudTraceContext(s string) (traceID, spanID string, traceSampl // ToLogEntry takes an Entry structure and converts it to the LogEntry proto. // A parent can take any of the following forms: -// projects/PROJECT_ID -// folders/FOLDER_ID -// billingAccounts/ACCOUNT_ID -// organizations/ORG_ID +// +// projects/PROJECT_ID +// folders/FOLDER_ID +// billingAccounts/ACCOUNT_ID +// organizations/ORG_ID +// // for backwards compatibility, a string with no '/' is also allowed and is interpreted // as a project ID. // diff --git a/logging/logging_test.go b/logging/logging_test.go index 1f07c7ba7f8..bd01c3b5433 100644 --- a/logging/logging_test.go +++ b/logging/logging_test.go @@ -895,7 +895,8 @@ func waitFor(f func() bool) bool { // Interleave a lot of Log and Flush calls, to induce race conditions. // Run this test with: -// go test -run LogFlushRace -race -count 100 +// +// go test -run LogFlushRace -race -count 100 func TestLogFlushRace(t *testing.T) { initLogs() // Generate new testLogID lg := client.Logger(testLogID, diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go index ac003a01094..6138613fd11 100644 --- a/longrunning/autogen/doc.go +++ b/longrunning/autogen/doc.go @@ -17,51 +17,52 @@ // Package longrunning is an auto-generated package for the // Long Running Operations API. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := longrunning.NewOperationsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := longrunning.NewOperationsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := longrunning.NewOperationsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &longrunningpb.ListOperationsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#ListOperationsRequest. -// } -// it := c.ListOperations(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := longrunning.NewOperationsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &longrunningpb.ListOperationsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#ListOperationsRequest. +// } +// it := c.ListOperations(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/managedidentities/apiv1/doc.go b/managedidentities/apiv1/doc.go index 46cca519c2b..9dfc107d568 100644 --- a/managedidentities/apiv1/doc.go +++ b/managedidentities/apiv1/doc.go @@ -21,48 +21,49 @@ // managing a highly available, hardened service running Microsoft Active // Directory (AD). // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := managedidentities.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := managedidentities.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := managedidentities.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &managedidentitiespb.CreateMicrosoftAdDomainRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/managedidentities/v1#CreateMicrosoftAdDomainRequest. -// } -// op, err := c.CreateMicrosoftAdDomain(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := managedidentities.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &managedidentitiespb.CreateMicrosoftAdDomainRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/managedidentities/v1#CreateMicrosoftAdDomainRequest. +// } +// op, err := c.CreateMicrosoftAdDomain(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/managedidentities/apiv1/managed_identities_client.go b/managedidentities/apiv1/managed_identities_client.go index 3ee4091d867..d4befe7cf25 100644 --- a/managedidentities/apiv1/managed_identities_client.go +++ b/managedidentities/apiv1/managed_identities_client.go @@ -107,7 +107,7 @@ type internalClient interface { // Client is a client for interacting with Managed Service for Microsoft Active Directory API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// API Overview +// # API Overview // // The managedidentites.googleapis.com service implements the Google Cloud // Managed Identites API for identity services @@ -117,35 +117,35 @@ type internalClient interface { // (create/read/update/delete) domains, reset managed identities admin password, // add/remove domain controllers in GCP regions and add/remove VPC peering. // -// Data Model +// # Data Model // // The Managed Identities service exposes the following resources: // -// Locations as global, named as follows: -// projects/{project_id}/locations/global. +// Locations as global, named as follows: +// projects/{project_id}/locations/global. // -// Domains, named as follows: -// /projects/{project_id}/locations/global/domain/{domain_name}. +// Domains, named as follows: +// /projects/{project_id}/locations/global/domain/{domain_name}. // // The {domain_name} refers to fully qualified domain name in the customer // project e.g. mydomain.myorganization.com (at http://mydomain.myorganization.com), with the following restrictions: // -// Must contain only lowercase letters, numbers, periods and hyphens. +// Must contain only lowercase letters, numbers, periods and hyphens. // -// Must start with a letter. +// Must start with a letter. // -// Must contain between 2-64 characters. +// Must contain between 2-64 characters. // -// Must end with a number or a letter. +// Must end with a number or a letter. // -// Must not start with period. +// Must not start with period. // -// First segement length (mydomain form example above) shouldn’t exceed -// 15 chars. +// First segement length (mydomain form example above) shouldn’t exceed +// 15 chars. // -// The last segment cannot be fully numeric. +// The last segment cannot be fully numeric. // -// Must be unique within the customer project. +// Must be unique within the customer project. type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -302,7 +302,7 @@ type gRPCClient struct { // NewClient creates a new managed identities service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// API Overview +// # API Overview // // The managedidentites.googleapis.com service implements the Google Cloud // Managed Identites API for identity services @@ -312,35 +312,35 @@ type gRPCClient struct { // (create/read/update/delete) domains, reset managed identities admin password, // add/remove domain controllers in GCP regions and add/remove VPC peering. // -// Data Model +// # Data Model // // The Managed Identities service exposes the following resources: // -// Locations as global, named as follows: -// projects/{project_id}/locations/global. +// Locations as global, named as follows: +// projects/{project_id}/locations/global. // -// Domains, named as follows: -// /projects/{project_id}/locations/global/domain/{domain_name}. +// Domains, named as follows: +// /projects/{project_id}/locations/global/domain/{domain_name}. // // The {domain_name} refers to fully qualified domain name in the customer // project e.g. mydomain.myorganization.com (at http://mydomain.myorganization.com), with the following restrictions: // -// Must contain only lowercase letters, numbers, periods and hyphens. +// Must contain only lowercase letters, numbers, periods and hyphens. // -// Must start with a letter. +// Must start with a letter. // -// Must contain between 2-64 characters. +// Must contain between 2-64 characters. // -// Must end with a number or a letter. +// Must end with a number or a letter. // -// Must not start with period. +// Must not start with period. // -// First segement length (mydomain form example above) shouldn’t exceed -// 15 chars. +// First segement length (mydomain form example above) shouldn’t exceed +// 15 chars. // -// The last segment cannot be fully numeric. +// The last segment cannot be fully numeric. // -// Must be unique within the customer project. +// Must be unique within the customer project. func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { diff --git a/mediatranslation/apiv1beta1/doc.go b/mediatranslation/apiv1beta1/doc.go index 6af644b1bc5..1fbe2de04c2 100644 --- a/mediatranslation/apiv1beta1/doc.go +++ b/mediatranslation/apiv1beta1/doc.go @@ -17,60 +17,61 @@ // Package mediatranslation is an auto-generated package for the // Media Translation API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := mediatranslation.NewSpeechTranslationClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := mediatranslation.NewSpeechTranslationClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := mediatranslation.NewSpeechTranslationClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// stream, err := c.StreamingTranslateSpeech(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// go func() { -// reqs := []*mediatranslationpb.StreamingTranslateSpeechRequest{ -// // TODO: Create requests. -// } -// for _, req := range reqs { -// if err := stream.Send(req); err != nil { -// // TODO: Handle error. -// } -// } -// stream.CloseSend() -// }() -// for { -// resp, err := stream.Recv() -// if err == io.EOF { -// break -// } -// if err != nil { -// // TODO: handle error. -// } -// // TODO: Use resp. -// _ = resp -// } +// ctx := context.Background() +// c, err := mediatranslation.NewSpeechTranslationClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// stream, err := c.StreamingTranslateSpeech(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// go func() { +// reqs := []*mediatranslationpb.StreamingTranslateSpeechRequest{ +// // TODO: Create requests. +// } +// for _, req := range reqs { +// if err := stream.Send(req); err != nil { +// // TODO: Handle error. +// } +// } +// stream.CloseSend() +// }() +// for { +// resp, err := stream.Recv() +// if err == io.EOF { +// break +// } +// if err != nil { +// // TODO: handle error. +// } +// // TODO: Use resp. +// _ = resp +// } // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/memcache/apiv1/cloud_memcache_client.go b/memcache/apiv1/cloud_memcache_client.go index 5ea4b0b2891..caede0a0b48 100644 --- a/memcache/apiv1/cloud_memcache_client.go +++ b/memcache/apiv1/cloud_memcache_client.go @@ -102,19 +102,19 @@ type internalCloudMemcacheClient interface { // for Memcached API and defines the following resource model for managing // Memorystore Memcached (also called Memcached below) instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Memcached instances, named: -// /instances/* +// Each location has a collection of Memcached instances, named: +// /instances/* // -// As such, Memcached instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Memcached instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be a GCP region; for example: // -// projects/my-memcached-project/locations/us-central1/instances/my-memcached +// projects/my-memcached-project/locations/us-central1/instances/my-memcached type CloudMemcacheClient struct { // The internal transport-dependent client. internalClient internalCloudMemcacheClient @@ -252,19 +252,19 @@ type cloudMemcacheGRPCClient struct { // for Memcached API and defines the following resource model for managing // Memorystore Memcached (also called Memcached below) instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Memcached instances, named: -// /instances/* +// Each location has a collection of Memcached instances, named: +// /instances/* // -// As such, Memcached instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Memcached instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be a GCP region; for example: // -// projects/my-memcached-project/locations/us-central1/instances/my-memcached +// projects/my-memcached-project/locations/us-central1/instances/my-memcached func NewCloudMemcacheClient(ctx context.Context, opts ...option.ClientOption) (*CloudMemcacheClient, error) { clientOpts := defaultCloudMemcacheGRPCClientOptions() if newCloudMemcacheClientHook != nil { diff --git a/memcache/apiv1/doc.go b/memcache/apiv1/doc.go index a749da18211..8a3b3ce7046 100644 --- a/memcache/apiv1/doc.go +++ b/memcache/apiv1/doc.go @@ -20,49 +20,50 @@ // Google Cloud Memorystore for Memcached API is used for creating and // managing Memcached instances in GCP. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := memcache.NewCloudMemcacheClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := memcache.NewCloudMemcacheClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := memcache.NewCloudMemcacheClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &memcachepb.ListInstancesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/memcache/v1#ListInstancesRequest. -// } -// it := c.ListInstances(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := memcache.NewCloudMemcacheClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &memcachepb.ListInstancesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/memcache/v1#ListInstancesRequest. +// } +// it := c.ListInstances(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/memcache/apiv1beta2/cloud_memcache_client.go b/memcache/apiv1beta2/cloud_memcache_client.go index 10a990dc5d1..96e5de0f7c8 100644 --- a/memcache/apiv1beta2/cloud_memcache_client.go +++ b/memcache/apiv1beta2/cloud_memcache_client.go @@ -125,19 +125,19 @@ type internalCloudMemcacheClient interface { // for Memcached API and defines the following resource model for managing // Memorystore Memcached (also called Memcached below) instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Memcached instances, named: -// /instances/* +// Each location has a collection of Memcached instances, named: +// /instances/* // -// As such, Memcached instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Memcached instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be a GCP region; for example: // -// projects/my-memcached-project/locations/us-central1/instances/my-memcached +// projects/my-memcached-project/locations/us-central1/instances/my-memcached type CloudMemcacheClient struct { // The internal transport-dependent client. internalClient internalCloudMemcacheClient @@ -287,19 +287,19 @@ type cloudMemcacheGRPCClient struct { // for Memcached API and defines the following resource model for managing // Memorystore Memcached (also called Memcached below) instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Memcached instances, named: -// /instances/* +// Each location has a collection of Memcached instances, named: +// /instances/* // -// As such, Memcached instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Memcached instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be a GCP region; for example: // -// projects/my-memcached-project/locations/us-central1/instances/my-memcached +// projects/my-memcached-project/locations/us-central1/instances/my-memcached func NewCloudMemcacheClient(ctx context.Context, opts ...option.ClientOption) (*CloudMemcacheClient, error) { clientOpts := defaultCloudMemcacheGRPCClientOptions() if newCloudMemcacheClientHook != nil { @@ -395,19 +395,19 @@ type cloudMemcacheRESTClient struct { // for Memcached API and defines the following resource model for managing // Memorystore Memcached (also called Memcached below) instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Memcached instances, named: -// /instances/* +// Each location has a collection of Memcached instances, named: +// /instances/* // -// As such, Memcached instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Memcached instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be a GCP region; for example: // -// projects/my-memcached-project/locations/us-central1/instances/my-memcached +// projects/my-memcached-project/locations/us-central1/instances/my-memcached func NewCloudMemcacheRESTClient(ctx context.Context, opts ...option.ClientOption) (*CloudMemcacheClient, error) { clientOpts := append(defaultCloudMemcacheRESTClientOptions(), opts...) httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) diff --git a/memcache/apiv1beta2/doc.go b/memcache/apiv1beta2/doc.go index 30f78b92188..5cdfac59e33 100644 --- a/memcache/apiv1beta2/doc.go +++ b/memcache/apiv1beta2/doc.go @@ -20,51 +20,52 @@ // Google Cloud Memorystore for Memcached API is used for creating and // managing Memcached instances in GCP. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := memcache.NewCloudMemcacheClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := memcache.NewCloudMemcacheClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := memcache.NewCloudMemcacheClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &memcachepb.ListInstancesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/memcache/v1beta2#ListInstancesRequest. -// } -// it := c.ListInstances(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := memcache.NewCloudMemcacheClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &memcachepb.ListInstancesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/memcache/v1beta2#ListInstancesRequest. +// } +// it := c.ListInstances(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/metastore/apiv1/dataproc_metastore_client.go b/metastore/apiv1/dataproc_metastore_client.go index 4843c76d985..d9c1082e072 100644 --- a/metastore/apiv1/dataproc_metastore_client.go +++ b/metastore/apiv1/dataproc_metastore_client.go @@ -194,15 +194,15 @@ type internalDataprocMetastoreClient interface { // // The Dataproc Metastore API defines the following resource model: // -// The service works with a collection of Google Cloud projects, named: -// /projects/* +// The service works with a collection of Google Cloud projects, named: +// /projects/* // -// Each project has a collection of available locations, named: /locations/* -// (a location must refer to a Google Cloud region) +// Each project has a collection of available locations, named: /locations/* +// (a location must refer to a Google Cloud region) // -// Each location has a collection of services, named: /services/* +// Each location has a collection of services, named: /services/* // -// Dataproc Metastore services are resources with names of the form: +// Dataproc Metastore services are resources with names of the form: // // /projects/{project_number}/locations/{location_id}/services/{service_id}. type DataprocMetastoreClient struct { @@ -407,15 +407,15 @@ type dataprocMetastoreGRPCClient struct { // // The Dataproc Metastore API defines the following resource model: // -// The service works with a collection of Google Cloud projects, named: -// /projects/* +// The service works with a collection of Google Cloud projects, named: +// /projects/* // -// Each project has a collection of available locations, named: /locations/* -// (a location must refer to a Google Cloud region) +// Each project has a collection of available locations, named: /locations/* +// (a location must refer to a Google Cloud region) // -// Each location has a collection of services, named: /services/* +// Each location has a collection of services, named: /services/* // -// Dataproc Metastore services are resources with names of the form: +// Dataproc Metastore services are resources with names of the form: // // /projects/{project_number}/locations/{location_id}/services/{service_id}. func NewDataprocMetastoreClient(ctx context.Context, opts ...option.ClientOption) (*DataprocMetastoreClient, error) { diff --git a/metastore/apiv1/doc.go b/metastore/apiv1/doc.go index fd7f5f2f971..dd1fb9c4491 100644 --- a/metastore/apiv1/doc.go +++ b/metastore/apiv1/doc.go @@ -20,49 +20,50 @@ // The Dataproc Metastore API is used to manage the lifecycle and // configuration of metastore services. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := metastore.NewDataprocMetastoreClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := metastore.NewDataprocMetastoreClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := metastore.NewDataprocMetastoreClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &metastorepb.ListServicesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/metastore/v1#ListServicesRequest. -// } -// it := c.ListServices(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := metastore.NewDataprocMetastoreClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &metastorepb.ListServicesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/metastore/v1#ListServicesRequest. +// } +// it := c.ListServices(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/metastore/apiv1alpha/dataproc_metastore_client.go b/metastore/apiv1alpha/dataproc_metastore_client.go index 66d4b898b38..cddc56b9a5f 100644 --- a/metastore/apiv1alpha/dataproc_metastore_client.go +++ b/metastore/apiv1alpha/dataproc_metastore_client.go @@ -194,15 +194,15 @@ type internalDataprocMetastoreClient interface { // // The Dataproc Metastore API defines the following resource model: // -// The service works with a collection of Google Cloud projects, named: -// /projects/* +// The service works with a collection of Google Cloud projects, named: +// /projects/* // -// Each project has a collection of available locations, named: /locations/* -// (a location must refer to a Google Cloud region) +// Each project has a collection of available locations, named: /locations/* +// (a location must refer to a Google Cloud region) // -// Each location has a collection of services, named: /services/* +// Each location has a collection of services, named: /services/* // -// Dataproc Metastore services are resources with names of the form: +// Dataproc Metastore services are resources with names of the form: // // /projects/{project_number}/locations/{location_id}/services/{service_id}. type DataprocMetastoreClient struct { @@ -407,15 +407,15 @@ type dataprocMetastoreGRPCClient struct { // // The Dataproc Metastore API defines the following resource model: // -// The service works with a collection of Google Cloud projects, named: -// /projects/* +// The service works with a collection of Google Cloud projects, named: +// /projects/* // -// Each project has a collection of available locations, named: /locations/* -// (a location must refer to a Google Cloud region) +// Each project has a collection of available locations, named: /locations/* +// (a location must refer to a Google Cloud region) // -// Each location has a collection of services, named: /services/* +// Each location has a collection of services, named: /services/* // -// Dataproc Metastore services are resources with names of the form: +// Dataproc Metastore services are resources with names of the form: // // /projects/{project_number}/locations/{location_id}/services/{service_id}. func NewDataprocMetastoreClient(ctx context.Context, opts ...option.ClientOption) (*DataprocMetastoreClient, error) { diff --git a/metastore/apiv1alpha/doc.go b/metastore/apiv1alpha/doc.go index 7ed0c223c36..9a216fd25dd 100644 --- a/metastore/apiv1alpha/doc.go +++ b/metastore/apiv1alpha/doc.go @@ -20,51 +20,52 @@ // The Dataproc Metastore API is used to manage the lifecycle and // configuration of metastore services. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := metastore.NewDataprocMetastoreClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := metastore.NewDataprocMetastoreClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := metastore.NewDataprocMetastoreClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &metastorepb.ListServicesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/metastore/v1alpha#ListServicesRequest. -// } -// it := c.ListServices(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := metastore.NewDataprocMetastoreClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &metastorepb.ListServicesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/metastore/v1alpha#ListServicesRequest. +// } +// it := c.ListServices(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/metastore/apiv1beta/dataproc_metastore_client.go b/metastore/apiv1beta/dataproc_metastore_client.go index 4cdfa59c09c..bbb272b6d9a 100644 --- a/metastore/apiv1beta/dataproc_metastore_client.go +++ b/metastore/apiv1beta/dataproc_metastore_client.go @@ -274,15 +274,15 @@ type internalDataprocMetastoreClient interface { // // The Dataproc Metastore API defines the following resource model: // -// The service works with a collection of Google Cloud projects, named: -// /projects/* +// The service works with a collection of Google Cloud projects, named: +// /projects/* // -// Each project has a collection of available locations, named: /locations/* -// (a location must refer to a Google Cloud region) +// Each project has a collection of available locations, named: /locations/* +// (a location must refer to a Google Cloud region) // -// Each location has a collection of services, named: /services/* +// Each location has a collection of services, named: /services/* // -// Dataproc Metastore services are resources with names of the form: +// Dataproc Metastore services are resources with names of the form: // // /projects/{project_number}/locations/{location_id}/services/{service_id}. type DataprocMetastoreClient struct { @@ -487,15 +487,15 @@ type dataprocMetastoreGRPCClient struct { // // The Dataproc Metastore API defines the following resource model: // -// The service works with a collection of Google Cloud projects, named: -// /projects/* +// The service works with a collection of Google Cloud projects, named: +// /projects/* // -// Each project has a collection of available locations, named: /locations/* -// (a location must refer to a Google Cloud region) +// Each project has a collection of available locations, named: /locations/* +// (a location must refer to a Google Cloud region) // -// Each location has a collection of services, named: /services/* +// Each location has a collection of services, named: /services/* // -// Dataproc Metastore services are resources with names of the form: +// Dataproc Metastore services are resources with names of the form: // // /projects/{project_number}/locations/{location_id}/services/{service_id}. func NewDataprocMetastoreClient(ctx context.Context, opts ...option.ClientOption) (*DataprocMetastoreClient, error) { @@ -596,15 +596,15 @@ type dataprocMetastoreRESTClient struct { // // The Dataproc Metastore API defines the following resource model: // -// The service works with a collection of Google Cloud projects, named: -// /projects/* +// The service works with a collection of Google Cloud projects, named: +// /projects/* // -// Each project has a collection of available locations, named: /locations/* -// (a location must refer to a Google Cloud region) +// Each project has a collection of available locations, named: /locations/* +// (a location must refer to a Google Cloud region) // -// Each location has a collection of services, named: /services/* +// Each location has a collection of services, named: /services/* // -// Dataproc Metastore services are resources with names of the form: +// Dataproc Metastore services are resources with names of the form: // // /projects/{project_number}/locations/{location_id}/services/{service_id}. func NewDataprocMetastoreRESTClient(ctx context.Context, opts ...option.ClientOption) (*DataprocMetastoreClient, error) { diff --git a/metastore/apiv1beta/doc.go b/metastore/apiv1beta/doc.go index 43934db7626..1e02648b571 100644 --- a/metastore/apiv1beta/doc.go +++ b/metastore/apiv1beta/doc.go @@ -20,51 +20,52 @@ // The Dataproc Metastore API is used to manage the lifecycle and // configuration of metastore services. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := metastore.NewDataprocMetastoreClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := metastore.NewDataprocMetastoreClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := metastore.NewDataprocMetastoreClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &metastorepb.ListServicesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/metastore/v1beta#ListServicesRequest. -// } -// it := c.ListServices(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := metastore.NewDataprocMetastoreClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &metastorepb.ListServicesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/metastore/v1beta#ListServicesRequest. +// } +// it := c.ListServices(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/monitoring/apiv3/doc.go b/monitoring/apiv3/doc.go index 41af4633494..5c01dfc7f13 100644 --- a/monitoring/apiv3/doc.go +++ b/monitoring/apiv3/doc.go @@ -24,7 +24,7 @@ // concepts found in the table entries, read the [Cloud Monitoring // documentation](https://cloud.google.com/monitoring/docs). // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/monitoring/apiv3/path_funcs.go b/monitoring/apiv3/path_funcs.go index b2b514ba528..ed03aa6d6a6 100644 --- a/monitoring/apiv3/path_funcs.go +++ b/monitoring/apiv3/path_funcs.go @@ -17,7 +17,9 @@ package monitoring // GroupProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func GroupProjectPath(project string) string { return "" + @@ -29,7 +31,9 @@ func GroupProjectPath(project string) string { // GroupGroupPath returns the path for the group resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/groups/%s", project, group) +// +// fmt.Sprintf("projects/%s/groups/%s", project, group) +// // instead. func GroupGroupPath(project, group string) string { return "" + @@ -43,7 +47,9 @@ func GroupGroupPath(project, group string) string { // MetricProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func MetricProjectPath(project string) string { return "" + @@ -55,7 +61,9 @@ func MetricProjectPath(project string) string { // MetricMetricDescriptorPath returns the path for the metric descriptor resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/metricDescriptors/%s", project, metricDescriptor) +// +// fmt.Sprintf("projects/%s/metricDescriptors/%s", project, metricDescriptor) +// // instead. func MetricMetricDescriptorPath(project, metricDescriptor string) string { return "" + @@ -69,7 +77,9 @@ func MetricMetricDescriptorPath(project, metricDescriptor string) string { // MetricMonitoredResourceDescriptorPath returns the path for the monitored resource descriptor resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/monitoredResourceDescriptors/%s", project, monitoredResourceDescriptor) +// +// fmt.Sprintf("projects/%s/monitoredResourceDescriptors/%s", project, monitoredResourceDescriptor) +// // instead. func MetricMonitoredResourceDescriptorPath(project, monitoredResourceDescriptor string) string { return "" + @@ -83,7 +93,9 @@ func MetricMonitoredResourceDescriptorPath(project, monitoredResourceDescriptor // UptimeCheckProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func UptimeCheckProjectPath(project string) string { return "" + @@ -95,7 +107,9 @@ func UptimeCheckProjectPath(project string) string { // UptimeCheckUptimeCheckConfigPath returns the path for the uptime check config resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", project, uptimeCheckConfig) +// +// fmt.Sprintf("projects/%s/uptimeCheckConfigs/%s", project, uptimeCheckConfig) +// // instead. func UptimeCheckUptimeCheckConfigPath(project, uptimeCheckConfig string) string { return "" + diff --git a/monitoring/apiv3/v2/doc.go b/monitoring/apiv3/v2/doc.go index 8844a492f92..332c800e017 100644 --- a/monitoring/apiv3/v2/doc.go +++ b/monitoring/apiv3/v2/doc.go @@ -19,49 +19,50 @@ // // Manages your Cloud Monitoring data and configurations. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := monitoring.NewAlertPolicyClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := monitoring.NewAlertPolicyClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := monitoring.NewAlertPolicyClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &monitoringpb.ListAlertPoliciesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/monitoring/v3#ListAlertPoliciesRequest. -// } -// it := c.ListAlertPolicies(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := monitoring.NewAlertPolicyClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &monitoringpb.ListAlertPoliciesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/monitoring/v3#ListAlertPoliciesRequest. +// } +// it := c.ListAlertPolicies(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/monitoring/dashboard/apiv1/doc.go b/monitoring/dashboard/apiv1/doc.go index 4cbe9d9d392..374d0e90505 100644 --- a/monitoring/dashboard/apiv1/doc.go +++ b/monitoring/dashboard/apiv1/doc.go @@ -24,43 +24,44 @@ // concepts found in the table entries, read the Cloud Monitoring // documentation (at https://cloud.google.com/monitoring/docs). // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := dashboard.NewDashboardsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := dashboard.NewDashboardsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := dashboard.NewDashboardsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &dashboardpb.CreateDashboardRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/monitoring/dashboard/v1#CreateDashboardRequest. -// } -// resp, err := c.CreateDashboard(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := dashboard.NewDashboardsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &dashboardpb.CreateDashboardRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/monitoring/dashboard/v1#CreateDashboardRequest. +// } +// resp, err := c.CreateDashboard(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/monitoring/metricsscope/apiv1/doc.go b/monitoring/metricsscope/apiv1/doc.go index 68b6e090c4a..5a2d6ffe31e 100644 --- a/monitoring/metricsscope/apiv1/doc.go +++ b/monitoring/metricsscope/apiv1/doc.go @@ -24,43 +24,44 @@ // concepts found in the table entries, read the Cloud Monitoring // documentation (at https://cloud.google.com/monitoring/docs). // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := metricsscope.NewMetricsScopesClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := metricsscope.NewMetricsScopesClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := metricsscope.NewMetricsScopesClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &metricsscopepb.GetMetricsScopeRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/monitoring/metricsscope/v1#GetMetricsScopeRequest. -// } -// resp, err := c.GetMetricsScope(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := metricsscope.NewMetricsScopesClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &metricsscopepb.GetMetricsScopeRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/monitoring/metricsscope/v1#GetMetricsScopeRequest. +// } +// resp, err := c.GetMetricsScope(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/networkconnectivity/apiv1/doc.go b/networkconnectivity/apiv1/doc.go index 7f8d9d04860..d264cd93327 100644 --- a/networkconnectivity/apiv1/doc.go +++ b/networkconnectivity/apiv1/doc.go @@ -20,49 +20,50 @@ // The Network Connectivity API provides access to Network Connectivity // Center. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := networkconnectivity.NewHubClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := networkconnectivity.NewHubClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := networkconnectivity.NewHubClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &networkconnectivitypb.ListHubsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#ListHubsRequest. -// } -// it := c.ListHubs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := networkconnectivity.NewHubClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &networkconnectivitypb.ListHubsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1#ListHubsRequest. +// } +// it := c.ListHubs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/networkconnectivity/apiv1alpha1/doc.go b/networkconnectivity/apiv1alpha1/doc.go index 2100e9decd5..06dd39b5f62 100644 --- a/networkconnectivity/apiv1alpha1/doc.go +++ b/networkconnectivity/apiv1alpha1/doc.go @@ -20,51 +20,52 @@ // The Network Connectivity API will be home to various services which // provide information pertaining to network connectivity. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := networkconnectivity.NewHubClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := networkconnectivity.NewHubClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := networkconnectivity.NewHubClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &networkconnectivitypb.ListHubsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1#ListHubsRequest. -// } -// it := c.ListHubs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := networkconnectivity.NewHubClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &networkconnectivitypb.ListHubsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1#ListHubsRequest. +// } +// it := c.ListHubs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/networkmanagement/apiv1/doc.go b/networkmanagement/apiv1/doc.go index 33c8b3464c8..fe86a6cbf6a 100644 --- a/networkmanagement/apiv1/doc.go +++ b/networkmanagement/apiv1/doc.go @@ -20,49 +20,50 @@ // The Network Management API provides a collection of network performance // monitoring and diagnostic capabilities. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := networkmanagement.NewReachabilityClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := networkmanagement.NewReachabilityClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := networkmanagement.NewReachabilityClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &networkmanagementpb.ListConnectivityTestsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkmanagement/v1#ListConnectivityTestsRequest. -// } -// it := c.ListConnectivityTests(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := networkmanagement.NewReachabilityClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &networkmanagementpb.ListConnectivityTestsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networkmanagement/v1#ListConnectivityTestsRequest. +// } +// it := c.ListConnectivityTests(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/networksecurity/apiv1beta1/doc.go b/networksecurity/apiv1beta1/doc.go index 2bf7fa30016..23a39e4752b 100644 --- a/networksecurity/apiv1beta1/doc.go +++ b/networksecurity/apiv1beta1/doc.go @@ -17,51 +17,52 @@ // Package networksecurity is an auto-generated package for the // Network Security API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := networksecurity.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := networksecurity.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := networksecurity.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &networksecuritypb.ListAuthorizationPoliciesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#ListAuthorizationPoliciesRequest. -// } -// it := c.ListAuthorizationPolicies(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := networksecurity.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &networksecuritypb.ListAuthorizationPoliciesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1#ListAuthorizationPoliciesRequest. +// } +// it := c.ListAuthorizationPolicies(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/notebooks/apiv1/doc.go b/notebooks/apiv1/doc.go index bc24272900f..7725f9270a9 100644 --- a/notebooks/apiv1/doc.go +++ b/notebooks/apiv1/doc.go @@ -19,49 +19,50 @@ // // Notebooks API is used to manage notebook resources in Google Cloud. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := notebooks.NewManagedNotebookClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := notebooks.NewManagedNotebookClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := notebooks.NewManagedNotebookClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := ¬ebookspb.ListRuntimesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/notebooks/v1#ListRuntimesRequest. -// } -// it := c.ListRuntimes(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := notebooks.NewManagedNotebookClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := ¬ebookspb.ListRuntimesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/notebooks/v1#ListRuntimesRequest. +// } +// it := c.ListRuntimes(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/notebooks/apiv1beta1/doc.go b/notebooks/apiv1beta1/doc.go index 867807a5669..60a1cc28d93 100644 --- a/notebooks/apiv1beta1/doc.go +++ b/notebooks/apiv1beta1/doc.go @@ -20,51 +20,52 @@ // AI Platform Notebooks API is used to manage notebook resources in Google // Cloud. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := notebooks.NewNotebookClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := notebooks.NewNotebookClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := notebooks.NewNotebookClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := ¬ebookspb.ListInstancesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1#ListInstancesRequest. -// } -// it := c.ListInstances(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := notebooks.NewNotebookClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := ¬ebookspb.ListInstancesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1#ListInstancesRequest. +// } +// it := c.ListInstances(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/optimization/apiv1/doc.go b/optimization/apiv1/doc.go index a79e3eca9d9..c034e6b9003 100644 --- a/optimization/apiv1/doc.go +++ b/optimization/apiv1/doc.go @@ -21,43 +21,44 @@ // optimization use cases starting with optimal route planning for vehicle // fleets. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := optimization.NewFleetRoutingClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := optimization.NewFleetRoutingClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := optimization.NewFleetRoutingClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &optimizationpb.OptimizeToursRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/optimization/v1#OptimizeToursRequest. -// } -// resp, err := c.OptimizeTours(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := optimization.NewFleetRoutingClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &optimizationpb.OptimizeToursRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/optimization/v1#OptimizeToursRequest. +// } +// resp, err := c.OptimizeTours(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/optimization/apiv1/fleet_routing_client.go b/optimization/apiv1/fleet_routing_client.go index cb3d62de549..584a9543138 100644 --- a/optimization/apiv1/fleet_routing_client.go +++ b/optimization/apiv1/fleet_routing_client.go @@ -100,29 +100,29 @@ type internalFleetRoutingClient interface { // // Validity of certain types of fields: // -// google.protobuf.Timestamp +// google.protobuf.Timestamp // -// Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00. +// Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00. // -// seconds must be in [0, 253402300799], -// i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00]. +// seconds must be in [0, 253402300799], +// i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00]. // -// nanos must be unset or set to 0. +// nanos must be unset or set to 0. // -// google.protobuf.Duration +// google.protobuf.Duration // -// seconds must be in [0, 253402300799], -// i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00]. +// seconds must be in [0, 253402300799], +// i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00]. // -// nanos must be unset or set to 0. +// nanos must be unset or set to 0. // -// google.type.LatLng +// google.type.LatLng // -// latitude must be in [-90.0, 90.0]. +// latitude must be in [-90.0, 90.0]. // -// longitude must be in [-180.0, 180.0]. +// longitude must be in [-180.0, 180.0]. // -// at least one of latitude and longitude must be non-zero. +// at least one of latitude and longitude must be non-zero. type FleetRoutingClient struct { // The internal transport-dependent client. internalClient internalFleetRoutingClient @@ -228,29 +228,29 @@ type fleetRoutingGRPCClient struct { // // Validity of certain types of fields: // -// google.protobuf.Timestamp +// google.protobuf.Timestamp // -// Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00. +// Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00. // -// seconds must be in [0, 253402300799], -// i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00]. +// seconds must be in [0, 253402300799], +// i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00]. // -// nanos must be unset or set to 0. +// nanos must be unset or set to 0. // -// google.protobuf.Duration +// google.protobuf.Duration // -// seconds must be in [0, 253402300799], -// i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00]. +// seconds must be in [0, 253402300799], +// i.e. in [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00]. // -// nanos must be unset or set to 0. +// nanos must be unset or set to 0. // -// google.type.LatLng +// google.type.LatLng // -// latitude must be in [-90.0, 90.0]. +// latitude must be in [-90.0, 90.0]. // -// longitude must be in [-180.0, 180.0]. +// longitude must be in [-180.0, 180.0]. // -// at least one of latitude and longitude must be non-zero. +// at least one of latitude and longitude must be non-zero. func NewFleetRoutingClient(ctx context.Context, opts ...option.ClientOption) (*FleetRoutingClient, error) { clientOpts := defaultFleetRoutingGRPCClientOptions() if newFleetRoutingClientHook != nil { diff --git a/orchestration/airflow/service/apiv1/doc.go b/orchestration/airflow/service/apiv1/doc.go index ca0e846c8dd..4de86175ef8 100644 --- a/orchestration/airflow/service/apiv1/doc.go +++ b/orchestration/airflow/service/apiv1/doc.go @@ -19,48 +19,49 @@ // // Manages Apache Airflow environments on Google Cloud Platform. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := service.NewEnvironmentsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := service.NewEnvironmentsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := service.NewEnvironmentsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &servicepb.CreateEnvironmentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/orchestration/airflow/service/v1#CreateEnvironmentRequest. -// } -// op, err := c.CreateEnvironment(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := service.NewEnvironmentsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &servicepb.CreateEnvironmentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/orchestration/airflow/service/v1#CreateEnvironmentRequest. +// } +// op, err := c.CreateEnvironment(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/orgpolicy/apiv2/doc.go b/orgpolicy/apiv2/doc.go index 04aad94e036..4df724c4e2e 100644 --- a/orgpolicy/apiv2/doc.go +++ b/orgpolicy/apiv2/doc.go @@ -20,49 +20,50 @@ // The Org Policy API allows users to configure governance rules on their GCP // resources across the Cloud Resource Hierarchy. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := orgpolicy.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := orgpolicy.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := orgpolicy.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &orgpolicypb.ListConstraintsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/orgpolicy/v2#ListConstraintsRequest. -// } -// it := c.ListConstraints(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := orgpolicy.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &orgpolicypb.ListConstraintsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/orgpolicy/v2#ListConstraintsRequest. +// } +// it := c.ListConstraints(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/osconfig/agentendpoint/apiv1/doc.go b/osconfig/agentendpoint/apiv1/doc.go index 2c1407079a6..3dcb92b2da6 100644 --- a/osconfig/agentendpoint/apiv1/doc.go +++ b/osconfig/agentendpoint/apiv1/doc.go @@ -20,25 +20,26 @@ // OS management tools that can be used for patch management, patch // compliance, and configuration management on VM instances. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := agentendpoint.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := agentendpoint.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/osconfig/agentendpoint/apiv1beta/doc.go b/osconfig/agentendpoint/apiv1beta/doc.go index 5acadb8b16e..46ccbf927ee 100644 --- a/osconfig/agentendpoint/apiv1beta/doc.go +++ b/osconfig/agentendpoint/apiv1beta/doc.go @@ -20,27 +20,28 @@ // OS management tools that can be used for patch management, patch // compliance, and configuration management on VM instances. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := agentendpoint.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := agentendpoint.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/osconfig/apiv1/doc.go b/osconfig/apiv1/doc.go index 10079500ab6..f93420a16e6 100644 --- a/osconfig/apiv1/doc.go +++ b/osconfig/apiv1/doc.go @@ -20,43 +20,44 @@ // OS management tools that can be used for patch management, patch // compliance, and configuration management on VM instances. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := osconfig.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := osconfig.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := osconfig.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &osconfigpb.ExecutePatchJobRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ExecutePatchJobRequest. -// } -// resp, err := c.ExecutePatchJob(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := osconfig.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &osconfigpb.ExecutePatchJobRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ExecutePatchJobRequest. +// } +// resp, err := c.ExecutePatchJob(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/osconfig/apiv1/os_config_client.go b/osconfig/apiv1/os_config_client.go index bee9264130a..b4bc1d79706 100644 --- a/osconfig/apiv1/os_config_client.go +++ b/osconfig/apiv1/os_config_client.go @@ -224,7 +224,7 @@ type internalClient interface { // Client is a client for interacting with OS Config API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// OS Config API +// # OS Config API // // The OS Config service is a server-side component that you can use to // manage package installations and patch jobs for virtual machine instances. @@ -345,7 +345,7 @@ type gRPCClient struct { // NewClient creates a new os config service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// OS Config API +// # OS Config API // // The OS Config service is a server-side component that you can use to // manage package installations and patch jobs for virtual machine instances. diff --git a/osconfig/apiv1/os_config_zonal_client.go b/osconfig/apiv1/os_config_zonal_client.go index 544ea96dac7..410bd3411ee 100644 --- a/osconfig/apiv1/os_config_zonal_client.go +++ b/osconfig/apiv1/os_config_zonal_client.go @@ -230,7 +230,7 @@ type internalOsConfigZonalClient interface { // OsConfigZonalClient is a client for interacting with OS Config API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Zonal OS Config API +// # Zonal OS Config API // // The OS Config service is the server-side component that allows users to // manage package installations and patch jobs for Compute Engine VM instances. @@ -412,7 +412,7 @@ type osConfigZonalGRPCClient struct { // NewOsConfigZonalClient creates a new os config zonal service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Zonal OS Config API +// # Zonal OS Config API // // The OS Config service is the server-side component that allows users to // manage package installations and patch jobs for Compute Engine VM instances. diff --git a/osconfig/apiv1alpha/doc.go b/osconfig/apiv1alpha/doc.go index 841789e18de..c6a91a5cd7f 100644 --- a/osconfig/apiv1alpha/doc.go +++ b/osconfig/apiv1alpha/doc.go @@ -20,50 +20,51 @@ // OS management tools that can be used for patch management, patch // compliance, and configuration management on VM instances. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := osconfig.NewOsConfigZonalClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := osconfig.NewOsConfigZonalClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := osconfig.NewOsConfigZonalClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &osconfigpb.CreateOSPolicyAssignmentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1alpha#CreateOSPolicyAssignmentRequest. -// } -// op, err := c.CreateOSPolicyAssignment(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := osconfig.NewOsConfigZonalClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &osconfigpb.CreateOSPolicyAssignmentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1alpha#CreateOSPolicyAssignmentRequest. +// } +// op, err := c.CreateOSPolicyAssignment(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/osconfig/apiv1alpha/os_config_zonal_client.go b/osconfig/apiv1alpha/os_config_zonal_client.go index 14125965fca..1b771bc3c5e 100644 --- a/osconfig/apiv1alpha/os_config_zonal_client.go +++ b/osconfig/apiv1alpha/os_config_zonal_client.go @@ -407,7 +407,7 @@ type internalOsConfigZonalClient interface { // OsConfigZonalClient is a client for interacting with OS Config API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Zonal OS Config API +// # Zonal OS Config API // // The OS Config service is the server-side component that allows users to // manage package installations and patch jobs for Compute Engine VM instances. @@ -605,7 +605,7 @@ type osConfigZonalGRPCClient struct { // NewOsConfigZonalClient creates a new os config zonal service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Zonal OS Config API +// # Zonal OS Config API // // The OS Config service is the server-side component that allows users to // manage package installations and patch jobs for Compute Engine VM instances. @@ -698,7 +698,7 @@ type osConfigZonalRESTClient struct { // NewOsConfigZonalRESTClient creates a new os config zonal service rest client. // -// Zonal OS Config API +// # Zonal OS Config API // // The OS Config service is the server-side component that allows users to // manage package installations and patch jobs for Compute Engine VM instances. diff --git a/osconfig/apiv1beta/doc.go b/osconfig/apiv1beta/doc.go index e230090af59..75e2ba0380d 100644 --- a/osconfig/apiv1beta/doc.go +++ b/osconfig/apiv1beta/doc.go @@ -20,45 +20,46 @@ // OS management tools that can be used for patch management, patch // compliance, and configuration management on VM instances. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := osconfig.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := osconfig.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := osconfig.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &osconfigpb.ExecutePatchJobRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1beta#ExecutePatchJobRequest. -// } -// resp, err := c.ExecutePatchJob(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := osconfig.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &osconfigpb.ExecutePatchJobRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1beta#ExecutePatchJobRequest. +// } +// resp, err := c.ExecutePatchJob(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/osconfig/apiv1beta/os_config_client.go b/osconfig/apiv1beta/os_config_client.go index 8dd90bdead4..8872ffebd2e 100644 --- a/osconfig/apiv1beta/os_config_client.go +++ b/osconfig/apiv1beta/os_config_client.go @@ -493,7 +493,7 @@ type internalClient interface { // Client is a client for interacting with OS Config API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// OS Config API +// # OS Config API // // The OS Config service is a server-side component that you can use to // manage package installations and patch jobs for virtual machine instances. @@ -645,7 +645,7 @@ type gRPCClient struct { // NewClient creates a new os config service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// OS Config API +// # OS Config API // // The OS Config service is a server-side component that you can use to // manage package installations and patch jobs for virtual machine instances. @@ -722,7 +722,7 @@ type restClient struct { // NewRESTClient creates a new os config service rest client. // -// OS Config API +// # OS Config API // // The OS Config service is a server-side component that you can use to // manage package installations and patch jobs for virtual machine instances. diff --git a/oslogin/apiv1/doc.go b/oslogin/apiv1/doc.go index 3e3021e3353..15bd344703c 100644 --- a/oslogin/apiv1/doc.go +++ b/oslogin/apiv1/doc.go @@ -20,41 +20,42 @@ // You can use OS Login to manage access to your VM instances using IAM // roles. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := oslogin.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := oslogin.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := oslogin.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &osloginpb.DeletePosixAccountRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/oslogin/v1#DeletePosixAccountRequest. -// } -// err = c.DeletePosixAccount(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// Use of Context +// ctx := context.Background() +// c, err := oslogin.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &osloginpb.DeletePosixAccountRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/oslogin/v1#DeletePosixAccountRequest. +// } +// err = c.DeletePosixAccount(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/oslogin/apiv1/os_login_client.go b/oslogin/apiv1/os_login_client.go index 9b613fe33dc..8f93d708e65 100644 --- a/oslogin/apiv1/os_login_client.go +++ b/oslogin/apiv1/os_login_client.go @@ -151,7 +151,7 @@ type internalClient interface { // Client is a client for interacting with Cloud OS Login API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Cloud OS Login API +// # Cloud OS Login API // // The Cloud OS Login API allows you to manage users and their associated SSH // public keys for logging into virtual machines on Google Cloud Platform. @@ -242,7 +242,7 @@ type gRPCClient struct { // NewClient creates a new os login service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Cloud OS Login API +// # Cloud OS Login API // // The Cloud OS Login API allows you to manage users and their associated SSH // public keys for logging into virtual machines on Google Cloud Platform. diff --git a/oslogin/apiv1beta/doc.go b/oslogin/apiv1beta/doc.go index 4e5e48527a7..e269f0a2973 100644 --- a/oslogin/apiv1beta/doc.go +++ b/oslogin/apiv1beta/doc.go @@ -20,43 +20,44 @@ // You can use OS Login to manage access to your VM instances using IAM // roles. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := oslogin.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := oslogin.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := oslogin.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &osloginpb.DeletePosixAccountRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/oslogin/v1beta#DeletePosixAccountRequest. -// } -// err = c.DeletePosixAccount(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// Use of Context +// ctx := context.Background() +// c, err := oslogin.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &osloginpb.DeletePosixAccountRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/oslogin/v1beta#DeletePosixAccountRequest. +// } +// err = c.DeletePosixAccount(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/oslogin/apiv1beta/os_login_client.go b/oslogin/apiv1beta/os_login_client.go index ab442223619..1e3528983cc 100644 --- a/oslogin/apiv1beta/os_login_client.go +++ b/oslogin/apiv1beta/os_login_client.go @@ -228,7 +228,7 @@ type internalClient interface { // Client is a client for interacting with Cloud OS Login API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Cloud OS Login API +// # Cloud OS Login API // // The Cloud OS Login API allows you to manage users and their associated SSH // public keys for logging into virtual machines on Google Cloud Platform. @@ -319,7 +319,7 @@ type gRPCClient struct { // NewClient creates a new os login service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Cloud OS Login API +// # Cloud OS Login API // // The Cloud OS Login API allows you to manage users and their associated SSH // public keys for logging into virtual machines on Google Cloud Platform. @@ -396,7 +396,7 @@ type restClient struct { // NewRESTClient creates a new os login service rest client. // -// Cloud OS Login API +// # Cloud OS Login API // // The Cloud OS Login API allows you to manage users and their associated SSH // public keys for logging into virtual machines on Google Cloud Platform. diff --git a/phishingprotection/apiv1beta1/doc.go b/phishingprotection/apiv1beta1/doc.go index e71e74fb6d9..ba4ca606252 100644 --- a/phishingprotection/apiv1beta1/doc.go +++ b/phishingprotection/apiv1beta1/doc.go @@ -17,45 +17,46 @@ // Package phishingprotection is an auto-generated package for the // Phishing Protection API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := phishingprotection.NewPhishingProtectionServiceV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := phishingprotection.NewPhishingProtectionServiceV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := phishingprotection.NewPhishingProtectionServiceV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &phishingprotectionpb.ReportPhishingRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/phishingprotection/v1beta1#ReportPhishingRequest. -// } -// resp, err := c.ReportPhishing(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := phishingprotection.NewPhishingProtectionServiceV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &phishingprotectionpb.ReportPhishingRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/phishingprotection/v1beta1#ReportPhishingRequest. +// } +// resp, err := c.ReportPhishing(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/policytroubleshooter/apiv1/doc.go b/policytroubleshooter/apiv1/doc.go index bcc0b095fcc..369d4e774d1 100644 --- a/policytroubleshooter/apiv1/doc.go +++ b/policytroubleshooter/apiv1/doc.go @@ -17,43 +17,44 @@ // Package policytroubleshooter is an auto-generated package for the // Policy Troubleshooter API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := policytroubleshooter.NewIamCheckerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := policytroubleshooter.NewIamCheckerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := policytroubleshooter.NewIamCheckerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := policytroubleshooter.NewIamCheckerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &policytroubleshooterpb.TroubleshootIamPolicyRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/policytroubleshooter/v1#TroubleshootIamPolicyRequest. -// } -// resp, err := c.TroubleshootIamPolicy(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &policytroubleshooterpb.TroubleshootIamPolicyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/policytroubleshooter/v1#TroubleshootIamPolicyRequest. +// } +// resp, err := c.TroubleshootIamPolicy(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/privatecatalog/apiv1beta1/doc.go b/privatecatalog/apiv1beta1/doc.go index bd58ec40edf..47601b86548 100644 --- a/privatecatalog/apiv1beta1/doc.go +++ b/privatecatalog/apiv1beta1/doc.go @@ -20,51 +20,52 @@ // Enable cloud users to discover private catalogs and products in their // organizations. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := privatecatalog.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := privatecatalog.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := privatecatalog.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &privatecatalogpb.SearchCatalogsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/privatecatalog/v1beta1#SearchCatalogsRequest. -// } -// it := c.SearchCatalogs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := privatecatalog.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &privatecatalogpb.SearchCatalogsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/privatecatalog/v1beta1#SearchCatalogsRequest. +// } +// it := c.SearchCatalogs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/profiler/profiler.go b/profiler/profiler.go index a00f95c8c53..e1f0c7500e1 100644 --- a/profiler/profiler.go +++ b/profiler/profiler.go @@ -16,11 +16,11 @@ // // Usage example: // -// import "cloud.google.com/go/profiler" -// ... -// if err := profiler.Start(profiler.Config{Service: "my-service"}); err != nil { -// // TODO: Handle error. -// } +// import "cloud.google.com/go/profiler" +// ... +// if err := profiler.Start(profiler.Config{Service: "my-service"}); err != nil { +// // TODO: Handle error. +// } // // Calling Start will start a goroutine to collect profiles and upload to // the profiler server, at the rhythm specified by the server. diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go index e097b956bfd..e9381d2a2c1 100644 --- a/pubsub/apiv1/doc.go +++ b/pubsub/apiv1/doc.go @@ -20,43 +20,44 @@ // Provides reliable, many-to-many, asynchronous messaging between // applications. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := pubsub.NewSchemaClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := pubsub.NewSchemaClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := pubsub.NewSchemaClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &pubsubpb.CreateSchemaRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/pubsub/v1#CreateSchemaRequest. -// } -// resp, err := c.CreateSchema(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := pubsub.NewSchemaClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &pubsubpb.CreateSchemaRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/pubsub/v1#CreateSchemaRequest. +// } +// resp, err := c.CreateSchema(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/pubsub/apiv1/path_funcs.go b/pubsub/apiv1/path_funcs.go index b9ab4848db1..7416e376d18 100644 --- a/pubsub/apiv1/path_funcs.go +++ b/pubsub/apiv1/path_funcs.go @@ -17,7 +17,9 @@ package pubsub // PublisherProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func PublisherProjectPath(project string) string { return "" + @@ -29,7 +31,9 @@ func PublisherProjectPath(project string) string { // PublisherTopicPath returns the path for the topic resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/topics/%s", project, topic) +// +// fmt.Sprintf("projects/%s/topics/%s", project, topic) +// // instead. func PublisherTopicPath(project, topic string) string { return "" + @@ -43,7 +47,9 @@ func PublisherTopicPath(project, topic string) string { // SubscriberProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func SubscriberProjectPath(project string) string { return "" + @@ -55,7 +61,9 @@ func SubscriberProjectPath(project string) string { // SubscriberSnapshotPath returns the path for the snapshot resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/snapshots/%s", project, snapshot) +// +// fmt.Sprintf("projects/%s/snapshots/%s", project, snapshot) +// // instead. func SubscriberSnapshotPath(project, snapshot string) string { return "" + @@ -69,7 +77,9 @@ func SubscriberSnapshotPath(project, snapshot string) string { // SubscriberSubscriptionPath returns the path for the subscription resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/subscriptions/%s", project, subscription) +// +// fmt.Sprintf("projects/%s/subscriptions/%s", project, subscription) +// // instead. func SubscriberSubscriptionPath(project, subscription string) string { return "" + @@ -83,7 +93,9 @@ func SubscriberSubscriptionPath(project, subscription string) string { // SubscriberTopicPath returns the path for the topic resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/topics/%s", project, topic) +// +// fmt.Sprintf("projects/%s/topics/%s", project, topic) +// // instead. func SubscriberTopicPath(project, topic string) string { return "" + diff --git a/pubsub/doc.go b/pubsub/doc.go index c3dd507c6c9..1f03407e31c 100644 --- a/pubsub/doc.go +++ b/pubsub/doc.go @@ -24,17 +24,16 @@ https://cloud.google.com/pubsub/docs See https://godoc.org/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package. - -Publishing +# Publishing Google Cloud Pub/Sub messages are published to topics. Topics may be created using the pubsub package like so: - topic, err := pubsubClient.CreateTopic(context.Background(), "topic-name") + topic, err := pubsubClient.CreateTopic(context.Background(), "topic-name") Messages may then be published to a topic: - res := topic.Publish(ctx, &pubsub.Message{Data: []byte("payload")}) + res := topic.Publish(ctx, &pubsub.Message{Data: []byte("payload")}) Publish queues the message for publishing and returns immediately. When enough messages have accumulated, or enough time has elapsed, the batch of messages is @@ -46,10 +45,9 @@ blocks until the message has been sent to the service. The first time you call Publish on a topic, goroutines are started in the background. To clean up these goroutines, call Stop: - topic.Stop() - + topic.Stop() -Receiving +# Receiving To receive messages published to a topic, clients create subscriptions to the topic. There may be more than one subscription per topic; each message @@ -57,18 +55,18 @@ that is published to the topic will be delivered to all of its subscriptions. Subscriptions may be created like so: - sub, err := pubsubClient.CreateSubscription(context.Background(), "sub-name", - pubsub.SubscriptionConfig{Topic: topic}) + sub, err := pubsubClient.CreateSubscription(context.Background(), "sub-name", + pubsub.SubscriptionConfig{Topic: topic}) Messages are then consumed from a subscription via callback. - err := sub.Receive(context.Background(), func(ctx context.Context, m *Message) { - log.Printf("Got message: %s", m.Data) - m.Ack() - }) - if err != nil { - // Handle error. - } + err := sub.Receive(context.Background(), func(ctx context.Context, m *Message) { + log.Printf("Got message: %s", m.Data) + m.Ack() + }) + if err != nil { + // Handle error. + } The callback is invoked concurrently by multiple goroutines, maximizing throughput. To terminate a call to Receive, cancel its context. @@ -91,8 +89,7 @@ may be surprising. Please take a look at https://cloud.google.com/pubsub/docs/pu for more details on how streaming pull behaves compared to the synchronous pull method. - -Streams Management +# Streams Management Streams used for streaming pull are managed by the gRPC connection pool setting. By default, the number of connections in the pool is min(4,GOMAXPROCS). @@ -100,13 +97,12 @@ By default, the number of connections in the pool is min(4,GOMAXPROCS). If you have 4 or more CPU cores, the default setting allows 400 streams which is still a good default for most cases. If you want to have more open streams (such as for low CPU core machines), you should pass in the grpc option as described below: - opts := []option.ClientOption{ - option.WithGRPCConnectionPool(8), - } - client, err := pubsub.NewClient(ctx, projID, opts...) - + opts := []option.ClientOption{ + option.WithGRPCConnectionPool(8), + } + client, err := pubsub.NewClient(ctx, projID, opts...) -Ack Deadlines +# Ack Deadlines The default pubsub deadlines are suitable for most use cases, but may be overridden. This section describes the tradeoffs that should be considered @@ -152,14 +148,13 @@ set MaxExtension to the subscription's AckDeadline: sub.ReceiveSettings.MaxExtension = cfg.AckDeadline - -Slow Message Processing +# Slow Message Processing For use cases where message processing exceeds 30 minutes, we recommend using the base client in a pull model, since long-lived streams are periodically killed by firewalls. See the example at https://godoc.org/cloud.google.com/go/pubsub/apiv1#example-SubscriberClient-Pull-LengthyClientProcessing -Emulator +# Emulator To use an emulator with this library, you can set the PUBSUB_EMULATOR_HOST environment variable to the address at which your emulator is running. This will @@ -177,7 +172,5 @@ and use a client as usual: // TODO: Handle error. } defer client.Close() - - */ package pubsub // import "cloud.google.com/go/pubsub" diff --git a/pubsub/loadtest/pb/loadtest.pb.go b/pubsub/loadtest/pb/loadtest.pb.go index 28e925a0e8c..e0b335d7ce2 100644 --- a/pubsub/loadtest/pb/loadtest.pb.go +++ b/pubsub/loadtest/pb/loadtest.pb.go @@ -1,3 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Code generated by protoc-gen-go. // source: loadtest.proto // DO NOT EDIT! @@ -6,9 +20,11 @@ Package google_pubsub_loadtest is a generated protocol buffer package. It is generated from these files: + loadtest.proto It has these top-level messages: + StartRequest StartResponse PubsubOptions diff --git a/pubsub/pstest/fake.go b/pubsub/pstest/fake.go index a362a63cc4d..c95444a4d65 100644 --- a/pubsub/pstest/fake.go +++ b/pubsub/pstest/fake.go @@ -508,8 +508,9 @@ var minAckDeadlineSecs int32 // SetMinAckDeadline changes the minack deadline to n. Must be // greater than or equal to 1 second. Remember to reset this value // to the default after your test changes it. Example usage: -// pstest.SetMinAckDeadlineSecs(1) -// defer pstest.ResetMinAckDeadlineSecs() +// +// pstest.SetMinAckDeadlineSecs(1) +// defer pstest.ResetMinAckDeadlineSecs() func SetMinAckDeadline(n time.Duration) { if n < time.Second { panic("SetMinAckDeadline expects a value greater than 1 second") diff --git a/pubsub/snapshot.go b/pubsub/snapshot.go index 5c1325924eb..8a223a99f9a 100644 --- a/pubsub/snapshot.go +++ b/pubsub/snapshot.go @@ -113,11 +113,12 @@ func (s *Subscription) SeekToTime(ctx context.Context, t time.Time) error { // If the name is empty string, a unique name is assigned. // // The created snapshot is guaranteed to retain: -// (a) The existing backlog on the subscription. More precisely, this is -// defined as the messages in the subscription's backlog that are -// unacknowledged when Snapshot returns without error. -// (b) Any messages published to the subscription's topic following -// Snapshot returning without error. +// +// (a) The existing backlog on the subscription. More precisely, this is +// defined as the messages in the subscription's backlog that are +// unacknowledged when Snapshot returns without error. +// (b) Any messages published to the subscription's topic following +// Snapshot returning without error. func (s *Subscription) CreateSnapshot(ctx context.Context, name string) (*SnapshotConfig, error) { if name != "" { name = fmt.Sprintf("projects/%s/snapshots/%s", strings.Split(s.name, "/")[1], name) diff --git a/pubsub/subscription.go b/pubsub/subscription.go index 7b5339a3279..219272c227f 100644 --- a/pubsub/subscription.go +++ b/pubsub/subscription.go @@ -953,9 +953,9 @@ var errReceiveInProgress = errors.New("pubsub: Receive already in progress for t // // The standard way to terminate a Receive is to cancel its context: // -// cctx, cancel := context.WithCancel(ctx) -// err := sub.Receive(cctx, callback) -// // Call cancel from callback, or another goroutine. +// cctx, cancel := context.WithCancel(ctx) +// err := sub.Receive(cctx, callback) +// // Call cancel from callback, or another goroutine. // // If the service returns a non-retryable error, Receive returns that error after // all of the outstanding calls to f have returned. If ctx is done, Receive diff --git a/pubsub/topic.go b/pubsub/topic.go index 26d05947025..c96b9ce9bce 100644 --- a/pubsub/topic.go +++ b/pubsub/topic.go @@ -512,11 +512,12 @@ var errTopicStopped = errors.New("pubsub: Stop has been called for this topic") // A PublishResult holds the result from a call to Publish. // // Call Get to obtain the result of the Publish call. Example: -// // Get blocks until Publish completes or ctx is done. -// id, err := r.Get(ctx) -// if err != nil { -// // TODO: Handle error. -// } +// +// // Get blocks until Publish completes or ctx is done. +// id, err := r.Get(ctx) +// if err != nil { +// // TODO: Handle error. +// } type PublishResult = ipubsub.PublishResult // Publish publishes msg to the topic asynchronously. Messages are batched and diff --git a/pubsublite/apiv1/doc.go b/pubsublite/apiv1/doc.go index 262ab59c5b9..4e7581a9be6 100644 --- a/pubsublite/apiv1/doc.go +++ b/pubsublite/apiv1/doc.go @@ -17,43 +17,44 @@ // Package pubsublite is an auto-generated package for the // Pub/Sub Lite API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := pubsublite.NewAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := pubsublite.NewAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := pubsublite.NewAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := pubsublite.NewAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &pubsublitepb.CreateTopicRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#CreateTopicRequest. -// } -// resp, err := c.CreateTopic(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &pubsublitepb.CreateTopicRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/pubsublite/v1#CreateTopicRequest. +// } +// resp, err := c.CreateTopic(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/pubsublite/doc.go b/pubsublite/doc.go index c6b74486a89..f9e91482c38 100644 --- a/pubsublite/doc.go +++ b/pubsublite/doc.go @@ -32,8 +32,7 @@ https://cloud.google.com/pubsub/lite. See https://pkg.go.dev/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package. - -Introduction +# Introduction Examples can be found at https://pkg.go.dev/cloud.google.com/go/pubsublite#pkg-examples @@ -53,34 +52,33 @@ https://pkg.go.dev/cloud.google.com/go/pubsublite/pscompat#example-NewSubscriber The following imports are required for code snippets below: - import ( - "cloud.google.com/go/pubsub" - "cloud.google.com/go/pubsublite" - "cloud.google.com/go/pubsublite/pscompat" - ) - + import ( + "cloud.google.com/go/pubsub" + "cloud.google.com/go/pubsublite" + "cloud.google.com/go/pubsublite/pscompat" + ) -Creating Topics +# Creating Topics Messages are published to topics. Pub/Sub Lite topics may be created like so: - ctx := context.Background() - const topicPath = "projects/my-project/locations/us-central1-c/topics/my-topic" - topicConfig := pubsublite.TopicConfig{ - Name: topicPath, - PartitionCount: 1, - PublishCapacityMiBPerSec: 4, - SubscribeCapacityMiBPerSec: 4, - PerPartitionBytes: 30 * 1024 * 1024 * 1024, // 30 GiB - RetentionDuration: pubsublite.InfiniteRetention, - } - adminClient, err := pubsublite.NewAdminClient(ctx, "us-central1") - if err != nil { - // TODO: Handle error. - } - if _, err = adminClient.CreateTopic(ctx, topicConfig); err != nil { - // TODO: Handle error. - } + ctx := context.Background() + const topicPath = "projects/my-project/locations/us-central1-c/topics/my-topic" + topicConfig := pubsublite.TopicConfig{ + Name: topicPath, + PartitionCount: 1, + PublishCapacityMiBPerSec: 4, + SubscribeCapacityMiBPerSec: 4, + PerPartitionBytes: 30 * 1024 * 1024 * 1024, // 30 GiB + RetentionDuration: pubsublite.InfiniteRetention, + } + adminClient, err := pubsublite.NewAdminClient(ctx, "us-central1") + if err != nil { + // TODO: Handle error. + } + if _, err = adminClient.CreateTopic(ctx, topicConfig); err != nil { + // TODO: Handle error. + } See https://cloud.google.com/pubsub/lite/docs/topics for more information about how Pub/Sub Lite topics are configured. @@ -88,22 +86,21 @@ how Pub/Sub Lite topics are configured. See https://cloud.google.com/pubsub/lite/docs/locations for the list of locations where Pub/Sub Lite is available. - -Publishing +# Publishing Pub/Sub Lite uses gRPC streams extensively for high throughput. For more differences, see https://pkg.go.dev/cloud.google.com/go/pubsublite/pscompat. To publish messages to a topic, first create a PublisherClient: - publisher, err := pscompat.NewPublisherClient(ctx, topicPath) - if err != nil { - // TODO: Handle error. - } + publisher, err := pscompat.NewPublisherClient(ctx, topicPath) + if err != nil { + // TODO: Handle error. + } Then call Publish: - result := publisher.Publish(ctx, &pubsub.Message{Data: []byte("payload")}) + result := publisher.Publish(ctx, &pubsub.Message{Data: []byte("payload")}) Publish queues the message for publishing and returns immediately. When enough messages have accumulated, or enough time has elapsed, the batch of messages is @@ -114,22 +111,21 @@ Publish returns a PublishResult, which behaves like a future; its Get method blocks until the message has been sent (or has failed to be sent) to the service: - id, err := result.Get(ctx) - if err != nil { - // TODO: Handle error. - } + id, err := result.Get(ctx) + if err != nil { + // TODO: Handle error. + } Once you've finishing publishing all messages, call Stop to flush all messages to the service and close gRPC streams. The PublisherClient can no longer be used after it has been stopped or has terminated due to a permanent error. - publisher.Stop() + publisher.Stop() See https://cloud.google.com/pubsub/lite/docs/publishing for more information about publishing. - -Creating Subscriptions +# Creating Subscriptions To receive messages published to a topic, create a subscription to the topic. There may be more than one subscription per topic; each message that is @@ -137,43 +133,42 @@ published to the topic will be delivered to all of its subscriptions. Pub/Sub Lite subscriptions may be created like so: - const subscriptionPath = "projects/my-project/locations/us-central1-c/subscriptions/my-subscription" - subscriptionConfig := pubsublite.SubscriptionConfig{ - Name: subscriptionPath, - Topic: topicPath, - DeliveryRequirement: pubsublite.DeliverImmediately, - } - if _, err = adminClient.CreateSubscription(ctx, subscriptionConfig); err != nil { - // TODO: Handle error. - } + const subscriptionPath = "projects/my-project/locations/us-central1-c/subscriptions/my-subscription" + subscriptionConfig := pubsublite.SubscriptionConfig{ + Name: subscriptionPath, + Topic: topicPath, + DeliveryRequirement: pubsublite.DeliverImmediately, + } + if _, err = adminClient.CreateSubscription(ctx, subscriptionConfig); err != nil { + // TODO: Handle error. + } See https://cloud.google.com/pubsub/lite/docs/subscriptions for more information about how subscriptions are configured. - -Receiving +# Receiving To receive messages for a subscription, first create a SubscriberClient: - subscriber, err := pscompat.NewSubscriberClient(ctx, subscriptionPath) + subscriber, err := pscompat.NewSubscriberClient(ctx, subscriptionPath) Messages are then consumed from a subscription via callback. The callback may be invoked concurrently by multiple goroutines (one per partition that the subscriber client is connected to). - cctx, cancel := context.WithCancel(ctx) - err = subscriber.Receive(cctx, func(ctx context.Context, m *pubsub.Message) { - log.Printf("Got message: %s", m.Data) - m.Ack() - }) - if err != nil { - // TODO: Handle error. - } + cctx, cancel := context.WithCancel(ctx) + err = subscriber.Receive(cctx, func(ctx context.Context, m *pubsub.Message) { + log.Printf("Got message: %s", m.Data) + m.Ack() + }) + if err != nil { + // TODO: Handle error. + } Receive blocks until either the context is canceled or a permanent error occurs. To terminate a call to Receive, cancel its context: - cancel() + cancel() Clients must call pubsub.Message.Ack() or pubsub.Message.Nack() for every message received. Pub/Sub Lite does not have ACK deadlines. Pub/Sub Lite also @@ -185,7 +180,6 @@ client that may be able to handle messages. See https://cloud.google.com/pubsub/lite/docs/subscribing for more information about receiving messages. - gRPC Connection Pools Pub/Sub Lite utilizes gRPC streams extensively. gRPC allows a maximum of 100 @@ -194,6 +188,6 @@ size of 8, which supports up to 800 topic partitions. To alter the connection pool size, pass a ClientOption to pscompat.NewPublisherClient and pscompat.NewSubscriberClient: - pub, err := pscompat.NewPublisherClient(ctx, topicPath, option.WithGRPCConnectionPool(10)) + pub, err := pscompat.NewPublisherClient(ctx, topicPath, option.WithGRPCConnectionPool(10)) */ package pubsublite // import "cloud.google.com/go/pubsublite" diff --git a/pubsublite/internal/wire/publisher.go b/pubsublite/internal/wire/publisher.go index a1e8b39fe18..215288f08cb 100644 --- a/pubsublite/internal/wire/publisher.go +++ b/pubsublite/internal/wire/publisher.go @@ -36,17 +36,17 @@ var ( // singlePartitionPublisher publishes messages to a single topic partition. // // Life of a successfully published message: -// - Publish() receives the message from the user. -// - It is added to `batcher.msgBundler`, which performs batching in accordance -// with user-configured PublishSettings. -// - onNewBatch() receives new message batches from the bundler. The batch is -// added to `batcher.publishQueue` (in-flight batches) and sent to the publish -// stream, if connected. If the stream is currently reconnecting, the entire -// queue is resent to the stream immediately after it has reconnected, in -// onStreamStatusChange(). -// - onResponse() receives the first cursor offset for the first batch in -// `batcher.publishQueue`. It assigns the cursor offsets for each message and -// releases the publish results to the user. +// - Publish() receives the message from the user. +// - It is added to `batcher.msgBundler`, which performs batching in accordance +// with user-configured PublishSettings. +// - onNewBatch() receives new message batches from the bundler. The batch is +// added to `batcher.publishQueue` (in-flight batches) and sent to the publish +// stream, if connected. If the stream is currently reconnecting, the entire +// queue is resent to the stream immediately after it has reconnected, in +// onStreamStatusChange(). +// - onResponse() receives the first cursor offset for the first batch in +// `batcher.publishQueue`. It assigns the cursor offsets for each message and +// releases the publish results to the user. // // See comments for unsafeInitiateShutdown() for error scenarios. type singlePartitionPublisher struct { @@ -221,14 +221,14 @@ func (pp *singlePartitionPublisher) onResponse(response interface{}) { // unsafeInitiateShutdown must be provided a target serviceStatus, which must be // one of: -// * serviceTerminating: attempts to successfully publish all pending messages -// before terminating the publisher. Occurs when: +// - serviceTerminating: attempts to successfully publish all pending messages +// before terminating the publisher. Occurs when: // - The user calls Stop(). // - A new message fails preconditions. This should block the publish of // subsequent messages to ensure ordering, but all pending messages should // be flushed. -// * serviceTerminated: immediately terminates the publisher and errors all -// in-flight batches and pending messages in the bundler. Occurs when: +// - serviceTerminated: immediately terminates the publisher and errors all +// in-flight batches and pending messages in the bundler. Occurs when: // - The publish stream terminates with a non-retryable error. // - An inconsistency is detected in the server's publish responses. Assume // there is a bug on the server and terminate the publisher, as correct diff --git a/pubsublite/operations.go b/pubsublite/operations.go index 0c69c60d01b..3f3f47b140e 100644 --- a/pubsublite/operations.go +++ b/pubsublite/operations.go @@ -147,10 +147,10 @@ func (s *SeekSubscriptionOperation) Metadata() (*OperationMetadata, error) { // Wait polls until the seek operation is complete and returns one of the // following: -// - A SeekSubscriptionResult and nil error if the operation is complete and -// succeeded. -// - Error containing failure reason if the operation is complete and failed. -// - Error if polling the operation status failed due to a non-retryable error. +// - A SeekSubscriptionResult and nil error if the operation is complete and +// succeeded. +// - Error containing failure reason if the operation is complete and failed. +// - Error if polling the operation status failed due to a non-retryable error. func (s *SeekSubscriptionOperation) Wait(ctx context.Context) (*SeekSubscriptionResult, error) { if _, err := s.op.Wait(ctx); err != nil { return nil, err diff --git a/pubsublite/pscompat/subscriber.go b/pubsublite/pscompat/subscriber.go index 5a9272378af..9f13ec4d240 100644 --- a/pubsublite/pscompat/subscriber.go +++ b/pubsublite/pscompat/subscriber.go @@ -293,9 +293,9 @@ func NewSubscriberClientWithSettings(ctx context.Context, subscription string, s // // The standard way to terminate a Receive is to cancel its context: // -// cctx, cancel := context.WithCancel(ctx) -// err := sub.Receive(cctx, callback) -// // Call cancel from callback, or another goroutine. +// cctx, cancel := context.WithCancel(ctx) +// err := sub.Receive(cctx, callback) +// // Call cancel from callback, or another goroutine. // // If there is a fatal service error, Receive returns that error after all of // the outstanding calls to f have returned. If ctx is done, Receive returns nil diff --git a/recaptchaenterprise/apiv1/doc.go b/recaptchaenterprise/apiv1/doc.go index de5e26d36d4..c06140f9190 100644 --- a/recaptchaenterprise/apiv1/doc.go +++ b/recaptchaenterprise/apiv1/doc.go @@ -17,43 +17,44 @@ // Package recaptchaenterprise is an auto-generated package for the // reCAPTCHA Enterprise API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := recaptchaenterprise.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := recaptchaenterprise.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := recaptchaenterprise.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := recaptchaenterprise.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &recaptchaenterprisepb.CreateAssessmentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1#CreateAssessmentRequest. -// } -// resp, err := c.CreateAssessment(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &recaptchaenterprisepb.CreateAssessmentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1#CreateAssessmentRequest. +// } +// resp, err := c.CreateAssessment(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/recaptchaenterprise/apiv1beta1/doc.go b/recaptchaenterprise/apiv1beta1/doc.go index ec6a283c3b2..48b9a8fb682 100644 --- a/recaptchaenterprise/apiv1beta1/doc.go +++ b/recaptchaenterprise/apiv1beta1/doc.go @@ -17,45 +17,46 @@ // Package recaptchaenterprise is an auto-generated package for the // reCAPTCHA Enterprise API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := recaptchaenterprise.NewRecaptchaEnterpriseServiceV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := recaptchaenterprise.NewRecaptchaEnterpriseServiceV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := recaptchaenterprise.NewRecaptchaEnterpriseServiceV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &recaptchaenterprisepb.CreateAssessmentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1#CreateAssessmentRequest. -// } -// resp, err := c.CreateAssessment(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := recaptchaenterprise.NewRecaptchaEnterpriseServiceV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &recaptchaenterprisepb.CreateAssessmentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1#CreateAssessmentRequest. +// } +// resp, err := c.CreateAssessment(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/recaptchaenterprise/v2/apiv1/doc.go b/recaptchaenterprise/v2/apiv1/doc.go index 2566c8d5e63..6dfd05bf19c 100644 --- a/recaptchaenterprise/v2/apiv1/doc.go +++ b/recaptchaenterprise/v2/apiv1/doc.go @@ -17,43 +17,44 @@ // Package recaptchaenterprise is an auto-generated package for the // reCAPTCHA Enterprise API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := recaptchaenterprise.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := recaptchaenterprise.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := recaptchaenterprise.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := recaptchaenterprise.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &recaptchaenterprisepb.CreateAssessmentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1#CreateAssessmentRequest. -// } -// resp, err := c.CreateAssessment(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &recaptchaenterprisepb.CreateAssessmentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1#CreateAssessmentRequest. +// } +// resp, err := c.CreateAssessment(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/recommendationengine/apiv1beta1/doc.go b/recommendationengine/apiv1beta1/doc.go index 259ddd0fe5a..eb415fdd4ac 100644 --- a/recommendationengine/apiv1beta1/doc.go +++ b/recommendationengine/apiv1beta1/doc.go @@ -21,45 +21,46 @@ // personalized recommendation systems without requiring a high level of // expertise in machine learning, recommendation system, or Google Cloud. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := recommendationengine.NewCatalogClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := recommendationengine.NewCatalogClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := recommendationengine.NewCatalogClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &recommendationenginepb.CreateCatalogItemRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recommendationengine/v1beta1#CreateCatalogItemRequest. -// } -// resp, err := c.CreateCatalogItem(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := recommendationengine.NewCatalogClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &recommendationenginepb.CreateCatalogItemRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recommendationengine/v1beta1#CreateCatalogItemRequest. +// } +// resp, err := c.CreateCatalogItem(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/recommender/apiv1/doc.go b/recommender/apiv1/doc.go index f10d8cc4f19..ae209fab475 100644 --- a/recommender/apiv1/doc.go +++ b/recommender/apiv1/doc.go @@ -17,49 +17,50 @@ // Package recommender is an auto-generated package for the // Recommender API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := recommender.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := recommender.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := recommender.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := recommender.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &recommenderpb.ListInsightsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recommender/v1#ListInsightsRequest. -// } -// it := c.ListInsights(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } +// req := &recommenderpb.ListInsightsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recommender/v1#ListInsightsRequest. +// } +// it := c.ListInsights(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/recommender/apiv1beta1/doc.go b/recommender/apiv1beta1/doc.go index 76766d151cd..e8efeace373 100644 --- a/recommender/apiv1beta1/doc.go +++ b/recommender/apiv1beta1/doc.go @@ -17,51 +17,52 @@ // Package recommender is an auto-generated package for the // Recommender API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := recommender.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := recommender.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := recommender.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &recommenderpb.ListInsightsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recommender/v1beta1#ListInsightsRequest. -// } -// it := c.ListInsights(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := recommender.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &recommenderpb.ListInsightsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/recommender/v1beta1#ListInsightsRequest. +// } +// it := c.ListInsights(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/redis/apiv1/cloud_redis_client.go b/redis/apiv1/cloud_redis_client.go index 0099a5f469f..915904cb71f 100644 --- a/redis/apiv1/cloud_redis_client.go +++ b/redis/apiv1/cloud_redis_client.go @@ -111,26 +111,26 @@ type internalCloudRedisClient interface { // CloudRedisClient is a client for interacting with Google Cloud Memorystore for Redis API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Configures and manages Cloud Memorystore for Redis instances +// # Configures and manages Cloud Memorystore for Redis instances // -// Google Cloud Memorystore for Redis v1 +// # Google Cloud Memorystore for Redis v1 // // The redis.googleapis.com service implements the Google Cloud Memorystore // for Redis API and defines the following resource model for managing Redis // instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Redis instances, named: /instances/* +// Each location has a collection of Redis instances, named: /instances/* // -// As such, Redis instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Redis instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be referring to a GCP region; for example: // -// projects/redpepper-1290/locations/us-central1/instances/my-redis +// projects/redpepper-1290/locations/us-central1/instances/my-redis type CloudRedisClient struct { // The internal transport-dependent client. internalClient internalCloudRedisClient @@ -171,7 +171,7 @@ func (c *CloudRedisClient) Connection() *grpc.ClientConn { // // The location should have the following format: // -// projects/{project_id}/locations/{location_id} +// projects/{project_id}/locations/{location_id} // // If location_id is specified as - (wildcard), then all regions // available to the project are queried, and the results are aggregated. @@ -338,26 +338,26 @@ type cloudRedisGRPCClient struct { // NewCloudRedisClient creates a new cloud redis client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Configures and manages Cloud Memorystore for Redis instances +// # Configures and manages Cloud Memorystore for Redis instances // -// Google Cloud Memorystore for Redis v1 +// # Google Cloud Memorystore for Redis v1 // // The redis.googleapis.com service implements the Google Cloud Memorystore // for Redis API and defines the following resource model for managing Redis // instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Redis instances, named: /instances/* +// Each location has a collection of Redis instances, named: /instances/* // -// As such, Redis instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Redis instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be referring to a GCP region; for example: // -// projects/redpepper-1290/locations/us-central1/instances/my-redis +// projects/redpepper-1290/locations/us-central1/instances/my-redis func NewCloudRedisClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClient, error) { clientOpts := defaultCloudRedisGRPCClientOptions() if newCloudRedisClientHook != nil { diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go index 4ab091efbe3..395d4bda1be 100644 --- a/redis/apiv1/doc.go +++ b/redis/apiv1/doc.go @@ -19,49 +19,50 @@ // // Creates and manages Redis instances on the Google Cloud Platform. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := redis.NewCloudRedisClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := redis.NewCloudRedisClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := redis.NewCloudRedisClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &redispb.ListInstancesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/redis/v1#ListInstancesRequest. -// } -// it := c.ListInstances(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := redis.NewCloudRedisClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &redispb.ListInstancesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/redis/v1#ListInstancesRequest. +// } +// it := c.ListInstances(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/redis/apiv1beta1/cloud_redis_client.go b/redis/apiv1beta1/cloud_redis_client.go index 7647c1d604b..b5e8b77fd9d 100644 --- a/redis/apiv1beta1/cloud_redis_client.go +++ b/redis/apiv1beta1/cloud_redis_client.go @@ -134,26 +134,26 @@ type internalCloudRedisClient interface { // CloudRedisClient is a client for interacting with Google Cloud Memorystore for Redis API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Configures and manages Cloud Memorystore for Redis instances +// # Configures and manages Cloud Memorystore for Redis instances // -// Google Cloud Memorystore for Redis v1beta1 +// # Google Cloud Memorystore for Redis v1beta1 // // The redis.googleapis.com service implements the Google Cloud Memorystore // for Redis API and defines the following resource model for managing Redis // instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Redis instances, named: /instances/* +// Each location has a collection of Redis instances, named: /instances/* // -// As such, Redis instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Redis instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be referring to a GCP region; for example: // -// projects/redpepper-1290/locations/us-central1/instances/my-redis +// projects/redpepper-1290/locations/us-central1/instances/my-redis type CloudRedisClient struct { // The internal transport-dependent client. internalClient internalCloudRedisClient @@ -194,7 +194,7 @@ func (c *CloudRedisClient) Connection() *grpc.ClientConn { // // The location should have the following format: // -// projects/{project_id}/locations/{location_id} +// projects/{project_id}/locations/{location_id} // // If location_id is specified as - (wildcard), then all regions // available to the project are queried, and the results are aggregated. @@ -361,26 +361,26 @@ type cloudRedisGRPCClient struct { // NewCloudRedisClient creates a new cloud redis client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Configures and manages Cloud Memorystore for Redis instances +// # Configures and manages Cloud Memorystore for Redis instances // -// Google Cloud Memorystore for Redis v1beta1 +// # Google Cloud Memorystore for Redis v1beta1 // // The redis.googleapis.com service implements the Google Cloud Memorystore // for Redis API and defines the following resource model for managing Redis // instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Redis instances, named: /instances/* +// Each location has a collection of Redis instances, named: /instances/* // -// As such, Redis instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Redis instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be referring to a GCP region; for example: // -// projects/redpepper-1290/locations/us-central1/instances/my-redis +// projects/redpepper-1290/locations/us-central1/instances/my-redis func NewCloudRedisClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClient, error) { clientOpts := defaultCloudRedisGRPCClientOptions() if newCloudRedisClientHook != nil { @@ -470,26 +470,26 @@ type cloudRedisRESTClient struct { // NewCloudRedisRESTClient creates a new cloud redis rest client. // -// Configures and manages Cloud Memorystore for Redis instances +// # Configures and manages Cloud Memorystore for Redis instances // -// Google Cloud Memorystore for Redis v1beta1 +// # Google Cloud Memorystore for Redis v1beta1 // // The redis.googleapis.com service implements the Google Cloud Memorystore // for Redis API and defines the following resource model for managing Redis // instances: // -// The service works with a collection of cloud projects, named: /projects/* +// The service works with a collection of cloud projects, named: /projects/* // -// Each project has a collection of available locations, named: /locations/* +// Each project has a collection of available locations, named: /locations/* // -// Each location has a collection of Redis instances, named: /instances/* +// Each location has a collection of Redis instances, named: /instances/* // -// As such, Redis instances are resources of the form: -// /projects/{project_id}/locations/{location_id}/instances/{instance_id} +// As such, Redis instances are resources of the form: +// /projects/{project_id}/locations/{location_id}/instances/{instance_id} // // Note that location_id must be referring to a GCP region; for example: // -// projects/redpepper-1290/locations/us-central1/instances/my-redis +// projects/redpepper-1290/locations/us-central1/instances/my-redis func NewCloudRedisRESTClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClient, error) { clientOpts := append(defaultCloudRedisRESTClientOptions(), opts...) httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) @@ -831,7 +831,7 @@ func (c *cloudRedisGRPCClient) RescheduleMaintenance(ctx context.Context, req *r // // The location should have the following format: // -// projects/{project_id}/locations/{location_id} +// projects/{project_id}/locations/{location_id} // // If location_id is specified as - (wildcard), then all regions // available to the project are queried, and the results are aggregated. diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go index ce6a825946a..298a269a430 100644 --- a/redis/apiv1beta1/doc.go +++ b/redis/apiv1beta1/doc.go @@ -19,51 +19,52 @@ // // Creates and manages Redis instances on the Google Cloud Platform. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := redis.NewCloudRedisClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := redis.NewCloudRedisClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := redis.NewCloudRedisClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &redispb.ListInstancesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/redis/v1beta1#ListInstancesRequest. -// } -// it := c.ListInstances(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := redis.NewCloudRedisClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &redispb.ListInstancesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/redis/v1beta1#ListInstancesRequest. +// } +// it := c.ListInstances(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/resourcemanager/apiv2/doc.go b/resourcemanager/apiv2/doc.go index d09dfedf9dc..22cbe60f6a3 100644 --- a/resourcemanager/apiv2/doc.go +++ b/resourcemanager/apiv2/doc.go @@ -20,49 +20,50 @@ // Creates, reads, and updates metadata for Google Cloud Platform resource // containers. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := resourcemanager.NewFoldersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := resourcemanager.NewFoldersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := resourcemanager.NewFoldersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &resourcemanagerpb.ListFoldersRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v2#ListFoldersRequest. -// } -// it := c.ListFolders(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := resourcemanager.NewFoldersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &resourcemanagerpb.ListFoldersRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v2#ListFoldersRequest. +// } +// it := c.ListFolders(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/resourcemanager/apiv2/folders_client.go b/resourcemanager/apiv2/folders_client.go index cb6b681f6f3..ffa9a608f2a 100644 --- a/resourcemanager/apiv2/folders_client.go +++ b/resourcemanager/apiv2/folders_client.go @@ -183,16 +183,16 @@ func (c *FoldersClient) GetFolder(ctx context.Context, req *resourcemanagerpb.Ge // In order to succeed, the addition of this new Folder must not violate // the Folder naming, height or fanout constraints. // -// The Folder’s display_name must be distinct from all other Folder’s that -// share its parent. +// The Folder’s display_name must be distinct from all other Folder’s that +// share its parent. // -// The addition of the Folder must not cause the active Folder hierarchy -// to exceed a height of 4. Note, the full active + deleted Folder hierarchy -// is allowed to reach a height of 8; this provides additional headroom when -// moving folders that contain deleted folders. +// The addition of the Folder must not cause the active Folder hierarchy +// to exceed a height of 4. Note, the full active + deleted Folder hierarchy +// is allowed to reach a height of 8; this provides additional headroom when +// moving folders that contain deleted folders. // -// The addition of the Folder must not cause the total number of Folders -// under its parent to exceed 100. +// The addition of the Folder must not cause the total number of Folders +// under its parent to exceed 100. // // If the operation fails due to a folder constraint violation, some errors // may be returned by the CreateFolder request, with status code diff --git a/resourcemanager/apiv3/doc.go b/resourcemanager/apiv3/doc.go index c6b97e56828..b6b0376a023 100644 --- a/resourcemanager/apiv3/doc.go +++ b/resourcemanager/apiv3/doc.go @@ -20,45 +20,46 @@ // Creates, reads, and updates metadata for Google Cloud Platform resource // containers. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := resourcemanager.NewFoldersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := resourcemanager.NewFoldersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := resourcemanager.NewFoldersClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &resourcemanagerpb.GetFolderRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#GetFolderRequest. -// } -// resp, err := c.GetFolder(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := resourcemanager.NewFoldersClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &resourcemanagerpb.GetFolderRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#GetFolderRequest. +// } +// resp, err := c.GetFolder(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/resourcemanager/apiv3/folders_client.go b/resourcemanager/apiv3/folders_client.go index cba5f3bd1a9..42201896d23 100644 --- a/resourcemanager/apiv3/folders_client.go +++ b/resourcemanager/apiv3/folders_client.go @@ -217,16 +217,16 @@ func (c *FoldersClient) SearchFolders(ctx context.Context, req *resourcemanagerp // In order to succeed, the addition of this new folder must not violate // the folder naming, height, or fanout constraints. // -// The folder’s display_name must be distinct from all other folders that -// share its parent. +// The folder’s display_name must be distinct from all other folders that +// share its parent. // -// The addition of the folder must not cause the active folder hierarchy -// to exceed a height of 10. Note, the full active + deleted folder hierarchy -// is allowed to reach a height of 20; this provides additional headroom when -// moving folders that contain deleted folders. +// The addition of the folder must not cause the active folder hierarchy +// to exceed a height of 10. Note, the full active + deleted folder hierarchy +// is allowed to reach a height of 20; this provides additional headroom when +// moving folders that contain deleted folders. // -// The addition of the folder must not cause the total number of folders -// under its parent to exceed 300. +// The addition of the folder must not cause the total number of folders +// under its parent to exceed 300. // // If the operation fails due to a folder constraint violation, some errors // may be returned by the CreateFolder request, with status code diff --git a/resourcemanager/apiv3/projects_client.go b/resourcemanager/apiv3/projects_client.go index 79e86d187b8..6bfdf0c30d0 100644 --- a/resourcemanager/apiv3/projects_client.go +++ b/resourcemanager/apiv3/projects_client.go @@ -339,39 +339,39 @@ func (c *ProjectsClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPoli // // The following constraints apply when using setIamPolicy(): // -// Project does not support allUsers and allAuthenticatedUsers as -// members in a Binding of a Policy. +// Project does not support allUsers and allAuthenticatedUsers as +// members in a Binding of a Policy. // -// The owner role can be granted to a user, serviceAccount, or a group -// that is part of an organization. For example, -// group@myownpersonaldomain.com (at mailto:group@myownpersonaldomain.com) could be added as an owner to a project in -// the myownpersonaldomain.com (at http://myownpersonaldomain.com) organization, but not the examplepetstore.com (at http://examplepetstore.com) -// organization. +// The owner role can be granted to a user, serviceAccount, or a group +// that is part of an organization. For example, +// group@myownpersonaldomain.com (at mailto:group@myownpersonaldomain.com) could be added as an owner to a project in +// the myownpersonaldomain.com (at http://myownpersonaldomain.com) organization, but not the examplepetstore.com (at http://examplepetstore.com) +// organization. // -// Service accounts can be made owners of a project directly -// without any restrictions. However, to be added as an owner, a user must be -// invited using the Cloud Platform console and must accept the invitation. +// Service accounts can be made owners of a project directly +// without any restrictions. However, to be added as an owner, a user must be +// invited using the Cloud Platform console and must accept the invitation. // -// A user cannot be granted the owner role using setIamPolicy(). The user -// must be granted the owner role using the Cloud Platform Console and must -// explicitly accept the invitation. +// A user cannot be granted the owner role using setIamPolicy(). The user +// must be granted the owner role using the Cloud Platform Console and must +// explicitly accept the invitation. // -// Invitations to grant the owner role cannot be sent using -// setIamPolicy(); -// they must be sent only using the Cloud Platform Console. +// Invitations to grant the owner role cannot be sent using +// setIamPolicy(); +// they must be sent only using the Cloud Platform Console. // -// Membership changes that leave the project without any owners that have -// accepted the Terms of Service (ToS) will be rejected. +// Membership changes that leave the project without any owners that have +// accepted the Terms of Service (ToS) will be rejected. // -// If the project is not part of an organization, there must be at least -// one owner who has accepted the Terms of Service (ToS) agreement in the -// policy. Calling setIamPolicy() to remove the last ToS-accepted owner -// from the policy will fail. This restriction also applies to legacy -// projects that no longer have owners who have accepted the ToS. Edits to -// IAM policies will be rejected until the lack of a ToS-accepting owner is -// rectified. +// If the project is not part of an organization, there must be at least +// one owner who has accepted the Terms of Service (ToS) agreement in the +// policy. Calling setIamPolicy() to remove the last ToS-accepted owner +// from the policy will fail. This restriction also applies to legacy +// projects that no longer have owners who have accepted the ToS. Edits to +// IAM policies will be rejected until the lack of a ToS-accepting owner is +// rectified. // -// Calling this method requires enabling the App Engine Admin API. +// Calling this method requires enabling the App Engine Admin API. func (c *ProjectsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) { return c.internalClient.SetIamPolicy(ctx, req, opts...) } diff --git a/resourcesettings/apiv1/doc.go b/resourcesettings/apiv1/doc.go index e29b7497a0d..7298736ece3 100644 --- a/resourcesettings/apiv1/doc.go +++ b/resourcesettings/apiv1/doc.go @@ -21,49 +21,50 @@ // of their GCP resources (e.g., VM, firewall, Project, etc.) across the // Cloud Resource Hierarchy. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := resourcesettings.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := resourcesettings.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := resourcesettings.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &resourcesettingspb.ListSettingsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcesettings/v1#ListSettingsRequest. -// } -// it := c.ListSettings(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := resourcesettings.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &resourcesettingspb.ListSettingsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcesettings/v1#ListSettingsRequest. +// } +// it := c.ListSettings(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/retail/apiv2/catalog_client.go b/retail/apiv2/catalog_client.go index 4cb0173dfed..0dceb10bdfa 100644 --- a/retail/apiv2/catalog_client.go +++ b/retail/apiv2/catalog_client.go @@ -212,13 +212,13 @@ func (c *CatalogClient) UpdateCatalog(ctx context.Context, req *retailpb.UpdateC // // More specifically: // -// PredictionService will only return product IDs from branch {newBranch}. +// PredictionService will only return product IDs from branch {newBranch}. // -// SearchService will only return product IDs from branch {newBranch} -// (if branch is not explicitly set). +// SearchService will only return product IDs from branch {newBranch} +// (if branch is not explicitly set). // -// UserEventService will only join events with products from branch -// {newBranch}. +// UserEventService will only join events with products from branch +// {newBranch}. func (c *CatalogClient) SetDefaultBranch(ctx context.Context, req *retailpb.SetDefaultBranchRequest, opts ...gax.CallOption) error { return c.internalClient.SetDefaultBranch(ctx, req, opts...) } diff --git a/retail/apiv2/doc.go b/retail/apiv2/doc.go index 6971f2533ee..193512c1622 100644 --- a/retail/apiv2/doc.go +++ b/retail/apiv2/doc.go @@ -21,49 +21,50 @@ // recommendation systems without requiring a high level of expertise in // machine learning, recommendation system, or Google Cloud. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := retail.NewCatalogClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := retail.NewCatalogClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := retail.NewCatalogClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &retailpb.ListCatalogsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/retail/v2#ListCatalogsRequest. -// } -// it := c.ListCatalogs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := retail.NewCatalogClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &retailpb.ListCatalogsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/retail/v2#ListCatalogsRequest. +// } +// it := c.ListCatalogs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/retail/apiv2alpha/catalog_client.go b/retail/apiv2alpha/catalog_client.go index 50a2767074e..f4b52facc60 100644 --- a/retail/apiv2alpha/catalog_client.go +++ b/retail/apiv2alpha/catalog_client.go @@ -310,13 +310,13 @@ func (c *CatalogClient) UpdateCatalog(ctx context.Context, req *retailpb.UpdateC // // More specifically: // -// PredictionService will only return product IDs from branch {newBranch}. +// PredictionService will only return product IDs from branch {newBranch}. // -// SearchService will only return product IDs from branch {newBranch} -// (if branch is not explicitly set). +// SearchService will only return product IDs from branch {newBranch} +// (if branch is not explicitly set). // -// UserEventService will only join events with products from branch -// {newBranch}. +// UserEventService will only join events with products from branch +// {newBranch}. func (c *CatalogClient) SetDefaultBranch(ctx context.Context, req *retailpb.SetDefaultBranchRequest, opts ...gax.CallOption) error { return c.internalClient.SetDefaultBranch(ctx, req, opts...) } diff --git a/retail/apiv2alpha/doc.go b/retail/apiv2alpha/doc.go index c552d2d4150..7d1d95abef3 100644 --- a/retail/apiv2alpha/doc.go +++ b/retail/apiv2alpha/doc.go @@ -21,51 +21,52 @@ // recommendation systems without requiring a high level of expertise in // machine learning, recommendation system, or Google Cloud. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := retail.NewCatalogClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := retail.NewCatalogClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := retail.NewCatalogClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &retailpb.ListCatalogsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/retail/v2alpha#ListCatalogsRequest. -// } -// it := c.ListCatalogs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := retail.NewCatalogClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &retailpb.ListCatalogsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/retail/v2alpha#ListCatalogsRequest. +// } +// it := c.ListCatalogs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/retail/apiv2alpha/model_client.go b/retail/apiv2alpha/model_client.go index 392ae8f8145..00ef76c1916 100644 --- a/retail/apiv2alpha/model_client.go +++ b/retail/apiv2alpha/model_client.go @@ -196,13 +196,13 @@ type internalModelClient interface { // // This service allows customers to e.g.: // -// Initiate training of a model. +// Initiate training of a model. // -// Pause training of an existing model. +// Pause training of an existing model. // -// List all the available models along with their metadata. +// List all the available models along with their metadata. // -// Control their tuning schedule. +// Control their tuning schedule. type ModelClient struct { // The internal transport-dependent client. internalClient internalModelClient @@ -335,13 +335,13 @@ type modelGRPCClient struct { // // This service allows customers to e.g.: // -// Initiate training of a model. +// Initiate training of a model. // -// Pause training of an existing model. +// Pause training of an existing model. // -// List all the available models along with their metadata. +// List all the available models along with their metadata. // -// Control their tuning schedule. +// Control their tuning schedule. func NewModelClient(ctx context.Context, opts ...option.ClientOption) (*ModelClient, error) { clientOpts := defaultModelGRPCClientOptions() if newModelClientHook != nil { diff --git a/retail/apiv2beta/catalog_client.go b/retail/apiv2beta/catalog_client.go index c4b43232768..5c9f7be3f71 100644 --- a/retail/apiv2beta/catalog_client.go +++ b/retail/apiv2beta/catalog_client.go @@ -310,13 +310,13 @@ func (c *CatalogClient) UpdateCatalog(ctx context.Context, req *retailpb.UpdateC // // More specifically: // -// PredictionService will only return product IDs from branch {newBranch}. +// PredictionService will only return product IDs from branch {newBranch}. // -// SearchService will only return product IDs from branch {newBranch} -// (if branch is not explicitly set). +// SearchService will only return product IDs from branch {newBranch} +// (if branch is not explicitly set). // -// UserEventService will only join events with products from branch -// {newBranch}. +// UserEventService will only join events with products from branch +// {newBranch}. func (c *CatalogClient) SetDefaultBranch(ctx context.Context, req *retailpb.SetDefaultBranchRequest, opts ...gax.CallOption) error { return c.internalClient.SetDefaultBranch(ctx, req, opts...) } diff --git a/retail/apiv2beta/doc.go b/retail/apiv2beta/doc.go index c277fc67824..03366b11ad0 100644 --- a/retail/apiv2beta/doc.go +++ b/retail/apiv2beta/doc.go @@ -21,51 +21,52 @@ // recommendation systems without requiring a high level of expertise in // machine learning, recommendation system, or Google Cloud. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := retail.NewCatalogClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := retail.NewCatalogClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := retail.NewCatalogClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &retailpb.ListCatalogsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/retail/v2beta#ListCatalogsRequest. -// } -// it := c.ListCatalogs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := retail.NewCatalogClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &retailpb.ListCatalogsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/retail/v2beta#ListCatalogsRequest. +// } +// it := c.ListCatalogs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/rpcreplay/doc.go b/rpcreplay/doc.go index df3efb2d52a..1b7fc7ab06d 100644 --- a/rpcreplay/doc.go +++ b/rpcreplay/doc.go @@ -20,45 +20,43 @@ yielding a unit test that is fast and flake-free. This package is EXPERIMENTAL and subject to change without notice. - -Recording +# Recording To record a sequence of gRPC calls to a file, create a Recorder and pass its DialOptions to grpc.Dial: - rec, err := rpcreplay.NewRecorder("service.replay", nil) - if err != nil { ... } - defer func() { - if err := rec.Close(); err != nil { ... } - }() - conn, err := grpc.Dial(serverAddress, rec.DialOptions()...) + rec, err := rpcreplay.NewRecorder("service.replay", nil) + if err != nil { ... } + defer func() { + if err := rec.Close(); err != nil { ... } + }() + conn, err := grpc.Dial(serverAddress, rec.DialOptions()...) It is essential to close the Recorder when the interaction is finished. There is also a NewRecorderWriter function for capturing to an arbitrary io.Writer. - -Replaying +# Replaying Replaying a captured file looks almost identical: create a Replayer and use its DialOptions. (Since we're reading the file and not writing it, we don't have to be as careful about the error returned from Close). - rep, err := rpcreplay.NewReplayer("service.replay") - if err != nil { ... } - defer rep.Close() - conn, err := grpc.Dial(serverAddress, rep.DialOptions()...) + rep, err := rpcreplay.NewReplayer("service.replay") + if err != nil { ... } + defer rep.Close() + conn, err := grpc.Dial(serverAddress, rep.DialOptions()...) Since a real connection isn't necessary for replay, you can get a fake one from the replayer instead of calling grpc.Dial: - rep, err := rpcreplay.NewReplayer("service.replay") - if err != nil { ... } - defer rep.Close() - conn, err := rep.Connection() + rep, err := rpcreplay.NewReplayer("service.replay") + if err != nil { ... } + defer rep.Close() + conn, err := rep.Connection() -Initial State +# Initial State A test might use random or time-sensitive values, for instance to create unique resources for isolation from other tests. The test therefore has initial values, such @@ -68,21 +66,20 @@ this initial state and re-establish it on replay. To record the initial state, serialize it into a []byte and pass it as the second argument to NewRecorder: - timeNow := time.Now() - b, err := timeNow.MarshalBinary() - if err != nil { ... } - rec, err := rpcreplay.NewRecorder("service.replay", b) + timeNow := time.Now() + b, err := timeNow.MarshalBinary() + if err != nil { ... } + rec, err := rpcreplay.NewRecorder("service.replay", b) On replay, get the bytes from Replayer.Initial: - rep, err := rpcreplay.NewReplayer("service.replay") - if err != nil { ... } - defer rep.Close() - err = timeNow.UnmarshalBinary(rep.Initial()) - if err != nil { ... } - + rep, err := rpcreplay.NewReplayer("service.replay") + if err != nil { ... } + defer rep.Close() + err = timeNow.UnmarshalBinary(rep.Initial()) + if err != nil { ... } -Callbacks +# Callbacks Recorders and replayers have support for running callbacks before messages are written to or read from the replay file. A Recorder has a BeforeFunc that can modify @@ -120,7 +117,7 @@ A common way to analyze and modify the various messages is to use a type switch. } } -Nondeterminism +# Nondeterminism A nondeterministic program may invoke RPCs in a different order each time it is run. The order in which RPCs are called during recording may differ @@ -138,7 +135,7 @@ name, since it has no other information at the time the stream is opened. Two st with the same method name that are started concurrently may replay in the wrong order. -Other Replayer Differences +# Other Replayer Differences Besides the differences in replay mentioned above, other differences may cause issues for some programs. We list them here. diff --git a/run/apiv2/doc.go b/run/apiv2/doc.go index c45861eadf4..f2fdc889eaa 100644 --- a/run/apiv2/doc.go +++ b/run/apiv2/doc.go @@ -17,45 +17,46 @@ // Package run is an auto-generated package for the // Cloud Run Admin API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := run.NewRevisionsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := run.NewRevisionsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := run.NewRevisionsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &runpb.GetRevisionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/run/v2#GetRevisionRequest. -// } -// resp, err := c.GetRevision(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := run.NewRevisionsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &runpb.GetRevisionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/run/v2#GetRevisionRequest. +// } +// resp, err := c.GetRevision(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/scheduler/apiv1/doc.go b/scheduler/apiv1/doc.go index 11fccd4a7c6..e7cd6fd0895 100644 --- a/scheduler/apiv1/doc.go +++ b/scheduler/apiv1/doc.go @@ -19,49 +19,50 @@ // // Creates and manages jobs run on a regular recurring schedule. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := scheduler.NewCloudSchedulerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := scheduler.NewCloudSchedulerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := scheduler.NewCloudSchedulerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &schedulerpb.ListJobsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/scheduler/v1#ListJobsRequest. -// } -// it := c.ListJobs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := scheduler.NewCloudSchedulerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &schedulerpb.ListJobsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/scheduler/v1#ListJobsRequest. +// } +// it := c.ListJobs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go index b93c4c0a9f4..1ae7865c128 100644 --- a/scheduler/apiv1beta1/doc.go +++ b/scheduler/apiv1beta1/doc.go @@ -19,51 +19,52 @@ // // Creates and manages jobs run on a regular recurring schedule. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := scheduler.NewCloudSchedulerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := scheduler.NewCloudSchedulerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := scheduler.NewCloudSchedulerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &schedulerpb.ListJobsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1#ListJobsRequest. -// } -// it := c.ListJobs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := scheduler.NewCloudSchedulerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &schedulerpb.ListJobsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1#ListJobsRequest. +// } +// it := c.ListJobs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/secretmanager/apiv1/doc.go b/secretmanager/apiv1/doc.go index 6c4b3de1c6d..d2ee244e8db 100644 --- a/secretmanager/apiv1/doc.go +++ b/secretmanager/apiv1/doc.go @@ -20,49 +20,50 @@ // Stores sensitive data such as API keys, passwords, and certificates. // Provides convenience while improving security. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := secretmanager.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := secretmanager.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := secretmanager.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &secretmanagerpb.ListSecretsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/secretmanager/v1#ListSecretsRequest. -// } -// it := c.ListSecrets(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := secretmanager.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &secretmanagerpb.ListSecretsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/secretmanager/v1#ListSecretsRequest. +// } +// it := c.ListSecrets(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/secretmanager/apiv1/secret_manager_client.go b/secretmanager/apiv1/secret_manager_client.go index 03485fb27d7..5083ffeae72 100644 --- a/secretmanager/apiv1/secret_manager_client.go +++ b/secretmanager/apiv1/secret_manager_client.go @@ -125,14 +125,14 @@ type internalClient interface { // Client is a client for interacting with Secret Manager API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Secret Manager Service +// # Secret Manager Service // // Manages secrets and operations using those secrets. Implements a REST // model with the following objects: // -// Secret +// Secret // -// SecretVersion +// SecretVersion type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -290,14 +290,14 @@ type gRPCClient struct { // NewClient creates a new secret manager service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Secret Manager Service +// # Secret Manager Service // // Manages secrets and operations using those secrets. Implements a REST // model with the following objects: // -// Secret +// Secret // -// SecretVersion +// SecretVersion func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { diff --git a/secretmanager/apiv1beta1/doc.go b/secretmanager/apiv1beta1/doc.go index 1253c9f428e..ab122d8922b 100644 --- a/secretmanager/apiv1beta1/doc.go +++ b/secretmanager/apiv1beta1/doc.go @@ -20,51 +20,52 @@ // Stores sensitive data such as API keys, passwords, and certificates. // Provides convenience while improving security. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := secretmanager.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := secretmanager.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := secretmanager.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &secretmanagerpb.ListSecretsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/secretmanager/v1beta1#ListSecretsRequest. -// } -// it := c.ListSecrets(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := secretmanager.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &secretmanagerpb.ListSecretsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/secretmanager/v1beta1#ListSecretsRequest. +// } +// it := c.ListSecrets(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/secretmanager/apiv1beta1/secret_manager_client.go b/secretmanager/apiv1beta1/secret_manager_client.go index 4417b562c00..03490990939 100644 --- a/secretmanager/apiv1beta1/secret_manager_client.go +++ b/secretmanager/apiv1beta1/secret_manager_client.go @@ -161,14 +161,14 @@ type internalClient interface { // Client is a client for interacting with Secret Manager API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Secret Manager Service +// # Secret Manager Service // // Manages secrets and operations using those secrets. Implements a REST // model with the following objects: // -// Secret +// Secret // -// SecretVersion +// SecretVersion type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -326,14 +326,14 @@ type gRPCClient struct { // NewClient creates a new secret manager service client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Secret Manager Service +// # Secret Manager Service // // Manages secrets and operations using those secrets. Implements a REST // model with the following objects: // -// Secret +// Secret // -// SecretVersion +// SecretVersion func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { @@ -407,14 +407,14 @@ type restClient struct { // NewRESTClient creates a new secret manager service rest client. // -// Secret Manager Service +// # Secret Manager Service // // Manages secrets and operations using those secrets. Implements a REST // model with the following objects: // -// Secret +// Secret // -// SecretVersion +// SecretVersion func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := append(defaultRESTClientOptions(), opts...) httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) diff --git a/security/privateca/apiv1/doc.go b/security/privateca/apiv1/doc.go index f2345fcab73..f6ecb8a9c36 100644 --- a/security/privateca/apiv1/doc.go +++ b/security/privateca/apiv1/doc.go @@ -22,43 +22,44 @@ // private certificate authorities (CAs) while staying in control of your // private keys. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := privateca.NewCertificateAuthorityClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := privateca.NewCertificateAuthorityClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := privateca.NewCertificateAuthorityClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &privatecapb.CreateCertificateRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/security/privateca/v1#CreateCertificateRequest. -// } -// resp, err := c.CreateCertificate(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := privateca.NewCertificateAuthorityClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &privatecapb.CreateCertificateRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/security/privateca/v1#CreateCertificateRequest. +// } +// resp, err := c.CreateCertificate(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/security/privateca/apiv1beta1/doc.go b/security/privateca/apiv1beta1/doc.go index 24a454a87d3..64654efd251 100644 --- a/security/privateca/apiv1beta1/doc.go +++ b/security/privateca/apiv1beta1/doc.go @@ -17,45 +17,46 @@ // Package privateca is an auto-generated package for the // Certificate Authority API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := privateca.NewCertificateAuthorityClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := privateca.NewCertificateAuthorityClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := privateca.NewCertificateAuthorityClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &privatecapb.CreateCertificateRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1#CreateCertificateRequest. -// } -// resp, err := c.CreateCertificate(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := privateca.NewCertificateAuthorityClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &privatecapb.CreateCertificateRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1#CreateCertificateRequest. +// } +// resp, err := c.CreateCertificate(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/securitycenter/apiv1/doc.go b/securitycenter/apiv1/doc.go index 097b84675b8..fdc5fd7cda8 100644 --- a/securitycenter/apiv1/doc.go +++ b/securitycenter/apiv1/doc.go @@ -20,48 +20,49 @@ // Security Command Center API provides access to temporal views of assets // and findings within an organization. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := securitycenter.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := securitycenter.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := securitycenter.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &securitycenterpb.BulkMuteFindingsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/v1#BulkMuteFindingsRequest. -// } -// op, err := c.BulkMuteFindings(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := securitycenter.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &securitycenterpb.BulkMuteFindingsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/v1#BulkMuteFindingsRequest. +// } +// op, err := c.BulkMuteFindings(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/securitycenter/apiv1beta1/doc.go b/securitycenter/apiv1beta1/doc.go index fb833b994c3..6efd73778a0 100644 --- a/securitycenter/apiv1beta1/doc.go +++ b/securitycenter/apiv1beta1/doc.go @@ -20,45 +20,46 @@ // Security Command Center API provides access to temporal views of assets // and findings within an organization. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := securitycenter.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := securitycenter.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := securitycenter.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &securitycenterpb.CreateSourceRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1#CreateSourceRequest. -// } -// resp, err := c.CreateSource(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := securitycenter.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &securitycenterpb.CreateSourceRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1#CreateSourceRequest. +// } +// resp, err := c.CreateSource(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/securitycenter/apiv1p1beta1/doc.go b/securitycenter/apiv1p1beta1/doc.go index bd294959dcd..8605c9ca1fa 100644 --- a/securitycenter/apiv1p1beta1/doc.go +++ b/securitycenter/apiv1p1beta1/doc.go @@ -20,45 +20,46 @@ // Security Command Center API provides access to temporal views of assets // and findings within an organization. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := securitycenter.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := securitycenter.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := securitycenter.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &securitycenterpb.CreateSourceRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1#CreateSourceRequest. -// } -// resp, err := c.CreateSource(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := securitycenter.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &securitycenterpb.CreateSourceRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1#CreateSourceRequest. +// } +// resp, err := c.CreateSource(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/securitycenter/settings/apiv1beta1/doc.go b/securitycenter/settings/apiv1beta1/doc.go index 894745fdcb8..a7968c5643e 100644 --- a/securitycenter/settings/apiv1beta1/doc.go +++ b/securitycenter/settings/apiv1beta1/doc.go @@ -20,45 +20,46 @@ // Cloud Security Command Center Settings API provides functionality to // retrieve and update configurations. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := settings.NewSecurityCenterSettingsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := settings.NewSecurityCenterSettingsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := settings.NewSecurityCenterSettingsClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &settingspb.GetServiceAccountRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1#GetServiceAccountRequest. -// } -// resp, err := c.GetServiceAccount(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := settings.NewSecurityCenterSettingsClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &settingspb.GetServiceAccountRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1#GetServiceAccountRequest. +// } +// resp, err := c.GetServiceAccount(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/securitycenter/settings/apiv1beta1/security_center_settings_client.go b/securitycenter/settings/apiv1beta1/security_center_settings_client.go index d08d1bcf64a..6b9719f4eb1 100644 --- a/securitycenter/settings/apiv1beta1/security_center_settings_client.go +++ b/securitycenter/settings/apiv1beta1/security_center_settings_client.go @@ -331,16 +331,16 @@ func (c *SecurityCenterSettingsClient) BatchGetSettings(ctx context.Context, req // Settings resources in the GCP resource hierarchy, and calculates the // effective settings on that resource by applying the following rules: // -// Settings provided closer to the target resource take precedence over -// those further away (e.g. folder will override organization level -// settings). +// Settings provided closer to the target resource take precedence over +// those further away (e.g. folder will override organization level +// settings). // -// Product defaults can be overridden at org, folder, project, and cluster -// levels. +// Product defaults can be overridden at org, folder, project, and cluster +// levels. // -// Detectors will be filtered out if they belong to a billing tier the -// customer -// has not configured. +// Detectors will be filtered out if they belong to a billing tier the +// customer +// has not configured. func (c *SecurityCenterSettingsClient) CalculateEffectiveSettings(ctx context.Context, req *settingspb.CalculateEffectiveSettingsRequest, opts ...gax.CallOption) (*settingspb.Settings, error) { return c.internalClient.CalculateEffectiveSettings(ctx, req, opts...) } diff --git a/servicecontrol/apiv1/doc.go b/servicecontrol/apiv1/doc.go index 3adaef28d93..06c08cb84f8 100644 --- a/servicecontrol/apiv1/doc.go +++ b/servicecontrol/apiv1/doc.go @@ -20,43 +20,44 @@ // Provides admission control and telemetry reporting for services integrated // with Service Infrastructure. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := servicecontrol.NewQuotaControllerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := servicecontrol.NewQuotaControllerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := servicecontrol.NewQuotaControllerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &servicecontrolpb.AllocateQuotaRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/servicecontrol/v1#AllocateQuotaRequest. -// } -// resp, err := c.AllocateQuota(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := servicecontrol.NewQuotaControllerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &servicecontrolpb.AllocateQuotaRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/servicecontrol/v1#AllocateQuotaRequest. +// } +// resp, err := c.AllocateQuota(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/servicedirectory/apiv1/doc.go b/servicedirectory/apiv1/doc.go index d73f6d3f01e..446b812cae7 100644 --- a/servicedirectory/apiv1/doc.go +++ b/servicedirectory/apiv1/doc.go @@ -20,43 +20,44 @@ // Service Directory is a platform for discovering, publishing, and // connecting services. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := servicedirectory.NewLookupClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := servicedirectory.NewLookupClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := servicedirectory.NewLookupClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &servicedirectorypb.ResolveServiceRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1#ResolveServiceRequest. -// } -// resp, err := c.ResolveService(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := servicedirectory.NewLookupClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &servicedirectorypb.ResolveServiceRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1#ResolveServiceRequest. +// } +// resp, err := c.ResolveService(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/servicedirectory/apiv1/registration_client.go b/servicedirectory/apiv1/registration_client.go index 163b74056b8..31a94580aea 100644 --- a/servicedirectory/apiv1/registration_client.go +++ b/servicedirectory/apiv1/registration_client.go @@ -324,18 +324,18 @@ type internalRegistrationClient interface { // Service Directory API for registering services. It defines the following // resource model: // -// The API has a collection of -// Namespace -// resources, named projects/*/locations/*/namespaces/*. +// The API has a collection of +// Namespace +// resources, named projects/*/locations/*/namespaces/*. // -// Each Namespace has a collection of -// Service resources, named -// projects/*/locations/*/namespaces/*/services/*. +// Each Namespace has a collection of +// Service resources, named +// projects/*/locations/*/namespaces/*/services/*. // -// Each Service has a collection of -// Endpoint -// resources, named -// projects/*/locations/*/namespaces/*/services/*/endpoints/*. +// Each Service has a collection of +// Endpoint +// resources, named +// projects/*/locations/*/namespaces/*/services/*/endpoints/*. type RegistrationClient struct { // The internal transport-dependent client. internalClient internalRegistrationClient @@ -484,18 +484,18 @@ type registrationGRPCClient struct { // Service Directory API for registering services. It defines the following // resource model: // -// The API has a collection of -// Namespace -// resources, named projects/*/locations/*/namespaces/*. +// The API has a collection of +// Namespace +// resources, named projects/*/locations/*/namespaces/*. // -// Each Namespace has a collection of -// Service resources, named -// projects/*/locations/*/namespaces/*/services/*. +// Each Namespace has a collection of +// Service resources, named +// projects/*/locations/*/namespaces/*/services/*. // -// Each Service has a collection of -// Endpoint -// resources, named -// projects/*/locations/*/namespaces/*/services/*/endpoints/*. +// Each Service has a collection of +// Endpoint +// resources, named +// projects/*/locations/*/namespaces/*/services/*/endpoints/*. func NewRegistrationClient(ctx context.Context, opts ...option.ClientOption) (*RegistrationClient, error) { clientOpts := defaultRegistrationGRPCClientOptions() if newRegistrationClientHook != nil { diff --git a/servicedirectory/apiv1beta1/doc.go b/servicedirectory/apiv1beta1/doc.go index 20d306bc297..3e7961465f2 100644 --- a/servicedirectory/apiv1beta1/doc.go +++ b/servicedirectory/apiv1beta1/doc.go @@ -20,45 +20,46 @@ // Service Directory is a platform for discovering, publishing, and // connecting services. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := servicedirectory.NewLookupClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := servicedirectory.NewLookupClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := servicedirectory.NewLookupClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &servicedirectorypb.ResolveServiceRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#ResolveServiceRequest. -// } -// resp, err := c.ResolveService(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := servicedirectory.NewLookupClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &servicedirectorypb.ResolveServiceRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#ResolveServiceRequest. +// } +// resp, err := c.ResolveService(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/servicedirectory/apiv1beta1/registration_client.go b/servicedirectory/apiv1beta1/registration_client.go index 113161b1cb0..c4c9f5530f7 100644 --- a/servicedirectory/apiv1beta1/registration_client.go +++ b/servicedirectory/apiv1beta1/registration_client.go @@ -533,18 +533,18 @@ type internalRegistrationClient interface { // Service Directory API for registering services. It defines the following // resource model: // -// The API has a collection of -// Namespace -// resources, named projects/*/locations/*/namespaces/*. +// The API has a collection of +// Namespace +// resources, named projects/*/locations/*/namespaces/*. // -// Each Namespace has a collection of -// Service resources, named -// projects/*/locations/*/namespaces/*/services/*. +// Each Namespace has a collection of +// Service resources, named +// projects/*/locations/*/namespaces/*/services/*. // -// Each Service has a collection of -// Endpoint -// resources, named -// projects/*/locations/*/namespaces/*/services/*/endpoints/*. +// Each Service has a collection of +// Endpoint +// resources, named +// projects/*/locations/*/namespaces/*/services/*/endpoints/*. type RegistrationClient struct { // The internal transport-dependent client. internalClient internalRegistrationClient @@ -693,18 +693,18 @@ type registrationGRPCClient struct { // Service Directory API for registering services. It defines the following // resource model: // -// The API has a collection of -// Namespace -// resources, named projects/*/locations/*/namespaces/*. +// The API has a collection of +// Namespace +// resources, named projects/*/locations/*/namespaces/*. // -// Each Namespace has a collection of -// Service resources, named -// projects/*/locations/*/namespaces/*/services/*. +// Each Namespace has a collection of +// Service resources, named +// projects/*/locations/*/namespaces/*/services/*. // -// Each Service has a collection of -// Endpoint -// resources, named -// projects/*/locations/*/namespaces/*/services/*/endpoints/*. +// Each Service has a collection of +// Endpoint +// resources, named +// projects/*/locations/*/namespaces/*/services/*/endpoints/*. func NewRegistrationClient(ctx context.Context, opts ...option.ClientOption) (*RegistrationClient, error) { clientOpts := defaultRegistrationGRPCClientOptions() if newRegistrationClientHook != nil { @@ -781,18 +781,18 @@ type registrationRESTClient struct { // Service Directory API for registering services. It defines the following // resource model: // -// The API has a collection of -// Namespace -// resources, named projects/*/locations/*/namespaces/*. +// The API has a collection of +// Namespace +// resources, named projects/*/locations/*/namespaces/*. // -// Each Namespace has a collection of -// Service resources, named -// projects/*/locations/*/namespaces/*/services/*. +// Each Namespace has a collection of +// Service resources, named +// projects/*/locations/*/namespaces/*/services/*. // -// Each Service has a collection of -// Endpoint -// resources, named -// projects/*/locations/*/namespaces/*/services/*/endpoints/*. +// Each Service has a collection of +// Endpoint +// resources, named +// projects/*/locations/*/namespaces/*/services/*/endpoints/*. func NewRegistrationRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegistrationClient, error) { clientOpts := append(defaultRegistrationRESTClientOptions(), opts...) httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) diff --git a/servicemanagement/apiv1/doc.go b/servicemanagement/apiv1/doc.go index c067b4573d3..17b1b84f770 100644 --- a/servicemanagement/apiv1/doc.go +++ b/servicemanagement/apiv1/doc.go @@ -21,49 +21,50 @@ // services on Google Cloud Platform so that they can be discovered and used // by service consumers. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := servicemanagement.NewServiceManagerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := servicemanagement.NewServiceManagerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := servicemanagement.NewServiceManagerClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &servicemanagementpb.ListServicesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/servicemanagement/v1#ListServicesRequest. -// } -// it := c.ListServices(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := servicemanagement.NewServiceManagerClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &servicemanagementpb.ListServicesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/servicemanagement/v1#ListServicesRequest. +// } +// it := c.ListServices(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/serviceusage/apiv1/doc.go b/serviceusage/apiv1/doc.go index b78c8cd6183..e8bea8b508a 100644 --- a/serviceusage/apiv1/doc.go +++ b/serviceusage/apiv1/doc.go @@ -21,48 +21,49 @@ // Platform, lists the available or enabled services, or disables services // that service consumers no longer use. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := serviceusage.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := serviceusage.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := serviceusage.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &serviceusagepb.EnableServiceRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/serviceusage/v1#EnableServiceRequest. -// } -// op, err := c.EnableService(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := serviceusage.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &serviceusagepb.EnableServiceRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/serviceusage/v1#EnableServiceRequest. +// } +// op, err := c.EnableService(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/shell/apiv1/doc.go b/shell/apiv1/doc.go index 095cfbc9140..3d50e6e5b2c 100644 --- a/shell/apiv1/doc.go +++ b/shell/apiv1/doc.go @@ -20,43 +20,44 @@ // Allows users to start, configure, and connect to interactive shell // sessions running in the cloud. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := shell.NewCloudShellClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := shell.NewCloudShellClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := shell.NewCloudShellClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &shellpb.GetEnvironmentRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/shell/v1#GetEnvironmentRequest. -// } -// resp, err := c.GetEnvironment(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := shell.NewCloudShellClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &shellpb.GetEnvironmentRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/shell/v1#GetEnvironmentRequest. +// } +// resp, err := c.GetEnvironment(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/spanner/admin/database/apiv1/backup.go b/spanner/admin/database/apiv1/backup.go index 89aa48aa081..3abeca64849 100644 --- a/spanner/admin/database/apiv1/backup.go +++ b/spanner/admin/database/apiv1/backup.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/spanner/admin/database/apiv1/backup_test.go b/spanner/admin/database/apiv1/backup_test.go index 49492d82afc..8bd5b6e8e43 100644 --- a/spanner/admin/database/apiv1/backup_test.go +++ b/spanner/admin/database/apiv1/backup_test.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/spanner/admin/database/apiv1/database_admin_client.go b/spanner/admin/database/apiv1/database_admin_client.go index 30580ae82de..8e8d81b9472 100644 --- a/spanner/admin/database/apiv1/database_admin_client.go +++ b/spanner/admin/database/apiv1/database_admin_client.go @@ -289,17 +289,17 @@ type internalDatabaseAdminClient interface { // DatabaseAdminClient is a client for interacting with Cloud Spanner API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Cloud Spanner Database Admin API +// # Cloud Spanner Database Admin API // // The Cloud Spanner Database Admin API can be used to: // -// create, drop, and list databases +// create, drop, and list databases // -// update the schema of pre-existing databases +// update the schema of pre-existing databases // -// create, delete and list backups for a database +// create, delete and list backups for a database // -// restore a database from an existing backup +// restore a database from an existing backup type DatabaseAdminClient struct { // The internal transport-dependent client. internalClient internalDatabaseAdminClient @@ -607,17 +607,17 @@ type databaseAdminGRPCClient struct { // NewDatabaseAdminClient creates a new database admin client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Cloud Spanner Database Admin API +// # Cloud Spanner Database Admin API // // The Cloud Spanner Database Admin API can be used to: // -// create, drop, and list databases +// create, drop, and list databases // -// update the schema of pre-existing databases +// update the schema of pre-existing databases // -// create, delete and list backups for a database +// create, delete and list backups for a database // -// restore a database from an existing backup +// restore a database from an existing backup func NewDatabaseAdminClient(ctx context.Context, opts ...option.ClientOption) (*DatabaseAdminClient, error) { clientOpts := defaultDatabaseAdminGRPCClientOptions() if newDatabaseAdminClientHook != nil { diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go index 2cf12a80031..269b631c4a7 100644 --- a/spanner/admin/database/apiv1/doc.go +++ b/spanner/admin/database/apiv1/doc.go @@ -20,49 +20,50 @@ // Cloud Spanner is a managed, mission-critical, globally consistent and // scalable relational database service. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := database.NewDatabaseAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := database.NewDatabaseAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := database.NewDatabaseAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &databasepb.ListDatabasesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/spanner/admin/database/v1#ListDatabasesRequest. -// } -// it := c.ListDatabases(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := database.NewDatabaseAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &databasepb.ListDatabasesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/spanner/admin/database/v1#ListDatabasesRequest. +// } +// it := c.ListDatabases(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/spanner/admin/database/apiv1/init.go b/spanner/admin/database/apiv1/init.go index 64a1f80e15e..a5aaadeac86 100644 --- a/spanner/admin/database/apiv1/init.go +++ b/spanner/admin/database/apiv1/init.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/spanner/admin/database/apiv1/path_funcs.go b/spanner/admin/database/apiv1/path_funcs.go index 5490f57c48a..d474b2cce29 100644 --- a/spanner/admin/database/apiv1/path_funcs.go +++ b/spanner/admin/database/apiv1/path_funcs.go @@ -17,7 +17,9 @@ package database // DatabaseAdminInstancePath returns the path for the instance resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/instances/%s", project, instance) +// +// fmt.Sprintf("projects/%s/instances/%s", project, instance) +// // instead. func DatabaseAdminInstancePath(project, instance string) string { return "" + @@ -31,7 +33,9 @@ func DatabaseAdminInstancePath(project, instance string) string { // DatabaseAdminDatabasePath returns the path for the database resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/instances/%s/databases/%s", project, instance, database) +// +// fmt.Sprintf("projects/%s/instances/%s/databases/%s", project, instance, database) +// // instead. func DatabaseAdminDatabasePath(project, instance, database string) string { return "" + diff --git a/spanner/admin/instance/apiv1/doc.go b/spanner/admin/instance/apiv1/doc.go index a697ece95bc..6b4b5a15a2d 100644 --- a/spanner/admin/instance/apiv1/doc.go +++ b/spanner/admin/instance/apiv1/doc.go @@ -17,49 +17,50 @@ // Package instance is an auto-generated package for the // Cloud Spanner Instance Admin API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := instance.NewInstanceAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := instance.NewInstanceAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := instance.NewInstanceAdminClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := instance.NewInstanceAdminClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &instancepb.ListInstanceConfigsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/spanner/admin/instance/v1#ListInstanceConfigsRequest. -// } -// it := c.ListInstanceConfigs(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } +// req := &instancepb.ListInstanceConfigsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/spanner/admin/instance/v1#ListInstanceConfigsRequest. +// } +// it := c.ListInstanceConfigs(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/spanner/admin/instance/apiv1/init.go b/spanner/admin/instance/apiv1/init.go index 6437b1464cc..54eb03ea1f5 100644 --- a/spanner/admin/instance/apiv1/init.go +++ b/spanner/admin/instance/apiv1/init.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/spanner/admin/instance/apiv1/instance_admin_client.go b/spanner/admin/instance/apiv1/instance_admin_client.go index bb995298580..d1a32fc7bab 100644 --- a/spanner/admin/instance/apiv1/instance_admin_client.go +++ b/spanner/admin/instance/apiv1/instance_admin_client.go @@ -170,7 +170,7 @@ type internalInstanceAdminClient interface { // InstanceAdminClient is a client for interacting with Cloud Spanner Instance Admin API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Cloud Spanner Instance Admin API +// # Cloud Spanner Instance Admin API // // The Cloud Spanner Instance Admin API can be used to create, delete, // modify and list instances. Instances are dedicated Cloud Spanner serving @@ -255,28 +255,28 @@ func (c *InstanceAdminClient) GetInstance(ctx context.Context, req *instancepb.G // // Immediately upon completion of this request: // -// The instance is readable via the API, with all requested attributes -// but no allocated resources. Its state is CREATING. +// The instance is readable via the API, with all requested attributes +// but no allocated resources. Its state is CREATING. // // Until completion of the returned operation: // -// Cancelling the operation renders the instance immediately unreadable -// via the API. +// Cancelling the operation renders the instance immediately unreadable +// via the API. // -// The instance can be deleted. +// The instance can be deleted. // -// All other attempts to modify the instance are rejected. +// All other attempts to modify the instance are rejected. // // Upon completion of the returned operation: // -// Billing for all successfully-allocated resources begins (some types -// may have lower than the requested levels). +// Billing for all successfully-allocated resources begins (some types +// may have lower than the requested levels). // -// Databases can be created in the instance. +// Databases can be created in the instance. // -// The instance’s allocated resource levels are readable via the API. +// The instance’s allocated resource levels are readable via the API. // -// The instance’s state becomes READY. +// The instance’s state becomes READY. // // The returned [long-running operation][google.longrunning.Operation] will // have a name of the format /operations/ and @@ -303,31 +303,31 @@ func (c *InstanceAdminClient) CreateInstanceOperation(name string) *CreateInstan // // Immediately upon completion of this request: // -// For resource types for which a decrease in the instance’s allocation -// has been requested, billing is based on the newly-requested level. +// For resource types for which a decrease in the instance’s allocation +// has been requested, billing is based on the newly-requested level. // // Until completion of the returned operation: // -// Cancelling the operation sets its metadata’s -// cancel_time, and begins -// restoring resources to their pre-request values. The operation -// is guaranteed to succeed at undoing all resource changes, -// after which point it terminates with a CANCELLED status. +// Cancelling the operation sets its metadata’s +// cancel_time, and begins +// restoring resources to their pre-request values. The operation +// is guaranteed to succeed at undoing all resource changes, +// after which point it terminates with a CANCELLED status. // -// All other attempts to modify the instance are rejected. +// All other attempts to modify the instance are rejected. // -// Reading the instance via the API continues to give the pre-request -// resource levels. +// Reading the instance via the API continues to give the pre-request +// resource levels. // // Upon completion of the returned operation: // -// Billing begins for all successfully-allocated resources (some types -// may have lower than the requested levels). +// Billing begins for all successfully-allocated resources (some types +// may have lower than the requested levels). // -// All newly-reserved resources are available for serving the instance’s -// tables. +// All newly-reserved resources are available for serving the instance’s +// tables. // -// The instance’s new resource levels are readable via the API. +// The instance’s new resource levels are readable via the API. // // The returned [long-running operation][google.longrunning.Operation] will // have a name of the format /operations/ and @@ -353,13 +353,13 @@ func (c *InstanceAdminClient) UpdateInstanceOperation(name string) *UpdateInstan // // Immediately upon completion of the request: // -// Billing ceases for all of the instance’s reserved resources. +// Billing ceases for all of the instance’s reserved resources. // // Soon afterward: // -// The instance and all of its databases immediately and -// irrevocably disappear from the API. All data in the databases -// is permanently deleted. +// The instance and all of its databases immediately and +// irrevocably disappear from the API. All data in the databases +// is permanently deleted. func (c *InstanceAdminClient) DeleteInstance(ctx context.Context, req *instancepb.DeleteInstanceRequest, opts ...gax.CallOption) error { return c.internalClient.DeleteInstance(ctx, req, opts...) } @@ -420,7 +420,7 @@ type instanceAdminGRPCClient struct { // NewInstanceAdminClient creates a new instance admin client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Cloud Spanner Instance Admin API +// # Cloud Spanner Instance Admin API // // The Cloud Spanner Instance Admin API can be used to create, delete, // modify and list instances. Instances are dedicated Cloud Spanner serving diff --git a/spanner/admin/instance/apiv1/path_funcs.go b/spanner/admin/instance/apiv1/path_funcs.go index a2255805f7f..92c5c053c0e 100644 --- a/spanner/admin/instance/apiv1/path_funcs.go +++ b/spanner/admin/instance/apiv1/path_funcs.go @@ -17,7 +17,9 @@ package instance // InstanceAdminProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func InstanceAdminProjectPath(project string) string { return "" + @@ -29,7 +31,9 @@ func InstanceAdminProjectPath(project string) string { // InstanceAdminInstanceConfigPath returns the path for the instance config resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/instanceConfigs/%s", project, instanceConfig) +// +// fmt.Sprintf("projects/%s/instanceConfigs/%s", project, instanceConfig) +// // instead. func InstanceAdminInstanceConfigPath(project, instanceConfig string) string { return "" + @@ -43,7 +47,9 @@ func InstanceAdminInstanceConfigPath(project, instanceConfig string) string { // InstanceAdminInstancePath returns the path for the instance resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/instances/%s", project, instance) +// +// fmt.Sprintf("projects/%s/instances/%s", project, instance) +// // instead. func InstanceAdminInstancePath(project, instance string) string { return "" + diff --git a/spanner/apiv1/doc.go b/spanner/apiv1/doc.go index b3e672f1605..b46aa82becc 100644 --- a/spanner/apiv1/doc.go +++ b/spanner/apiv1/doc.go @@ -20,43 +20,44 @@ // Cloud Spanner is a managed, mission-critical, globally consistent and // scalable relational database service. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := spanner.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := spanner.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := spanner.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &spannerpb.CreateSessionRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/spanner/v1#CreateSessionRequest. -// } -// resp, err := c.CreateSession(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := spanner.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &spannerpb.CreateSessionRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/spanner/v1#CreateSessionRequest. +// } +// resp, err := c.CreateSession(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/spanner/apiv1/path_funcs.go b/spanner/apiv1/path_funcs.go index 19f30adb39f..db29b0ba52e 100644 --- a/spanner/apiv1/path_funcs.go +++ b/spanner/apiv1/path_funcs.go @@ -17,7 +17,9 @@ package spanner // DatabasePath returns the path for the database resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/instances/%s/databases/%s", project, instance, database) +// +// fmt.Sprintf("projects/%s/instances/%s/databases/%s", project, instance, database) +// // instead. func DatabasePath(project, instance, database string) string { return "" + @@ -33,7 +35,9 @@ func DatabasePath(project, instance, database string) string { // SessionPath returns the path for the session resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", project, instance, database, session) +// +// fmt.Sprintf("projects/%s/instances/%s/databases/%s/sessions/%s", project, instance, database, session) +// // instead. func SessionPath(project, instance, database, session string) string { return "" + diff --git a/spanner/apiv1/spanner_client.go b/spanner/apiv1/spanner_client.go index 9d37d53d525..79c1a44c07f 100644 --- a/spanner/apiv1/spanner_client.go +++ b/spanner/apiv1/spanner_client.go @@ -243,7 +243,7 @@ type internalClient interface { // Client is a client for interacting with Cloud Spanner API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Cloud Spanner API +// # Cloud Spanner API // // The Cloud Spanner API can be used to manage sessions and execute // transactions on data stored in Cloud Spanner databases. @@ -485,7 +485,7 @@ type gRPCClient struct { // NewClient creates a new spanner client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Cloud Spanner API +// # Cloud Spanner API // // The Cloud Spanner API can be used to manage sessions and execute // transactions on data stored in Cloud Spanner databases. diff --git a/spanner/doc.go b/spanner/doc.go index 39850ebaa0a..8c30fdcc2a4 100644 --- a/spanner/doc.go +++ b/spanner/doc.go @@ -25,18 +25,17 @@ introduction to Cloud Spanner and additional help on using this API. See https://godoc.org/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package. - -Creating a Client +# Creating a Client To start working with this package, create a client that refers to the database of interest: - ctx := context.Background() - client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D") - if err != nil { - // TODO: Handle error. - } - defer client.Close() + ctx := context.Background() + client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D") + if err != nil { + // TODO: Handle error. + } + defer client.Close() Remember to close the client after use to free up the sessions in the session pool. @@ -46,74 +45,69 @@ environment variable to the address at which your emulator is running. This will send requests to that address instead of to Cloud Spanner. You can then create and use a client as usual: - // Set SPANNER_EMULATOR_HOST environment variable. - err := os.Setenv("SPANNER_EMULATOR_HOST", "localhost:9010") - if err != nil { - // TODO: Handle error. - } - // Create client as usual. - client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D") - if err != nil { - // TODO: Handle error. - } - + // Set SPANNER_EMULATOR_HOST environment variable. + err := os.Setenv("SPANNER_EMULATOR_HOST", "localhost:9010") + if err != nil { + // TODO: Handle error. + } + // Create client as usual. + client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D") + if err != nil { + // TODO: Handle error. + } -Simple Reads and Writes +# Simple Reads and Writes Two Client methods, Apply and Single, work well for simple reads and writes. As a quick introduction, here we write a new row to the database and read it back: - _, err := client.Apply(ctx, []*spanner.Mutation{ - spanner.Insert("Users", - []string{"name", "email"}, - []interface{}{"alice", "a@example.com"})}) - if err != nil { - // TODO: Handle error. - } - row, err := client.Single().ReadRow(ctx, "Users", - spanner.Key{"alice"}, []string{"email"}) - if err != nil { - // TODO: Handle error. - } + _, err := client.Apply(ctx, []*spanner.Mutation{ + spanner.Insert("Users", + []string{"name", "email"}, + []interface{}{"alice", "a@example.com"})}) + if err != nil { + // TODO: Handle error. + } + row, err := client.Single().ReadRow(ctx, "Users", + spanner.Key{"alice"}, []string{"email"}) + if err != nil { + // TODO: Handle error. + } All the methods used above are discussed in more detail below. - -Keys +# Keys Every Cloud Spanner row has a unique key, composed of one or more columns. Construct keys with a literal of type Key: - key1 := spanner.Key{"alice"} - + key1 := spanner.Key{"alice"} -KeyRanges +# KeyRanges The keys of a Cloud Spanner table are ordered. You can specify ranges of keys using the KeyRange type: - kr1 := spanner.KeyRange{Start: key1, End: key2} + kr1 := spanner.KeyRange{Start: key1, End: key2} By default, a KeyRange includes its start key but not its end key. Use the Kind field to specify other boundary conditions: - // include both keys - kr2 := spanner.KeyRange{Start: key1, End: key2, Kind: spanner.ClosedClosed} + // include both keys + kr2 := spanner.KeyRange{Start: key1, End: key2, Kind: spanner.ClosedClosed} - -KeySets +# KeySets A KeySet represents a set of keys. A single Key or KeyRange can act as a KeySet. Use the KeySets function to build the union of several KeySets: - ks1 := spanner.KeySets(key1, key2, kr1, kr2) + ks1 := spanner.KeySets(key1, key2, kr1, kr2) AllKeys returns a KeySet that refers to all the keys in a table: - ks2 := spanner.AllKeys() - + ks2 := spanner.AllKeys() -Transactions +# Transactions All Cloud Spanner reads and writes occur inside transactions. There are two types of transactions, read-only and read-write. Read-only transactions cannot @@ -122,8 +116,7 @@ database state or states in the past. Read-write transactions can read the database before writing to it, and always apply to the most recent database state. - -Single Reads +# Single Reads The simplest and fastest transaction is a ReadOnlyTransaction that supports a single read operation. Use Client.Single to create such a transaction. You can @@ -132,35 +125,35 @@ chain the call to Single with a call to a Read method. When you only want one row whose key you know, use ReadRow. Provide the table name, key, and the columns you want to read: - row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) + row, err := client.Single().ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) Read multiple rows with the Read method. It takes a table name, KeySet, and list of columns: - iter := client.Single().Read(ctx, "Accounts", keyset1, columns) + iter := client.Single().Read(ctx, "Accounts", keyset1, columns) Read returns a RowIterator. You can call the Do method on the iterator and pass a callback: - err := iter.Do(func(row *Row) error { - // TODO: use row - return nil - }) + err := iter.Do(func(row *Row) error { + // TODO: use row + return nil + }) RowIterator also follows the standard pattern for the Google Cloud Client Libraries: - defer iter.Stop() - for { - row, err := iter.Next() - if err == iterator.Done { - break - } - if err != nil { - // TODO: Handle error. - } - // TODO: use row - } + defer iter.Stop() + for { + row, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: use row + } Always call Stop when you finish using an iterator this way, whether or not you iterate to the end. (Failing to call Stop could lead you to exhaust the @@ -168,23 +161,22 @@ database's session quota.) To read rows with an index, use ReadUsingIndex. -Statements +# Statements The most general form of reading uses SQL statements. Construct a Statement with NewStatement, setting any parameters using the Statement's Params map: - stmt := spanner.NewStatement("SELECT First, Last FROM SINGERS WHERE Last >= @start") - stmt.Params["start"] = "Dylan" + stmt := spanner.NewStatement("SELECT First, Last FROM SINGERS WHERE Last >= @start") + stmt.Params["start"] = "Dylan" You can also construct a Statement directly with a struct literal, providing your own map of parameters. Use the Query method to run the statement and obtain an iterator: - iter := client.Single().Query(ctx, stmt) - + iter := client.Single().Query(ctx, stmt) -Rows +# Rows Once you have a Row, via an iterator or a call to ReadRow, you can extract column values in several ways. Pass in a pointer to a Go variable of the @@ -192,49 +184,46 @@ appropriate type when you extract a value. You can extract by column position or name: - err := row.Column(0, &name) - err = row.ColumnByName("balance", &balance) + err := row.Column(0, &name) + err = row.ColumnByName("balance", &balance) You can extract all the columns at once: - err = row.Columns(&name, &balance) + err = row.Columns(&name, &balance) Or you can define a Go struct that corresponds to your columns, and extract into that: - var s struct { Name string; Balance int64 } - err = row.ToStruct(&s) - + var s struct { Name string; Balance int64 } + err = row.ToStruct(&s) For Cloud Spanner columns that may contain NULL, use one of the NullXXX types, like NullString: - var ns spanner.NullString - if err := row.Column(0, &ns); err != nil { - // TODO: Handle error. - } - if ns.Valid { - fmt.Println(ns.StringVal) - } else { - fmt.Println("column is NULL") - } - + var ns spanner.NullString + if err := row.Column(0, &ns); err != nil { + // TODO: Handle error. + } + if ns.Valid { + fmt.Println(ns.StringVal) + } else { + fmt.Println("column is NULL") + } -Multiple Reads +# Multiple Reads To perform more than one read in a transaction, use ReadOnlyTransaction: - txn := client.ReadOnlyTransaction() - defer txn.Close() - iter := txn.Query(ctx, stmt1) - // ... - iter = txn.Query(ctx, stmt2) - // ... + txn := client.ReadOnlyTransaction() + defer txn.Close() + iter := txn.Query(ctx, stmt1) + // ... + iter = txn.Query(ctx, stmt2) + // ... You must call Close when you are done with the transaction. - -Timestamps and Timestamp Bounds +# Timestamps and Timestamp Bounds Cloud Spanner read-only transactions conceptually perform all their reads at a single moment in time, called the transaction's read timestamp. Once a read has @@ -249,14 +238,13 @@ selected by a transaction by calling the WithTimestampBound method on the transaction before using it. For example, to perform a query on data that is at most one minute stale, use - client.Single(). - WithTimestampBound(spanner.MaxStaleness(1*time.Minute)). - Query(ctx, stmt) + client.Single(). + WithTimestampBound(spanner.MaxStaleness(1*time.Minute)). + Query(ctx, stmt) See the documentation of TimestampBound for more details. - -Mutations +# Mutations To write values to a Cloud Spanner database, construct a Mutation. The spanner package has functions for inserting, updating and deleting rows. Except for the @@ -265,30 +253,29 @@ comes in three varieties. One takes lists of columns and values along with the table name: - m1 := spanner.Insert("Users", - []string{"name", "email"}, - []interface{}{"alice", "a@example.com"}) + m1 := spanner.Insert("Users", + []string{"name", "email"}, + []interface{}{"alice", "a@example.com"}) One takes a map from column names to values: - m2 := spanner.InsertMap("Users", map[string]interface{}{ - "name": "alice", - "email": "a@example.com", - }) + m2 := spanner.InsertMap("Users", map[string]interface{}{ + "name": "alice", + "email": "a@example.com", + }) And the third accepts a struct value, and determines the columns from the struct field names: - type User struct { Name, Email string } - u := User{Name: "alice", Email: "a@example.com"} - m3, err := spanner.InsertStruct("Users", u) + type User struct { Name, Email string } + u := User{Name: "alice", Email: "a@example.com"} + m3, err := spanner.InsertStruct("Users", u) - -Writes +# Writes To apply a list of mutations to the database, use Apply: - _, err := client.Apply(ctx, []*spanner.Mutation{m1, m2, m3}) + _, err := client.Apply(ctx, []*spanner.Mutation{m1, m2, m3}) If you need to read before writing in a single transaction, use a ReadWriteTransaction. ReadWriteTransactions may be aborted automatically by the @@ -297,33 +284,32 @@ and the client will handle the retries automatically. Use the transaction's BufferWrite method to buffer mutations, which will all be executed at the end of the transaction: - _, err := client.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error { - var balance int64 - row, err := txn.ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) - if err != nil { - // The transaction function will be called again if the error code - // of this error is Aborted. The backend may automatically abort - // any read/write transaction if it detects a deadlock or other - // problems. - return err - } - if err := row.Column(0, &balance); err != nil { - return err - } - - if balance <= 10 { - return errors.New("insufficient funds in account") - } - balance -= 10 - m := spanner.Update("Accounts", []string{"user", "balance"}, []interface{}{"alice", balance}) - // The buffered mutation will be committed. If the commit - // fails with an Aborted error, this function will be called - // again. - return txn.BufferWrite([]*spanner.Mutation{m}) - }) - - -Structs + _, err := client.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error { + var balance int64 + row, err := txn.ReadRow(ctx, "Accounts", spanner.Key{"alice"}, []string{"balance"}) + if err != nil { + // The transaction function will be called again if the error code + // of this error is Aborted. The backend may automatically abort + // any read/write transaction if it detects a deadlock or other + // problems. + return err + } + if err := row.Column(0, &balance); err != nil { + return err + } + + if balance <= 10 { + return errors.New("insufficient funds in account") + } + balance -= 10 + m := spanner.Update("Accounts", []string{"user", "balance"}, []interface{}{"alice", balance}) + // The buffered mutation will be committed. If the commit + // fails with an Aborted error, this function will be called + // again. + return txn.BufferWrite([]*spanner.Mutation{m}) + }) + +# Structs Cloud Spanner STRUCT (aka STRUCT) values (https://cloud.google.com/spanner/docs/data-types#struct-type) can be @@ -349,8 +335,7 @@ NULL and empty array values respectively of the corresponding StructType. A slice of pointers to a Go struct type can be used to specify an array of NULL-able STRUCT values. - -DML and Partitioned DML +# DML and Partitioned DML Spanner supports DML statements like INSERT, UPDATE and DELETE. Use ReadWriteTransaction.Update to run DML statements. It returns the number of rows @@ -362,8 +347,7 @@ For large databases, it may be more efficient to partition the DML statement. Use client.PartitionedUpdate to run a DML statement in this way. Not all DML statements can be partitioned. - -Tracing +# Tracing This client has been instrumented to use OpenCensus tracing (http://opencensus.io). To enable tracing, see "Enabling Tracing for a Program" diff --git a/spanner/key.go b/spanner/key.go index aa876ec3d85..2901b6455d6 100644 --- a/spanner/key.go +++ b/spanner/key.go @@ -235,7 +235,7 @@ const ( // the following range returns all events for user "Bob" that occurred in the // year 2015: // -// spanner.KeyRange{ +// spanner.KeyRange{ // Start: spanner.Key{"Bob", "2015-01-01"}, // End: spanner.Key{"Bob", "2015-12-31"}, // Kind: ClosedClosed, diff --git a/spanner/mutation.go b/spanner/mutation.go index 7ee0ca3477a..54168972ae9 100644 --- a/spanner/mutation.go +++ b/spanner/mutation.go @@ -69,7 +69,7 @@ const ( // To apply a series of mutations as part of an atomic read-modify-write // operation, use ReadWriteTransaction. // -// Updating a row +// # Updating a row // // Changing the values of columns in an existing row is very similar to // inserting a new row: @@ -79,7 +79,7 @@ const ( // []interface{}{UserID, profile}) // _, err := client.Apply(ctx, []*spanner.Mutation{m}) // -// Deleting a row +// # Deleting a row // // To delete a row, use spanner.Delete: // @@ -93,7 +93,7 @@ const ( // if cascading deletes are specified in those tables' schemas. Delete does // nothing if the named row does not exist (does not yield an error). // -// Deleting a field +// # Deleting a field // // To delete/clear a field within a row, use spanner.Update with the value nil: // @@ -105,22 +105,22 @@ const ( // The valid Go types and their corresponding Cloud Spanner types that can be // used in the Insert/Update/InsertOrUpdate functions are: // -// string, *string, NullString - STRING -// []string, []*string, []NullString - STRING ARRAY -// []byte - BYTES -// [][]byte - BYTES ARRAY -// int, int64, *int64, NullInt64 - INT64 -// []int, []int64, []*int64, []NullInt64 - INT64 ARRAY -// bool, *bool, NullBool - BOOL -// []bool, []*bool, []NullBool - BOOL ARRAY -// float64, *float64, NullFloat64 - FLOAT64 -// []float64, []*float64, []NullFloat64 - FLOAT64 ARRAY -// time.Time, *time.Time, NullTime - TIMESTAMP -// []time.Time, []*time.Time, []NullTime - TIMESTAMP ARRAY -// Date, *Date, NullDate - DATE -// []Date, []*Date, []NullDate - DATE ARRAY -// big.Rat, *big.Rat, NullNumeric - NUMERIC -// []big.Rat, []*big.Rat, []NullNumeric - NUMERIC ARRAY +// string, *string, NullString - STRING +// []string, []*string, []NullString - STRING ARRAY +// []byte - BYTES +// [][]byte - BYTES ARRAY +// int, int64, *int64, NullInt64 - INT64 +// []int, []int64, []*int64, []NullInt64 - INT64 ARRAY +// bool, *bool, NullBool - BOOL +// []bool, []*bool, []NullBool - BOOL ARRAY +// float64, *float64, NullFloat64 - FLOAT64 +// []float64, []*float64, []NullFloat64 - FLOAT64 ARRAY +// time.Time, *time.Time, NullTime - TIMESTAMP +// []time.Time, []*time.Time, []NullTime - TIMESTAMP ARRAY +// Date, *Date, NullDate - DATE +// []Date, []*Date, []NullDate - DATE ARRAY +// big.Rat, *big.Rat, NullNumeric - NUMERIC +// []big.Rat, []*big.Rat, []NullNumeric - NUMERIC ARRAY // // To compare two Mutations for testing purposes, use reflect.DeepEqual. type Mutation struct { diff --git a/spanner/row.go b/spanner/row.go index d33854e0e2a..535861d2658 100644 --- a/spanner/row.go +++ b/spanner/row.go @@ -283,16 +283,16 @@ func errToStructArgType(p interface{}) error { // The rules for mapping a row's columns into a struct's exported fields // are: // -// 1. If a field has a `spanner: "column_name"` tag, then decode column -// 'column_name' into the field. A special case is the `spanner: "-"` -// tag, which instructs ToStruct to ignore the field during decoding. +// 1. If a field has a `spanner: "column_name"` tag, then decode column +// 'column_name' into the field. A special case is the `spanner: "-"` +// tag, which instructs ToStruct to ignore the field during decoding. // -// 2. Otherwise, if the name of a field matches the name of a column (ignoring case), -// decode the column into the field. +// 2. Otherwise, if the name of a field matches the name of a column (ignoring case), +// decode the column into the field. // -// 3. The number of columns in the row must match the number of exported fields in the struct. -// There must be exactly one match for each column in the row. The method will return an error -// if a column in the row cannot be assigned to a field in the struct. +// 3. The number of columns in the row must match the number of exported fields in the struct. +// There must be exactly one match for each column in the row. The method will return an error +// if a column in the row cannot be assigned to a field in the struct. // // The fields of the destination struct can be of any type that is acceptable // to spanner.Row.Column. @@ -325,16 +325,16 @@ func (r *Row) ToStruct(p interface{}) error { // The rules for mapping a row's columns into a struct's exported fields // are: // -// 1. If a field has a `spanner: "column_name"` tag, then decode column -// 'column_name' into the field. A special case is the `spanner: "-"` -// tag, which instructs ToStruct to ignore the field during decoding. +// 1. If a field has a `spanner: "column_name"` tag, then decode column +// 'column_name' into the field. A special case is the `spanner: "-"` +// tag, which instructs ToStruct to ignore the field during decoding. // -// 2. Otherwise, if the name of a field matches the name of a column (ignoring case), -// decode the column into the field. +// 2. Otherwise, if the name of a field matches the name of a column (ignoring case), +// decode the column into the field. // -// 3. The number of columns in the row and exported fields in the struct do not need to match. -// Any field in the struct that cannot not be assigned a value from the row is assigned its default value. -// Any column in the row that does not have a corresponding field in the struct is ignored. +// 3. The number of columns in the row and exported fields in the struct do not need to match. +// Any field in the struct that cannot not be assigned a value from the row is assigned its default value. +// Any column in the row that does not have a corresponding field in the struct is ignored. // // The fields of the destination struct can be of any type that is acceptable // to spanner.Row.Column. diff --git a/spanner/session.go b/spanner/session.go index 67a9bd1b9d4..2add940b1d5 100644 --- a/spanner/session.go +++ b/spanner/session.go @@ -1568,11 +1568,11 @@ func (hc *healthChecker) worker(i int) { // maintainer maintains the number of sessions in the pool based on the session // pool configuration and the current and historical number of sessions checked // out of the pool. The maintainer will: -// 1. Ensure that the session pool contains at least MinOpened sessions. -// 2. If the current number of sessions in the pool exceeds the greatest number -// of checked out sessions (=sessions in use) during the last 10 minutes, -// and the delta is larger than MaxIdleSessions, the maintainer will reduce -// the number of sessions to maxSessionsInUseDuringWindow+MaxIdleSessions. +// 1. Ensure that the session pool contains at least MinOpened sessions. +// 2. If the current number of sessions in the pool exceeds the greatest number +// of checked out sessions (=sessions in use) during the last 10 minutes, +// and the delta is larger than MaxIdleSessions, the maintainer will reduce +// the number of sessions to maxSessionsInUseDuringWindow+MaxIdleSessions. func (hc *healthChecker) maintainer() { // Wait until the pool is ready. <-hc.ready diff --git a/spanner/session_test.go b/spanner/session_test.go index 0edee6dc43e..b70b938ad81 100644 --- a/spanner/session_test.go +++ b/spanner/session_test.go @@ -1374,11 +1374,11 @@ func TestSessionHealthCheck(t *testing.T) { } // TestStressSessionPool does stress test on session pool by the following concurrent operations: -// 1) Test worker gets a session from the pool. -// 2) Test worker turns a session back into the pool. -// 3) Test worker destroys a session got from the pool. -// 4) Healthcheck destroys a broken session (because a worker has already destroyed it). -// 5) Test worker closes the session pool. +// 1. Test worker gets a session from the pool. +// 2. Test worker turns a session back into the pool. +// 3. Test worker destroys a session got from the pool. +// 4. Healthcheck destroys a broken session (because a worker has already destroyed it). +// 5. Test worker closes the session pool. // // During the test, the session pool maintainer maintains the number of sessions, // and it is expected that all sessions that are taken from session pool remains valid. @@ -1545,10 +1545,10 @@ func testStressSessionPool(t *testing.T, cfg SessionPoolConfig, ti int, idx int, // TestMaintainer checks the session pool maintainer maintains the number of // sessions in the following cases: // -// 1. On initialization of session pool, replenish session pool to meet -// MinOpened or MaxIdle. -// 2. On increased session usage, provision extra MaxIdle sessions. -// 3. After the surge passes, scale down the session pool accordingly. +// 1. On initialization of session pool, replenish session pool to meet +// MinOpened or MaxIdle. +// 2. On increased session usage, provision extra MaxIdle sessions. +// 3. After the surge passes, scale down the session pool accordingly. func TestMaintainer(t *testing.T) { t.Parallel() ctx := context.Background() diff --git a/spanner/spannertest/db.go b/spanner/spannertest/db.go index f922e77af6d..6179a80779e 100644 --- a/spanner/spannertest/db.go +++ b/spanner/spannertest/db.go @@ -157,6 +157,7 @@ func (tx *transaction) Rollback() { row represents a list of data elements. The mapping between Spanner types and Go types internal to this package are: + BOOL bool INT64 int64 FLOAT64 float64 diff --git a/spanner/spannertest/inmem.go b/spanner/spannertest/inmem.go index 552fb3a1bb8..d350d61014f 100644 --- a/spanner/spannertest/inmem.go +++ b/spanner/spannertest/inmem.go @@ -20,10 +20,11 @@ Package spannertest contains test helpers for working with Cloud Spanner. This package is EXPERIMENTAL, and is lacking several features. See the README.md file in this directory for more details. -In-memory fake +# In-memory fake This package has an in-memory fake implementation of spanner. To use it, create a Server, and then connect to it with no security: + srv, err := spannertest.NewServer("localhost:0") ... conn, err := grpc.DialContext(ctx, srv.Addr, grpc.WithInsecure()) @@ -33,6 +34,7 @@ create a Server, and then connect to it with no security: Alternatively, create a Server, then set the SPANNER_EMULATOR_HOST environment variable and use the regular spanner.NewClient: + srv, err := spannertest.NewServer("localhost:0") ... os.Setenv("SPANNER_EMULATOR_HOST", srv.Addr) diff --git a/spanner/timestampbound.go b/spanner/timestampbound.go index fd017c49682..8af5a879a74 100644 --- a/spanner/timestampbound.go +++ b/spanner/timestampbound.go @@ -50,7 +50,7 @@ const ( // can be specified when creating transactions, see the documentation of // spanner.Client for an example. // -// Strong reads +// # Strong reads // // Strong reads are guaranteed to see the effects of all transactions that have // committed before the start of the read. Furthermore, all rows yielded by a @@ -64,7 +64,7 @@ const ( // // Use StrongRead to create a bound of this type. // -// Exact staleness +// # Exact staleness // // An exact staleness timestamp bound executes reads at a user-specified // timestamp. Reads at a timestamp are guaranteed to see a consistent prefix of @@ -85,7 +85,7 @@ const ( // // Use ReadTimestamp and ExactStaleness to create a bound of this type. // -// Bounded staleness +// # Bounded staleness // // Bounded staleness modes allow Cloud Spanner to pick the read timestamp, // subject to a user-provided staleness bound. Cloud Spanner chooses the newest @@ -113,7 +113,7 @@ const ( // // Use MinReadTimestamp and MaxStaleness to create a bound of this type. // -// Old read timestamps and garbage collection +// # Old read timestamps and garbage collection // // Cloud Spanner continuously garbage collects deleted and overwritten data in // the background to reclaim storage space. This process is known as "version diff --git a/spanner/transaction.go b/spanner/transaction.go index 4a467bba951..8f928309234 100644 --- a/spanner/transaction.go +++ b/spanner/transaction.go @@ -831,7 +831,7 @@ func (t *ReadOnlyTransaction) WithTimestampBound(tb TimestampBound) *ReadOnlyTra // // See (*Client).ReadWriteTransaction for an example. // -// Semantics +// # Semantics // // Cloud Spanner can commit the transaction if all read locks it acquired are // still valid at commit time, and it is able to acquire write locks for all @@ -844,7 +844,7 @@ func (t *ReadOnlyTransaction) WithTimestampBound(tb TimestampBound) *ReadOnlyTra // Spanner locks for any sort of mutual exclusion other than between Cloud // Spanner transactions themselves. // -// Aborted transactions +// # Aborted transactions // // Application code does not need to retry explicitly; RunInTransaction will // automatically retry a transaction if an attempt results in an abort. The lock @@ -858,7 +858,7 @@ func (t *ReadOnlyTransaction) WithTimestampBound(tb TimestampBound) *ReadOnlyTra // retries a transaction can attempt; instead, it is better to limit the total // amount of wall time spent retrying. // -// Idle transactions +// # Idle transactions // // A transaction is considered idle if it has no outstanding reads or SQL // queries and has not started a read or SQL query within the last 10 @@ -1333,9 +1333,9 @@ type writeOnlyTransaction struct { // applyAtLeastOnce commits a list of mutations to Cloud Spanner at least once, // unless one of the following happens: // -// 1) Context times out. -// 2) An unretryable error (e.g. database not found) occurs. -// 3) There is a malformed Mutation object. +// 1. Context times out. +// 2. An unretryable error (e.g. database not found) occurs. +// 3. There is a malformed Mutation object. func (t *writeOnlyTransaction) applyAtLeastOnce(ctx context.Context, ms ...*Mutation) (time.Time, error) { var ( ts time.Time diff --git a/spanner/value.go b/spanner/value.go index 70d7e7df7fd..322f72add1d 100644 --- a/spanner/value.go +++ b/spanner/value.go @@ -118,19 +118,19 @@ var ( // Encoder is the interface implemented by a custom type that can be encoded to // a supported type by Spanner. A code example: // -// type customField struct { -// Prefix string -// Suffix string -// } +// type customField struct { +// Prefix string +// Suffix string +// } // -// // Convert a customField value to a string -// func (cf customField) EncodeSpanner() (interface{}, error) { -// var b bytes.Buffer -// b.WriteString(cf.Prefix) -// b.WriteString("-") -// b.WriteString(cf.Suffix) -// return b.String(), nil -// } +// // Convert a customField value to a string +// func (cf customField) EncodeSpanner() (interface{}, error) { +// var b bytes.Buffer +// b.WriteString(cf.Prefix) +// b.WriteString("-") +// b.WriteString(cf.Suffix) +// return b.String(), nil +// } type Encoder interface { EncodeSpanner() (interface{}, error) } @@ -138,24 +138,24 @@ type Encoder interface { // Decoder is the interface implemented by a custom type that can be decoded // from a supported type by Spanner. A code example: // -// type customField struct { -// Prefix string -// Suffix string -// } +// type customField struct { +// Prefix string +// Suffix string +// } // -// // Convert a string to a customField value -// func (cf *customField) DecodeSpanner(val interface{}) (err error) { -// strVal, ok := val.(string) -// if !ok { -// return fmt.Errorf("failed to decode customField: %v", val) -// } -// s := strings.Split(strVal, "-") -// if len(s) > 1 { -// cf.Prefix = s[0] -// cf.Suffix = s[1] -// } -// return nil -// } +// // Convert a string to a customField value +// func (cf *customField) DecodeSpanner(val interface{}) (err error) { +// strVal, ok := val.(string) +// if !ok { +// return fmt.Errorf("failed to decode customField: %v", val) +// } +// s := strings.Split(strVal, "-") +// if len(s) > 1 { +// cf.Prefix = s[0] +// cf.Suffix = s[1] +// } +// return nil +// } type Decoder interface { DecodeSpanner(input interface{}) error } diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go index c8fbcdb94e6..32ff1c853a3 100644 --- a/speech/apiv1/doc.go +++ b/speech/apiv1/doc.go @@ -19,43 +19,44 @@ // // Converts audio to text by applying powerful neural network models. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := speech.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := speech.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := speech.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &speechpb.RecognizeRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/speech/v1#RecognizeRequest. -// } -// resp, err := c.Recognize(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := speech.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &speechpb.RecognizeRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/speech/v1#RecognizeRequest. +// } +// resp, err := c.Recognize(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go index aa175095b9f..22b9d7be5d1 100644 --- a/speech/apiv1p1beta1/doc.go +++ b/speech/apiv1p1beta1/doc.go @@ -19,45 +19,46 @@ // // Converts audio to text by applying powerful neural network models. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := speech.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := speech.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := speech.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &speechpb.RecognizeRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1#RecognizeRequest. -// } -// resp, err := c.Recognize(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := speech.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &speechpb.RecognizeRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1#RecognizeRequest. +// } +// resp, err := c.Recognize(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/storage/bucket.go b/storage/bucket.go index 55ad121c285..84582bb8773 100644 --- a/storage/bucket.go +++ b/storage/bucket.go @@ -55,7 +55,8 @@ type BucketHandle struct { // The supplied name must contain only lowercase letters, numbers, dashes, // underscores, and dots. The full specification for valid bucket names can be // found at: -// https://cloud.google.com/storage/docs/bucket-naming +// +// https://cloud.google.com/storage/docs/bucket-naming func (c *Client) Bucket(name string) *BucketHandle { retry := c.retry.clone() return &BucketHandle{ @@ -150,7 +151,8 @@ func (b *BucketHandle) DefaultObjectACL() *ACLHandle { // // name must consist entirely of valid UTF-8-encoded runes. The full specification // for valid object names can be found at: -// https://cloud.google.com/storage/docs/naming-objects +// +// https://cloud.google.com/storage/docs/naming-objects func (b *BucketHandle) Object(name string) *ObjectHandle { retry := b.retry.clone() return &ObjectHandle{ diff --git a/storage/doc.go b/storage/doc.go index f4654b32c3e..cce44c4365e 100644 --- a/storage/doc.go +++ b/storage/doc.go @@ -22,16 +22,15 @@ https://cloud.google.com/storage/docs. See https://pkg.go.dev/cloud.google.com/go for authentication, timeouts, connection pooling and similar aspects of this package. - -Creating a Client +# Creating a Client To start working with this package, create a client: - ctx := context.Background() - client, err := storage.NewClient(ctx) - if err != nil { - // TODO: Handle error. - } + ctx := context.Background() + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for @@ -40,47 +39,47 @@ concurrent use by multiple goroutines. If you only wish to access public data, you can create an unauthenticated client with - client, err := storage.NewClient(ctx, option.WithoutAuthentication()) + client, err := storage.NewClient(ctx, option.WithoutAuthentication()) To use an emulator with this library, you can set the STORAGE_EMULATOR_HOST environment variable to the address at which your emulator is running. This will send requests to that address instead of to Cloud Storage. You can then create and use a client as usual: - // Set STORAGE_EMULATOR_HOST environment variable. - err := os.Setenv("STORAGE_EMULATOR_HOST", "localhost:9000") - if err != nil { - // TODO: Handle error. - } + // Set STORAGE_EMULATOR_HOST environment variable. + err := os.Setenv("STORAGE_EMULATOR_HOST", "localhost:9000") + if err != nil { + // TODO: Handle error. + } - // Create client as usual. - client, err := storage.NewClient(ctx) - if err != nil { - // TODO: Handle error. - } + // Create client as usual. + client, err := storage.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } - // This request is now directed to http://localhost:9000/storage/v1/b - // instead of https://storage.googleapis.com/storage/v1/b - if err := client.Bucket("my-bucket").Create(ctx, projectID, nil); err != nil { - // TODO: Handle error. - } + // This request is now directed to http://localhost:9000/storage/v1/b + // instead of https://storage.googleapis.com/storage/v1/b + if err := client.Bucket("my-bucket").Create(ctx, projectID, nil); err != nil { + // TODO: Handle error. + } Please note that there is no official emulator for Cloud Storage. -Buckets +# Buckets A Google Cloud Storage bucket is a collection of objects. To work with a bucket, make a bucket handle: - bkt := client.Bucket(bucketName) + bkt := client.Bucket(bucketName) A handle is a reference to a bucket. You can have a handle even if the bucket doesn't exist yet. To create a bucket in Google Cloud Storage, call Create on the handle: - if err := bkt.Create(ctx, projectID, nil); err != nil { - // TODO: Handle error. - } + if err := bkt.Create(ctx, projectID, nil); err != nil { + // TODO: Handle error. + } Note that although buckets are associated with projects, bucket names are global across all projects. @@ -90,14 +89,14 @@ BucketAttrs. The third argument to BucketHandle.Create allows you to set the initial BucketAttrs of a bucket. To retrieve a bucket's attributes, use Attrs: - attrs, err := bkt.Attrs(ctx) - if err != nil { - // TODO: Handle error. - } - fmt.Printf("bucket %s, created at %s, is located in %s with storage class %s\n", - attrs.Name, attrs.Created, attrs.Location, attrs.StorageClass) + attrs, err := bkt.Attrs(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Printf("bucket %s, created at %s, is located in %s with storage class %s\n", + attrs.Name, attrs.Created, attrs.Location, attrs.StorageClass) -Objects +# Objects An object holds arbitrary data as a sequence of bytes, like a file. You refer to objects using a handle, just as with buckets, but unlike buckets @@ -105,78 +104,78 @@ you don't explicitly create an object. Instead, the first time you write to an object it will be created. You can use the standard Go io.Reader and io.Writer interfaces to read and write object data: - obj := bkt.Object("data") - // Write something to obj. - // w implements io.Writer. - w := obj.NewWriter(ctx) - // Write some text to obj. This will either create the object or overwrite whatever is there already. - if _, err := fmt.Fprintf(w, "This object contains text.\n"); err != nil { - // TODO: Handle error. - } - // Close, just like writing a file. - if err := w.Close(); err != nil { - // TODO: Handle error. - } - - // Read it back. - r, err := obj.NewReader(ctx) - if err != nil { - // TODO: Handle error. - } - defer r.Close() - if _, err := io.Copy(os.Stdout, r); err != nil { - // TODO: Handle error. - } - // Prints "This object contains text." + obj := bkt.Object("data") + // Write something to obj. + // w implements io.Writer. + w := obj.NewWriter(ctx) + // Write some text to obj. This will either create the object or overwrite whatever is there already. + if _, err := fmt.Fprintf(w, "This object contains text.\n"); err != nil { + // TODO: Handle error. + } + // Close, just like writing a file. + if err := w.Close(); err != nil { + // TODO: Handle error. + } + + // Read it back. + r, err := obj.NewReader(ctx) + if err != nil { + // TODO: Handle error. + } + defer r.Close() + if _, err := io.Copy(os.Stdout, r); err != nil { + // TODO: Handle error. + } + // Prints "This object contains text." Objects also have attributes, which you can fetch with Attrs: - objAttrs, err := obj.Attrs(ctx) - if err != nil { - // TODO: Handle error. - } - fmt.Printf("object %s has size %d and can be read using %s\n", - objAttrs.Name, objAttrs.Size, objAttrs.MediaLink) + objAttrs, err := obj.Attrs(ctx) + if err != nil { + // TODO: Handle error. + } + fmt.Printf("object %s has size %d and can be read using %s\n", + objAttrs.Name, objAttrs.Size, objAttrs.MediaLink) -Listing objects +# Listing objects Listing objects in a bucket is done with the Bucket.Objects method: - query := &storage.Query{Prefix: ""} - - var names []string - it := bkt.Objects(ctx, query) - for { - attrs, err := it.Next() - if err == iterator.Done { - break - } - if err != nil { - log.Fatal(err) - } - names = append(names, attrs.Name) - } + query := &storage.Query{Prefix: ""} + + var names []string + it := bkt.Objects(ctx, query) + for { + attrs, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + log.Fatal(err) + } + names = append(names, attrs.Name) + } Objects are listed lexicographically by name. To filter objects lexicographically, Query.StartOffset and/or Query.EndOffset can be used: - query := &storage.Query{ - Prefix: "", - StartOffset: "bar/", // Only list objects lexicographically >= "bar/" - EndOffset: "foo/", // Only list objects lexicographically < "foo/" - } + query := &storage.Query{ + Prefix: "", + StartOffset: "bar/", // Only list objects lexicographically >= "bar/" + EndOffset: "foo/", // Only list objects lexicographically < "foo/" + } - // ... as before + // ... as before If only a subset of object attributes is needed when listing, specifying this subset using Query.SetAttrSelection may speed up the listing process: - query := &storage.Query{Prefix: ""} - query.SetAttrSelection([]string{"Name"}) + query := &storage.Query{Prefix: ""} + query.SetAttrSelection([]string{"Name"}) - // ... as before + // ... as before -ACLs +# ACLs Both objects and buckets have ACLs (Access Control Lists). An ACL is a list of ACLRules, each of which specifies the role of a user, group or project. ACLs @@ -186,17 +185,17 @@ https://cloud.google.com/storage/docs/access-control/iam). To list the ACLs of a bucket or object, obtain an ACLHandle and call its List method: - acls, err := obj.ACL().List(ctx) - if err != nil { - // TODO: Handle error. - } - for _, rule := range acls { - fmt.Printf("%s has role %s\n", rule.Entity, rule.Role) - } + acls, err := obj.ACL().List(ctx) + if err != nil { + // TODO: Handle error. + } + for _, rule := range acls { + fmt.Printf("%s has role %s\n", rule.Entity, rule.Role) + } You can also set and delete ACLs. -Conditions +# Conditions Every object has a generation and a metageneration. The generation changes whenever the content changes, and the metageneration changes whenever the @@ -208,32 +207,32 @@ For example, say you've read an object's metadata into objAttrs. Now you want to write to that object, but only if its contents haven't changed since you read it. Here is how to express that: - w = obj.If(storage.Conditions{GenerationMatch: objAttrs.Generation}).NewWriter(ctx) - // Proceed with writing as above. + w = obj.If(storage.Conditions{GenerationMatch: objAttrs.Generation}).NewWriter(ctx) + // Proceed with writing as above. -Signed URLs +# Signed URLs You can obtain a URL that lets anyone read or write an object for a limited time. Signing a URL requires credentials authorized to sign a URL. To use the same authentication that was used when instantiating the Storage client, use the BucketHandle.SignedURL method. - url, err := client.Bucket(bucketName).SignedURL(objectName, opts) - if err != nil { - // TODO: Handle error. - } - fmt.Println(url) + url, err := client.Bucket(bucketName).SignedURL(objectName, opts) + if err != nil { + // TODO: Handle error. + } + fmt.Println(url) You can also sign a URL wihout creating a client. See the documentation of SignedURL for details. - url, err := storage.SignedURL(bucketName, "shared-object", opts) - if err != nil { - // TODO: Handle error. - } - fmt.Println(url) + url, err := storage.SignedURL(bucketName, "shared-object", opts) + if err != nil { + // TODO: Handle error. + } + fmt.Println(url) -Post Policy V4 Signed Request +# Post Policy V4 Signed Request A type of signed request that allows uploads through HTML forms directly to Cloud Storage with temporary permission. Conditions can be applied to restrict how the HTML form is used and exercised @@ -242,13 +241,13 @@ by a user. For more information, please see https://cloud.google.com/storage/docs/xml-api/post-object as well as the documentation of BucketHandle.GenerateSignedPostPolicyV4. - pv4, err := client.Bucket(bucketName).GenerateSignedPostPolicyV4(objectName, opts) - if err != nil { - // TODO: Handle error. - } - fmt.Printf("URL: %s\nFields; %v\n", pv4.URL, pv4.Fields) + pv4, err := client.Bucket(bucketName).GenerateSignedPostPolicyV4(objectName, opts) + if err != nil { + // TODO: Handle error. + } + fmt.Printf("URL: %s\nFields; %v\n", pv4.URL, pv4.Fields) -Errors +# Errors Errors returned by this client are often of the type googleapi.Error. These errors can be introspected for more information by using errors.As @@ -261,7 +260,7 @@ with the richer googleapi.Error type. For example: See https://pkg.go.dev/google.golang.org/api/googleapi#Error for more information. -Retrying failed requests +# Retrying failed requests Methods in this package may retry calls that fail with transient errors. Retrying continues indefinitely unless the controlling context is canceled, the diff --git a/storage/integration_test.go b/storage/integration_test.go index 30b7765b935..2f46a981365 100644 --- a/storage/integration_test.go +++ b/storage/integration_test.go @@ -4077,8 +4077,8 @@ func TestIntegration_ReaderCancel(t *testing.T) { // * Content-Type of "text/plain" // will be properly served back. // See: -// * https://cloud.google.com/storage/docs/transcoding#transcoding_and_gzip -// * https://github.com/googleapis/google-cloud-go/issues/1800 +// - https://cloud.google.com/storage/docs/transcoding#transcoding_and_gzip +// - https://github.com/googleapis/google-cloud-go/issues/1800 func TestIntegration_NewReaderWithContentEncodingGzip(t *testing.T) { ctx := context.Background() client := testConfig(ctx, t) diff --git a/storage/internal/apiv2/doc.go b/storage/internal/apiv2/doc.go index 5f6bbccd352..d0d1f42d917 100644 --- a/storage/internal/apiv2/doc.go +++ b/storage/internal/apiv2/doc.go @@ -19,43 +19,44 @@ // // Lets you store and retrieve potentially-large, immutable data objects. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := storage.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := storage.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := storage.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &storagepb.DeleteBucketRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/cloud.google.com/go/storage/internal/apiv2/stubs#DeleteBucketRequest. -// } -// err = c.DeleteBucket(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// Use of Context +// ctx := context.Background() +// c, err := storage.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &storagepb.DeleteBucketRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/cloud.google.com/go/storage/internal/apiv2/stubs#DeleteBucketRequest. +// } +// err = c.DeleteBucket(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/storage/internal/apiv2/storage_client.go b/storage/internal/apiv2/storage_client.go index f29eedf0ee4..b704e273e66 100644 --- a/storage/internal/apiv2/storage_client.go +++ b/storage/internal/apiv2/storage_client.go @@ -165,22 +165,22 @@ type internalClient interface { // // Resources are named as follows: // -// Projects are referred to as they are defined by the Resource Manager API, -// using strings like projects/123456 or projects/my-string-id. +// Projects are referred to as they are defined by the Resource Manager API, +// using strings like projects/123456 or projects/my-string-id. // -// Buckets are named using string names of the form: -// projects/{project}/buckets/{bucket} -// For globally unique buckets, _ may be substituted for the project. +// Buckets are named using string names of the form: +// projects/{project}/buckets/{bucket} +// For globally unique buckets, _ may be substituted for the project. // -// Objects are uniquely identified by their name along with the name of the -// bucket they belong to, as separate strings in this API. For example: +// Objects are uniquely identified by their name along with the name of the +// bucket they belong to, as separate strings in this API. For example: // -// ReadObjectRequest { -// bucket: ‘projects/_/buckets/my-bucket’ -// object: ‘my-object’ -// } -// Note that object names can contain / characters, which are treated as -// any other character (no special directory semantics). +// ReadObjectRequest { +// bucket: ‘projects/_/buckets/my-bucket’ +// object: ‘my-object’ +// } +// Note that object names can contain / characters, which are treated as +// any other character (no special directory semantics). type Client struct { // The internal transport-dependent client. internalClient internalClient @@ -330,33 +330,33 @@ func (c *Client) UpdateObject(ctx context.Context, req *storagepb.UpdateObjectRe // error or an error response from the server), the client should do as // follows: // -// Check the result Status of the stream, to determine if writing can be -// resumed on this stream or must be restarted from scratch (by calling -// StartResumableWrite()). The resumable errors are DEADLINE_EXCEEDED, -// INTERNAL, and UNAVAILABLE. For each case, the client should use binary -// exponential backoff before retrying. Additionally, writes can be -// resumed after RESOURCE_EXHAUSTED errors, but only after taking -// appropriate measures, which may include reducing aggregate send rate -// across clients and/or requesting a quota increase for your project. +// Check the result Status of the stream, to determine if writing can be +// resumed on this stream or must be restarted from scratch (by calling +// StartResumableWrite()). The resumable errors are DEADLINE_EXCEEDED, +// INTERNAL, and UNAVAILABLE. For each case, the client should use binary +// exponential backoff before retrying. Additionally, writes can be +// resumed after RESOURCE_EXHAUSTED errors, but only after taking +// appropriate measures, which may include reducing aggregate send rate +// across clients and/or requesting a quota increase for your project. // -// If the call to WriteObject returns ABORTED, that indicates -// concurrent attempts to update the resumable write, caused either by -// multiple racing clients or by a single client where the previous -// request was timed out on the client side but nonetheless reached the -// server. In this case the client should take steps to prevent further -// concurrent writes (e.g., increase the timeouts, stop using more than -// one process to perform the upload, etc.), and then should follow the -// steps below for resuming the upload. +// If the call to WriteObject returns ABORTED, that indicates +// concurrent attempts to update the resumable write, caused either by +// multiple racing clients or by a single client where the previous +// request was timed out on the client side but nonetheless reached the +// server. In this case the client should take steps to prevent further +// concurrent writes (e.g., increase the timeouts, stop using more than +// one process to perform the upload, etc.), and then should follow the +// steps below for resuming the upload. // -// For resumable errors, the client should call QueryWriteStatus() and -// then continue writing from the returned persisted_size. This may be -// less than the amount of data the client previously sent. Note also that -// it is acceptable to send data starting at an offset earlier than the -// returned persisted_size; in this case, the service will skip data at -// offsets that were already persisted (without checking that it matches -// the previously written data), and write only the data starting from the -// persisted offset. This behavior can make client-side handling simpler -// in some cases. +// For resumable errors, the client should call QueryWriteStatus() and +// then continue writing from the returned persisted_size. This may be +// less than the amount of data the client previously sent. Note also that +// it is acceptable to send data starting at an offset earlier than the +// returned persisted_size; in this case, the service will skip data at +// offsets that were already persisted (without checking that it matches +// the previously written data), and write only the data starting from the +// persisted offset. This behavior can make client-side handling simpler +// in some cases. // // The service will not view the object as complete until the client has // sent a WriteObjectRequest with finish_write set to true. Sending any @@ -466,22 +466,22 @@ type gRPCClient struct { // // Resources are named as follows: // -// Projects are referred to as they are defined by the Resource Manager API, -// using strings like projects/123456 or projects/my-string-id. +// Projects are referred to as they are defined by the Resource Manager API, +// using strings like projects/123456 or projects/my-string-id. // -// Buckets are named using string names of the form: -// projects/{project}/buckets/{bucket} -// For globally unique buckets, _ may be substituted for the project. +// Buckets are named using string names of the form: +// projects/{project}/buckets/{bucket} +// For globally unique buckets, _ may be substituted for the project. // -// Objects are uniquely identified by their name along with the name of the -// bucket they belong to, as separate strings in this API. For example: +// Objects are uniquely identified by their name along with the name of the +// bucket they belong to, as separate strings in this API. For example: // -// ReadObjectRequest { -// bucket: ‘projects/_/buckets/my-bucket’ -// object: ‘my-object’ -// } -// Note that object names can contain / characters, which are treated as -// any other character (no special directory semantics). +// ReadObjectRequest { +// bucket: ‘projects/_/buckets/my-bucket’ +// object: ‘my-object’ +// } +// Note that object names can contain / characters, which are treated as +// any other character (no special directory semantics). func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { clientOpts := defaultGRPCClientOptions() if newClientHook != nil { diff --git a/storage/reader.go b/storage/reader.go index 7a28b6745e7..d895a4390db 100644 --- a/storage/reader.go +++ b/storage/reader.go @@ -309,8 +309,8 @@ func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) // and different than its original storage form. This happens when the "Content-Encoding" // header is "gzip". // See: -// * https://cloud.google.com/storage/docs/transcoding#transcoding_and_gzip -// * https://github.com/googleapis/google-cloud-go/issues/1800 +// - https://cloud.google.com/storage/docs/transcoding#transcoding_and_gzip +// - https://github.com/googleapis/google-cloud-go/issues/1800 func decompressiveTranscoding(res *http.Response) bool { // Decompressive Transcoding. return res.Header.Get("Content-Encoding") == "gzip" || diff --git a/storage/retry_test.go b/storage/retry_test.go index 6ee371ced7c..4b3966a2d69 100644 --- a/storage/retry_test.go +++ b/storage/retry_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/storage/storage.go b/storage/storage.go index d6634e3dbca..95fe8fc62c8 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -509,13 +509,13 @@ func v2SanitizeHeaders(hdrs []string) []string { // at https://cloud.google.com/storage/docs/authentication/canonical-requests#about-headers. // // V4 does a couple things differently from V2: -// - Headers get sorted by key, instead of by key:value. We do this in -// signedURLV4. -// - There's no canonical regexp: we simply split headers on :. -// - We don't exclude canonical headers. -// - We replace leading and trailing spaces in header values, like v2, but also -// all intermediate space duplicates get stripped. That is, there's only ever -// a single consecutive space. +// - Headers get sorted by key, instead of by key:value. We do this in +// signedURLV4. +// - There's no canonical regexp: we simply split headers on :. +// - We don't exclude canonical headers. +// - We replace leading and trailing spaces in header values, like v2, but also +// all intermediate space duplicates get stripped. That is, there's only ever +// a single consecutive space. func v4SanitizeHeaders(hdrs []string) []string { headerMap := map[string][]string{} for _, hdr := range hdrs { @@ -1052,11 +1052,12 @@ func (o *ObjectHandle) ObjectName() string { // // For example, to change ContentType and delete ContentEncoding and // Metadata, use -// ObjectAttrsToUpdate{ -// ContentType: "text/html", -// ContentEncoding: "", -// Metadata: map[string]string{}, -// } +// +// ObjectAttrsToUpdate{ +// ContentType: "text/html", +// ContentEncoding: "", +// Metadata: map[string]string{}, +// } type ObjectAttrsToUpdate struct { EventBasedHold optional.Bool TemporaryHold optional.Bool diff --git a/storagetransfer/apiv1/doc.go b/storagetransfer/apiv1/doc.go index 387371f8ad2..0c20741e2be 100644 --- a/storagetransfer/apiv1/doc.go +++ b/storagetransfer/apiv1/doc.go @@ -20,43 +20,44 @@ // Transfers data from external data sources to a Google Cloud Storage bucket // or between Google Cloud Storage buckets. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := storagetransfer.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := storagetransfer.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := storagetransfer.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &storagetransferpb.GetGoogleServiceAccountRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/storagetransfer/v1#GetGoogleServiceAccountRequest. -// } -// resp, err := c.GetGoogleServiceAccount(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := storagetransfer.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &storagetransferpb.GetGoogleServiceAccountRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/storagetransfer/v1#GetGoogleServiceAccountRequest. +// } +// resp, err := c.GetGoogleServiceAccount(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/talent/apiv4/doc.go b/talent/apiv4/doc.go index fc5ba327e6f..d1d256de521 100644 --- a/talent/apiv4/doc.go +++ b/talent/apiv4/doc.go @@ -20,43 +20,44 @@ // Cloud Talent Solution provides the capability to create, read, update, and // delete job postings, as well as search jobs based on keywords and filters. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := talent.NewCompanyClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := talent.NewCompanyClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := talent.NewCompanyClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &talentpb.CreateCompanyRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/talent/v4#CreateCompanyRequest. -// } -// resp, err := c.CreateCompany(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := talent.NewCompanyClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &talentpb.CreateCompanyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/talent/v4#CreateCompanyRequest. +// } +// resp, err := c.CreateCompany(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go index 4974d7bdd00..c3cec89bb00 100644 --- a/talent/apiv4beta1/doc.go +++ b/talent/apiv4beta1/doc.go @@ -20,45 +20,46 @@ // Cloud Talent Solution provides the capability to create, read, update, and // delete job postings, as well as search jobs based on keywords and filters. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := talent.NewCompanyClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := talent.NewCompanyClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := talent.NewCompanyClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &talentpb.CreateCompanyRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/talent/v4beta1#CreateCompanyRequest. -// } -// resp, err := c.CreateCompany(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := talent.NewCompanyClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &talentpb.CreateCompanyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/talent/v4beta1#CreateCompanyRequest. +// } +// resp, err := c.CreateCompany(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/texttospeech/apiv1/doc.go b/texttospeech/apiv1/doc.go index 1feff9fb5e1..efe73d0800d 100644 --- a/texttospeech/apiv1/doc.go +++ b/texttospeech/apiv1/doc.go @@ -20,43 +20,44 @@ // Synthesizes natural-sounding speech by applying powerful neural network // models. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := texttospeech.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := texttospeech.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := texttospeech.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &texttospeechpb.ListVoicesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/texttospeech/v1#ListVoicesRequest. -// } -// resp, err := c.ListVoices(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := texttospeech.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &texttospeechpb.ListVoicesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/texttospeech/v1#ListVoicesRequest. +// } +// resp, err := c.ListVoices(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/third_party/go/doc/comment.go b/third_party/go/doc/comment.go index 42495ae436f..9177bd5c511 100644 --- a/third_party/go/doc/comment.go +++ b/third_party/go/doc/comment.go @@ -32,7 +32,7 @@ var ( ) // Escape comment text for HTML. If nice is set, -// also turn `` into “ and '' into ”. +// also turn “ into “ and ” into ”. func commentEscape(w io.Writer, text string, nice, md bool) { if nice { // In the first pass, we convert `` and '' into their unicode equivalents. @@ -115,8 +115,8 @@ var ( // into a link). Go identifiers that appear in the words map are italicized; if // the corresponding map value is not the empty string, it is considered a URL // and the word is converted into a link. If nice is set, the remaining text's -// appearance is improved where it makes sense (e.g., `` is turned into “ -// and '' into ”). +// appearance is improved where it makes sense (e.g., “ is turned into “ +// and ” into ”). func emphasize(w io.Writer, line string, words map[string]string, nice, md bool) { for { m := matchRx.FindStringSubmatchIndex(line) diff --git a/third_party/go/doc/doc.go b/third_party/go/doc/doc.go index fe775107351..ed0a515e07f 100644 --- a/third_party/go/doc/doc.go +++ b/third_party/go/doc/doc.go @@ -117,7 +117,6 @@ const ( // New takes ownership of the AST pkg and may edit or overwrite it. // To have the Examples fields populated, use NewFromFiles and include // the package's _test.go files. -// func New(pkg *ast.Package, importPath string, mode Mode) *Package { var r reader r.readPackage(pkg, mode) @@ -159,7 +158,6 @@ func New(pkg *ast.Package, importPath string, mode Mode) *Package { // // NewFromFiles takes ownership of the AST files and may edit them, // unless the PreserveAST Mode bit is on. -// func NewFromFiles(fset *token.FileSet, files []*ast.File, importPath string, opts ...interface{}) (*Package, error) { // Check for invalid API usage. if fset == nil { diff --git a/third_party/go/doc/example.go b/third_party/go/doc/example.go index 9d07adf5dd9..2523d5ee1eb 100644 --- a/third_party/go/doc/example.go +++ b/third_party/go/doc/example.go @@ -456,13 +456,12 @@ func lastComment(b *ast.BlockStmt, c []*ast.CommentGroup) (i int, last *ast.Comm // // The classification process is ambiguous in some cases: // -// - ExampleFoo_Bar matches a type named Foo_Bar -// or a method named Foo.Bar. -// - ExampleFoo_bar matches a type named Foo_bar -// or Foo (with a "bar" suffix). +// - ExampleFoo_Bar matches a type named Foo_Bar +// or a method named Foo.Bar. +// - ExampleFoo_bar matches a type named Foo_bar +// or Foo (with a "bar" suffix). // // Examples with malformed names are not associated with anything. -// func classifyExamples(p *Package, examples []*Example) { if len(examples) == 0 { return diff --git a/third_party/go/doc/exports.go b/third_party/go/doc/exports.go index fa6bcbc5afb..7b4e1b175d2 100644 --- a/third_party/go/doc/exports.go +++ b/third_party/go/doc/exports.go @@ -16,7 +16,6 @@ import ( // filterIdentList removes unexported names from list in place // and returns the resulting list. -// func filterIdentList(list []*ast.Ident) []*ast.Ident { j := 0 for _, x := range list { @@ -72,7 +71,6 @@ func updateIdentList(list []*ast.Ident) (hasExported bool) { } // hasExportedName reports whether list contains any exported names. -// func hasExportedName(list []*ast.Ident) bool { for _, x := range list { if x.IsExported() { @@ -85,7 +83,6 @@ func hasExportedName(list []*ast.Ident) bool { // removeErrorField removes anonymous fields named "error" from an interface. // This is called when "error" has been determined to be a local name, // not the predeclared type. -// func removeErrorField(ityp *ast.InterfaceType) { list := ityp.Methods.List // we know that ityp.Methods != nil j := 0 @@ -112,7 +109,6 @@ func removeErrorField(ityp *ast.InterfaceType) { // in place and reports whether fields were removed. Anonymous fields are // recorded with the parent type. filterType is called with the types of // all remaining fields. -// func (r *reader) filterFieldList(parent *namedType, fields *ast.FieldList, ityp *ast.InterfaceType) (removedFields bool) { if fields == nil { return @@ -156,7 +152,6 @@ func (r *reader) filterFieldList(parent *namedType, fields *ast.FieldList, ityp } // filterParamList applies filterType to each parameter type in fields. -// func (r *reader) filterParamList(fields *ast.FieldList) { if fields != nil { for _, f := range fields.List { @@ -168,7 +163,6 @@ func (r *reader) filterParamList(fields *ast.FieldList) { // filterType strips any unexported struct fields or method types from typ // in place. If fields (or methods) have been removed, the corresponding // struct or interface type has the Incomplete field set to true. -// func (r *reader) filterType(parent *namedType, typ ast.Expr) { switch t := typ.(type) { case *ast.Ident: @@ -236,7 +230,6 @@ func (r *reader) filterSpec(spec ast.Spec) bool { // copyConstType returns a copy of typ with position pos. // typ must be a valid constant type. // In practice, only (possibly qualified) identifiers are possible. -// func copyConstType(typ ast.Expr, pos token.Pos) ast.Expr { switch typ := typ.(type) { case *ast.Ident: @@ -299,7 +292,6 @@ func (r *reader) filterDecl(decl ast.Decl) bool { } // fileExports removes unexported declarations from src in place. -// func (r *reader) fileExports(src *ast.File) { j := 0 for _, d := range src.Decls { diff --git a/third_party/go/doc/filter.go b/third_party/go/doc/filter.go index 7fc6e3d4170..1ce8d702ff3 100644 --- a/third_party/go/doc/filter.go +++ b/third_party/go/doc/filter.go @@ -98,7 +98,6 @@ func filterTypes(a []*Type, f Filter) []*Type { // Filter eliminates documentation for names that don't pass through the filter f. // TODO(gri): Recognize "Type.Method" as a name. -// func (p *Package) Filter(f Filter) { p.Consts = filterValues(p.Consts, f) p.Vars = filterValues(p.Vars, f) diff --git a/third_party/go/doc/headscan.go b/third_party/go/doc/headscan.go index fe7daa6b0d2..38f567809e4 100644 --- a/third_party/go/doc/headscan.go +++ b/third_party/go/doc/headscan.go @@ -6,13 +6,13 @@ // +build ignore /* - The headscan command extracts comment headings from package files; - it is used to detect false positives which may require an adjustment - to the comment formatting heuristics in comment.go. +The headscan command extracts comment headings from package files; +it is used to detect false positives which may require an adjustment +to the comment formatting heuristics in comment.go. - Usage: headscan [-root root_directory] +Usage: headscan [-root root_directory] - By default, the $GOROOT/src directory is scanned. +By default, the $GOROOT/src directory is scanned. */ package main diff --git a/third_party/go/doc/reader.go b/third_party/go/doc/reader.go index bc22403ac49..c120f599bc4 100644 --- a/third_party/go/doc/reader.go +++ b/third_party/go/doc/reader.go @@ -22,12 +22,10 @@ import ( // A methodSet describes a set of methods. Entries where Decl == nil are conflict // entries (more than one method with the same name at the same embedding level). -// type methodSet map[string]*Func // recvString returns a string representation of recv of the // form "T", "*T", or "BADRECV" (if not a proper receiver type). -// func recvString(recv ast.Expr) string { switch t := recv.(type) { case *ast.Ident: @@ -42,7 +40,6 @@ func recvString(recv ast.Expr) string { // If there are multiple f's with the same name, set keeps the first // one with documentation; conflicts are ignored. The boolean // specifies whether to leave the AST untouched. -// func (mset methodSet) set(f *ast.FuncDecl, preserveAST bool) { name := f.Name.Name if g := mset[name]; g != nil && g.Doc != "" { @@ -78,7 +75,6 @@ func (mset methodSet) set(f *ast.FuncDecl, preserveAST bool) { // add adds method m to the method set; m is ignored if the method set // already contains a method with the same name at the same or a higher // level than m. -// func (mset methodSet) add(m *Func) { old := mset[m.Name] if old == nil || m.Level < old.Level { @@ -99,7 +95,6 @@ func (mset methodSet) add(m *Func) { // baseTypeName returns the name of the base type of x (or "") // and whether the type is imported or not. -// func baseTypeName(x ast.Expr) (name string, imported bool) { switch t := x.(type) { case *ast.Ident: @@ -124,7 +119,6 @@ type embeddedSet map[*namedType]bool // A namedType represents a named unqualified (package local, or possibly // predeclared) type. The namedType for a type name is always found via // reader.lookupType. -// type namedType struct { doc string // doc comment for type name string // type name @@ -149,7 +143,6 @@ type namedType struct { // in the respective AST nodes so that they are not printed // twice (once when printing the documentation and once when // printing the corresponding AST node). -// type reader struct { mode Mode @@ -179,7 +172,6 @@ func (r *reader) isVisible(name string) bool { // If the base type has not been encountered yet, a new // type with the given name but no associated declaration // is added to the type map. -// func (r *reader) lookupType(name string) *namedType { if name == "" || name == "_" { return nil // no type docs for anonymous types @@ -202,7 +194,6 @@ func (r *reader) lookupType(name string) *namedType { // anonymous field in the parent type. If the field is imported // (qualified name) or the parent is nil, the field is ignored. // The function returns the field name. -// func (r *reader) recordAnonymousField(parent *namedType, fieldType ast.Expr) (fname string) { fname, imp := baseTypeName(fieldType) if parent == nil || imp { @@ -243,7 +234,6 @@ func specNames(specs []ast.Spec) []string { } // readValue processes a const or var declaration. -// func (r *reader) readValue(decl *ast.GenDecl) { // determine if decl should be associated with a type // Heuristic: For each typed entry, determine the type name, if any. @@ -317,7 +307,6 @@ func (r *reader) readValue(decl *ast.GenDecl) { } // fields returns a struct's fields or an interface's methods. -// func fields(typ ast.Expr) (list []*ast.Field, isStruct bool) { var fields *ast.FieldList switch t := typ.(type) { @@ -334,7 +323,6 @@ func fields(typ ast.Expr) (list []*ast.Field, isStruct bool) { } // readType processes a type declaration. -// func (r *reader) readType(decl *ast.GenDecl, spec *ast.TypeSpec) { typ := r.lookupType(spec.Name.Name) if typ == nil { @@ -370,13 +358,11 @@ func (r *reader) readType(decl *ast.GenDecl, spec *ast.TypeSpec) { } // isPredeclared reports whether n denotes a predeclared type. -// func (r *reader) isPredeclared(n string) bool { return predeclaredTypes[n] && r.types[n] == nil } // readFunc processes a func or method declaration. -// func (r *reader) readFunc(fun *ast.FuncDecl) { // strip function body if requested. if r.mode&PreserveAST == 0 { @@ -449,7 +435,6 @@ var ( ) // readNote collects a single note from a sequence of comments. -// func (r *reader) readNote(list []*ast.Comment) { text := (&ast.CommentGroup{List: list}).Text() if m := noteMarkerRx.FindStringSubmatchIndex(text); m != nil { @@ -475,7 +460,6 @@ func (r *reader) readNote(list []*ast.Comment) { // and is followed by the note body (e.g., "// BUG(gri): fix this"). // The note ends at the end of the comment group or at the start of // another note in the same comment group, whichever comes first. -// func (r *reader) readNotes(comments []*ast.CommentGroup) { for _, group := range comments { i := -1 // comment index of most recent note start, valid if >= 0 @@ -495,7 +479,6 @@ func (r *reader) readNotes(comments []*ast.CommentGroup) { } // readFile adds the AST for a source file to the reader. -// func (r *reader) readFile(src *ast.File) { // add package documentation if src.Doc != nil { @@ -645,7 +628,6 @@ func customizeRecv(f *Func, recvTypeName string, embeddedIsPtr bool, level int) } // collectEmbeddedMethods collects the embedded methods of typ in mset. -// func (r *reader) collectEmbeddedMethods(mset methodSet, typ *namedType, recvTypeName string, embeddedIsPtr bool, level int, visited embeddedSet) { visited[typ] = true for embedded, isPtr := range typ.embedded { @@ -669,7 +651,6 @@ func (r *reader) collectEmbeddedMethods(mset methodSet, typ *namedType, recvType } // computeMethodSets determines the actual method sets for each type encountered. -// func (r *reader) computeMethodSets() { for _, t := range r.types { // collect embedded methods for t @@ -694,7 +675,6 @@ func (r *reader) computeMethodSets() { // types that have no declaration. Instead, these functions and methods // are shown at the package level. It also removes types with missing // declarations or which are not visible. -// func (r *reader) cleanupTypes() { for _, t := range r.types { visible := r.isVisible(t.name) @@ -761,7 +741,6 @@ func sortedKeys(m map[string]int) []string { } // sortingName returns the name to use when sorting d into place. -// func sortingName(d *ast.GenDecl) string { if len(d.Specs) == 1 { if s, ok := d.Specs[0].(*ast.ValueSpec); ok { @@ -854,7 +833,6 @@ func sortedFuncs(m methodSet, allMethods bool) []*Func { // noteBodies returns a list of note body strings given a list of notes. // This is only used to populate the deprecated Package.Bugs field. -// func noteBodies(notes []*Note) []string { var list []string for _, n := range notes { diff --git a/third_party/go/doc/synopsis.go b/third_party/go/doc/synopsis.go index 8b9f58aadba..bca4486132c 100644 --- a/third_party/go/doc/synopsis.go +++ b/third_party/go/doc/synopsis.go @@ -15,7 +15,6 @@ import ( // firstSentenceLen returns the length of the first sentence in s. // The sentence ends after the first period followed by space and // not preceded by exactly one uppercase letter. -// func firstSentenceLen(s string) int { var ppp, pp, p rune for i, q := range s { @@ -67,7 +66,6 @@ func clean(s string, flags int) string { // has no \n, \r, or \t characters and uses only single spaces between // words. If s starts with any of the IllegalPrefixes, the result // is the empty string. -// func Synopsis(s string) string { s = clean(s[0:firstSentenceLen(s)], 0) for _, prefix := range IllegalPrefixes { diff --git a/third_party/pkgsite/print_type.go b/third_party/pkgsite/print_type.go index 200980a6860..3fda7f3cf53 100644 --- a/third_party/pkgsite/print_type.go +++ b/third_party/pkgsite/print_type.go @@ -30,14 +30,14 @@ import ( // PrintType returns a string representation of the decl. // // PrintType works by: -// 1. Generate a map from every identifier to a URL for the identifier (or no -// URL if the identifier shouldn't link). -// 2. ast.Inspect the decl to get an ordered slice of every identifier to the -// link for it, using the map from step 1. -// 3. Print out the plain doc for the decl. -// 4. Use scanner.Scanner to find every identifier (in the same order as step -// 2). If there is a link for the identifier, insert it. Otherwise, print -// the plain doc. +// 1. Generate a map from every identifier to a URL for the identifier (or no +// URL if the identifier shouldn't link). +// 2. ast.Inspect the decl to get an ordered slice of every identifier to the +// link for it, using the map from step 1. +// 3. Print out the plain doc for the decl. +// 4. Use scanner.Scanner to find every identifier (in the same order as step +// 2). If there is a link for the identifier, insert it. Otherwise, print +// the plain doc. func PrintType(fset *token.FileSet, decl ast.Decl, toURL func(string, string) string, topLevelDecls map[interface{}]bool) string { anchorLinksMap := generateAnchorLinks(decl, toURL, topLevelDecls) // Convert the map (keyed by *ast.Ident) to a slice of URLs (or no URL). diff --git a/tpu/apiv1/doc.go b/tpu/apiv1/doc.go index d867f2c2e3a..5c85473c27f 100644 --- a/tpu/apiv1/doc.go +++ b/tpu/apiv1/doc.go @@ -19,49 +19,50 @@ // // TPU API provides customers with access to Google TPU technology. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := tpu.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := tpu.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := tpu.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &tpupb.ListNodesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/tpu/v1#ListNodesRequest. -// } -// it := c.ListNodes(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := tpu.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &tpupb.ListNodesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/tpu/v1#ListNodesRequest. +// } +// it := c.ListNodes(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/tpu/apiv1/tpu_client.go b/tpu/apiv1/tpu_client.go index 75e28067152..320d5713408 100644 --- a/tpu/apiv1/tpu_client.go +++ b/tpu/apiv1/tpu_client.go @@ -108,7 +108,7 @@ type internalClient interface { // Client is a client for interacting with Cloud TPU API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // -// Manages TPU nodes and other resources +// # Manages TPU nodes and other resources // // TPU API v1 type Client struct { @@ -259,7 +259,7 @@ type gRPCClient struct { // NewClient creates a new tpu client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // -// Manages TPU nodes and other resources +// # Manages TPU nodes and other resources // // TPU API v1 func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { diff --git a/trace/apiv1/doc.go b/trace/apiv1/doc.go index de823ecb9c6..268664ed159 100644 --- a/trace/apiv1/doc.go +++ b/trace/apiv1/doc.go @@ -23,49 +23,50 @@ // interact with the Trace API directly. If you are looking to instrument // your application for Stackdriver Trace, we recommend using OpenCensus. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := trace.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := trace.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := trace.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &cloudtracepb.ListTracesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/cloudtrace/v1#ListTracesRequest. -// } -// it := c.ListTraces(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := trace.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &cloudtracepb.ListTracesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/cloudtrace/v1#ListTracesRequest. +// } +// it := c.ListTraces(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/trace/apiv2/doc.go b/trace/apiv2/doc.go index b58f874c37e..2d1f1bdef9b 100644 --- a/trace/apiv2/doc.go +++ b/trace/apiv2/doc.go @@ -23,41 +23,42 @@ // interact with the Trace API directly. If you are looking to instrument // your application for Stackdriver Trace, we recommend using OpenCensus. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := trace.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := trace.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := trace.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &cloudtracepb.BatchWriteSpansRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/cloudtrace/v2#BatchWriteSpansRequest. -// } -// err = c.BatchWriteSpans(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// Use of Context +// ctx := context.Background() +// c, err := trace.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &cloudtracepb.BatchWriteSpansRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/cloudtrace/v2#BatchWriteSpansRequest. +// } +// err = c.BatchWriteSpans(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/trace/apiv2/path_funcs.go b/trace/apiv2/path_funcs.go index 80b8d40b58e..e8a8a2b0767 100644 --- a/trace/apiv2/path_funcs.go +++ b/trace/apiv2/path_funcs.go @@ -17,7 +17,9 @@ package trace // ProjectPath returns the path for the project resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s", project) +// +// fmt.Sprintf("projects/%s", project) +// // instead. func ProjectPath(project string) string { return "" + @@ -29,7 +31,9 @@ func ProjectPath(project string) string { // SpanPath returns the path for the span resource. // // Deprecated: Use -// fmt.Sprintf("projects/%s/traces/%s/spans/%s", project, trace, span) +// +// fmt.Sprintf("projects/%s/traces/%s/spans/%s", project, trace, span) +// // instead. func SpanPath(project, trace, span string) string { return "" + diff --git a/translate/apiv3/doc.go b/translate/apiv3/doc.go index 4ef7f91e33c..2c883d7a81d 100644 --- a/translate/apiv3/doc.go +++ b/translate/apiv3/doc.go @@ -19,43 +19,44 @@ // // Integrates text translation into your website or application. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := translate.NewTranslationClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := translate.NewTranslationClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := translate.NewTranslationClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &translatepb.TranslateTextRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/translate/v3#TranslateTextRequest. -// } -// resp, err := c.TranslateText(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := translate.NewTranslationClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &translatepb.TranslateTextRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/translate/v3#TranslateTextRequest. +// } +// resp, err := c.TranslateText(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/video/livestream/apiv1/doc.go b/video/livestream/apiv1/doc.go index 1d3e812b150..0de3cab8af8 100644 --- a/video/livestream/apiv1/doc.go +++ b/video/livestream/apiv1/doc.go @@ -17,48 +17,49 @@ // Package livestream is an auto-generated package for the // Live Stream API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := livestream.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := livestream.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := livestream.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &livestreampb.CreateChannelRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/livestream/v1#CreateChannelRequest. -// } -// op, err := c.CreateChannel(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := livestream.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &livestreampb.CreateChannelRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/livestream/v1#CreateChannelRequest. +// } +// op, err := c.CreateChannel(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/video/stitcher/apiv1/doc.go b/video/stitcher/apiv1/doc.go index ae6efddc995..101552a630d 100644 --- a/video/stitcher/apiv1/doc.go +++ b/video/stitcher/apiv1/doc.go @@ -17,43 +17,44 @@ // Package stitcher is an auto-generated package for the // Video Stitcher API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := stitcher.NewVideoStitcherClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := stitcher.NewVideoStitcherClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := stitcher.NewVideoStitcherClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := stitcher.NewVideoStitcherClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &stitcherpb.CreateCdnKeyRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#CreateCdnKeyRequest. -// } -// resp, err := c.CreateCdnKey(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &stitcherpb.CreateCdnKeyRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/stitcher/v1#CreateCdnKeyRequest. +// } +// resp, err := c.CreateCdnKey(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/video/transcoder/apiv1/doc.go b/video/transcoder/apiv1/doc.go index 4d8d3fae11a..580dab7e344 100644 --- a/video/transcoder/apiv1/doc.go +++ b/video/transcoder/apiv1/doc.go @@ -20,43 +20,44 @@ // This API converts video files into formats suitable for consumer // distribution. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := transcoder.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := transcoder.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := transcoder.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &transcoderpb.CreateJobRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1#CreateJobRequest. -// } -// resp, err := c.CreateJob(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := transcoder.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &transcoderpb.CreateJobRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/video/transcoder/v1#CreateJobRequest. +// } +// resp, err := c.CreateJob(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/videointelligence/apiv1/doc.go b/videointelligence/apiv1/doc.go index 5b883574923..3657fb8700d 100644 --- a/videointelligence/apiv1/doc.go +++ b/videointelligence/apiv1/doc.go @@ -21,48 +21,49 @@ // specifies the region for annotation and transcribes speech to text. // Supports both asynchronous API and streaming API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := videointelligence.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := videointelligence.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := videointelligence.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &videointelligencepb.AnnotateVideoRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/videointelligence/v1#AnnotateVideoRequest. -// } -// op, err := c.AnnotateVideo(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := videointelligence.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &videointelligencepb.AnnotateVideoRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/videointelligence/v1#AnnotateVideoRequest. +// } +// op, err := c.AnnotateVideo(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/videointelligence/apiv1beta2/doc.go b/videointelligence/apiv1beta2/doc.go index ed489a5c7d2..301c58603a6 100644 --- a/videointelligence/apiv1beta2/doc.go +++ b/videointelligence/apiv1beta2/doc.go @@ -21,50 +21,51 @@ // specifies the region for annotation and transcribes speech to text. // Supports both asynchronous API and streaming API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := videointelligence.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := videointelligence.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := videointelligence.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &videointelligencepb.AnnotateVideoRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2#AnnotateVideoRequest. -// } -// op, err := c.AnnotateVideo(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := videointelligence.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &videointelligencepb.AnnotateVideoRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2#AnnotateVideoRequest. +// } +// op, err := c.AnnotateVideo(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/videointelligence/apiv1p3beta1/doc.go b/videointelligence/apiv1p3beta1/doc.go index 46d81f46ec7..037518b083a 100644 --- a/videointelligence/apiv1p3beta1/doc.go +++ b/videointelligence/apiv1p3beta1/doc.go @@ -21,50 +21,51 @@ // specifies the region for annotation and transcribes speech to text. // Supports both asynchronous API and streaming API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := videointelligence.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := videointelligence.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := videointelligence.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &videointelligencepb.AnnotateVideoRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/videointelligence/v1p3beta1#AnnotateVideoRequest. -// } -// op, err := c.AnnotateVideo(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := videointelligence.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &videointelligencepb.AnnotateVideoRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/videointelligence/v1p3beta1#AnnotateVideoRequest. +// } +// op, err := c.AnnotateVideo(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/vision/apiv1/doc.go b/vision/apiv1/doc.go index ea85fe6294e..498c4021edd 100644 --- a/vision/apiv1/doc.go +++ b/vision/apiv1/doc.go @@ -21,43 +21,44 @@ // and landmark detection, optical character recognition (OCR), and detection // of explicit content, into applications. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := vision.NewProductSearchClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := vision.NewProductSearchClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := vision.NewProductSearchClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &visionpb.CreateProductSetRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1#CreateProductSetRequest. -// } -// resp, err := c.CreateProductSet(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := vision.NewProductSearchClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &visionpb.CreateProductSetRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1#CreateProductSetRequest. +// } +// resp, err := c.CreateProductSet(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/vision/apiv1/product_search_client.go b/vision/apiv1/product_search_client.go index cd1dae63dfe..4d04d3e5c66 100644 --- a/vision/apiv1/product_search_client.go +++ b/vision/apiv1/product_search_client.go @@ -327,17 +327,17 @@ type internalProductSearchClient interface { // Manages Products and ProductSets of reference images for use in product // search. It uses the following resource model: // -// The API has a collection of ProductSet resources, named -// projects/*/locations/*/productSets/*, which acts as a way to put different -// products into groups to limit identification. +// The API has a collection of ProductSet resources, named +// projects/*/locations/*/productSets/*, which acts as a way to put different +// products into groups to limit identification. // // In parallel, // -// The API has a collection of Product resources, named -// projects/*/locations/*/products/* +// The API has a collection of Product resources, named +// projects/*/locations/*/products/* // -// Each Product has a collection of ReferenceImage resources, named -// projects/*/locations/*/products/*/referenceImages/* +// Each Product has a collection of ReferenceImage resources, named +// projects/*/locations/*/products/*/referenceImages/* type ProductSearchClient struct { // The internal transport-dependent client. internalClient internalProductSearchClient @@ -377,8 +377,8 @@ func (c *ProductSearchClient) Connection() *grpc.ClientConn { // // Possible errors: // -// Returns INVALID_ARGUMENT if display_name is missing, or is longer than -// 4096 characters. +// Returns INVALID_ARGUMENT if display_name is missing, or is longer than +// 4096 characters. func (c *ProductSearchClient) CreateProductSet(ctx context.Context, req *visionpb.CreateProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { return c.internalClient.CreateProductSet(ctx, req, opts...) } @@ -387,8 +387,8 @@ func (c *ProductSearchClient) CreateProductSet(ctx context.Context, req *visionp // // Possible errors: // -// Returns INVALID_ARGUMENT if page_size is greater than 100, or less -// than 1. +// Returns INVALID_ARGUMENT if page_size is greater than 100, or less +// than 1. func (c *ProductSearchClient) ListProductSets(ctx context.Context, req *visionpb.ListProductSetsRequest, opts ...gax.CallOption) *ProductSetIterator { return c.internalClient.ListProductSets(ctx, req, opts...) } @@ -397,7 +397,7 @@ func (c *ProductSearchClient) ListProductSets(ctx context.Context, req *visionpb // // Possible errors: // -// Returns NOT_FOUND if the ProductSet does not exist. +// Returns NOT_FOUND if the ProductSet does not exist. func (c *ProductSearchClient) GetProductSet(ctx context.Context, req *visionpb.GetProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { return c.internalClient.GetProductSet(ctx, req, opts...) } @@ -407,10 +407,10 @@ func (c *ProductSearchClient) GetProductSet(ctx context.Context, req *visionpb.G // // Possible errors: // -// Returns NOT_FOUND if the ProductSet does not exist. +// Returns NOT_FOUND if the ProductSet does not exist. // -// Returns INVALID_ARGUMENT if display_name is present in update_mask but -// missing from the request or longer than 4096 characters. +// Returns INVALID_ARGUMENT if display_name is present in update_mask but +// missing from the request or longer than 4096 characters. func (c *ProductSearchClient) UpdateProductSet(ctx context.Context, req *visionpb.UpdateProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { return c.internalClient.UpdateProductSet(ctx, req, opts...) } @@ -427,12 +427,12 @@ func (c *ProductSearchClient) DeleteProductSet(ctx context.Context, req *visionp // // Possible errors: // -// Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 -// characters. +// Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 +// characters. // -// Returns INVALID_ARGUMENT if description is longer than 4096 characters. +// Returns INVALID_ARGUMENT if description is longer than 4096 characters. // -// Returns INVALID_ARGUMENT if product_category is missing or invalid. +// Returns INVALID_ARGUMENT if product_category is missing or invalid. func (c *ProductSearchClient) CreateProduct(ctx context.Context, req *visionpb.CreateProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { return c.internalClient.CreateProduct(ctx, req, opts...) } @@ -441,7 +441,7 @@ func (c *ProductSearchClient) CreateProduct(ctx context.Context, req *visionpb.C // // Possible errors: // -// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. +// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. func (c *ProductSearchClient) ListProducts(ctx context.Context, req *visionpb.ListProductsRequest, opts ...gax.CallOption) *ProductIterator { return c.internalClient.ListProducts(ctx, req, opts...) } @@ -450,7 +450,7 @@ func (c *ProductSearchClient) ListProducts(ctx context.Context, req *visionpb.Li // // Possible errors: // -// Returns NOT_FOUND if the Product does not exist. +// Returns NOT_FOUND if the Product does not exist. func (c *ProductSearchClient) GetProduct(ctx context.Context, req *visionpb.GetProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { return c.internalClient.GetProduct(ctx, req, opts...) } @@ -464,15 +464,15 @@ func (c *ProductSearchClient) GetProduct(ctx context.Context, req *visionpb.GetP // // Possible errors: // -// Returns NOT_FOUND if the Product does not exist. +// Returns NOT_FOUND if the Product does not exist. // -// Returns INVALID_ARGUMENT if display_name is present in update_mask but is -// missing from the request or longer than 4096 characters. +// Returns INVALID_ARGUMENT if display_name is present in update_mask but is +// missing from the request or longer than 4096 characters. // -// Returns INVALID_ARGUMENT if description is present in update_mask but is -// longer than 4096 characters. +// Returns INVALID_ARGUMENT if description is present in update_mask but is +// longer than 4096 characters. // -// Returns INVALID_ARGUMENT if product_category is present in update_mask. +// Returns INVALID_ARGUMENT if product_category is present in update_mask. func (c *ProductSearchClient) UpdateProduct(ctx context.Context, req *visionpb.UpdateProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { return c.internalClient.UpdateProduct(ctx, req, opts...) } @@ -499,15 +499,15 @@ func (c *ProductSearchClient) DeleteProduct(ctx context.Context, req *visionpb.D // // Possible errors: // -// Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 -// characters. +// Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 +// characters. // -// Returns INVALID_ARGUMENT if the product does not exist. +// Returns INVALID_ARGUMENT if the product does not exist. // -// Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing -// compatible with the parent product’s product_category is detected. +// Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing +// compatible with the parent product’s product_category is detected. // -// Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. +// Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. func (c *ProductSearchClient) CreateReferenceImage(ctx context.Context, req *visionpb.CreateReferenceImageRequest, opts ...gax.CallOption) (*visionpb.ReferenceImage, error) { return c.internalClient.CreateReferenceImage(ctx, req, opts...) } @@ -527,10 +527,10 @@ func (c *ProductSearchClient) DeleteReferenceImage(ctx context.Context, req *vis // // Possible errors: // -// Returns NOT_FOUND if the parent product does not exist. +// Returns NOT_FOUND if the parent product does not exist. // -// Returns INVALID_ARGUMENT if the page_size is greater than 100, or less -// than 1. +// Returns INVALID_ARGUMENT if the page_size is greater than 100, or less +// than 1. func (c *ProductSearchClient) ListReferenceImages(ctx context.Context, req *visionpb.ListReferenceImagesRequest, opts ...gax.CallOption) *ReferenceImageIterator { return c.internalClient.ListReferenceImages(ctx, req, opts...) } @@ -539,7 +539,7 @@ func (c *ProductSearchClient) ListReferenceImages(ctx context.Context, req *visi // // Possible errors: // -// Returns NOT_FOUND if the specified image does not exist. +// Returns NOT_FOUND if the specified image does not exist. func (c *ProductSearchClient) GetReferenceImage(ctx context.Context, req *visionpb.GetReferenceImageRequest, opts ...gax.CallOption) (*visionpb.ReferenceImage, error) { return c.internalClient.GetReferenceImage(ctx, req, opts...) } @@ -551,7 +551,7 @@ func (c *ProductSearchClient) GetReferenceImage(ctx context.Context, req *vision // // Possible errors: // -// Returns NOT_FOUND if the Product or the ProductSet doesn’t exist. +// Returns NOT_FOUND if the Product or the ProductSet doesn’t exist. func (c *ProductSearchClient) AddProductToProductSet(ctx context.Context, req *visionpb.AddProductToProductSetRequest, opts ...gax.CallOption) error { return c.internalClient.AddProductToProductSet(ctx, req, opts...) } @@ -567,7 +567,7 @@ func (c *ProductSearchClient) RemoveProductFromProductSet(ctx context.Context, r // // Possible errors: // -// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. +// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. func (c *ProductSearchClient) ListProductsInProductSet(ctx context.Context, req *visionpb.ListProductsInProductSetRequest, opts ...gax.CallOption) *ProductIterator { return c.internalClient.ListProductsInProductSet(ctx, req, opts...) } @@ -658,17 +658,17 @@ type productSearchGRPCClient struct { // Manages Products and ProductSets of reference images for use in product // search. It uses the following resource model: // -// The API has a collection of ProductSet resources, named -// projects/*/locations/*/productSets/*, which acts as a way to put different -// products into groups to limit identification. +// The API has a collection of ProductSet resources, named +// projects/*/locations/*/productSets/*, which acts as a way to put different +// products into groups to limit identification. // // In parallel, // -// The API has a collection of Product resources, named -// projects/*/locations/*/products/* +// The API has a collection of Product resources, named +// projects/*/locations/*/products/* // -// Each Product has a collection of ReferenceImage resources, named -// projects/*/locations/*/products/*/referenceImages/* +// Each Product has a collection of ReferenceImage resources, named +// projects/*/locations/*/products/*/referenceImages/* func NewProductSearchClient(ctx context.Context, opts ...option.ClientOption) (*ProductSearchClient, error) { clientOpts := defaultProductSearchGRPCClientOptions() if newProductSearchClientHook != nil { diff --git a/vision/apiv1p1beta1/doc.go b/vision/apiv1p1beta1/doc.go index d8d3593ea9f..4c740c604a5 100644 --- a/vision/apiv1p1beta1/doc.go +++ b/vision/apiv1p1beta1/doc.go @@ -21,45 +21,46 @@ // and landmark detection, optical character recognition (OCR), and detection // of explicit content, into applications. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := vision.NewImageAnnotatorClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := vision.NewImageAnnotatorClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := vision.NewImageAnnotatorClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &visionpb.BatchAnnotateImagesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1#BatchAnnotateImagesRequest. -// } -// resp, err := c.BatchAnnotateImages(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := vision.NewImageAnnotatorClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &visionpb.BatchAnnotateImagesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1#BatchAnnotateImagesRequest. +// } +// resp, err := c.BatchAnnotateImages(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/vision/v2/apiv1/doc.go b/vision/v2/apiv1/doc.go index f42efa2f42e..e87afaec3e9 100644 --- a/vision/v2/apiv1/doc.go +++ b/vision/v2/apiv1/doc.go @@ -21,43 +21,44 @@ // and landmark detection, optical character recognition (OCR), and detection // of explicit content, into applications. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := vision.NewProductSearchClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := vision.NewProductSearchClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := vision.NewProductSearchClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &visionpb.CreateProductSetRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1#CreateProductSetRequest. -// } -// resp, err := c.CreateProductSet(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := vision.NewProductSearchClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &visionpb.CreateProductSetRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1#CreateProductSetRequest. +// } +// resp, err := c.CreateProductSet(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/vision/v2/apiv1/product_search_client.go b/vision/v2/apiv1/product_search_client.go index 6793eec3f27..b443ed274ed 100644 --- a/vision/v2/apiv1/product_search_client.go +++ b/vision/v2/apiv1/product_search_client.go @@ -327,17 +327,17 @@ type internalProductSearchClient interface { // Manages Products and ProductSets of reference images for use in product // search. It uses the following resource model: // -// The API has a collection of ProductSet resources, named -// projects/*/locations/*/productSets/*, which acts as a way to put different -// products into groups to limit identification. +// The API has a collection of ProductSet resources, named +// projects/*/locations/*/productSets/*, which acts as a way to put different +// products into groups to limit identification. // // In parallel, // -// The API has a collection of Product resources, named -// projects/*/locations/*/products/* +// The API has a collection of Product resources, named +// projects/*/locations/*/products/* // -// Each Product has a collection of ReferenceImage resources, named -// projects/*/locations/*/products/*/referenceImages/* +// Each Product has a collection of ReferenceImage resources, named +// projects/*/locations/*/products/*/referenceImages/* type ProductSearchClient struct { // The internal transport-dependent client. internalClient internalProductSearchClient @@ -377,8 +377,8 @@ func (c *ProductSearchClient) Connection() *grpc.ClientConn { // // Possible errors: // -// Returns INVALID_ARGUMENT if display_name is missing, or is longer than -// 4096 characters. +// Returns INVALID_ARGUMENT if display_name is missing, or is longer than +// 4096 characters. func (c *ProductSearchClient) CreateProductSet(ctx context.Context, req *visionpb.CreateProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { return c.internalClient.CreateProductSet(ctx, req, opts...) } @@ -387,8 +387,8 @@ func (c *ProductSearchClient) CreateProductSet(ctx context.Context, req *visionp // // Possible errors: // -// Returns INVALID_ARGUMENT if page_size is greater than 100, or less -// than 1. +// Returns INVALID_ARGUMENT if page_size is greater than 100, or less +// than 1. func (c *ProductSearchClient) ListProductSets(ctx context.Context, req *visionpb.ListProductSetsRequest, opts ...gax.CallOption) *ProductSetIterator { return c.internalClient.ListProductSets(ctx, req, opts...) } @@ -397,7 +397,7 @@ func (c *ProductSearchClient) ListProductSets(ctx context.Context, req *visionpb // // Possible errors: // -// Returns NOT_FOUND if the ProductSet does not exist. +// Returns NOT_FOUND if the ProductSet does not exist. func (c *ProductSearchClient) GetProductSet(ctx context.Context, req *visionpb.GetProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { return c.internalClient.GetProductSet(ctx, req, opts...) } @@ -407,10 +407,10 @@ func (c *ProductSearchClient) GetProductSet(ctx context.Context, req *visionpb.G // // Possible errors: // -// Returns NOT_FOUND if the ProductSet does not exist. +// Returns NOT_FOUND if the ProductSet does not exist. // -// Returns INVALID_ARGUMENT if display_name is present in update_mask but -// missing from the request or longer than 4096 characters. +// Returns INVALID_ARGUMENT if display_name is present in update_mask but +// missing from the request or longer than 4096 characters. func (c *ProductSearchClient) UpdateProductSet(ctx context.Context, req *visionpb.UpdateProductSetRequest, opts ...gax.CallOption) (*visionpb.ProductSet, error) { return c.internalClient.UpdateProductSet(ctx, req, opts...) } @@ -427,12 +427,12 @@ func (c *ProductSearchClient) DeleteProductSet(ctx context.Context, req *visionp // // Possible errors: // -// Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 -// characters. +// Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 +// characters. // -// Returns INVALID_ARGUMENT if description is longer than 4096 characters. +// Returns INVALID_ARGUMENT if description is longer than 4096 characters. // -// Returns INVALID_ARGUMENT if product_category is missing or invalid. +// Returns INVALID_ARGUMENT if product_category is missing or invalid. func (c *ProductSearchClient) CreateProduct(ctx context.Context, req *visionpb.CreateProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { return c.internalClient.CreateProduct(ctx, req, opts...) } @@ -441,7 +441,7 @@ func (c *ProductSearchClient) CreateProduct(ctx context.Context, req *visionpb.C // // Possible errors: // -// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. +// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. func (c *ProductSearchClient) ListProducts(ctx context.Context, req *visionpb.ListProductsRequest, opts ...gax.CallOption) *ProductIterator { return c.internalClient.ListProducts(ctx, req, opts...) } @@ -450,7 +450,7 @@ func (c *ProductSearchClient) ListProducts(ctx context.Context, req *visionpb.Li // // Possible errors: // -// Returns NOT_FOUND if the Product does not exist. +// Returns NOT_FOUND if the Product does not exist. func (c *ProductSearchClient) GetProduct(ctx context.Context, req *visionpb.GetProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { return c.internalClient.GetProduct(ctx, req, opts...) } @@ -464,15 +464,15 @@ func (c *ProductSearchClient) GetProduct(ctx context.Context, req *visionpb.GetP // // Possible errors: // -// Returns NOT_FOUND if the Product does not exist. +// Returns NOT_FOUND if the Product does not exist. // -// Returns INVALID_ARGUMENT if display_name is present in update_mask but is -// missing from the request or longer than 4096 characters. +// Returns INVALID_ARGUMENT if display_name is present in update_mask but is +// missing from the request or longer than 4096 characters. // -// Returns INVALID_ARGUMENT if description is present in update_mask but is -// longer than 4096 characters. +// Returns INVALID_ARGUMENT if description is present in update_mask but is +// longer than 4096 characters. // -// Returns INVALID_ARGUMENT if product_category is present in update_mask. +// Returns INVALID_ARGUMENT if product_category is present in update_mask. func (c *ProductSearchClient) UpdateProduct(ctx context.Context, req *visionpb.UpdateProductRequest, opts ...gax.CallOption) (*visionpb.Product, error) { return c.internalClient.UpdateProduct(ctx, req, opts...) } @@ -499,15 +499,15 @@ func (c *ProductSearchClient) DeleteProduct(ctx context.Context, req *visionpb.D // // Possible errors: // -// Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 -// characters. +// Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 +// characters. // -// Returns INVALID_ARGUMENT if the product does not exist. +// Returns INVALID_ARGUMENT if the product does not exist. // -// Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing -// compatible with the parent product’s product_category is detected. +// Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing +// compatible with the parent product’s product_category is detected. // -// Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. +// Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. func (c *ProductSearchClient) CreateReferenceImage(ctx context.Context, req *visionpb.CreateReferenceImageRequest, opts ...gax.CallOption) (*visionpb.ReferenceImage, error) { return c.internalClient.CreateReferenceImage(ctx, req, opts...) } @@ -527,10 +527,10 @@ func (c *ProductSearchClient) DeleteReferenceImage(ctx context.Context, req *vis // // Possible errors: // -// Returns NOT_FOUND if the parent product does not exist. +// Returns NOT_FOUND if the parent product does not exist. // -// Returns INVALID_ARGUMENT if the page_size is greater than 100, or less -// than 1. +// Returns INVALID_ARGUMENT if the page_size is greater than 100, or less +// than 1. func (c *ProductSearchClient) ListReferenceImages(ctx context.Context, req *visionpb.ListReferenceImagesRequest, opts ...gax.CallOption) *ReferenceImageIterator { return c.internalClient.ListReferenceImages(ctx, req, opts...) } @@ -539,7 +539,7 @@ func (c *ProductSearchClient) ListReferenceImages(ctx context.Context, req *visi // // Possible errors: // -// Returns NOT_FOUND if the specified image does not exist. +// Returns NOT_FOUND if the specified image does not exist. func (c *ProductSearchClient) GetReferenceImage(ctx context.Context, req *visionpb.GetReferenceImageRequest, opts ...gax.CallOption) (*visionpb.ReferenceImage, error) { return c.internalClient.GetReferenceImage(ctx, req, opts...) } @@ -551,7 +551,7 @@ func (c *ProductSearchClient) GetReferenceImage(ctx context.Context, req *vision // // Possible errors: // -// Returns NOT_FOUND if the Product or the ProductSet doesn’t exist. +// Returns NOT_FOUND if the Product or the ProductSet doesn’t exist. func (c *ProductSearchClient) AddProductToProductSet(ctx context.Context, req *visionpb.AddProductToProductSetRequest, opts ...gax.CallOption) error { return c.internalClient.AddProductToProductSet(ctx, req, opts...) } @@ -567,7 +567,7 @@ func (c *ProductSearchClient) RemoveProductFromProductSet(ctx context.Context, r // // Possible errors: // -// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. +// Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. func (c *ProductSearchClient) ListProductsInProductSet(ctx context.Context, req *visionpb.ListProductsInProductSetRequest, opts ...gax.CallOption) *ProductIterator { return c.internalClient.ListProductsInProductSet(ctx, req, opts...) } @@ -658,17 +658,17 @@ type productSearchGRPCClient struct { // Manages Products and ProductSets of reference images for use in product // search. It uses the following resource model: // -// The API has a collection of ProductSet resources, named -// projects/*/locations/*/productSets/*, which acts as a way to put different -// products into groups to limit identification. +// The API has a collection of ProductSet resources, named +// projects/*/locations/*/productSets/*, which acts as a way to put different +// products into groups to limit identification. // // In parallel, // -// The API has a collection of Product resources, named -// projects/*/locations/*/products/* +// The API has a collection of Product resources, named +// projects/*/locations/*/products/* // -// Each Product has a collection of ReferenceImage resources, named -// projects/*/locations/*/products/*/referenceImages/* +// Each Product has a collection of ReferenceImage resources, named +// projects/*/locations/*/products/*/referenceImages/* func NewProductSearchClient(ctx context.Context, opts ...option.ClientOption) (*ProductSearchClient, error) { clientOpts := defaultProductSearchGRPCClientOptions() if newProductSearchClientHook != nil { diff --git a/vmmigration/apiv1/doc.go b/vmmigration/apiv1/doc.go index f71c321817b..b9dabb36dde 100644 --- a/vmmigration/apiv1/doc.go +++ b/vmmigration/apiv1/doc.go @@ -20,49 +20,50 @@ // Use the Migrate to Virtual Machines API to programmatically migrate // workloads. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := vmmigration.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := vmmigration.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := vmmigration.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &vmmigrationpb.ListSourcesRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vmmigration/v1#ListSourcesRequest. -// } -// it := c.ListSources(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := vmmigration.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &vmmigrationpb.ListSourcesRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vmmigration/v1#ListSourcesRequest. +// } +// it := c.ListSources(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/vpcaccess/apiv1/doc.go b/vpcaccess/apiv1/doc.go index 6760a4e603c..7b3796eda7e 100644 --- a/vpcaccess/apiv1/doc.go +++ b/vpcaccess/apiv1/doc.go @@ -19,48 +19,49 @@ // // API for managing VPC access connectors. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := vpcaccess.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := vpcaccess.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := vpcaccess.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &vpcaccesspb.CreateConnectorRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vpcaccess/v1#CreateConnectorRequest. -// } -// op, err := c.CreateConnector(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// -// resp, err := op.Wait(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := vpcaccess.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &vpcaccesspb.CreateConnectorRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vpcaccess/v1#CreateConnectorRequest. +// } +// op, err := c.CreateConnector(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// +// resp, err := op.Wait(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/webrisk/apiv1/doc.go b/webrisk/apiv1/doc.go index 37a7edf73db..cecdffbde68 100644 --- a/webrisk/apiv1/doc.go +++ b/webrisk/apiv1/doc.go @@ -17,43 +17,44 @@ // Package webrisk is an auto-generated package for the // Web Risk API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := webrisk.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := webrisk.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := webrisk.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// c, err := webrisk.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &webriskpb.ComputeThreatListDiffRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/webrisk/v1#ComputeThreatListDiffRequest. -// } -// resp, err := c.ComputeThreatListDiff(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &webriskpb.ComputeThreatListDiffRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/webrisk/v1#ComputeThreatListDiffRequest. +// } +// resp, err := c.ComputeThreatListDiff(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/webrisk/apiv1beta1/doc.go b/webrisk/apiv1beta1/doc.go index 16f5aef49d8..9cd8c37ea36 100644 --- a/webrisk/apiv1beta1/doc.go +++ b/webrisk/apiv1beta1/doc.go @@ -17,45 +17,46 @@ // Package webrisk is an auto-generated package for the // Web Risk API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := webrisk.NewWebRiskServiceV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := webrisk.NewWebRiskServiceV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := webrisk.NewWebRiskServiceV1Beta1Client(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &webriskpb.ComputeThreatListDiffRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/webrisk/v1beta1#ComputeThreatListDiffRequest. -// } -// resp, err := c.ComputeThreatListDiff(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := webrisk.NewWebRiskServiceV1Beta1Client(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &webriskpb.ComputeThreatListDiffRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/webrisk/v1beta1#ComputeThreatListDiffRequest. +// } +// resp, err := c.ComputeThreatListDiff(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/websecurityscanner/apiv1/doc.go b/websecurityscanner/apiv1/doc.go index bd035c6dc12..90f2f031869 100644 --- a/websecurityscanner/apiv1/doc.go +++ b/websecurityscanner/apiv1/doc.go @@ -19,43 +19,44 @@ // // Scans your Compute and App Engine apps for common web vulnerabilities. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := websecurityscanner.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := websecurityscanner.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := websecurityscanner.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &websecurityscannerpb.CreateScanConfigRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#CreateScanConfigRequest. -// } -// resp, err := c.CreateScanConfig(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// -// Use of Context +// ctx := context.Background() +// c, err := websecurityscanner.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &websecurityscannerpb.CreateScanConfigRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1#CreateScanConfigRequest. +// } +// resp, err := c.CreateScanConfig(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/workflows/apiv1/doc.go b/workflows/apiv1/doc.go index 5c0635de2e7..0f234561839 100644 --- a/workflows/apiv1/doc.go +++ b/workflows/apiv1/doc.go @@ -20,49 +20,50 @@ // Manage workflow definitions. To execute workflows and manage executions, // see the Workflows Executions API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := workflows.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := workflows.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := workflows.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &workflowspb.ListWorkflowsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/v1#ListWorkflowsRequest. -// } -// it := c.ListWorkflows(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := workflows.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &workflowspb.ListWorkflowsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/v1#ListWorkflowsRequest. +// } +// it := c.ListWorkflows(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/workflows/apiv1beta/doc.go b/workflows/apiv1beta/doc.go index e1e7e1a570f..06437358205 100644 --- a/workflows/apiv1beta/doc.go +++ b/workflows/apiv1beta/doc.go @@ -20,51 +20,52 @@ // Manage workflow definitions. To execute workflows and manage executions, // see the Workflows Executions API. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := workflows.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := workflows.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := workflows.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &workflowspb.ListWorkflowsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/v1beta#ListWorkflowsRequest. -// } -// it := c.ListWorkflows(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := workflows.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &workflowspb.ListWorkflowsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/v1beta#ListWorkflowsRequest. +// } +// it := c.ListWorkflows(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/workflows/executions/apiv1/doc.go b/workflows/executions/apiv1/doc.go index 65728f28385..fe3e79b8568 100644 --- a/workflows/executions/apiv1/doc.go +++ b/workflows/executions/apiv1/doc.go @@ -19,49 +19,50 @@ // // Execute workflows created with Workflows API. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := executions.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := executions.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := executions.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &executionspb.ListExecutionsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/executions/v1#ListExecutionsRequest. -// } -// it := c.ListExecutions(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := executions.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &executionspb.ListExecutionsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/executions/v1#ListExecutionsRequest. +// } +// it := c.ListExecutions(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. diff --git a/workflows/executions/apiv1beta/doc.go b/workflows/executions/apiv1beta/doc.go index 9f4fde5f7f4..e565e70022b 100644 --- a/workflows/executions/apiv1beta/doc.go +++ b/workflows/executions/apiv1beta/doc.go @@ -19,51 +19,52 @@ // // Manages user-provided workflows. // -// NOTE: This package is in beta. It is not stable, and may be subject to changes. +// NOTE: This package is in beta. It is not stable, and may be subject to changes. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// c, err := executions.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// c, err := executions.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.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 +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// c, err := executions.NewClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &executionspb.ListExecutionsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/executions/v1beta#ListExecutionsRequest. -// } -// it := c.ListExecutions(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// c, err := executions.NewClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &executionspb.ListExecutionsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/workflows/executions/v1beta#ListExecutionsRequest. +// } +// it := c.ListExecutions(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls.