Access GCP Bucket-Java automation

As the projects are moving towards cloud, more often during automation we have to deal with accessing cloud platform and perform various actions like
- Verifying data
- Download files
- Check File exists
Here is the implementation steps for accessing GCP cloud storage and let see how to implement it.
Configure GCP in Maven Project
- Create a maven project
Add Maven dependency for GCP
<!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.117.0</version>
</dependency>
Generate Service Account Key : Json
Navigate to GCP cloud URL
- IAM&Admin → Service Accounts → Generate Json Key

Follow GCP documentation for more detailed steps.
Java Implementation
Here is the code for accessing cloud storage using ‘com.google.cloud.storage’ library using an ‘Singleton design pattern’.
IGCPConnection Interface:
GCPConnection Class