Class ServiceAccountKey.Builder

  • All Implemented Interfaces:
    ServiceAccountKeyOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
    Enclosing class:
    ServiceAccountKey

    public static final class ServiceAccountKey.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
    implements ServiceAccountKeyOrBuilder
     Represents a service account key.
    
     A service account has two sets of key-pairs: user-managed, and
     system-managed.
    
     User-managed key-pairs can be created and deleted by users.  Users are
     responsible for rotating these keys periodically to ensure security of
     their service accounts.  Users retain the private key of these key-pairs,
     and Google retains ONLY the public key.
    
     System-managed keys are automatically rotated by Google, and are used for
     signing for a maximum of two weeks. The rotation process is probabilistic,
     and usage of the new key will gradually ramp up and down over the key's
     lifetime.
    
     If you cache the public key set for a service account, we recommend that you
     update the cache every 15 minutes. User-managed keys can be added and removed
     at any time, so it is important to update the cache frequently. For
     Google-managed keys, Google will publish a key at least 6 hours before it is
     first used for signing and will keep publishing it for at least 6 hours after
     it was last used for signing.
    
     Public keys for all service accounts are also published at the OAuth2
     Service Account API.
     
    Protobuf type google.iam.admin.v1.ServiceAccountKey
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • clear

        public ServiceAccountKey.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • getDefaultInstanceForType

        public ServiceAccountKey getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public ServiceAccountKey build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public ServiceAccountKey buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public ServiceAccountKey.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • setField

        public ServiceAccountKey.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                  Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • clearField

        public ServiceAccountKey.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • clearOneof

        public ServiceAccountKey.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • setRepeatedField

        public ServiceAccountKey.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                          int index,
                                                          Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • addRepeatedField

        public ServiceAccountKey.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                          Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • mergeFrom

        public ServiceAccountKey.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<ServiceAccountKey.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • mergeFrom

        public ServiceAccountKey.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                                   com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                            throws IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<ServiceAccountKey.Builder>
        Throws:
        IOException
      • getName

        public String getName()
         The resource name of the service account key in the following format
         `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
         
        string name = 1;
        Specified by:
        getName in interface ServiceAccountKeyOrBuilder
        Returns:
        The name.
      • getNameBytes

        public com.google.protobuf.ByteString getNameBytes()
         The resource name of the service account key in the following format
         `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
         
        string name = 1;
        Specified by:
        getNameBytes in interface ServiceAccountKeyOrBuilder
        Returns:
        The bytes for name.
      • setName

        public ServiceAccountKey.Builder setName​(String value)
         The resource name of the service account key in the following format
         `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
         
        string name = 1;
        Parameters:
        value - The name to set.
        Returns:
        This builder for chaining.
      • clearName

        public ServiceAccountKey.Builder clearName()
         The resource name of the service account key in the following format
         `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
         
        string name = 1;
        Returns:
        This builder for chaining.
      • setNameBytes

        public ServiceAccountKey.Builder setNameBytes​(com.google.protobuf.ByteString value)
         The resource name of the service account key in the following format
         `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
         
        string name = 1;
        Parameters:
        value - The bytes for name to set.
        Returns:
        This builder for chaining.
      • getPrivateKeyTypeValue

        public int getPrivateKeyTypeValue()
         The output format for the private key.
         Only provided in `CreateServiceAccountKey` responses, not
         in `GetServiceAccountKey` or `ListServiceAccountKey` responses.
        
         Google never exposes system-managed private keys, and never retains
         user-managed private keys.
         
        .google.iam.admin.v1.ServiceAccountPrivateKeyType private_key_type = 2;
        Specified by:
        getPrivateKeyTypeValue in interface ServiceAccountKeyOrBuilder
        Returns:
        The enum numeric value on the wire for privateKeyType.
      • setPrivateKeyTypeValue

        public ServiceAccountKey.Builder setPrivateKeyTypeValue​(int value)
         The output format for the private key.
         Only provided in `CreateServiceAccountKey` responses, not
         in `GetServiceAccountKey` or `ListServiceAccountKey` responses.
        
         Google never exposes system-managed private keys, and never retains
         user-managed private keys.
         
        .google.iam.admin.v1.ServiceAccountPrivateKeyType private_key_type = 2;
        Parameters:
        value - The enum numeric value on the wire for privateKeyType to set.
        Returns:
        This builder for chaining.
      • getPrivateKeyType

        public ServiceAccountPrivateKeyType getPrivateKeyType()
         The output format for the private key.
         Only provided in `CreateServiceAccountKey` responses, not
         in `GetServiceAccountKey` or `ListServiceAccountKey` responses.
        
         Google never exposes system-managed private keys, and never retains
         user-managed private keys.
         
        .google.iam.admin.v1.ServiceAccountPrivateKeyType private_key_type = 2;
        Specified by:
        getPrivateKeyType in interface ServiceAccountKeyOrBuilder
        Returns:
        The privateKeyType.
      • setPrivateKeyType

        public ServiceAccountKey.Builder setPrivateKeyType​(ServiceAccountPrivateKeyType value)
         The output format for the private key.
         Only provided in `CreateServiceAccountKey` responses, not
         in `GetServiceAccountKey` or `ListServiceAccountKey` responses.
        
         Google never exposes system-managed private keys, and never retains
         user-managed private keys.
         
        .google.iam.admin.v1.ServiceAccountPrivateKeyType private_key_type = 2;
        Parameters:
        value - The privateKeyType to set.
        Returns:
        This builder for chaining.
      • clearPrivateKeyType

        public ServiceAccountKey.Builder clearPrivateKeyType()
         The output format for the private key.
         Only provided in `CreateServiceAccountKey` responses, not
         in `GetServiceAccountKey` or `ListServiceAccountKey` responses.
        
         Google never exposes system-managed private keys, and never retains
         user-managed private keys.
         
        .google.iam.admin.v1.ServiceAccountPrivateKeyType private_key_type = 2;
        Returns:
        This builder for chaining.
      • getKeyAlgorithmValue

        public int getKeyAlgorithmValue()
         Specifies the algorithm (and possibly key size) for the key.
         
        .google.iam.admin.v1.ServiceAccountKeyAlgorithm key_algorithm = 8;
        Specified by:
        getKeyAlgorithmValue in interface ServiceAccountKeyOrBuilder
        Returns:
        The enum numeric value on the wire for keyAlgorithm.
      • setKeyAlgorithmValue

        public ServiceAccountKey.Builder setKeyAlgorithmValue​(int value)
         Specifies the algorithm (and possibly key size) for the key.
         
        .google.iam.admin.v1.ServiceAccountKeyAlgorithm key_algorithm = 8;
        Parameters:
        value - The enum numeric value on the wire for keyAlgorithm to set.
        Returns:
        This builder for chaining.
      • setKeyAlgorithm

        public ServiceAccountKey.Builder setKeyAlgorithm​(ServiceAccountKeyAlgorithm value)
         Specifies the algorithm (and possibly key size) for the key.
         
        .google.iam.admin.v1.ServiceAccountKeyAlgorithm key_algorithm = 8;
        Parameters:
        value - The keyAlgorithm to set.
        Returns:
        This builder for chaining.
      • clearKeyAlgorithm

        public ServiceAccountKey.Builder clearKeyAlgorithm()
         Specifies the algorithm (and possibly key size) for the key.
         
        .google.iam.admin.v1.ServiceAccountKeyAlgorithm key_algorithm = 8;
        Returns:
        This builder for chaining.
      • getPrivateKeyData

        public com.google.protobuf.ByteString getPrivateKeyData()
         The private key data. Only provided in `CreateServiceAccountKey`
         responses. Make sure to keep the private key data secure because it
         allows for the assertion of the service account identity.
         When base64 decoded, the private key data can be used to authenticate with
         Google API client libraries and with
         <a href="/sdk/gcloud/reference/auth/activate-service-account">gcloud
         auth activate-service-account</a>.
         
        bytes private_key_data = 3;
        Specified by:
        getPrivateKeyData in interface ServiceAccountKeyOrBuilder
        Returns:
        The privateKeyData.
      • setPrivateKeyData

        public ServiceAccountKey.Builder setPrivateKeyData​(com.google.protobuf.ByteString value)
         The private key data. Only provided in `CreateServiceAccountKey`
         responses. Make sure to keep the private key data secure because it
         allows for the assertion of the service account identity.
         When base64 decoded, the private key data can be used to authenticate with
         Google API client libraries and with
         <a href="/sdk/gcloud/reference/auth/activate-service-account">gcloud
         auth activate-service-account</a>.
         
        bytes private_key_data = 3;
        Parameters:
        value - The privateKeyData to set.
        Returns:
        This builder for chaining.
      • clearPrivateKeyData

        public ServiceAccountKey.Builder clearPrivateKeyData()
         The private key data. Only provided in `CreateServiceAccountKey`
         responses. Make sure to keep the private key data secure because it
         allows for the assertion of the service account identity.
         When base64 decoded, the private key data can be used to authenticate with
         Google API client libraries and with
         <a href="/sdk/gcloud/reference/auth/activate-service-account">gcloud
         auth activate-service-account</a>.
         
        bytes private_key_data = 3;
        Returns:
        This builder for chaining.
      • getPublicKeyData

        public com.google.protobuf.ByteString getPublicKeyData()
         The public key data. Only provided in `GetServiceAccountKey` responses.
         
        bytes public_key_data = 7;
        Specified by:
        getPublicKeyData in interface ServiceAccountKeyOrBuilder
        Returns:
        The publicKeyData.
      • setPublicKeyData

        public ServiceAccountKey.Builder setPublicKeyData​(com.google.protobuf.ByteString value)
         The public key data. Only provided in `GetServiceAccountKey` responses.
         
        bytes public_key_data = 7;
        Parameters:
        value - The publicKeyData to set.
        Returns:
        This builder for chaining.
      • clearPublicKeyData

        public ServiceAccountKey.Builder clearPublicKeyData()
         The public key data. Only provided in `GetServiceAccountKey` responses.
         
        bytes public_key_data = 7;
        Returns:
        This builder for chaining.
      • hasValidAfterTime

        public boolean hasValidAfterTime()
         The key can be used after this timestamp.
         
        .google.protobuf.Timestamp valid_after_time = 4;
        Specified by:
        hasValidAfterTime in interface ServiceAccountKeyOrBuilder
        Returns:
        Whether the validAfterTime field is set.
      • getValidAfterTime

        public com.google.protobuf.Timestamp getValidAfterTime()
         The key can be used after this timestamp.
         
        .google.protobuf.Timestamp valid_after_time = 4;
        Specified by:
        getValidAfterTime in interface ServiceAccountKeyOrBuilder
        Returns:
        The validAfterTime.
      • setValidAfterTime

        public ServiceAccountKey.Builder setValidAfterTime​(com.google.protobuf.Timestamp value)
         The key can be used after this timestamp.
         
        .google.protobuf.Timestamp valid_after_time = 4;
      • setValidAfterTime

        public ServiceAccountKey.Builder setValidAfterTime​(com.google.protobuf.Timestamp.Builder builderForValue)
         The key can be used after this timestamp.
         
        .google.protobuf.Timestamp valid_after_time = 4;
      • mergeValidAfterTime

        public ServiceAccountKey.Builder mergeValidAfterTime​(com.google.protobuf.Timestamp value)
         The key can be used after this timestamp.
         
        .google.protobuf.Timestamp valid_after_time = 4;
      • clearValidAfterTime

        public ServiceAccountKey.Builder clearValidAfterTime()
         The key can be used after this timestamp.
         
        .google.protobuf.Timestamp valid_after_time = 4;
      • getValidAfterTimeBuilder

        public com.google.protobuf.Timestamp.Builder getValidAfterTimeBuilder()
         The key can be used after this timestamp.
         
        .google.protobuf.Timestamp valid_after_time = 4;
      • getValidAfterTimeOrBuilder

        public com.google.protobuf.TimestampOrBuilder getValidAfterTimeOrBuilder()
         The key can be used after this timestamp.
         
        .google.protobuf.Timestamp valid_after_time = 4;
        Specified by:
        getValidAfterTimeOrBuilder in interface ServiceAccountKeyOrBuilder
      • hasValidBeforeTime

        public boolean hasValidBeforeTime()
         The key can be used before this timestamp.
         For system-managed key pairs, this timestamp is the end time for the
         private key signing operation. The public key could still be used
         for verification for a few hours after this time.
         
        .google.protobuf.Timestamp valid_before_time = 5;
        Specified by:
        hasValidBeforeTime in interface ServiceAccountKeyOrBuilder
        Returns:
        Whether the validBeforeTime field is set.
      • getValidBeforeTime

        public com.google.protobuf.Timestamp getValidBeforeTime()
         The key can be used before this timestamp.
         For system-managed key pairs, this timestamp is the end time for the
         private key signing operation. The public key could still be used
         for verification for a few hours after this time.
         
        .google.protobuf.Timestamp valid_before_time = 5;
        Specified by:
        getValidBeforeTime in interface ServiceAccountKeyOrBuilder
        Returns:
        The validBeforeTime.
      • setValidBeforeTime

        public ServiceAccountKey.Builder setValidBeforeTime​(com.google.protobuf.Timestamp value)
         The key can be used before this timestamp.
         For system-managed key pairs, this timestamp is the end time for the
         private key signing operation. The public key could still be used
         for verification for a few hours after this time.
         
        .google.protobuf.Timestamp valid_before_time = 5;
      • setValidBeforeTime

        public ServiceAccountKey.Builder setValidBeforeTime​(com.google.protobuf.Timestamp.Builder builderForValue)
         The key can be used before this timestamp.
         For system-managed key pairs, this timestamp is the end time for the
         private key signing operation. The public key could still be used
         for verification for a few hours after this time.
         
        .google.protobuf.Timestamp valid_before_time = 5;
      • mergeValidBeforeTime

        public ServiceAccountKey.Builder mergeValidBeforeTime​(com.google.protobuf.Timestamp value)
         The key can be used before this timestamp.
         For system-managed key pairs, this timestamp is the end time for the
         private key signing operation. The public key could still be used
         for verification for a few hours after this time.
         
        .google.protobuf.Timestamp valid_before_time = 5;
      • clearValidBeforeTime

        public ServiceAccountKey.Builder clearValidBeforeTime()
         The key can be used before this timestamp.
         For system-managed key pairs, this timestamp is the end time for the
         private key signing operation. The public key could still be used
         for verification for a few hours after this time.
         
        .google.protobuf.Timestamp valid_before_time = 5;
      • getValidBeforeTimeBuilder

        public com.google.protobuf.Timestamp.Builder getValidBeforeTimeBuilder()
         The key can be used before this timestamp.
         For system-managed key pairs, this timestamp is the end time for the
         private key signing operation. The public key could still be used
         for verification for a few hours after this time.
         
        .google.protobuf.Timestamp valid_before_time = 5;
      • getValidBeforeTimeOrBuilder

        public com.google.protobuf.TimestampOrBuilder getValidBeforeTimeOrBuilder()
         The key can be used before this timestamp.
         For system-managed key pairs, this timestamp is the end time for the
         private key signing operation. The public key could still be used
         for verification for a few hours after this time.
         
        .google.protobuf.Timestamp valid_before_time = 5;
        Specified by:
        getValidBeforeTimeOrBuilder in interface ServiceAccountKeyOrBuilder
      • getKeyOriginValue

        public int getKeyOriginValue()
         The key origin.
         
        .google.iam.admin.v1.ServiceAccountKeyOrigin key_origin = 9;
        Specified by:
        getKeyOriginValue in interface ServiceAccountKeyOrBuilder
        Returns:
        The enum numeric value on the wire for keyOrigin.
      • setKeyOriginValue

        public ServiceAccountKey.Builder setKeyOriginValue​(int value)
         The key origin.
         
        .google.iam.admin.v1.ServiceAccountKeyOrigin key_origin = 9;
        Parameters:
        value - The enum numeric value on the wire for keyOrigin to set.
        Returns:
        This builder for chaining.
      • setKeyOrigin

        public ServiceAccountKey.Builder setKeyOrigin​(ServiceAccountKeyOrigin value)
         The key origin.
         
        .google.iam.admin.v1.ServiceAccountKeyOrigin key_origin = 9;
        Parameters:
        value - The keyOrigin to set.
        Returns:
        This builder for chaining.
      • clearKeyOrigin

        public ServiceAccountKey.Builder clearKeyOrigin()
         The key origin.
         
        .google.iam.admin.v1.ServiceAccountKeyOrigin key_origin = 9;
        Returns:
        This builder for chaining.
      • getKeyTypeValue

        public int getKeyTypeValue()
         The key type.
         
        .google.iam.admin.v1.ListServiceAccountKeysRequest.KeyType key_type = 10;
        Specified by:
        getKeyTypeValue in interface ServiceAccountKeyOrBuilder
        Returns:
        The enum numeric value on the wire for keyType.
      • setKeyTypeValue

        public ServiceAccountKey.Builder setKeyTypeValue​(int value)
         The key type.
         
        .google.iam.admin.v1.ListServiceAccountKeysRequest.KeyType key_type = 10;
        Parameters:
        value - The enum numeric value on the wire for keyType to set.
        Returns:
        This builder for chaining.
      • clearKeyType

        public ServiceAccountKey.Builder clearKeyType()
         The key type.
         
        .google.iam.admin.v1.ListServiceAccountKeysRequest.KeyType key_type = 10;
        Returns:
        This builder for chaining.
      • setDisabled

        public ServiceAccountKey.Builder setDisabled​(boolean value)
         The key status.
         
        bool disabled = 11;
        Parameters:
        value - The disabled to set.
        Returns:
        This builder for chaining.
      • clearDisabled

        public ServiceAccountKey.Builder clearDisabled()
         The key status.
         
        bool disabled = 11;
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final ServiceAccountKey.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>
      • mergeUnknownFields

        public final ServiceAccountKey.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<ServiceAccountKey.Builder>