알쓸전컴(알아두면 쓸모있는 전자 컴퓨터)

google Could Platfrom GCP API java (1) 인증 본문

Google Cloud Platform (GCP)

google Could Platfrom GCP API java (1) 인증

백곳 2019. 2. 20. 17:12

Google Could Platfrom API java (1) 인증


GCP 에 API 를 사용하기 위해서 일단 인증 방법 및 셋업 방법을 메뉴얼에 찾보았다.


https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-java


일단 메뉴얼 문서의 시작은 위의 사이트 이다.


먼저


maven

<dependency>
 
<groupId>com.google.cloud</groupId>
 
<artifactId>google-cloud-storage</artifactId>
 
<version>1.49.0</version>
</dependency>

Gradle

compile 'com.google.cloud:google-cloud-storage:1.49.0'


가 라이브 러리 설치 파일이다.


참고로 Android 에서는 해당 라이브러리 사용 못합니다. 

Android는 RESTAPI로 해야 될것 같습니다.


그리고 나서 인증키를 받아야 하는데




사이트에 가보면 위와 같이 Key를 받는 페이지에 들어가서


키를 받으시면 됩니다.

그리고 리눅스나 MACOS 는



위와 같이 환경 패스를 다운 받은 파일로 경로를 설정해줘야 합니다.,



윈도우는 파워셀이나 CMD 를 이용하면 되네요 ..



저 경로에서 인증키를 가져오기 때문에 프로그램에서는 복잡한 인증 코드 구현 없이


    Storage storage = StorageOptions.getDefaultInstance().getService();

이거로 인증 끝입니다.




'Google Cloud Platform (GCP)' 카테고리의 다른 글

Google Storage - Google Cloud CDN 설정하기  (0) 2019.02.21
Comments