getServiceAccount method
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:
- "googleCredentials" : Google Credentials File format.
- "pkcs12" : PKCS12 format. The password for the PKCS12 file is 'notasecret'. For more information, see https://tools.ietf.org/html/rfc7292. The data for keys of this type are base64 encoded according to RFC 4648 Section 4. See http://tools.ietf.org/html/rfc4648#section-4.
$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>);
}