Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swagger pilot codes #418

Merged

Conversation

jihoon-seo
Copy link
Member

이 PR 은 Swagger pilot codes 를 담고 있습니다.
코드 리뷰 및 라이브 데모를 확인해 보시고, 의견을 주시고,
이 PR이 merge 되면 추후 Swagger 코드를 더 추가하면 되겠습니다.

CC: @seokho-son

  • REST API 서버 관련 코드가 들어 있는
    api-runtime/rest-runtime/ 디렉토리에 대해
    Swagger docs 를 만들어 주는 프로그램인 swag 를 실행시켜
    api-runtime/rest-runtime/docs/ 디렉토리에 Swagger docs 생성
    (필요 시 output dir 변경 가능)
    • Makefileswag 관련 target 추가 (swag 설치 필요)
  • Swagger page 제공하는 REST API 추가
  • CB-Spider 실행 시, Swagger page 접속 URL 제공
  <CB-Spider> Multi-Cloud Infrastructure Federation Framework
     - AdminWeb: http://129.254.75.178:1024/spider/adminweb
     - REST API: http://129.254.75.178:1024/spider
     - Swagger : http://129.254.75.178:1024/spider/swagger/index.html
     - Go   API: grpc://129.254.75.178:2048
  • Pilot code: createKey 함수에 대해 Swagger Go annotations 작성
    image

[TODO]

  • Swagger page 에 표시될 정보 추가
    (참고: Tumblebug)
    image

  • Swagger REST API dashboard 추가
    (참고: Tumblebug)
    image

  • Spider Swagger REST API 페이지 추가
    (참고: Tumblebug)

  • ...

@jihoon-seo jihoon-seo requested a review from powerkimhub June 17, 2021 06:01
@powerkimhub
Copy link
Member

@jihoon-seo

  • 캄사합니다.
  • build 시 문의 드립니다.
  • 아래와 같이 failed 관련 warning은 지금은 무시해도 되는건지요?
make swag
        [CB-Spider] build Swagger docs
2021/06/17 06:46:49 Generate swagger docs....
2021/06/17 06:46:49 Generate general API Info, search dir:./
2021/06/17 06:46:49 warning: failed to get package name in dir: ./, error: execute go list command, exit status 1, stdout:, stderr:no Go files in /tmp/swagger-test/cb-spider
2021/06/17 06:46:49 Generating restruntime.keyPairCreateReq
2021/06/17 06:46:49 Generating resources.KeyPairInfo
2021/06/17 06:46:49 Generating resources.IID
2021/06/17 06:46:49 Generating resources.KeyValue
2021/06/17 06:46:49 Generating restruntime.SimpleMsg
2021/06/17 06:46:49 create docs.go at api-runtime/rest-runtime/docs/docs.go
2021/06/17 06:46:49 create swagger.json at api-runtime/rest-runtime/docs/swagger.json
2021/06/17 06:46:49 create swagger.yaml at api-runtime/rest-runtime/docs/swagger.yaml

@jihoon-seo jihoon-seo force-pushed the 210617_Add_Swagger_pilot_codes branch from 8137308 to a04c4d7 Compare June 17, 2021 06:59
@jihoon-seo
Copy link
Member Author

jihoon-seo commented Jun 17, 2021

@powerkimhub 님과 협의한 대로, Swagger codes 가 어느 정도 완성될 때 까지는 Banner 에 표시하지 않는 것으로 하여, 주석 처리 하였습니다.

@powerkimhub
Copy link
Member

by @jihoon-seo

  • 다음 메시지의 이유는
2021/06/17 06:46:49 warning: failed to get package name in dir: ./, error: execute go list command, exit status 1, stdout:, stderr:no Go files in /tmp/swagger-test/cb-spider

  • 다음 명령 실행 위치에 *.go 파일이 없는 경우 출력 될수 있으며, 동작에는 문제가 없어 보임
    @~/go/bin/swag i -g api-runtime/rest-runtime/CBSpiderRuntime.go -o api-runtime/rest-runtime/docs
    

@powerkimhub powerkimhub merged commit 74031d7 into cloud-barista:master Jun 17, 2021
@jihoon-seo jihoon-seo deleted the 210617_Add_Swagger_pilot_codes branch June 17, 2021 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants