connectCoreV1GetNamespacedServiceProxy method

Future<String> connectCoreV1GetNamespacedServiceProxy({
  1. required String name,
  2. required String namespace,
  3. String? pathQuery,
})

Connect GET requests to proxy of Service.

name Name of the ServiceProxyOptions.

namespace Object name and auth scope, such as for teams and projects.

pathQuery Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy.

Implementation

Future<String> connectCoreV1GetNamespacedServiceProxy({
  required String name,
  required String namespace,
  String? pathQuery,
}) async {
  final queryStrings = <String, Object>{};
  if (pathQuery != null) {
    queryStrings['path'] = pathQuery;
  }

  final query =
      queryStrings.isEmpty ? '' : '?${_joinQueryStrings(queryStrings)}';

  final result = await _getJsonString(
      '/api/v1/namespaces/$namespace/services/$name/proxy$query');
  return result;
}