createCoreV1NamespacedEvent method

Future<Event> createCoreV1NamespacedEvent({
  1. required Event body,
  2. required String namespace,
  3. bool? pretty,
})

Create an Event.

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

pretty If true, then the output is pretty printed.

Implementation

Future<api_core_v1.Event> createCoreV1NamespacedEvent({
  required api_core_v1.Event body,
  required String namespace,
  bool? pretty,
}) async {
  final queryStrings = <String, Object>{};
  if (pretty != null) {
    queryStrings['pretty'] = pretty;
  }

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

  final jsonBody = jsonEncode(body.toJson());
  final result = await _postJsonMap(
      '/api/v1/namespaces/$namespace/events$query', jsonBody);
  return api_core_v1.Event.fromJson(result);
}