Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ void GoldenKitchenSinkMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata(
"x-goog-user-project", options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ void GoldenThingAdminMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata(
"x-goog-user-project", options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
3 changes: 3 additions & 0 deletions generator/internal/metadata_decorator_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ void $metadata_class_name$::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata(
"x-goog-user-project", options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}
)""");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ void AccessApprovalMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ void AccessContextManagerMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ void ApiGatewayServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ void ConnectionServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ void ApplicationsMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ void AuthorizedCertificatesMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ void AuthorizedDomainsMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ void DomainMappingsMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ void FirewallMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void InstancesMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void ServicesMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ void VersionsMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ void ArtifactRegistryMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
3 changes: 3 additions & 0 deletions google/cloud/asset/internal/asset_metadata_decorator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ void AssetServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ void AssuredWorkloadsServiceMetadata::SetMetadata(
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
3 changes: 3 additions & 0 deletions google/cloud/automl/internal/auto_ml_metadata_decorator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ void AutoMlMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ void PredictionServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ void BigQueryReadMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ void ConnectionServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ void DataTransferServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
3 changes: 3 additions & 0 deletions google/cloud/bigquery/internal/model_metadata_decorator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ void ModelServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ void ReservationServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ void BigtableInstanceAdminMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ void BigtableTableAdminMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
3 changes: 3 additions & 0 deletions google/cloud/billing/internal/budget_metadata_decorator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ void BudgetServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ void CloudBillingMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ void CloudCatalogMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ void BinauthzManagementServiceV1Metadata::SetMetadata(
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ void SystemPolicyV1Metadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ void ValidationHelperV1Metadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ void CloudChannelServiceMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ void CloudBuildMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
19 changes: 17 additions & 2 deletions google/cloud/common_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,26 @@ struct UserProjectOption {
using Type = std::string;
};

/**
* Configure the "authority" attribute.
*
* For gRPC requests this is the `authority()` field in the
* `grpc::ClientContext`. This configures the :authority pseudo-header in the
* HTTP/2 request.
* https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.3
*
* For REST-based services using HTTP/1.1 or HTTP/1.0 this is the `Host` header.
*/
struct AuthorityOption {
using Type = std::string;
};

/**
* A list of all the common options.
*/
using CommonOptionList = OptionList<EndpointOption, UserAgentProductsOption,
TracingComponentsOption, UserProjectOption>;
using CommonOptionList =
OptionList<EndpointOption, UserAgentProductsOption, TracingComponentsOption,
UserProjectOption, AuthorityOption>;

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace cloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ void EnvironmentsMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ void ImageVersionsMetadata::SetMetadata(grpc::ClientContext& context) {
context.AddMetadata("x-goog-user-project",
options.get<UserProjectOption>());
}
if (options.has<AuthorityOption>()) {
context.set_authority(options.get<AuthorityOption>());
}
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Loading