validate_service_config.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2019 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include <string>
20 
21 #include <grpc/grpc.h>
22 #include <grpcpp/support/config.h>
24 
27 
28 namespace grpc {
29 namespace experimental {
30 std::string ValidateServiceConfigJSON(const std::string& service_config_json) {
31  grpc_init();
33  grpc_core::ServiceConfigImpl::Create(/*args=*/nullptr,
34  service_config_json.c_str(), &error);
35  std::string return_value;
36  if (!GRPC_ERROR_IS_NONE(error)) {
37  return_value = grpc_error_std_string(error);
39  }
40  grpc_shutdown();
41  return return_value;
42 }
43 } // namespace experimental
44 } // namespace grpc
validate_service_config.h
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
grpc
Definition: grpcpp/alarm.h:33
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc.h
error.h
config.h
grpc_core::ServiceConfigImpl::Create
static RefCountedPtr< ServiceConfig > Create(const grpc_channel_args *args, absl::string_view json_string, grpc_error_handle *error)
Definition: service_config_impl.cc:41
grpc_error_std_string
std::string grpc_error_std_string(grpc_error_handle error)
Definition: error.cc:944
service_config_impl.h
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
grpc::experimental::ValidateServiceConfigJSON
std::string ValidateServiceConfigJSON(const std::string &service_config_json)
Definition: validate_service_config.cc:30
grpc_init
GRPCAPI void grpc_init(void)
Definition: init.cc:146
grpc_error
Definition: error_internal.h:42
grpc_shutdown
GRPCAPI void grpc_shutdown(void)
Definition: init.cc:209
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:50