Class ParameterManagerTemplate

java.lang.Object
com.google.cloud.spring.parametermanager.ParameterManagerTemplate
All Implemented Interfaces:
ParameterManagerOperations

public class ParameterManagerTemplate extends Object implements ParameterManagerOperations
Offers convenience methods for performing common operations on Parameter Manager including creating and reading parameters.
  • Field Details

  • Constructor Details

  • Method Details

    • setAllowDefaultParameterValue

      public ParameterManagerTemplate setAllowDefaultParameterValue(boolean allowDefaultParameterValue)
    • getProjectId

      public String getProjectId()
    • createParameter

      public void createParameter(String locationId, String parameterId, String versionId, String payload)
      Description copied from interface: ParameterManagerOperations
      Creates a new parameter or a new version of existing parameter with the provided payload.

      If there is already a parameter saved in ParameterManager with the specified parameterId, then it simply creates a new version with given id under the parameter with the specified payload.

      Specified by:
      createParameter in interface ParameterManagerOperations
      Parameters:
      locationId - the parameter location string.
      parameterId - the parameter ID of the parameter to create.
      versionId - the version ID of the parameter version to create.
      payload - the parameter payload as a string.
    • createParameter

      public void createParameter(String projectId, String locationId, String parameterId, String versionId, String payload)
      Description copied from interface: ParameterManagerOperations
      Creates a new parameter or a new version of existing parameter with the provided payload.

      If there is already a parameter saved in ParameterManager with the specified parameterId, then it simply creates a new version with given id under the parameter with the specified payload.

      Specified by:
      createParameter in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the parameter location string.
      parameterId - the parameter ID of the parameter to create.
      versionId - the version ID of the parameter version to create.
      payload - the parameter payload as a string.
    • createParameter

      public void createParameter(String locationId, String parameterId, String versionId, String payload, com.google.cloud.parametermanager.v1.ParameterFormat format)
      Description copied from interface: ParameterManagerOperations
      Creates a new parameter or a new version of existing parameter with the provided payload in provided format.

      If there is already a parameter saved in ParameterManager with the specified parameterId, then it simply creates a new version with given id under the parameter with the specified payload.

      Specified by:
      createParameter in interface ParameterManagerOperations
      Parameters:
      locationId - the parameter location string.
      parameterId - the parameter ID of the parameter to create.
      versionId - the version ID of the parameter version to create.
      payload - the parameter payload as a string.
      format - the parameter format (JSON or YAML or UNFORMATTED).
    • createParameter

      public void createParameter(String projectId, String locationId, String parameterId, String versionId, String payload, com.google.cloud.parametermanager.v1.ParameterFormat format)
      Description copied from interface: ParameterManagerOperations
      Creates a new parameter or a new version of existing parameter with the provided payload.

      If there is already a parameter saved in ParameterManager with the specified parameterId, then it simply creates a new version with given id under the parameter with the specified payload.

      Specified by:
      createParameter in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the parameter location string.
      parameterId - the parameter ID of the parameter to create.
      versionId - the version ID of the parameter version to create.
      payload - the parameter payload as a string.
      format - the parameter format (JSON or YAML or UNFORMATTED).
    • createParameter

      public void createParameter(String locationId, String parameterId, String versionId, byte[] payload)
      Description copied from interface: ParameterManagerOperations
      Creates a new parameter or a new version of existing parameter with the provided payload.

      If there is already a parameter saved in ParameterManager with the specified parameterId, then it simply creates a new version with given id under the parameter with the specified payload.

      Specified by:
      createParameter in interface ParameterManagerOperations
      Parameters:
      locationId - the parameter location string.
      parameterId - the parameter ID of the parameter to create.
      versionId - the version ID of the parameter version to create.
      payload - the parameter payload as a byte array.
    • createParameter

      public void createParameter(String locationId, String parameterId, String versionId, byte[] payload, com.google.cloud.parametermanager.v1.ParameterFormat format)
      Description copied from interface: ParameterManagerOperations
      Creates a new parameter or a new version of existing parameter with the provided payload in given format.

      If there is already a parameter saved in ParameterManager with the specified parameterId, then it simply creates a new version with given id under the parameter with the specified payload.

      Specified by:
      createParameter in interface ParameterManagerOperations
      Parameters:
      locationId - the parameter location string.
      parameterId - the parameter ID of the parameter to create.
      versionId - the version ID of the parameter version to create.
      payload - the parameter payload as a byte array.
      format - the parameter format (JSON or YAML or UNFORMATTED).
    • createParameter

      public void createParameter(String projectId, String locationId, String parameterId, String versionId, byte[] payload, com.google.cloud.parametermanager.v1.ParameterFormat format)
      Description copied from interface: ParameterManagerOperations
      Creates a new parameter or a new version of existing parameter with the provided payload.

      If there is already a parameter saved in ParameterManager with the specified parameterId, then it simply creates a new version with given id under the parameter with the specified payload.

      Specified by:
      createParameter in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the parameter location string.
      parameterId - the parameter ID of the parameter to create.
      versionId - the version ID of the parameter version to create.
      payload - the parameter payload as a byte array.
      format - the parameter format (JSON or YAML or UNFORMATTED).
    • enableParameterVersion

      public void enableParameterVersion(String locationId, String parameterId, String versionId)
      Description copied from interface: ParameterManagerOperations
      Enables the specified parameter version under the default-configured project for specified locationId.
      Specified by:
      enableParameterVersion in interface ParameterManagerOperations
      Parameters:
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to enable.
      versionId - the version ID to be enabled.
    • enableParameterVersion

      public void enableParameterVersion(String projectId, String locationId, String parameterId, String versionId)
      Description copied from interface: ParameterManagerOperations
      Enables the specified parameter version under the specified projectId for specified locationId.
      Specified by:
      enableParameterVersion in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to enable.
      versionId - the version ID to be enabled.
    • disableParameterVersion

      public void disableParameterVersion(String locationId, String parameterId, String versionId)
      Description copied from interface: ParameterManagerOperations
      Disables the specified parameter version under the default-configured project for specified locationId.
      Specified by:
      disableParameterVersion in interface ParameterManagerOperations
      Parameters:
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to enable.
      versionId - the version ID to be enabled.
    • disableParameterVersion

      public void disableParameterVersion(String projectId, String locationId, String parameterId, String versionId)
      Description copied from interface: ParameterManagerOperations
      Disables the specified parameter version under the specified projectId for specified locationId.
      Specified by:
      disableParameterVersion in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to enable.
      versionId - the version ID to be enabled.
    • deleteParameter

      public void deleteParameter(String locationId, String parameterId)
      Description copied from interface: ParameterManagerOperations
      Deletes the specified parameterId under the default-configured project for specified locationId.
      Specified by:
      deleteParameter in interface ParameterManagerOperations
      Parameters:
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to delete.
    • deleteParameter

      public void deleteParameter(String projectId, String locationId, String parameterId)
      Description copied from interface: ParameterManagerOperations
      Deletes the specified parameterID under the specified projectId for specified locationId.
      Specified by:
      deleteParameter in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to delete.
    • deleteParameterVersion

      public void deleteParameterVersion(String locationId, String parameterId, String versionId)
      Description copied from interface: ParameterManagerOperations
      Deletes the specified parameter version under the default-configured project for specified locationId.
      Specified by:
      deleteParameterVersion in interface ParameterManagerOperations
      Parameters:
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to delete.
      versionId - the version ID to be deleted.
    • deleteParameterVersion

      public void deleteParameterVersion(String projectId, String locationId, String parameterId, String versionId)
      Description copied from interface: ParameterManagerOperations
      Deletes the specified parameter version under the specified projectId for specified locationId.
      Specified by:
      deleteParameterVersion in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to delete.
      versionId - the version ID to be deleted.
    • parameterExists

      public boolean parameterExists(String locationId, String parameterId)
      Description copied from interface: ParameterManagerOperations
      Checks if the specified parameterID exists in the default-configured project for specified locationId.
      Specified by:
      parameterExists in interface ParameterManagerOperations
      Parameters:
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to check.
      Returns:
      true if the parameter exists in Parameter Manager; false otherwise
    • parameterExists

      public boolean parameterExists(String projectId, String locationId, String parameterId)
      Description copied from interface: ParameterManagerOperations
      Checks if the specified parameterID exists in the specified project for specified locationId.
      Specified by:
      parameterExists in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the location string where given parameter is present.
      parameterId - the parameter ID of the parameter to check.
      Returns:
      true if the parameter exists in Parameter Manager; false otherwise
    • parameterVersionExists

      public boolean parameterVersionExists(String locationId, String parameterId, String versionId)
      Description copied from interface: ParameterManagerOperations
      Checks if the specified parameter version exists in the default-configured project for the specified locationId.
      Specified by:
      parameterVersionExists in interface ParameterManagerOperations
      Parameters:
      locationId - the location string where the given parameter version is present.
      parameterId - the parameter ID of the parameter to check.
      versionId - the version ID of the parameter version to check.
      Returns:
      true if the parameter version exists in Parameter Manager; false otherwise
    • parameterVersionExists

      public boolean parameterVersionExists(String projectId, String locationId, String parameterId, String versionId)
      Description copied from interface: ParameterManagerOperations
      Checks if the specified parameter version exists in the specified project for the specified locationId.
      Specified by:
      parameterVersionExists in interface ParameterManagerOperations
      Parameters:
      projectId - unique identifier of your GCP project.
      locationId - the location string where the given parameter version is present.
      parameterId - the parameter ID of the parameter to check.
      versionId - the version ID of the parameter version to check.
      Returns:
      true if the parameter version exists in Parameter Manager; false otherwise
    • getParameterString

      @Nullable public String getParameterString(String parameterIdentifier)
      Description copied from interface: ParameterManagerOperations
      Gets the parameter data as a string from the specified parameterIdentifier.

      The parameterIdentifier must be a fully qualified `pm@` protocol string which specifies the parameter (see javadocs of ParameterManagerOperations for the protocol format).

      If the parameter ID string is passed in, then this will return the data of the parameter for the default project at the latest version.

      Specified by:
      getParameterString in interface ParameterManagerOperations
      Parameters:
      parameterIdentifier - a pm@ formatted string specifying the parameter version.
      Returns:
      The parameter data as a string
    • getParameterBytes

      @Nullable public byte[] getParameterBytes(String parameterIdentifier)
      Description copied from interface: ParameterManagerOperations
      Gets the parameter data as a byte array from the specified parameterIdentifier.

      The parameterIdentifier must be a fully qualified `pm@` protocol string which specifies the parameter (see javadocs of ParameterManagerOperations for the protocol format).

      If the parameter ID string is passed in, then this will return the data of the parameter for the default project at the latest version.

      Specified by:
      getParameterBytes in interface ParameterManagerOperations
      Parameters:
      parameterIdentifier - a pm@ formatted string specifying the parameter version.
      Returns:
      The parameter data as a byte array
    • renderedParameterVersionString

      @Nullable public String renderedParameterVersionString(String parameterIdentifier)
      Description copied from interface: ParameterManagerOperations
      Gets the rendered parameter data as a string from the specified parameterIdentifier.

      The parameterIdentifier must be a fully qualified `pm@` protocol string which specifies the parameter (see javadocs of ParameterManagerOperations for the protocol format).

      If the parameter ID string is passed in, then this will return the rendered data of the parameter for the default project at the latest version.

      Specified by:
      renderedParameterVersionString in interface ParameterManagerOperations
      Parameters:
      parameterIdentifier - a pm@ formatted string specifying the parameter version.
      Returns:
      The rendered parameter data as a string
    • renderedParameterVersionBytes

      @Nullable public byte[] renderedParameterVersionBytes(String parameterIdentifier)
      Description copied from interface: ParameterManagerOperations
      Gets the rendered parameter data as a byte array from the specified parameterIdentifier.

      The parameterIdentifier must be a fully qualified `pm@` protocol string which specifies the parameter (see javadocs of ParameterManagerOperations for the protocol format).

      If the parameter ID string is passed in, then this will return the rendered data of the parameter for the default project at the latest version.

      Specified by:
      renderedParameterVersionBytes in interface ParameterManagerOperations
      Parameters:
      parameterIdentifier - a pm@ formatted string specifying the parameter version.
      Returns:
      The rendered parameter data as a byte array