Class ServiceAccount (1.1.8) 
  
  
  
   
  
    
  
  
    
    
    
    
  Version 1.1.8keyboard_arrow_down  
  
 
    
    
    
      
  
  
  
    
public   final   class  ServiceAccount   extends   GeneratedMessageV3   implements   ServiceAccountOrBuilder  
   An IAM service account.
 A service account is an account for an application or a virtual machine (VM)
 instance, not a person. You can use a service account to call Google APIs. To
 learn more, read the overview of service
 accounts .
 When you create a service account, you specify the project ID that owns the
 service account, as well as a name that must be unique within the project.
 IAM uses these values to create an email address that identifies the service
 account.
 Protobuf type google.iam.admin.v1.ServiceAccount
Static Fields
   
  DESCRIPTION_FIELD_NUMBER 
  
    
public   static   final   int   DESCRIPTION_FIELD_NUMBER  
  Field Value 
  
  DISABLED_FIELD_NUMBER 
  
    
public   static   final   int   DISABLED_FIELD_NUMBER  
  Field Value 
  
  DISPLAY_NAME_FIELD_NUMBER 
  
    
public   static   final   int   DISPLAY_NAME_FIELD_NUMBER  
  Field Value 
  
  EMAIL_FIELD_NUMBER 
  
    
public   static   final   int   EMAIL_FIELD_NUMBER  
  Field Value 
  
  ETAG_FIELD_NUMBER 
  
    
public   static   final   int   ETAG_FIELD_NUMBER  
  Field Value 
  
  NAME_FIELD_NUMBER 
  
    
public   static   final   int   NAME_FIELD_NUMBER  
  Field Value 
  
  OAUTH2_CLIENT_ID_FIELD_NUMBER 
  
    
public   static   final   int   OAUTH2_CLIENT_ID_FIELD_NUMBER  
  Field Value 
  
  PROJECT_ID_FIELD_NUMBER 
  
    
public   static   final   int   PROJECT_ID_FIELD_NUMBER  
  Field Value 
  
  UNIQUE_ID_FIELD_NUMBER 
  
    
public   static   final   int   UNIQUE_ID_FIELD_NUMBER  
  Field Value 
  
  Static Methods
   
  getDefaultInstance() 
  
    
public   static   ServiceAccount   getDefaultInstance ()  
  Returns 
  
  getDescriptor() 
  
    
public   static   final   Descriptors . Descriptor   getDescriptor ()  
  Returns 
  
  newBuilder() 
  
    
public   static   ServiceAccount . Builder   newBuilder ()  
  Returns 
  
  newBuilder(ServiceAccount prototype) 
  
    
public   static   ServiceAccount . Builder   newBuilder ( ServiceAccount   prototype )  
  Parameter 
  
  Returns 
  
  
    
