Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(generator): Connection base-class operations should fail #8236

Merged
merged 8 commits into from
Feb 4, 2022
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 @@ -54,16 +54,9 @@ GoldenKitchenSinkConnection::WriteLogEntries(
}

StreamRange<std::string> GoldenKitchenSinkConnection::ListLogs(
google::test::admin::database::v1::ListLogsRequest request) {
return google::cloud::internal::MakePaginationRange<StreamRange<
std::string>>(
std::move(request),
[](google::test::admin::database::v1::ListLogsRequest const&) {
return StatusOr<google::test::admin::database::v1::ListLogsResponse>{};
},
[](google::test::admin::database::v1::ListLogsResponse const&) {
return std::vector<std::string>();
});
google::test::admin::database::v1::ListLogsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<std::string>>();
}

StreamRange<google::test::admin::database::v1::TailLogEntriesResponse> GoldenKitchenSinkConnection::TailLogEntries(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,9 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
GoldenThingAdminConnection::~GoldenThingAdminConnection() = default;

StreamRange<google::test::admin::database::v1::Database> GoldenThingAdminConnection::ListDatabases(
google::test::admin::database::v1::ListDatabasesRequest request) {
return google::cloud::internal::MakePaginationRange<StreamRange<
google::test::admin::database::v1::Database>>(
std::move(request),
[](google::test::admin::database::v1::ListDatabasesRequest const&) {
return StatusOr<google::test::admin::database::v1::ListDatabasesResponse>{};
},
[](google::test::admin::database::v1::ListDatabasesResponse const&) {
return std::vector<google::test::admin::database::v1::Database>();
});
google::test::admin::database::v1::ListDatabasesRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::test::admin::database::v1::Database>>();
}

future<StatusOr<google::test::admin::database::v1::Database>>
Expand Down Expand Up @@ -127,16 +120,9 @@ GoldenThingAdminConnection::DeleteBackup(
}

StreamRange<google::test::admin::database::v1::Backup> GoldenThingAdminConnection::ListBackups(
google::test::admin::database::v1::ListBackupsRequest request) {
return google::cloud::internal::MakePaginationRange<StreamRange<
google::test::admin::database::v1::Backup>>(
std::move(request),
[](google::test::admin::database::v1::ListBackupsRequest const&) {
return StatusOr<google::test::admin::database::v1::ListBackupsResponse>{};
},
[](google::test::admin::database::v1::ListBackupsResponse const&) {
return std::vector<google::test::admin::database::v1::Backup>();
});
google::test::admin::database::v1::ListBackupsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::test::admin::database::v1::Backup>>();
}

future<StatusOr<google::test::admin::database::v1::Database>>
Expand All @@ -148,29 +134,15 @@ GoldenThingAdminConnection::RestoreDatabase(
}

StreamRange<google::longrunning::Operation> GoldenThingAdminConnection::ListDatabaseOperations(
google::test::admin::database::v1::ListDatabaseOperationsRequest request) {
return google::cloud::internal::MakePaginationRange<StreamRange<
google::longrunning::Operation>>(
std::move(request),
[](google::test::admin::database::v1::ListDatabaseOperationsRequest const&) {
return StatusOr<google::test::admin::database::v1::ListDatabaseOperationsResponse>{};
},
[](google::test::admin::database::v1::ListDatabaseOperationsResponse const&) {
return std::vector<google::longrunning::Operation>();
});
google::test::admin::database::v1::ListDatabaseOperationsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::longrunning::Operation>>();
}

StreamRange<google::longrunning::Operation> GoldenThingAdminConnection::ListBackupOperations(
google::test::admin::database::v1::ListBackupOperationsRequest request) {
return google::cloud::internal::MakePaginationRange<StreamRange<
google::longrunning::Operation>>(
std::move(request),
[](google::test::admin::database::v1::ListBackupOperationsRequest const&) {
return StatusOr<google::test::admin::database::v1::ListBackupOperationsResponse>{};
},
[](google::test::admin::database::v1::ListBackupOperationsResponse const&) {
return std::vector<google::longrunning::Operation>();
});
google::test::admin::database::v1::ListBackupOperationsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::longrunning::Operation>>();
}

future<StatusOr<google::test::admin::database::v1::Database>>
Expand Down
13 changes: 3 additions & 10 deletions generator/internal/connection_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,9 @@ std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
{
// clang-format off
{"\nStreamRange<$range_output_type$> $connection_class_name$::$method_name$(\n"
" $request_type$ request) {\n"
" return google::cloud::internal::MakePaginationRange<StreamRange<\n"
" $range_output_type$>>(\n"
" std::move(request),\n"
" []($request_type$ const&) {\n"
" return StatusOr<$response_type$>{};\n"
" },\n"
" []($response_type$ const&) {\n"
" return std::vector<$range_output_type$>();\n"
" });\n"
" $request_type$) { // NOLINT(performance-unnecessary-value-param)\n"
" return google::cloud::internal::MakeUnimplementedPaginationRange<\n"
" StreamRange<$range_output_type$>>();\n"
"}\n"
// clang-format on
},
Expand Down
20 changes: 5 additions & 15 deletions google/cloud/accessapproval/access_approval_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,11 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
AccessApprovalConnection::~AccessApprovalConnection() = default;

StreamRange<google::cloud::accessapproval::v1::ApprovalRequest>
AccessApprovalConnection::ListApprovalRequests(
google::cloud::accessapproval::v1::ListApprovalRequestsMessage request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::cloud::accessapproval::v1::ApprovalRequest>>(
std::move(request),
[](google::cloud::accessapproval::v1::
ListApprovalRequestsMessage const&) {
return StatusOr<
google::cloud::accessapproval::v1::ListApprovalRequestsResponse>{};
},
[](google::cloud::accessapproval::v1::
ListApprovalRequestsResponse const&) {
return std::vector<
google::cloud::accessapproval::v1::ApprovalRequest>();
});
AccessApprovalConnection::ListApprovalRequests(
google::cloud::accessapproval::v1::
ListApprovalRequestsMessage) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::cloud::accessapproval::v1::ApprovalRequest>>();
}

StatusOr<google::cloud::accessapproval::v1::ApprovalRequest>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,11 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
AccessContextManagerConnection::~AccessContextManagerConnection() = default;

StreamRange<google::identity::accesscontextmanager::v1::AccessPolicy>
AccessContextManagerConnection::ListAccessPolicies(
google::identity::accesscontextmanager::v1::ListAccessPoliciesRequest
request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::identity::accesscontextmanager::v1::AccessPolicy>>(
std::move(request),
[](google::identity::accesscontextmanager::v1::
ListAccessPoliciesRequest const&) {
return StatusOr<google::identity::accesscontextmanager::v1::
ListAccessPoliciesResponse>{};
},
[](google::identity::accesscontextmanager::v1::
ListAccessPoliciesResponse const&) {
return std::vector<
google::identity::accesscontextmanager::v1::AccessPolicy>();
});
AccessContextManagerConnection::ListAccessPolicies(
google::identity::accesscontextmanager::v1::
ListAccessPoliciesRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::identity::accesscontextmanager::v1::AccessPolicy>>();
}

StatusOr<google::identity::accesscontextmanager::v1::AccessPolicy>
Expand Down Expand Up @@ -89,22 +78,11 @@ AccessContextManagerConnection::DeleteAccessPolicy(
}

StreamRange<google::identity::accesscontextmanager::v1::AccessLevel>
AccessContextManagerConnection::ListAccessLevels(
google::identity::accesscontextmanager::v1::ListAccessLevelsRequest
request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::identity::accesscontextmanager::v1::AccessLevel>>(
std::move(request),
[](google::identity::accesscontextmanager::v1::
ListAccessLevelsRequest const&) {
return StatusOr<google::identity::accesscontextmanager::v1::
ListAccessLevelsResponse>{};
},
[](google::identity::accesscontextmanager::v1::
ListAccessLevelsResponse const&) {
return std::vector<
google::identity::accesscontextmanager::v1::AccessLevel>();
});
AccessContextManagerConnection::ListAccessLevels(
google::identity::accesscontextmanager::v1::
ListAccessLevelsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::identity::accesscontextmanager::v1::AccessLevel>>();
}

StatusOr<google::identity::accesscontextmanager::v1::AccessLevel>
Expand Down Expand Up @@ -153,22 +131,11 @@ AccessContextManagerConnection::ReplaceAccessLevels(
}

StreamRange<google::identity::accesscontextmanager::v1::ServicePerimeter>
AccessContextManagerConnection::ListServicePerimeters(
google::identity::accesscontextmanager::v1::ListServicePerimetersRequest
request) {
return google::cloud::internal::MakePaginationRange<StreamRange<
google::identity::accesscontextmanager::v1::ServicePerimeter>>(
std::move(request),
[](google::identity::accesscontextmanager::v1::
ListServicePerimetersRequest const&) {
return StatusOr<google::identity::accesscontextmanager::v1::
ListServicePerimetersResponse>{};
},
[](google::identity::accesscontextmanager::v1::
ListServicePerimetersResponse const&) {
return std::vector<
google::identity::accesscontextmanager::v1::ServicePerimeter>();
});
AccessContextManagerConnection::ListServicePerimeters(
google::identity::accesscontextmanager::v1::
ListServicePerimetersRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<StreamRange<
google::identity::accesscontextmanager::v1::ServicePerimeter>>();
}

StatusOr<google::identity::accesscontextmanager::v1::ServicePerimeter>
Expand Down Expand Up @@ -230,22 +197,11 @@ AccessContextManagerConnection::CommitServicePerimeters(
}

StreamRange<google::identity::accesscontextmanager::v1::GcpUserAccessBinding>
AccessContextManagerConnection::ListGcpUserAccessBindings(
google::identity::accesscontextmanager::v1::ListGcpUserAccessBindingsRequest
request) {
return google::cloud::internal::MakePaginationRange<StreamRange<
google::identity::accesscontextmanager::v1::GcpUserAccessBinding>>(
std::move(request),
[](google::identity::accesscontextmanager::v1::
ListGcpUserAccessBindingsRequest const&) {
return StatusOr<google::identity::accesscontextmanager::v1::
ListGcpUserAccessBindingsResponse>{};
},
[](google::identity::accesscontextmanager::v1::
ListGcpUserAccessBindingsResponse const&) {
return std::vector<
google::identity::accesscontextmanager::v1::GcpUserAccessBinding>();
});
AccessContextManagerConnection::ListGcpUserAccessBindings(
google::identity::accesscontextmanager::v1::
ListGcpUserAccessBindingsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<StreamRange<
google::identity::accesscontextmanager::v1::GcpUserAccessBinding>>();
}

StatusOr<google::identity::accesscontextmanager::v1::GcpUserAccessBinding>
Expand Down
49 changes: 15 additions & 34 deletions google/cloud/apigateway/api_gateway_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,11 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
ApiGatewayServiceConnection::~ApiGatewayServiceConnection() = default;

StreamRange<google::cloud::apigateway::v1::Gateway>
ApiGatewayServiceConnection::ListGateways(
google::cloud::apigateway::v1::ListGatewaysRequest request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::cloud::apigateway::v1::Gateway>>(
std::move(request),
[](google::cloud::apigateway::v1::ListGatewaysRequest const&) {
return StatusOr<google::cloud::apigateway::v1::ListGatewaysResponse>{};
},
[](google::cloud::apigateway::v1::ListGatewaysResponse const&) {
return std::vector<google::cloud::apigateway::v1::Gateway>();
});
ApiGatewayServiceConnection::ListGateways(
google::cloud::apigateway::v1::
ListGatewaysRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::cloud::apigateway::v1::Gateway>>();
}

StatusOr<google::cloud::apigateway::v1::Gateway>
Expand Down Expand Up @@ -80,17 +74,11 @@ ApiGatewayServiceConnection::DeleteGateway(
}

StreamRange<google::cloud::apigateway::v1::Api>
ApiGatewayServiceConnection::ListApis(
google::cloud::apigateway::v1::ListApisRequest request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::cloud::apigateway::v1::Api>>(
std::move(request),
[](google::cloud::apigateway::v1::ListApisRequest const&) {
return StatusOr<google::cloud::apigateway::v1::ListApisResponse>{};
},
[](google::cloud::apigateway::v1::ListApisResponse const&) {
return std::vector<google::cloud::apigateway::v1::Api>();
});
ApiGatewayServiceConnection::ListApis(
google::cloud::apigateway::v1::
ListApisRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::cloud::apigateway::v1::Api>>();
}

StatusOr<google::cloud::apigateway::v1::Api>
Expand Down Expand Up @@ -124,18 +112,11 @@ ApiGatewayServiceConnection::DeleteApi(
}

StreamRange<google::cloud::apigateway::v1::ApiConfig>
ApiGatewayServiceConnection::ListApiConfigs(
google::cloud::apigateway::v1::ListApiConfigsRequest request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::cloud::apigateway::v1::ApiConfig>>(
std::move(request),
[](google::cloud::apigateway::v1::ListApiConfigsRequest const&) {
return StatusOr<
google::cloud::apigateway::v1::ListApiConfigsResponse>{};
},
[](google::cloud::apigateway::v1::ListApiConfigsResponse const&) {
return std::vector<google::cloud::apigateway::v1::ApiConfig>();
});
ApiGatewayServiceConnection::ListApiConfigs(
google::cloud::apigateway::v1::
ListApiConfigsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::cloud::apigateway::v1::ApiConfig>>();
}

StatusOr<google::cloud::apigateway::v1::ApiConfig>
Expand Down
17 changes: 5 additions & 12 deletions google/cloud/appengine/authorized_certificates_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,11 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
AuthorizedCertificatesConnection::~AuthorizedCertificatesConnection() = default;

StreamRange<google::appengine::v1::AuthorizedCertificate>
AuthorizedCertificatesConnection::ListAuthorizedCertificates(
google::appengine::v1::ListAuthorizedCertificatesRequest request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::appengine::v1::AuthorizedCertificate>>(
std::move(request),
[](google::appengine::v1::ListAuthorizedCertificatesRequest const&) {
return StatusOr<
google::appengine::v1::ListAuthorizedCertificatesResponse>{};
},
[](google::appengine::v1::ListAuthorizedCertificatesResponse const&) {
return std::vector<google::appengine::v1::AuthorizedCertificate>();
});
AuthorizedCertificatesConnection::ListAuthorizedCertificates(
google::appengine::v1::
ListAuthorizedCertificatesRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::appengine::v1::AuthorizedCertificate>>();
}

StatusOr<google::appengine::v1::AuthorizedCertificate>
Expand Down
16 changes: 5 additions & 11 deletions google/cloud/appengine/authorized_domains_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,11 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
AuthorizedDomainsConnection::~AuthorizedDomainsConnection() = default;

StreamRange<google::appengine::v1::AuthorizedDomain>
AuthorizedDomainsConnection::ListAuthorizedDomains(
google::appengine::v1::ListAuthorizedDomainsRequest request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::appengine::v1::AuthorizedDomain>>(
std::move(request),
[](google::appengine::v1::ListAuthorizedDomainsRequest const&) {
return StatusOr<google::appengine::v1::ListAuthorizedDomainsResponse>{};
},
[](google::appengine::v1::ListAuthorizedDomainsResponse const&) {
return std::vector<google::appengine::v1::AuthorizedDomain>();
});
AuthorizedDomainsConnection::ListAuthorizedDomains(
google::appengine::v1::
ListAuthorizedDomainsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::appengine::v1::AuthorizedDomain>>();
}

std::shared_ptr<AuthorizedDomainsConnection> MakeAuthorizedDomainsConnection(
Expand Down
16 changes: 5 additions & 11 deletions google/cloud/appengine/domain_mappings_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,11 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
DomainMappingsConnection::~DomainMappingsConnection() = default;

StreamRange<google::appengine::v1::DomainMapping>
DomainMappingsConnection::ListDomainMappings(
google::appengine::v1::ListDomainMappingsRequest request) {
return google::cloud::internal::MakePaginationRange<
StreamRange<google::appengine::v1::DomainMapping>>(
std::move(request),
[](google::appengine::v1::ListDomainMappingsRequest const&) {
return StatusOr<google::appengine::v1::ListDomainMappingsResponse>{};
},
[](google::appengine::v1::ListDomainMappingsResponse const&) {
return std::vector<google::appengine::v1::DomainMapping>();
});
DomainMappingsConnection::ListDomainMappings(
google::appengine::v1::
ListDomainMappingsRequest) { // NOLINT(performance-unnecessary-value-param)
return google::cloud::internal::MakeUnimplementedPaginationRange<
StreamRange<google::appengine::v1::DomainMapping>>();
}

StatusOr<google::appengine::v1::DomainMapping>
Expand Down
Loading