putPolicy method

Future<void> putPolicy(
  1. PolicyEntry policy
)

Puts a policy entry to the S3I-Directory.

Throws a NetworkAuthenticationException if AuthenticationManager.getAccessToken fails. Throws a SocketException if no internet connection is available. Throws a NetworkResponseException if the received status code is not 204 or 201.

Implementation

Future<void> putPolicy(PolicyEntry policy) async {
  final Response response =
      await putDirectory('/policies/${policy.id}', jsonBody: policy.toJson());
  if (response.statusCode != 204 && response.statusCode != 201) {
    throw NetworkResponseException(response);
  }
}