public   static   ServiceAccount   parseDelimitedFrom ( InputStream   input )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   ServiceAccount   parseDelimitedFrom ( InputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  parseFrom(byte[] data) 
  
    
public   static   ServiceAccount   parseFrom ( byte []   data )  
  Parameter 
  
    
      
        Name Description  
      
        data byte [] 
     
  
  Returns 
  
  Exceptions 
  
  parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   ServiceAccount   parseFrom ( byte []   data ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  parseFrom(ByteString data) 
  
    
public   static   ServiceAccount   parseFrom ( ByteString   data )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   ServiceAccount   parseFrom ( ByteString   data ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   ServiceAccount   parseFrom ( CodedInputStream   input )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   ServiceAccount   parseFrom ( CodedInputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   ServiceAccount   parseFrom ( InputStream   input )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   ServiceAccount   parseFrom ( InputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  parseFrom(ByteBuffer data) 
  
    
public   static   ServiceAccount   parseFrom ( ByteBuffer   data )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   ServiceAccount   parseFrom ( ByteBuffer   data ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  parser() 
  
    
public   static   Parser<ServiceAccount>   parser ()  
  Returns 
  
  Methods
   
  equals(Object obj) 
  
    
public   boolean   equals ( Object   obj )  
  Parameter 
  
  Returns 
  
  Overrides 
  
  getDefaultInstanceForType() 
  
    
public   ServiceAccount   getDefaultInstanceForType ()  
  Returns 
  
  getDescription() 
  
    
public   String   getDescription ()  
   Optional. A user-specified, human-readable description of the service account. The
 maximum length is 256 UTF-8 bytes.
 string description = 8 [(.google.api.field_behavior) = OPTIONAL];
Returns 
  
    
      
        Type Description  
      
        String The description.
 
     
  
  getDescriptionBytes() 
  
    
public   ByteString   getDescriptionBytes ()  
   Optional. A user-specified, human-readable description of the service account. The
 maximum length is 256 UTF-8 bytes.
 string description = 8 [(.google.api.field_behavior) = OPTIONAL];
Returns 
  
    
      
        Type Description  
      
        ByteString The bytes for description.
 
     
  
  getDisabled() 
  
    
public   boolean   getDisabled ()  
   Output only. Whether the service account is disabled.
 bool disabled = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
    
      
        Type Description  
      
        boolean The disabled.
 
     
  
  getDisplayName() 
  
    
public   String   getDisplayName ()  
   Optional. A user-specified, human-readable name for the service account. The maximum
 length is 100 UTF-8 bytes.
 string display_name = 6 [(.google.api.field_behavior) = OPTIONAL];
Returns 
  
    
      
        Type Description  
      
        String The displayName.
 
     
  
  getDisplayNameBytes() 
  
    
public   ByteString   getDisplayNameBytes ()  
   Optional. A user-specified, human-readable name for the service account. The maximum
 length is 100 UTF-8 bytes.
 string display_name = 6 [(.google.api.field_behavior) = OPTIONAL];
Returns 
  
    
      
        Type Description  
      
        ByteString The bytes for displayName.
 
     
  
  getEmail() 
  
   Output only. The email address of the service account.
 string email = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
    
      
        Type Description  
      
        String The email.
 
     
  
  getEmailBytes() 
  
    
public   ByteString   getEmailBytes ()  
   Output only. The email address of the service account.
 string email = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
  getEtag() (deprecated) 
  
    
public   ByteString   getEtag ()  
  Deprecated.  
 Deprecated. Do not use.
 bytes etag = 7 [deprecated = true];
Returns 
  
  getName() 
  
   The resource name of the service account.
 Use one of the following formats:
projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}
As an alternative, you can use the - wildcard character instead of the
project ID:projects/-/serviceAccounts/{EMAIL_ADDRESS}projects/-/serviceAccounts/{UNIQUE_ID}
When possible, avoid using the - wildcard character, because it can cause
response messages to contain misleading error codes. For example, if you
try to get the service account
projects/-/serviceAccounts/fake@example.com, which does not exist, the
response contains an HTTP 403 Forbidden error instead of a 404 Not
Found error. 
 string name = 1;
Returns 
  
    
      
        Type Description  
      
        String The name.
 
     
  
  getNameBytes() 
  
    
public   ByteString   getNameBytes ()  
   The resource name of the service account.
 Use one of the following formats:
projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}
As an alternative, you can use the - wildcard character instead of the
project ID:projects/-/serviceAccounts/{EMAIL_ADDRESS}projects/-/serviceAccounts/{UNIQUE_ID}
When possible, avoid using the - wildcard character, because it can cause
response messages to contain misleading error codes. For example, if you
try to get the service account
projects/-/serviceAccounts/fake@example.com, which does not exist, the
response contains an HTTP 403 Forbidden error instead of a 404 Not
Found error. 
 string name = 1;
Returns 
  
  getOauth2ClientId() 
  
    
public   String   getOauth2ClientId ()  
   Output only. The OAuth 2.0 client ID for the service account.
 string oauth2_client_id = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
    
      
        Type Description  
      
        String The oauth2ClientId.
 
     
  
  getOauth2ClientIdBytes() 
  
    
public   ByteString   getOauth2ClientIdBytes ()  
   Output only. The OAuth 2.0 client ID for the service account.
 string oauth2_client_id = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
    
      
        Type Description  
      
        ByteString The bytes for oauth2ClientId.
 
     
  
  getParserForType() 
  
    
public   Parser<ServiceAccount>   getParserForType ()  
  Returns 
  
  Overrides 
  
  getProjectId() 
  
    
public   String   getProjectId ()  
   Output only. The ID of the project that owns the service account.
 string project_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
    
      
        Type Description  
      
        String The projectId.
 
     
  
  getProjectIdBytes() 
  
    
public   ByteString   getProjectIdBytes ()  
   Output only. The ID of the project that owns the service account.
 string project_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
    
      
        Type Description  
      
        ByteString The bytes for projectId.
 
     
  
  getSerializedSize() 
  
    
public   int   getSerializedSize ()  
  Returns 
  
  Overrides 
  
  getUniqueId() 
  
    
public   String   getUniqueId ()  
   Output only. The unique, stable numeric ID for the service account.
 Each service account retains its unique ID even if you delete the service
 account. For example, if you delete a service account, then create a new
 service account with the same name, the new service account has a different
 unique ID than the deleted service account.
 string unique_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
    
      
        Type Description  
      
        String The uniqueId.
 
     
  
  getUniqueIdBytes() 
  
    
public   ByteString   getUniqueIdBytes ()  
   Output only. The unique, stable numeric ID for the service account.
 Each service account retains its unique ID even if you delete the service
 account. For example, if you delete a service account, then create a new
 service account with the same name, the new service account has a different
 unique ID than the deleted service account.
 string unique_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
Returns 
  
    
      
        Type Description  
      
        ByteString The bytes for uniqueId.
 
     
  
  getUnknownFields() 
  
    
public   final   UnknownFieldSet   getUnknownFields ()  
  Returns 
  
  Overrides 
  
  hashCode() 
  
  Returns 
  
  Overrides 
  
  internalGetFieldAccessorTable() 
  
    
protected   GeneratedMessageV3 . FieldAccessorTable   internalGetFieldAccessorTable ()  
  Returns 
  
  Overrides 
  
  isInitialized() 
  
    
public   final   boolean   isInitialized ()  
  Returns 
  
  Overrides 
  
  newBuilderForType() 
  
    
public   ServiceAccount . Builder   newBuilderForType ()  
  Returns 
  
  newBuilderForType(GeneratedMessageV3.BuilderParent parent) 
  
    
protected   ServiceAccount . Builder   newBuilderForType ( GeneratedMessageV3 . BuilderParent   parent )  
  Parameter 
  
  Returns 
  
  Overrides 
  
  newInstance(GeneratedMessageV3.UnusedPrivateParameter unused) 
  
    
protected   Object   newInstance ( GeneratedMessageV3 . UnusedPrivateParameter   unused )  
  Parameter 
  
  Returns 
  
  Overrides 
  
  toBuilder() 
  
    
public   ServiceAccount . Builder   toBuilder ()  
  Returns 
  
  writeTo(CodedOutputStream output) 
  
    
public   void   writeTo ( CodedOutputStream   output )  
  Parameter 
  
  Overrides 
  
  Exceptions 
  
 
     
    
  
  
  
     
  
    
    
      
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-29 UTC.
 
 
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-29 UTC."],[],[]]