getServiceAccount method

Future<ServiceAccount> getServiceAccount(
  1. String enterpriseId, {
  2. String? keyType,
  3. String? $fields,
})

Returns a service account and credentials.

The service account can be bound to the enterprise by calling setAccount. The service account is unique to this enterprise and EMM, and will be deleted if the enterprise is unbound. The credentials contain private key data and are not stored server-side. This method can only be called after calling Enterprises.Enroll or Enterprises.CompleteSignup, and before Enterprises.SetAccount; at other times it will return an error. Subsequent calls after the first will generate a new, unique set of credentials, and invalidate the previously generated credentials. Once the service account is bound to the enterprise, it can be managed using the serviceAccountKeys resource.

Request parameters:

enterpriseId - The ID of the enterprise.

keyType - The type of credential to return with the service account. Required. Possible string values are:

$fields - Selector specifying which fields to include in a partial response.

Completes with a ServiceAccount.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ServiceAccount> getServiceAccount(
  core.String enterpriseId, {
  core.String? keyType,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (keyType != null) 'keyType': [keyType],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'androidenterprise/v1/enterprises/' +
      commons.escapeVariable('$enterpriseId') +
      '/serviceAccount';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ServiceAccount.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}