diff --git a/.github/renovate.json5 b/.github/renovate.json5 index c9123c1..a9aa0ee 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -11,8 +11,8 @@ "groupName": "all minor, patch, or digest dependencies on Go", }, { - "matchManagers": ["dockerfile"], - "groupName": "all dependencies on Dockerfile", + "matchManagers": ["dockerfile", "docker-compose"], + "groupName": "all dependencies on Docker", }, { "matchManagers": ["github-actions"], @@ -22,6 +22,7 @@ "enabledManagers": [ "gomod", "dockerfile", + "docker-compose", "github-actions", ], } diff --git a/cmd/cndctl/cmd/scene.go b/cmd/cndctl/cmd/scene.go index 993a9f6..16abef2 100644 --- a/cmd/cndctl/cmd/scene.go +++ b/cmd/cndctl/cmd/scene.go @@ -8,7 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/spf13/cobra" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/obsws" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/obsws" pb "github.com/cloudnativedaysjp/cnd-operation-server/pkg/ws-proxy/schema" ) diff --git a/cmd/cndctl/cmd/track.go b/cmd/cndctl/cmd/track.go index 14b5a5b..086be9e 100644 --- a/cmd/cndctl/cmd/track.go +++ b/cmd/cndctl/cmd/track.go @@ -39,7 +39,7 @@ var trackListCmd = &cobra.Command{ // // Print // - for _, track := range resp.Track { + for _, track := range resp.Tracks { fmt.Printf("%s (trackId: %d)\n", track.ObsHost, track.TrackId) } }, diff --git a/cmd/server/Dockerfile b/cmd/server/Dockerfile index 6bb7e8b..6c0e1da 100644 --- a/cmd/server/Dockerfile +++ b/cmd/server/Dockerfile @@ -12,4 +12,4 @@ FROM gcr.io/distroless/static-debian11:nonroot WORKDIR / COPY --from=builder /workspace/server . -ENTRYPOINT ["/cndctl"] +ENTRYPOINT ["/server"] diff --git a/cmd/server/config/config.go b/cmd/server/config/config.go index 9878a4c..60860ee 100644 --- a/cmd/server/config/config.go +++ b/cmd/server/config/config.go @@ -35,11 +35,12 @@ func LoadConf(filename string) (*Config, error) { } type Config struct { - Debug DebugConfig `json:"debug"` - WsProxyBindAddr string `json:"bindAddr" default:":20080"` - Dreamkast DreamkastConfig `json:"dreamkast" validate:"required"` - Redis RedisConfig `json:"redis " validate:"required"` - Tracks []TrackConfig `json:"tracks" validate:"required"` + Debug DebugConfig `json:"debug"` + WsProxy WsProxyConfig `json:"wsProxy" validate:"required"` + Metrics MetricsConfig `json:"metrics"` + Dreamkast DreamkastConfig `json:"dreamkast" validate:"required"` + Redis RedisConfig `json:"redis " validate:"required"` + Tracks []TrackConfig `json:"tracks" validate:"required"` } type DebugConfig struct { @@ -51,6 +52,14 @@ type DebugConfig struct { DisableWsProxy bool `json:"disableWsProxy"` } +type MetricsConfig struct { + BindAddr string `json:"bindAddr" default:":20081"` +} + +type WsProxyConfig struct { + BindAddr string `json:"bindAddr" default:":20080"` +} + type DreamkastConfig struct { EventAbbr string `json:"eventAbbr" validate:"required"` EndpointUrl string `json:"endpointUrl" validate:"required"` diff --git a/cmd/server/example.yaml b/cmd/server/example.yaml deleted file mode 100644 index 24a83d0..0000000 --- a/cmd/server/example.yaml +++ /dev/null @@ -1,28 +0,0 @@ -bindAddr: :20080 -dreamkast: - eventAbbr: cnsec2022 - endpointUrl: https://event.cloudnativedays.jp/api/ - auth0Domain: ${AUTH0_DOMAIN} - auth0ClientId: ${AUTH0_CLIENT_ID} - auth0ClientSecret: ${AUTH0_CLIENT_SECRET} -resids: - host: https://xxx.jp:6379 // TODO:reis作成後に設定する -tracks: - - dkTrackId: 29 - obs: - host: ${SWITCHER01_HOST} - password: ${SWITCHER01_PASSWORD} - slack: - webhookUrl: "" - #- dkTrackId: 30 - # obs: - # host: ${SWITCHER02_HOST} - # password: ${SWITCHER02_PASSWORD} - # slack: - # webhookUrl: ${WEBHOOK_URL} - #- dkTrackId: 31 - # obs: - # host: ${SWITCHER03_HOST} - # password: ${SWITCHER03_PASSWORD} - # slack: - # webhookUrl: ${WEBHOOK_URL} diff --git a/cmd/server/main.go b/cmd/server/main.go index 34be06c..eb2c667 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -11,6 +11,7 @@ import ( "github.com/cloudnativedaysjp/cnd-operation-server/cmd/server/config" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/dkwatcher" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/metrics" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/notifier" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/obswatcher" @@ -33,7 +34,12 @@ func main() { ctx, cancel := context.WithCancel(context.Background()) eg, ctx := errgroup.WithContext(ctx) - talkStream := make(chan model.Talk, 16) + talkStream := make(chan model.CurrentAndNextTalk, 16) + + // metrics + go func() { + _ = metrics.RunCndOperationServer(conf.Metrics.BindAddr) + }() // obswatcher if !conf.Debug.DisableObsWatcher { @@ -104,7 +110,7 @@ func main() { return server.Run(ctx, server.Config{ Development: conf.Debug.Development, Debug: conf.Debug.Debug, - BindAddr: conf.WsProxyBindAddr, + BindAddr: conf.WsProxy.BindAddr, Obs: configObs, }) }) diff --git a/development/.gitignore b/development/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/development/.gitignore @@ -0,0 +1 @@ +.env diff --git a/development/README.md b/development/README.md new file mode 100644 index 0000000..3c72575 --- /dev/null +++ b/development/README.md @@ -0,0 +1,36 @@ +development +=== + +## 事前準備 + +手元で Websocket を有効化した OBS を立ち上げ、検証用にシーン・ソースを用意します。 + +### Download + +* [Download OBS](https://obsproject.com/ja/download) +* [Download obs-websocket](https://github.com/obsproject/obs-websocket/releases/) + +### 検証用シーン・ソースの準備 + +TBW + +## 検証環境の起動 + +Docker Compose を用い、cnd-operation-server, seaman (SlackBot), dk-mock-server (Dreamkast API の Mock Server) を立ち上げます。 + +* `.env` ファイルの作成 + +``` +SLACK_BOT_TOKEN=... +SLACK_APP_TOKEN=... +SWITHCER01_SLACK_CHANNEL_ID=... +GITHUB_ACCESS_TOKEN=... +SWITCHER01_HOST=... +SWITCHER01_PASSWORD=... +``` + +* コンテナの起動 + +```bash +docker compose up -d +``` diff --git a/development/cnd-operation-server.yaml b/development/cnd-operation-server.yaml new file mode 100644 index 0000000..cbbac87 --- /dev/null +++ b/development/cnd-operation-server.yaml @@ -0,0 +1,13 @@ +wsProxy: + bindAddr: :20080 +dreamkast: + eventAbbr: cnsec2022 + endpointUrl: ${DK_ENDPOINT_URL} +tracks: + - dkTrackId: 29 + obs: + host: ${SWITCHER01_HOST} + password: ${SWITCHER01_PASSWORD} + slack: + botToken: ${SLACK_BOT_TOKEN} + channelId: ${SWITCHER01_SLACK_CHANNEL_ID} diff --git a/development/dk-mock-server.yaml b/development/dk-mock-server.yaml new file mode 100644 index 0000000..61f2b79 --- /dev/null +++ b/development/dk-mock-server.yaml @@ -0,0 +1,402 @@ +- request: + # Note: the method could be omitted because GET is the default + method: GET + path: /api/v1/tracks + query_params: + eventAbbr: cnsec2022 + dynamic_response: + engine: go_template + # Note: the status could be omitted because 200 is the default + script: > + headers: + Content-Type: application/json + body: > + [ + { + "id": 29, + "name": "A", + "videoPlatform": "ivs", + "videoId": null, + "channelArn": null, + "onAirTalk": { + "id": 645, + "talk_id": 1503, + "site": null, + "url": null, + "on_air": true, + "created_at": "2022-08-04T03:20:57.000+09:00", + "updated_at": "2022-08-05T18:45:51.000+09:00", + "video_id": "", + "slido_id": null, + "video_file_data": null + } + }, + { + "id": 30, + "name": "B", + "videoPlatform": "ivs", + "videoId": null, + "channelArn": null, + "onAirTalk": { + "id": 646, + "talk_id": 1504, + "site": null, + "url": null, + "on_air": true, + "created_at": "2022-08-04T03:20:58.000+09:00", + "updated_at": "2022-08-05T18:47:50.000+09:00", + "video_id": "", + "slido_id": null, + "video_file_data": null + } + }, + { + "id": 31, + "name": "C", + "videoPlatform": "ivs", + "videoId": null, + "channelArn": null, + "onAirTalk": { + "id": 647, + "talk_id": 1505, + "site": null, + "url": null, + "on_air": true, + "created_at": "2022-08-04T03:20:58.000+09:00", + "updated_at": "2022-08-05T18:45:38.000+09:00", + "video_id": "", + "slido_id": null, + "video_file_data": null + } + } + ] + +- request: + # Note: the method could be omitted because GET is the default + method: GET + path: /api/v1/talks + query_params: + eventAbbr: cnsec2022 + trackId: 29 + dynamic_response: + engine: go_template + # Note: the status could be omitted because 200 is the default + script: > + headers: + Content-Type: application/json + body: > + [ + { + "id": 1433, + "conferenceId": 6, + "trackId": 29, + "videoPlatform": null, + "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1433a/12/playlist.m3u8", + "title": "Simplify Cloud Native Security with Trivy", + "abstract": "クラウド環境への移行に伴い必要なセキュリティ対策も大きく変化しました。しかしこれらの対策には多くのツールを組み合わせて使う必要があり、導入・学習コストが高くなっています。そこで本発表では、OSSであるTrivyを用いて特に攻撃へと繋がりやすい依存ライブラリの脆弱性や脆弱なインフラ設定、誤ってコミットされたパスワード等の検知を一括で行う方法について説明します。また、実際にCloudFormationやHelmチャートをスキャンすることでデプロイ前に危険な設定を検知するデモを行います。", + "speakers": [ + { + "id": 1283, + "name": "Teppei Fukuda" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h1m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "初級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "https://speakerdeck.com/knqyf263/simplify-cloud-native-security-with-trivy/", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h1m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "presentationMethod": "オンライン登壇" + }, + { + "id": 1438, + "conferenceId": 6, + "trackId": 29, + "videoPlatform": null, + "videoId": "https://dreamkast-ivs-stream-archive-prd.s3.amazonaws.com/medialive/cnsec2022/talks/1438/1438.m3u8", + "title": "Sysdig Secure/Falcoの活用術!〜Kubernetes基盤の脅威モデリングとランタイムセキュリティの強化〜", + "abstract": "本講演では、IIJのマルチテナントなKubernetes基盤であるIKE(IIJ Kubernetes Engine)上の実運用システムやフローに対して脅威モデリングを行い、Sysdig Secure/Falcoを用いてIKEのランタイムセキュリティを強化するために実施したPoCについて紹介します。どのようにしてKubernetesを基盤とした実運用システムやフローの潜在的な脅威を見つけるのか。また、見つかった脅威についてどのような対策をしていくのか。Sysdig Secure/Falcoを活用しながら試行錯誤したプロセスを解説していきます。", + "speakers": [ + { + "id": 1290, + "name": "Chihiro Hasegawa / Han Li" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "中級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "https://speakerdeck.com/owlinux1000/falcofalsehuo-yong-shu-kubernetesji-pan-falsexie-wei-moderingutorantaimusekiyuriteifalseqiang-hua", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "presentationMethod": "事前収録" + }, + { + "id": 1439, + "conferenceId": 6, + "trackId": 29, + "videoPlatform": null, + "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1439/19/playlist.m3u8", + "title": "Kubernetes Service Account As Multi-Cloud Identity", + "abstract": "多くのクラウドプロバイダの提供するManaged Kubernetesサービスでは、Kubernetes Service Accountから、クラウドAPIを自動的に認証する機能を提供しています。EKSであればIAM Roles for Service Account(IRSA), GKEであればWorkload Ideneity等です。これらの機能を使えば、アプリケーションはクラウドSDKを呼び出すだけで、適切な権限をもつ、自動的に払い出された一時的なクレデンシャルを使って、シームレスかつ安全にクラウドAPIにアクセスすることが可能です。\r\n\r\nしかし、これがオンプレミスで稼働しているようなUnmanagedなKubernetesであればどうでしょうか。永続的なAPI キーをクラウドプロバイダで発行し、それらを各アプリケーションPodにマウントすることでクラウドAPIの認証を実現していることが多いのではないでしょうか。永続的なAPIキーはそれ自体がセキュリティリスクとなりますし、リスク低減のためにはローテーションの運用負荷も存在します。アプリケーションが利用するAPIキーが複数存在したり、複数のクラウドプロバイダとやり取りする環境だと、これらのリスク・運用負荷はより大きくなります。\r\n\r\n本セッションでは、KubernetesのServiceAccountIssuerDiscoveryの機能と、各種クラウドプロバイダが提供しているIdentity Federationの機能を活用して、永続的なAPI Keyを利用せず、KubernetesのService Accountを複数クラウド共通のIdentityとして利用可能にする方法について共有します。これによって、クラウドプロバイダ側でKubernetes Service Accountへの権限を付与するだけで、シームレスかつ安全に、複数クラウドAPIにアクセスできる環境を実現できます。", + "speakers": [ + { + "id": 1291, + "name": "Shingo Omura" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h10m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "中級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "https://www.slideshare.net/pfi/kubernetes-service-account-as-multicloud-identity-cloud-native-security-conference-2022-cnsec2022", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h10m") "UTC"}}", + "presentationMethod": "事前収録" + } + ] + +- request: + # Note: the method could be omitted because GET is the default + method: GET + path: /api/v1/talks + query_params: + eventAbbr: cnsec2022 + trackId: 30 + dynamic_response: + engine: go_template + # Note: the status could be omitted because 200 is the default + script: > + headers: + Content-Type: application/json + body: > + [ + { + "id": 1441, + "conferenceId": 6, + "trackId": 30, + "videoPlatform": null, + "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1441/16/playlist.m3u8", + "title": "セキュアなTerraformの使い方 ~ 機密情報をコードに含めず環境構築するにはどうしたらいいの?", + "abstract": "IaCの便利さ・メリットがよく知られるようになった昨今、Terraformでクラウド環境を構築するという選択肢はとても一般的です。\r\nしかし「構築内容をコード・文書として残す」というIaCの特性上、機密情報がコードやツールによる生成物に含まれないよう注意を払いながら開発していくことが求められます。\r\n本セッションではそのリスクを避けるためにはどのようにコードを記述すればいいのか、そもそもどのリソースをTerraformで扱っていくべきなのか、またどのようにチームでセキュアなTerraform運用をしていけばいいのかについて論じます。", + "speakers": [ + { + "id": 1293, + "name": "Haruka Sakihara" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h1m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "初級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "https://speakerdeck.com/harukasakihara/sekiyuanaterraformfalseshi-ifang-ji-mi-qing-bao-wokodonihan-mezuhuan-jing-gou-zhu-surunihadousitaraiifalse", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h1m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "presentationMethod": "オンライン登壇" + }, + { + "id": 1442, + "conferenceId": 6, + "trackId": 30, + "videoPlatform": null, + "videoId": "https://dreamkast-ivs-stream-archive-prd.s3.amazonaws.com/medialive/cnsec2022/talks/1442/1442.m3u8", + "title": "Istioを活用したセキュアなマイクロサービスの実現: アプリ透過型のユーザ及びサービス間の認証認可", + "abstract": "マイクロサービス型システムのセキュリティを高める上で、サービスやそれを構成するインスタンスの粒度での細かな認証認可は重要です。しかし、それには実装や管理に多くの手間がかかります。そこで、本講演ではOSSのサービスメッシュ実装であるIstioを用いて、アプリから透過的に認証認可を行う方法を紹介します。具体的にはmTLSを用いたサービス間認証、外部認証基盤を用いたユーザ認証、IstioとOpen Policy Agent(OPA)との連携方法、Keycloak連携によるWeb GUIのユーザ認証等を解説します。", + "speakers": [ + { + "id": 1294, + "name": "Takaya Ide" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "中級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "https://speakerdeck.com/ido_kara_deru/secure-microservices-with-istio", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "presentationMethod": "事前収録" + }, + { + "id": 1451, + "conferenceId": 6, + "trackId": 30, + "videoPlatform": null, + "videoId": "https://dreamkast-ivs-stream-archive-prd.s3.amazonaws.com/medialive/cnsec2022/talks/1451/1451.m3u8", + "title": "実践 SpiceDB - クラウドネイティブ時代をサバイブできるパーミッション管理の実装を目指して", + "abstract": "権限体系の設計や、認可処理の実装は往々にして複雑であり、とりわけ疎結合なアーキテクチャにおける複雑性はひとしおです。この課題を乗り越え、クライドネイティブ時代に耐える認可システムを実現するための手法としてOSS「SpiceDB」を詳解します。とりわけ、(1)SpiceDBスキーマ設計のベストプラクティスや、(2)Goコード生成器の実装等を通した実装上のベストプラクティス、(3)実運用により見えてきた採用時の注意点など、未だ世界的に報告例の少ない情報もシェアできればと思います。", + "speakers": [ + { + "id": 1304, + "name": "Takashi Yoneuchi" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h10m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "上級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h10m") "UTC"}}", + "presentationMethod": "事前収録" + } + ] + +- request: + # Note: the method could be omitted because GET is the default + method: GET + path: /api/v1/talks + query_params: + eventAbbr: cnsec2022 + trackId: 31 + dynamic_response: + engine: go_template + # Note: the status could be omitted because 200 is the default + script: > + headers: + Content-Type: application/json + body: > + [ + { + "id": 1436, + "conferenceId": 6, + "trackId": 31, + "videoPlatform": null, + "videoId": "https://dreamkast-ivs-stream-archive-prd.s3.amazonaws.com/medialive/cnsec2022/talks/1436/1436.m3u8", + "title": "なぜあなたのプロジェクトのDevSecOpsは形骸化するのか", + "abstract": "昨今、DevSecOpsを導入する企業が非常に増えています。しかし「実はツールの導入をしただけで、セキュリティを改善するまで至っていない」というお声を聞くことが多いことも事実です。DevSecOpsにはツールによって使いやすい・使いにくいの差はありますが、銀の弾丸は存在しません。本当に意味のあるDevSecOpsを実現するには、現状の自組織の課題と、DevSecOpsによってどのようなセキュアな開発体験を目指すのかを、明確に意識する必要があります。このアプローチのヒントになるお話を、複数のクライアントへのDevSecOps導入経験を元にして紹介していきます。", + "speakers": [ + { + "id": 1288, + "name": "Masaya Tahara" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h1m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "初級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "https://www.slideshare.net/MasayaTahara/devsecopscloudnative-security-conference-2022", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h1m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "presentationMethod": "事前収録" + }, + { + "id": 1445, + "conferenceId": 6, + "trackId": 31, + "videoPlatform": null, + "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1445/13/playlist.m3u8", + "title": "SBOMを利用したソフトウェアサプライチェーンの保護", + "abstract": "近年、サプライチェーンセキュリティが大きな話題となっており、著名なnpm, rust, pythonパッケージに対する攻撃も観測されています。これらの対策には自社で開発したソフトウェアだけではなく、依存するOSSを含めた可視化と脆弱性検知が必要になります。\r\n本講演では、プロダクトを安全に開発/運用するための方法として、SBOMと呼ばれるソフトウェアの可視化方法についてご紹介します。SBOMとは何か、どのような課題を解決するのかを紹介した上で、SBOMを生成し脆弱性検知する方法をデモを交えて説明します。", + "speakers": [ + { + "id": 1297, + "name": "Masahiro Fujimura" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "初級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "presentationMethod": "オンライン登壇" + }, + { + "id": 1450, + "conferenceId": 6, + "trackId": 31, + "videoPlatform": null, + "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1450/15/playlist.m3u8", + "title": "サイバー攻撃を想定したクラウドネイティブセキュリティガイドラインとCNAPP及びSecurity Observabilityの未来", + "abstract": "クラウドネイティブのセキュリティはレイヤーごとに考え、規定・実行・維持する必要があります。ワークロードがガイドラインどおりに継続実行されているか確認する必要がありますが、現状は脅威まで検討された可視化とはなっていません。\r\n本セッションでは、デファクトスタンダードなセキュリティの枠組みと脅威情報でガイドラインを作成した取り組みを紹介し、従来のCSPM/CWPPを越えたCNAPPとは何か、Security Observabilityをどうすべきかの一考察をご説明します。", + "speakers": [ + { + "id": 1303, + "name": "Nobuaki Sako, Shun Yoshie" + } + ], + "dayId": 16, + "showOnTimetable": true, + "startTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "endTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h10m") "UTC"}}", + "talkDuration": 0, + "talkDifficulty": "初級者", + "talkCategory": "", + "onAir": false, + "documentUrl": "https://speakerdeck.com/syoshie/saibagong-ji-woxiang-ding-sitakuraudoneiteibusekiyuriteigaidoraintocnappji-bisecurity-observabilityfalsewei-lai", + "conferenceDayId": 16, + "conferenceDayDate": "{{dateInZone "2006-01-02" (now | date_modify "+9h") "UTC"}}", + "startOffset": 0, + "endOffset": 0, + "actualStartTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h7m") "UTC"}}", + "actualEndTime": "2000-01-01T{{dateInZone "15:04:05.000+09:00" (now | date_modify "+9h10m") "UTC"}}", + "presentationMethod": "オンライン登壇" + } + ] diff --git a/development/docker-compose.without-server.yml b/development/docker-compose.without-server.yml new file mode 100644 index 0000000..f99e72d --- /dev/null +++ b/development/docker-compose.without-server.yml @@ -0,0 +1,32 @@ +version: "3.8" +services: + seaman: + image: public.ecr.aws/f5j9d0q5/seaman:0.0.9 + command: --config=/mnt/seaman.yaml + network_mode: host # for connecting to local cnd-operation-server + volumes: + - ./seaman.yaml:/mnt/seaman.yaml + environment: + BROADCAST_ENDPOINT_URL: localhost:20080 + SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN} + SLACK_APP_TOKEN: ${SLACK_APP_TOKEN} + GITHUB_ACCESS_TOKEN: ${GITHUB_ACCESS_TOKEN} + + dk-mock-server: + image: thiht/smocker + ports: + - 18080:8080 + - 18081:8081 + + dk-mock-server-init: + image: curlimages/curl + entrypoint: + - sh + - -c + - | + sleep 5; + curl -s -XPOST --header "Content-Type: application/x-yaml" --data-binary "@/mnt/mock.yaml" dk-mock-server:8081/mocks; + volumes: + - ./dk-mock-server.yaml:/mnt/mock.yaml + depends_on: + - dk-mock-server diff --git a/development/docker-compose.yml b/development/docker-compose.yml new file mode 100644 index 0000000..535631a --- /dev/null +++ b/development/docker-compose.yml @@ -0,0 +1,47 @@ +version: "3.8" +services: + cnd-operation-server: + build: + context: .. + dockerfile: cmd/server/Dockerfile + command: --config=/mnt/cnd-operation-server.yaml + ports: + - 20080:20080 + volumes: + - ./cnd-operation-server.yaml:/mnt/cnd-operation-server.yaml + environment: + DK_ENDPOINT_URL: http://dk-mock-server:8080/api + SWITCHER01_HOST: ${SWITCHER01_HOST} + SWITCHER01_PASSWORD: ${SWITCHER01_PASSWORD} + SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN} + SWITCHER01_SLACK_CHANNEL_ID: ${SWITCHER01_SLACK_CHANNEL_ID} + + seaman: + image: public.ecr.aws/f5j9d0q5/seaman:0.0.9 + command: --config=/mnt/seaman.yaml + volumes: + - ./seaman.yaml:/mnt/seaman.yaml + environment: + BROADCAST_ENDPOINT_URL: cnd-operation-server:20080 + SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN} + SLACK_APP_TOKEN: ${SLACK_APP_TOKEN} + GITHUB_ACCESS_TOKEN: ${GITHUB_ACCESS_TOKEN} + + dk-mock-server: + image: thiht/smocker + ports: + - 18080:8080 + - 18081:8081 + + dk-mock-server-init: + image: curlimages/curl + entrypoint: + - sh + - -c + - | + sleep 5; + curl -s -XPOST --header "Content-Type: application/x-yaml" --data-binary "@/mnt/mock.yaml" dk-mock-server:8081/mocks; + volumes: + - ./dk-mock-server.yaml:/mnt/mock.yaml + depends_on: + - dk-mock-server diff --git a/development/seaman.yaml b/development/seaman.yaml new file mode 100644 index 0000000..5791e6d --- /dev/null +++ b/development/seaman.yaml @@ -0,0 +1,11 @@ +debug: false +slack: + botToken: ${SLACK_BOT_TOKEN} + appToken: ${SLACK_APP_TOKEN} +github: + username: ShotaKitazawa + accessToken: ${GITHUB_ACCESS_TOKEN} +release: + targets: [] +broadcast: + endpointUrl: ${BROADCAST_ENDPOINT_URL} diff --git a/go.mod b/go.mod index 316baff..5af7384 100644 --- a/go.mod +++ b/go.mod @@ -5,19 +5,23 @@ go 1.19 require ( github.com/andreykaipov/goobs v0.10.0 github.com/avast/retry-go v3.0.0+incompatible + github.com/cloudnativedaysjp/seaman v0.0.9 github.com/creasty/defaults v1.6.0 github.com/go-logr/logr v1.2.3 github.com/go-logr/zapr v1.2.3 github.com/go-playground/validator/v10 v10.11.1 github.com/golang/protobuf v1.5.2 + github.com/google/go-cmp v0.5.9 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/k0kubun/pp v3.0.1+incompatible + github.com/labstack/echo/v4 v4.9.1 + github.com/prometheus/client_golang v1.13.0 github.com/slack-go/slack v0.11.3 - github.com/spf13/cobra v1.5.0 + github.com/spf13/cobra v1.6.0 go.uber.org/zap v1.23.0 - golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 + golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 - google.golang.org/grpc v1.49.0 + google.golang.org/grpc v1.50.1 google.golang.org/protobuf v1.28.1 sigs.k8s.io/yaml v1.3.0 ) @@ -29,25 +33,33 @@ require ( require ( github.com/buger/jsonparser v1.1.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-redis/redis v6.15.9+incompatible github.com/go-redis/redis/v8 v8.11.5 github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect + github.com/labstack/gommon v0.4.0 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - go.uber.org/atomic v1.7.0 // indirect - go.uber.org/multierr v1.6.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasttemplate v1.2.1 // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/multierr v1.8.0 // indirect golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect + golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect golang.org/x/text v0.3.7 // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect + google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 63ebbef..0862a78 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,69 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/andreykaipov/goobs v0.10.0 h1:wa4CxbYu/NqwUmx5E4/baDqYRYEmfHwg2T23RAg3jlU= github.com/andreykaipov/goobs v0.10.0/go.mod h1:EqG73Uu/4npyhXIWWszgRelNkEeIz+d0slUT6NKWYs4= github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudnativedaysjp/seaman v0.0.7 h1:a5dXzklLiVMX+GieV2s67pRbyIiajqlb/0r+g2JAuaU= +github.com/cloudnativedaysjp/seaman v0.0.7/go.mod h1:sPUguGLeztUQ0qMMJlbD9rSLVFxum96CEtNgMIzbR+w= +github.com/cloudnativedaysjp/seaman v0.0.9 h1:gDESi7wOiEmLM0JO1guOe7QFfMQD3zn5VDQlP/hg7ss= +github.com/cloudnativedaysjp/seaman v0.0.9/go.mod h1:sPUguGLeztUQ0qMMJlbD9rSLVFxum96CEtNgMIzbR+w= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -26,8 +78,17 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -48,38 +109,87 @@ github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40= @@ -87,6 +197,7 @@ github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3t github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -96,31 +207,80 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY= +github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= +github.com/labstack/echo/v4 v4.9.1 h1:GliPYSpzGKlyOhqIbG8nmHBo3i1saKWFOgh41AN3b+Y= +github.com/labstack/echo/v4 v4.9.1/go.mod h1:Pop5HLc+xoc4qhTZ1ip6C0RtP7Z+4VzRLWZZFKqbbjo= +github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= +github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= +github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= +github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/slack-go/slack v0.11.3 h1:GN7revxEMax4amCc3El9a+9SGnjmBvSUobs0QnO6ZO8= github.com/slack-go/slack v0.11.3/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= +github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI= +github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -131,122 +291,343 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= +go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e h1:TsQ7F31D3bUCLeqPT0u+yjp1guoArKaNKmCr22PYgTQ= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 h1:ZrnxWX62AgTKOSagEqxvb3ffipvEDX2pl7E1TdqLqIc= -golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 h1:cu5kTvlzcw1Q5S9f5ip1/cpiB4nXvw1XYzFPGgzLUOY= +golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 h1:PDIOdWxZ8eRizhKa1AAvY53xsvLB1cWorMjslvY3VA8= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/mock/README.md b/mock/README.md deleted file mode 100644 index c8eaefb..0000000 --- a/mock/README.md +++ /dev/null @@ -1,206 +0,0 @@ -cnd-operation-server mock -========================= - -手元で cnd-operation-server を動作させるために、Dreamkast の talks, tracks API を提供するためのmock。 -mock server は https://github.com/Thiht/smocker を利用する。 - -## mock server 利用手順 -以下、smocker を docker で起動した場合の手順を記載する。 - -1. smocker を docker で起動 -smocker の [document](https://smocker.dev/guide/installation.html#with-docker) に記載の方法で起動する。 -``` -docker run -d \ - --restart=always \ - -p 8080:8080 \ - -p 8081:8081 \ - --name smocker \ - thiht/smocker -``` - -`8080` が mock server port で、`8081` が設定用のport。 -``` -8080 is the mock server port. It will expose the routes you register through the configuration port. -8081 is the configuration port. It's the port you will use to register new mocks. This port also exposes a user interface. -``` - -2. `mock.yaml`を利用して、起動した mock server に mock シナリオを追加する。 -``` -$ curl -XPOST --header "Content-Type: application/x-yaml" --data-binary "@mock.yaml" localhost:8081/mocks - -{"message":"Mocks registered successfully"} -``` - -## mock response -`mock.yaml` に定義されている API エンドポイントは以下の2つ。 -- `/api/v1/tracks?eventAbbr=cnsec2022` -- `/api/v1/talks?eventAbbr=cnsec2022&trackId=29` - -`/api/v1/talks?eventAbbr=cnsec2022&trackId=29` は、APIをたたいた時刻から1分後、2分後、3分後に開始するSession情報を返却する。 - -### Response Example -- `/api/v1/tracks?eventAbbr=cnsec2022` -``` -$ curl "localhost:8080/api/v1/tracks?eventAbbr=cnsec2022" - -[ - { - "id": 29, - "name": "A", - "videoPlatform": "ivs", - "videoId": null, - "channelArn": null, - "onAirTalk": { - "id": 645, - "talk_id": 1503, - "site": null, - "url": null, - "on_air": true, - "created_at": "2022-08-04T03:20:57.000+09:00", - "updated_at": "2022-08-05T18:45:51.000+09:00", - "video_id": "", - "slido_id": null, - "video_file_data": null - } - }, - { - "id": 30, - "name": "B", - "videoPlatform": "ivs", - "videoId": null, - "channelArn": null, - "onAirTalk": { - "id": 646, - "talk_id": 1504, - "site": null, - "url": null, - "on_air": true, - "created_at": "2022-08-04T03:20:58.000+09:00", - "updated_at": "2022-08-05T18:47:50.000+09:00", - "video_id": "", - "slido_id": null, - "video_file_data": null - } - }, - { - "id": 31, - "name": "C", - "videoPlatform": "ivs", - "videoId": null, - "channelArn": null, - "onAirTalk": { - "id": 647, - "talk_id": 1505, - "site": null, - "url": null, - "on_air": true, - "created_at": "2022-08-04T03:20:58.000+09:00", - "updated_at": "2022-08-05T18:45:38.000+09:00", - "video_id": "", - "slido_id": null, - "video_file_data": null - } - } -] -``` - -- /api/v1/talks?eventAbbr=cnsec2022&trackId=29` -``` -$ curl "localhost:8080/api/v1/talks?eventAbbr=cnsec2022&trackId=29" - -[ - { - "id": 1433, - "conferenceId": 6, - "trackId": 29, - "videoPlatform": null, - "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1433a/12/playlist.m3u8", - "title": "Simplify Cloud Native Security with Trivy", - "abstract": "クラウド環境への移行に伴い必要なセキュリティ対策も大きく変化しました。しかしこれらの対策には多くのツールを組み合わせて使う必要があり、導入・学習コストが高くなっています。そこで本発表では、OSS であるTrivyを用いて特に攻撃へと繋がりやすい依存ライブラリの脆弱性や脆弱なインフラ設定、誤ってコミットされたパスワード等の検知を一括で行う方法について説明します。また、実際にCloudFormationやHelmチャートをスキャンすることでデプロイ前に危険な設定を検知するデモを行います。", - "speakers": [ - { - "id": 1283, - "name": "Teppei Fukuda" - } - ], - "dayId": 16, - "showOnTimetable": true, - "startTime": "2022-10-03T18:49:47.939+09:00", - "endTime": "2022-10-03T18:50:47.939+09:00", - "talkDuration": 0, - "talkDifficulty": "初級者", - "talkCategory": "", - "onAir": false, - "documentUrl": "https://speakerdeck.com/knqyf263/simplify-cloud-native-security-with-trivy/", - "conferenceDayId": 16, - "conferenceDayDate": "2022-08-05", - "startOffset": 0, - "endOffset": 0, - "actualStartTime": "2022-10-03T18:49:47.939+09:00", - "actualEndTime": "2022-10-03T18:50:47.939+09:00", - "presentationMethod": "オンライン登壇" - }, - { - "id": 1438, - "conferenceId": 6, - "trackId": 29, - "videoPlatform": null, - "videoId": "https://dreamkast-ivs-stream-archive-prd.s3.amazonaws.com/medialive/cnsec2022/talks/1438/1438.m3u8", - "title": "Sysdig Secure/Falcoの活用術!〜Kubernetes基盤の脅威モデリングとランタイムセキュリティの強化〜", - "abstract": "本講演では、IIJのマルチテナントなKubernetes基盤であるIKE(IIJ Kubernetes Engine)上の実運用システムやフローに対して脅威モデリングを行い、Sysdig Secure/Falcoを用いてIKEのランタイムセキュリティ を強化するために実施したPoCについて紹介します。どのようにしてKubernetesを基盤とした実運用システムやフローの潜在的な脅威を見つけるのか。また、見つかった脅威についてどのような対策をしていくのか。Sysdig Secure/Falcoを活用しながら試行錯誤したプロセスを解説していきます。", - "speakers": [ - { - "id": 1290, - "name": "Chihiro Hasegawa / Han Li" - } - ], - "dayId": 16, - "showOnTimetable": true, - "startTime": "2022-10-03T18:50:47.939+09:00", - "endTime": "2022-10-03T18:51:47.939+09:00", - "talkDuration": 0, - "talkDifficulty": "中級者", - "talkCategory": "", - "onAir": false, - "documentUrl": "https://speakerdeck.com/owlinux1000/falcofalsehuo-yong-shu-kubernetesji-pan-falsexie-wei-moderingutorantaimusekiyuriteifalseqiang-hua", - "conferenceDayId": 16, - "conferenceDayDate": "2022-08-05", - "startOffset": 0, - "endOffset": 0, - "actualStartTime": "2022-10-03T18:50:47.939+09:00", - "actualEndTime": "2022-10-03T18:51:47.939+09:00", - "presentationMethod": "事前収録" - }, - { - "id": 1439, - "conferenceId": 6, - "trackId": 29, - "videoPlatform": null, - "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1439/19/playlist.m3u8", - "title": "Kubernetes Service Account As Multi-Cloud Identity", - "abstract": "多くのクラウドプロバイダの提供するManaged Kubernetesサービスでは、Kubernetes Service Accountから、クラウドAPIを自動的に認証する機能を提供しています。EKSであればIAM Roles for Service Account(IRSA), GKEであればWorkload Ideneity等です。これらの機能を使えば、アプリケーションはクラウドSDKを呼び出すだけで、適切な権限をもつ、自動的に払い出された一時的なクレデンシャルを使って、シームレスかつ安全にクラウドAPIにアクセスすることが可能です。\r\n\r\nしかし、これがオンプレミスで稼働しているようなUnmanagedなKubernetesであればどうでしょうか。永続的なAPI キーをクラウドプロバイダで発行し、それらを各アプリケーションPodに マウントすることでクラウドAPIの認証を実現していることが多いのではないでしょうか。永続的なAPIキーはそれ自体がセキュリティリスクとなりますし、リスク低減のためにはローテーションの運用負荷も存在します。アプリケー ションが利用するAPIキーが複数存在したり、複数のクラウドプロバイダとやり取りする環境だと、これらのリスク・運用負荷はより大きくなります。\r\n\r\n本セッションでは、KubernetesのServiceAccountIssuerDiscoveryの機能 と、各種クラウドプロバイダが提供しているIdentity Federationの機能を活用して、永続的なAPI Keyを利用せず、KubernetesのService Accountを複数クラウド共通のIdentityとして利用可能にする方法について共有します。これによって、クラウドプロバイダ側でKubernetes Service Accountへの権限を付与するだけで、シームレスかつ安全に、複数クラウドAPIにアクセスできる環境を実現できます。", - "speakers": [ - { - "id": 1291, - "name": "Shingo Omura" - } - ], - "dayId": 16, - "showOnTimetable": true, - "startTime": "2022-10-03T18:51:47.939+09:00", - "endTime": "2022-10-03T18:52:47.939+09:00", - "talkDuration": 0, - "talkDifficulty": "中級者", - "talkCategory": "", - "onAir": false, - "documentUrl": "https://www.slideshare.net/pfi/kubernetes-service-account-as-multicloud-identity-cloud-native-security-conference-2022-cnsec2022", - "conferenceDayId": 16, - "conferenceDayDate": "2022-08-05", - "startOffset": 0, - "endOffset": 0, - "actualStartTime": "2022-10-03T18:51:47.939+09:00", - "actualEndTime": "2022-10-03T18:52:47.939+09:00", - "presentationMethod": "事前収録" - } -] -``` diff --git a/mock/mock.yaml b/mock/mock.yaml deleted file mode 100644 index b3dfef7..0000000 --- a/mock/mock.yaml +++ /dev/null @@ -1,182 +0,0 @@ -- request: - # Note: the method could be omitted because GET is the default - method: GET - path: /api/v1/tracks - query_params: - eventAbbr: cnsec2022 - dynamic_response: - engine: go_template - # Note: the status could be omitted because 200 is the default - script: > - headers: - Content-Type: application/json - body: > - [ - { - "id": 29, - "name": "A", - "videoPlatform": "ivs", - "videoId": null, - "channelArn": null, - "onAirTalk": { - "id": 645, - "talk_id": 1503, - "site": null, - "url": null, - "on_air": true, - "created_at": "2022-08-04T03:20:57.000+09:00", - "updated_at": "2022-08-05T18:45:51.000+09:00", - "video_id": "", - "slido_id": null, - "video_file_data": null - } - }, - { - "id": 30, - "name": "B", - "videoPlatform": "ivs", - "videoId": null, - "channelArn": null, - "onAirTalk": { - "id": 646, - "talk_id": 1504, - "site": null, - "url": null, - "on_air": true, - "created_at": "2022-08-04T03:20:58.000+09:00", - "updated_at": "2022-08-05T18:47:50.000+09:00", - "video_id": "", - "slido_id": null, - "video_file_data": null - } - }, - { - "id": 31, - "name": "C", - "videoPlatform": "ivs", - "videoId": null, - "channelArn": null, - "onAirTalk": { - "id": 647, - "talk_id": 1505, - "site": null, - "url": null, - "on_air": true, - "created_at": "2022-08-04T03:20:58.000+09:00", - "updated_at": "2022-08-05T18:45:38.000+09:00", - "video_id": "", - "slido_id": null, - "video_file_data": null - } - } - ] - -- request: - # Note: the method could be omitted because GET is the default - method: GET - path: /api/v1/talks - query_params: - eventAbbr: cnsec2022 - trackId: 29 - dynamic_response: - engine: go_template - # Note: the status could be omitted because 200 is the default - script: > - headers: - Content-Type: application/json - body: > - [ - { - "id": 1433, - "conferenceId": 6, - "trackId": 29, - "videoPlatform": null, - "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1433a/12/playlist.m3u8", - "title": "Simplify Cloud Native Security with Trivy", - "abstract": "クラウド環境への移行に伴い必要なセキュリティ対策も大きく変化しました。しかしこれらの対策には多くのツールを組み合わせて使う必要があり、導入・学習コストが高くなっています。そこで本発表では、OSSであるTrivyを用いて特に攻撃へと繋がりやすい依存ライブラリの脆弱性や脆弱なインフラ設定、誤ってコミットされたパスワード等の検知を一括で行う方法について説明します。また、実際にCloudFormationやHelmチャートをスキャンすることでデプロイ前に危険な設定を検知するデモを行います。", - "speakers": [ - { - "id": 1283, - "name": "Teppei Fukuda" - } - ], - "dayId": 16, - "showOnTimetable": true, - "startTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h1m") "UTC"}}", - "endTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h2m") "UTC"}}", - "talkDuration": 0, - "talkDifficulty": "初級者", - "talkCategory": "", - "onAir": false, - "documentUrl": "https://speakerdeck.com/knqyf263/simplify-cloud-native-security-with-trivy/", - "conferenceDayId": 16, - "conferenceDayDate": "2022-08-05", - "startOffset": 0, - "endOffset": 0, - "actualStartTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h1m") "UTC"}}", - "actualEndTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h2m") "UTC"}}", - "presentationMethod": "オンライン登壇" - }, - { - "id": 1438, - "conferenceId": 6, - "trackId": 29, - "videoPlatform": null, - "videoId": "https://dreamkast-ivs-stream-archive-prd.s3.amazonaws.com/medialive/cnsec2022/talks/1438/1438.m3u8", - "title": "Sysdig Secure/Falcoの活用術!〜Kubernetes基盤の脅威モデリングとランタイムセキュリティの強化〜", - "abstract": "本講演では、IIJのマルチテナントなKubernetes基盤であるIKE(IIJ Kubernetes Engine)上の実運用システムやフローに対して脅威モデリングを行い、Sysdig Secure/Falcoを用いてIKEのランタイムセキュリティを強化するために実施したPoCについて紹介します。どのようにしてKubernetesを基盤とした実運用システムやフローの潜在的な脅威を見つけるのか。また、見つかった脅威についてどのような対策をしていくのか。Sysdig Secure/Falcoを活用しながら試行錯誤したプロセスを解説していきます。", - "speakers": [ - { - "id": 1290, - "name": "Chihiro Hasegawa / Han Li" - } - ], - "dayId": 16, - "showOnTimetable": true, - "startTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h2m") "UTC"}}", - "endTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h3m") "UTC"}}", - "talkDuration": 0, - "talkDifficulty": "中級者", - "talkCategory": "", - "onAir": false, - "documentUrl": "https://speakerdeck.com/owlinux1000/falcofalsehuo-yong-shu-kubernetesji-pan-falsexie-wei-moderingutorantaimusekiyuriteifalseqiang-hua", - "conferenceDayId": 16, - "conferenceDayDate": "2022-08-05", - "startOffset": 0, - "endOffset": 0, - "actualStartTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h2m") "UTC"}}", - "actualEndTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h3m") "UTC"}}", - "presentationMethod": "事前収録" - }, - { - "id": 1439, - "conferenceId": 6, - "trackId": 29, - "videoPlatform": null, - "videoId": "https://d3pun3ptcv21q4.cloudfront.net/mediapackage/cnsec2022/talks/1439/19/playlist.m3u8", - "title": "Kubernetes Service Account As Multi-Cloud Identity", - "abstract": "多くのクラウドプロバイダの提供するManaged Kubernetesサービスでは、Kubernetes Service Accountから、クラウドAPIを自動的に認証する機能を提供しています。EKSであればIAM Roles for Service Account(IRSA), GKEであればWorkload Ideneity等です。これらの機能を使えば、アプリケーションはクラウドSDKを呼び出すだけで、適切な権限をもつ、自動的に払い出された一時的なクレデンシャルを使って、シームレスかつ安全にクラウドAPIにアクセスすることが可能です。\r\n\r\nしかし、これがオンプレミスで稼働しているようなUnmanagedなKubernetesであればどうでしょうか。永続的なAPI キーをクラウドプロバイダで発行し、それらを各アプリケーションPodにマウントすることでクラウドAPIの認証を実現していることが多いのではないでしょうか。永続的なAPIキーはそれ自体がセキュリティリスクとなりますし、リスク低減のためにはローテーションの運用負荷も存在します。アプリケーションが利用するAPIキーが複数存在したり、複数のクラウドプロバイダとやり取りする環境だと、これらのリスク・運用負荷はより大きくなります。\r\n\r\n本セッションでは、KubernetesのServiceAccountIssuerDiscoveryの機能と、各種クラウドプロバイダが提供しているIdentity Federationの機能を活用して、永続的なAPI Keyを利用せず、KubernetesのService Accountを複数クラウド共通のIdentityとして利用可能にする方法について共有します。これによって、クラウドプロバイダ側でKubernetes Service Accountへの権限を付与するだけで、シームレスかつ安全に、複数クラウドAPIにアクセスできる環境を実現できます。", - "speakers": [ - { - "id": 1291, - "name": "Shingo Omura" - } - ], - "dayId": 16, - "showOnTimetable": true, - "startTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h3m") "UTC"}}", - "endTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", - "talkDuration": 0, - "talkDifficulty": "中級者", - "talkCategory": "", - "onAir": false, - "documentUrl": "https://www.slideshare.net/pfi/kubernetes-service-account-as-multicloud-identity-cloud-native-security-conference-2022-cnsec2022", - "conferenceDayId": 16, - "conferenceDayDate": "2022-08-05", - "startOffset": 0, - "endOffset": 0, - "actualStartTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h3m") "UTC"}}", - "actualEndTime": "{{dateInZone "2006-01-02T15:04:05.000+09:00" (now | date_modify "+9h4m") "UTC"}}", - "presentationMethod": "事前収録" - } - ] diff --git a/pkg/dkwatcher/dkwatcher.go b/pkg/dkwatcher/dkwatcher.go index 5cf8222..fac4f4e 100644 --- a/pkg/dkwatcher/dkwatcher.go +++ b/pkg/dkwatcher/dkwatcher.go @@ -9,9 +9,10 @@ import ( "go.uber.org/zap" "golang.org/x/xerrors" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/dreamkast" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/sharedmem" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/db" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/dreamkast" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/sharedmem" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/metrics" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/utils" ) @@ -28,11 +29,12 @@ type Config struct { Auth0ClientSecret string Auth0ClientAudience string RedisHost string - NotificationEventSendChan chan<- model.Talk + NotificationEventSendChan chan<- model.CurrentAndNextTalk } const ( - syncPeriod = 30 * time.Second + syncPeriod = 30 * time.Second + howManyMinutesUntilNotify = 5 * time.Minute ) func Run(ctx context.Context, conf Config) error { @@ -48,6 +50,7 @@ func Run(ctx context.Context, conf Config) error { } logger := zapr.NewLogger(zapLogger).WithName(componentName) ctx = logr.NewContext(ctx, logger) + ctx = metrics.SetDreamkastMetricsToCtx(ctx, metrics.NewDreamkastMetricsDao(conf.DkEndpointUrl)) dkClient, err := dreamkast.NewClient(conf.EventAbbr, conf.DkEndpointUrl, conf.Auth0Domain, conf.Auth0ClientId, conf.Auth0ClientSecret, conf.Auth0ClientAudience) @@ -60,10 +63,13 @@ func Run(ctx context.Context, conf Config) error { return err } - mw := sharedmem.Writer{UseStorageForTalks: true} + mw := sharedmem.Writer{UseStorageForTrack: true} mr := sharedmem.Reader{UseStorageForDisableAutomation: true} tick := time.NewTicker(syncPeriod) + if err := procedure(ctx, dkClient, mw, mr, conf.NotificationEventSendChan); err != nil { + return err + } for { select { case <-ctx.Done(): @@ -80,26 +86,20 @@ func Run(ctx context.Context, conf Config) error { } func procedure(ctx context.Context, - dkClient dreamkast.ClientIface, mw sharedmem.WriterIface, mr sharedmem.ReaderIface, - notificationEventSendChan chan<- model.Talk, redisClient *db.RedisClient, + dkClient dreamkast.Client, mw sharedmem.WriterIface, mr sharedmem.ReaderIface, + notificationEventSendChan chan<- model.CurrentAndNextTalk, redisClient *db.RedisClient, ) error { - logger := utils.GetLogger(ctx) + rootLogger := utils.GetLogger(ctx) - talksList, err := dkClient.ListTalks(ctx) + tracks, err := dkClient.ListTracks(ctx) if err != nil { - logger.Error(xerrors.Errorf("message: %w", err), "dkClient.ListTalks was failed") + rootLogger.Error(xerrors.Errorf("message: %w", err), "dkClient.ListTalks was failed") return nil } - for _, talks := range talksList { - currentTalk, err := talks.GetCurrentTalk() - if err != nil { - logger.Error(xerrors.Errorf("message: %w", err), "dkClient.GetCurrentTalk was failed") - continue - } - trackId := currentTalk.TrackId - logger = logger.WithValues("trackId", trackId) + for _, track := range tracks { + logger := rootLogger.WithValues("trackId", track.Id) - if disabled, err := mr.DisableAutomation(trackId); err != nil { + if disabled, err := mr.DisableAutomation(track.Id); err != nil { logger.Error(xerrors.Errorf("message: %w", err), "mr.DisableAutomation() was failed") return nil } else if disabled { @@ -107,8 +107,8 @@ func procedure(ctx context.Context, continue } - if err := mw.SetTalks(trackId, talks); err != nil { - logger.Error(xerrors.Errorf("message: %w", err), "mw.SetTalks was failed") + if err := mw.SetTrack(track); err != nil { + logger.Error(xerrors.Errorf("message: %w", err), "mw.SetTrack was failed") continue } hasNotify, err := talks.HasNotify(ctx, redisClient) @@ -119,10 +119,16 @@ func procedure(ctx context.Context, if !hasNotify { nextTalk, err := talks.GetNextTalk(currentTalk) if err != nil { - logger.Error(xerrors.Errorf("message: %w", err), "talks.GetNextTalk was failed") - continue + logger.Info("currentTalk is none") + currentTalk = &model.Talk{} + } + nextTalk, err := track.Talks.GetNextTalk() + if err != nil { + logger.Info("nextTalk is none") + nextTalk = &model.Talk{} } - notificationEventSendChan <- *nextTalk + notificationEventSendChan <- model.CurrentAndNextTalk{ + Current: *currentTalk, Next: *nextTalk} } } return nil diff --git a/pkg/infrastructure/dreamkast/client.go b/pkg/infra/dreamkast/client.go similarity index 79% rename from pkg/infrastructure/dreamkast/client.go rename to pkg/infra/dreamkast/client.go index bac2828..333b506 100644 --- a/pkg/infrastructure/dreamkast/client.go +++ b/pkg/infra/dreamkast/client.go @@ -7,19 +7,19 @@ import ( "github.com/avast/retry-go" "golang.org/x/xerrors" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/dreamkast/lib" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/dreamkast/lib" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/utils" ) -type ClientIface interface { - ListTalks(ctx context.Context) ([]model.Talks, error) +type Client interface { + ListTracks(ctx context.Context) ([]model.Track, error) SetSpecifiedTalkOnAir(ctx context.Context, talkId int32) error SetNextTalkOnAir(ctx context.Context, trackId int32) error } -type Client struct { - client lib.DreamkastApi +type ClientImpl struct { + client lib.DreamkastClient eventAbbr string auth0Domain string @@ -30,24 +30,24 @@ type Client struct { func NewClient(eventAbbr, dkEndpointUrl string, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Audience string, -) (ClientIface, error) { +) (Client, error) { c, err := lib.NewClient(dkEndpointUrl) if err != nil { return nil, err } - return &Client{ + return &ClientImpl{ c, eventAbbr, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Audience, }, nil } -func (c *Client) ListTalks(ctx context.Context) ([]model.Talks, error) { +func (c *ClientImpl) ListTracks(ctx context.Context) ([]model.Track, error) { logger := utils.GetLogger(ctx) tracks, err := c.client.ListTracks(ctx, c.eventAbbr) if err != nil { return nil, xerrors.Errorf("message: %w", err) } - var result []model.Talks + var result []model.Track for _, track := range tracks { var talksModel model.Talks talks, err := c.client.ListTalks(ctx, c.eventAbbr, track.ID) @@ -79,12 +79,16 @@ func (c *Client) ListTalks(ctx context.Context) ([]model.Talks, error) { } talksModel = append(talksModel, t) } - result = append(result, talksModel) + result = append(result, model.Track{ + Id: track.ID, + Name: track.Name, + Talks: talksModel, + }) } return result, nil } -func (c *Client) SetSpecifiedTalkOnAir(ctx context.Context, talkId int32) error { +func (c *ClientImpl) SetSpecifiedTalkOnAir(ctx context.Context, talkId int32) error { // If Auth0Token has been expired, retry only once. err := retry.Do( func() (err error) { @@ -100,20 +104,20 @@ func (c *Client) SetSpecifiedTalkOnAir(ctx context.Context, talkId int32) error return err } -func (c *Client) setSpecifiedTalkOnAir(ctx context.Context, talkId int32) error { +func (c *ClientImpl) setSpecifiedTalkOnAir(ctx context.Context, talkId int32) error { if err := c.client.GenerateAuth0Token(ctx, c.auth0Domain, c.auth0ClientId, c.auth0ClientSecret, c.auth0Audience, ); err != nil { return xerrors.Errorf("message: %w", err) } - if err := c.client.UpdateTalks(ctx, talkId, true); err != nil { + if err := c.client.UpdateTalk(ctx, talkId, true); err != nil { return xerrors.Errorf("message: %w", err) } return nil } -func (c *Client) SetNextTalkOnAir(ctx context.Context, trackId int32) error { +func (c *ClientImpl) SetNextTalkOnAir(ctx context.Context, trackId int32) error { // If Auth0Token has been expired, retry only once. err := retry.Do( func() (err error) { @@ -129,7 +133,7 @@ func (c *Client) SetNextTalkOnAir(ctx context.Context, trackId int32) error { return err } -func (c *Client) setNextTalkOnAir(ctx context.Context, trackId int32) error { +func (c *ClientImpl) setNextTalkOnAir(ctx context.Context, trackId int32) error { if err := c.client.GenerateAuth0Token(ctx, c.auth0Domain, c.auth0ClientId, c.auth0ClientSecret, c.auth0Audience, ); err != nil { @@ -156,7 +160,7 @@ func (c *Client) setNextTalkOnAir(ctx context.Context, trackId int32) error { } } - if err := c.client.UpdateTalks(ctx, nextTalkId, true); err != nil { + if err := c.client.UpdateTalk(ctx, nextTalkId, true); err != nil { return xerrors.Errorf("message: %w", err) } return nil diff --git a/pkg/infrastructure/dreamkast/lib/client.go b/pkg/infra/dreamkast/lib/client.go similarity index 67% rename from pkg/infrastructure/dreamkast/lib/client.go rename to pkg/infra/dreamkast/lib/client.go index a0dbd8a..fadc979 100644 --- a/pkg/infrastructure/dreamkast/lib/client.go +++ b/pkg/infra/dreamkast/lib/client.go @@ -11,21 +11,28 @@ import ( "github.com/cloudnativedaysjp/cnd-operation-server/pkg/utils" ) -type PrimitiveClient struct { +type DreamkastClient interface { + GenerateAuth0Token(ctx context.Context, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Audience string) error + ListTracks(ctx context.Context, eventAbbr string) (ListTracksResp, error) + ListTalks(ctx context.Context, eventAbbr string, trackId int32) (ListTalksResp, error) + UpdateTalk(ctx context.Context, talkId int32, onAir bool) error +} + +type DreamkastClientImpl struct { client *http.Client dkEndpointUrl url.URL auth0Token string } -func NewClient(dkEndpointUrl string) (DreamkastApi, error) { +func NewClient(dkEndpointUrl string) (DreamkastClient, error) { dkUrl, err := url.Parse(dkEndpointUrl) if err != nil { return nil, err } - return &PrimitiveClient{client: http.DefaultClient, dkEndpointUrl: *dkUrl}, nil + return &DreamkastClientImpl{client: http.DefaultClient, dkEndpointUrl: *dkUrl}, nil } -func (c *PrimitiveClient) GenerateAuth0Token(ctx context.Context, +func (c *DreamkastClientImpl) GenerateAuth0Token(ctx context.Context, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Audience string, ) error { if c.auth0Token != "" { diff --git a/pkg/infrastructure/dreamkast/lib/schema.go b/pkg/infra/dreamkast/lib/schema.go similarity index 100% rename from pkg/infrastructure/dreamkast/lib/schema.go rename to pkg/infra/dreamkast/lib/schema.go diff --git a/pkg/infrastructure/dreamkast/lib/talks.go b/pkg/infra/dreamkast/lib/talks.go similarity index 83% rename from pkg/infrastructure/dreamkast/lib/talks.go rename to pkg/infra/dreamkast/lib/talks.go index a328d4b..0ef3a47 100644 --- a/pkg/infrastructure/dreamkast/lib/talks.go +++ b/pkg/infra/dreamkast/lib/talks.go @@ -9,7 +9,7 @@ import ( "strconv" ) -func (c *PrimitiveClient) ListTalks(ctx context.Context, eventAbbr string, trackId int32) (ListTalksResp, error) { +func (c *DreamkastClientImpl) ListTalks(ctx context.Context, eventAbbr string, trackId int32) (ListTalksResp, error) { url := c.dkEndpointUrl url.Path = filepath.Join(url.Path, "/v1/talks") req, err := http.NewRequest("GET", url.String(), nil) @@ -37,7 +37,7 @@ func (c *PrimitiveClient) ListTalks(ctx context.Context, eventAbbr string, track // TODO: set Token to header // TODO: write test -func (c *PrimitiveClient) UpdateTalks(ctx context.Context, talkId int32, onAir bool) error { +func (c *DreamkastClientImpl) UpdateTalk(ctx context.Context, talkId int32, onAir bool) error { url := c.dkEndpointUrl url.Path = filepath.Join(url.Path, "/v1/talks", strconv.Itoa(int(talkId))) reqBody, err := json.Marshal(&UpdateTalksReq{OnAir: onAir}) diff --git a/pkg/infrastructure/dreamkast/lib/talks_test.go b/pkg/infra/dreamkast/lib/talks_test.go similarity index 91% rename from pkg/infrastructure/dreamkast/lib/talks_test.go rename to pkg/infra/dreamkast/lib/talks_test.go index 1e7cbc0..be698db 100644 --- a/pkg/infrastructure/dreamkast/lib/talks_test.go +++ b/pkg/infra/dreamkast/lib/talks_test.go @@ -30,7 +30,7 @@ func TestPrimitiveClient_ListTalks(t *testing.T) { if err != nil { t.Fatal(err) } - c := &PrimitiveClient{ + c := &DreamkastClientImpl{ client: http.DefaultClient, dkEndpointUrl: *u, } @@ -42,7 +42,7 @@ func TestPrimitiveClient_ListTalks(t *testing.T) { got, err := c.ListTalks(ctx, dkEventAbbr, int32(trackId)) if err != nil { - t.Errorf("PrimitiveClient.ListTalks() error = %v", err) + t.Errorf("DreamkastClientImpl.ListTalks() error = %v", err) return } pp.Print(got) @@ -66,7 +66,7 @@ func TestPrimitiveClient_UpdateTalks(t *testing.T) { if err != nil { t.Fatal(err) } - c := &PrimitiveClient{ + c := &DreamkastClientImpl{ client: http.DefaultClient, dkEndpointUrl: *u, } @@ -80,7 +80,7 @@ func TestPrimitiveClient_UpdateTalks(t *testing.T) { } if err := c.UpdateTalks(ctx, int32(talkId), true); err != nil { - t.Errorf("PrimitiveClient.UpdateTalks() error = %v", err) + t.Errorf("DreamkastClientImpl.UpdateTalks() error = %v", err) } }) } diff --git a/pkg/infrastructure/dreamkast/lib/tracks.go b/pkg/infra/dreamkast/lib/tracks.go similarity index 84% rename from pkg/infrastructure/dreamkast/lib/tracks.go rename to pkg/infra/dreamkast/lib/tracks.go index 2eaa137..acfc995 100644 --- a/pkg/infrastructure/dreamkast/lib/tracks.go +++ b/pkg/infra/dreamkast/lib/tracks.go @@ -7,7 +7,7 @@ import ( "path/filepath" ) -func (c *PrimitiveClient) ListTracks(ctx context.Context, eventAbbr string) (ListTracksResp, error) { +func (c *DreamkastClientImpl) ListTracks(ctx context.Context, eventAbbr string) (ListTracksResp, error) { url := c.dkEndpointUrl url.Path = filepath.Join(url.Path, "/v1/tracks") req, err := http.NewRequest("GET", url.String(), nil) diff --git a/pkg/infrastructure/dreamkast/lib/tracks_test.go b/pkg/infra/dreamkast/lib/tracks_test.go similarity index 89% rename from pkg/infrastructure/dreamkast/lib/tracks_test.go rename to pkg/infra/dreamkast/lib/tracks_test.go index d03a99a..0e9a68f 100644 --- a/pkg/infrastructure/dreamkast/lib/tracks_test.go +++ b/pkg/infra/dreamkast/lib/tracks_test.go @@ -28,14 +28,14 @@ func TestPrimitiveClient_ListTracks(t *testing.T) { if err != nil { t.Fatal(err) } - c := &PrimitiveClient{ + c := &DreamkastClientImpl{ client: http.DefaultClient, dkEndpointUrl: *u, } got, err := c.ListTracks(ctx, dkEventAbbr) if err != nil { - t.Errorf("PrimitiveClient.ListTracks() error = %v", err) + t.Errorf("DreamkastClientImpl.ListTracks() error = %v", err) return } pp.Print(got) diff --git a/pkg/infra/dreamkast/lib/wrapper.go b/pkg/infra/dreamkast/lib/wrapper.go new file mode 100644 index 0000000..ab6f8b7 --- /dev/null +++ b/pkg/infra/dreamkast/lib/wrapper.go @@ -0,0 +1,56 @@ +package lib + +import ( + "context" + "time" + + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/metrics" + "golang.org/x/xerrors" +) + +type DreamkastClientWrapper struct { + c DreamkastClient + nowFunc func() time.Time + dkEndpointUrl string +} + +func NewDreamkastClientWrapper(dkEndpointUrl string) (DreamkastClient, error) { + c, err := NewClient(dkEndpointUrl) + if err != nil { + return nil, xerrors.Errorf("message: %w", err) + } + return &DreamkastClientWrapper{ + c, + func() time.Time { return time.Now() }, + dkEndpointUrl, + }, nil +} + +func (w DreamkastClientWrapper) GenerateAuth0Token(ctx context.Context, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Audience string) error { + return w.c.GenerateAuth0Token(ctx, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Audience) +} + +func (w DreamkastClientWrapper) ListTracks(ctx context.Context, eventAbbr string) (ListTracksResp, error) { + metricsDao := metrics.DreamkastMetricsFromCtx(ctx) + now := w.nowFunc() + result, err := w.c.ListTracks(ctx, eventAbbr) + metricsDao.ListTracks(w.nowFunc().Sub(now)) + return result, err +} + +func (w DreamkastClientWrapper) ListTalks(ctx context.Context, eventAbbr string, trackId int32) (ListTalksResp, error) { + metricsDao := metrics.DreamkastMetricsFromCtx(ctx) + now := w.nowFunc() + result, err := w.c.ListTalks(ctx, eventAbbr, trackId) + metricsDao.ListTalks(w.nowFunc().Sub(now)) + return result, err +} + +func (w DreamkastClientWrapper) UpdateTalk(ctx context.Context, talkId int32, onAir bool) error { + metricsDao := metrics.DreamkastMetricsFromCtx(ctx) + now := w.nowFunc() + err := w.c.UpdateTalk(ctx, talkId, onAir) + metricsDao.UpdateTalk(w.nowFunc().Sub(now)) + return err + +} diff --git a/pkg/infrastructure/obsws/client.go b/pkg/infra/obsws/client.go similarity index 85% rename from pkg/infrastructure/obsws/client.go rename to pkg/infra/obsws/client.go index 9dc4504..591f851 100644 --- a/pkg/infrastructure/obsws/client.go +++ b/pkg/infra/obsws/client.go @@ -9,33 +9,33 @@ import ( "github.com/andreykaipov/goobs/api/requests/scenes" "golang.org/x/xerrors" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/obsws/lib" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/obsws/lib" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/utils" ) -type ClientIface interface { +type Client interface { GetHost() string ListScenes(ctx context.Context) ([]Scene, error) MoveSceneToNext(ctx context.Context) error GetRemainingTimeOnCurrentScene(ctx context.Context) (*DurationAndCursor, error) } -type Client struct { - client lib.ObsWsApi +type ClientImpl struct { + client lib.ObsWsClient host string password string } -func NewObsWebSocketClient(host, password string) (ClientIface, error) { +func NewObsWebSocketClient(host, password string) (Client, error) { c := lib.NewClient() if err := c.GenerateClient(host, password); err != nil { return nil, err } - return &Client{c, host, password}, nil + return &ClientImpl{c, host, password}, nil } -func (c *Client) GetHost() string { +func (c *ClientImpl) GetHost() string { return c.host } @@ -46,7 +46,7 @@ type Scene struct { } // ListScenes is output list of scenes. It is sorted order by as shown in OBS. -func (c *Client) ListScenes(ctx context.Context) ([]Scene, error) { +func (c *ClientImpl) ListScenes(ctx context.Context) ([]Scene, error) { if err := c.client.GenerateClient(c.host, c.password); err != nil { return nil, err } @@ -74,7 +74,7 @@ func (c *Client) ListScenes(ctx context.Context) ([]Scene, error) { return scenes, nil } -func (c *Client) MoveSceneToNext(ctx context.Context) error { +func (c *ClientImpl) MoveSceneToNext(ctx context.Context) error { logger := utils.GetLogger(ctx) if err := c.client.GenerateClient(c.host, c.password); err != nil { return err @@ -100,8 +100,8 @@ func (c *Client) MoveSceneToNext(ctx context.Context) error { } } if currentProgramFlag { - logger.Info("current scene is tha last scene.") - nextSceneName = _scenes[0].Name + logger.Info("current scene is the last scene.") + return nil } else if !nextProgramFlag { return fmt.Errorf("CurrentProgram is nothing") } @@ -116,11 +116,11 @@ func (c *Client) MoveSceneToNext(ctx context.Context) error { } type DurationAndCursor struct { - Duration float64 - Cursor float64 + DurationMilliSecond float64 + CursorMilliSecond float64 } -func (c *Client) GetRemainingTimeOnCurrentScene(ctx context.Context) (*DurationAndCursor, error) { +func (c *ClientImpl) GetRemainingTimeOnCurrentScene(ctx context.Context) (*DurationAndCursor, error) { _ = utils.GetLogger(ctx) if err := c.client.GenerateClient(c.host, c.password); err != nil { return nil, err diff --git a/pkg/infrastructure/obsws/lib/iface.go b/pkg/infra/obsws/lib/iface.go similarity index 96% rename from pkg/infrastructure/obsws/lib/iface.go rename to pkg/infra/obsws/lib/iface.go index 23a136b..9c363cf 100644 --- a/pkg/infrastructure/obsws/lib/iface.go +++ b/pkg/infra/obsws/lib/iface.go @@ -6,7 +6,7 @@ import ( "github.com/andreykaipov/goobs/api/requests/scenes" ) -type ObsWsApi interface { +type ObsWsClient interface { GenerateClient(host, password string) error MediaInputs() ObsWsMediaInputsApi Scenes() ObsWsScenesApi diff --git a/pkg/infrastructure/obsws/lib/client.go b/pkg/infra/obsws/lib/wrapper.go similarity index 53% rename from pkg/infrastructure/obsws/lib/client.go rename to pkg/infra/obsws/lib/wrapper.go index f20f5c4..56aa0ac 100644 --- a/pkg/infrastructure/obsws/lib/client.go +++ b/pkg/infra/obsws/lib/wrapper.go @@ -5,15 +5,15 @@ import ( "golang.org/x/xerrors" ) -type PrimitiveClient struct { +type ObsWsClientWrapper struct { client *goobs.Client } -func NewClient() ObsWsApi { - return &PrimitiveClient{} +func NewClient() ObsWsClient { + return &ObsWsClientWrapper{} } -func (c *PrimitiveClient) GenerateClient(host, password string) error { +func (c *ObsWsClientWrapper) GenerateClient(host, password string) error { if c.client != nil { return nil } @@ -25,14 +25,14 @@ func (c *PrimitiveClient) GenerateClient(host, password string) error { return nil } -func (c *PrimitiveClient) MediaInputs() ObsWsMediaInputsApi { +func (c *ObsWsClientWrapper) MediaInputs() ObsWsMediaInputsApi { return c.client.MediaInputs } -func (c *PrimitiveClient) Scenes() ObsWsScenesApi { +func (c *ObsWsClientWrapper) Scenes() ObsWsScenesApi { return c.client.Scenes } -func (c *PrimitiveClient) SceneItems() ObsWsSceneItemsApi { +func (c *ObsWsClientWrapper) SceneItems() ObsWsSceneItemsApi { return c.client.SceneItems } diff --git a/pkg/infrastructure/sharedmem/debuger.go b/pkg/infra/sharedmem/debuger.go similarity index 75% rename from pkg/infrastructure/sharedmem/debuger.go rename to pkg/infra/sharedmem/debuger.go index 468d428..de64f75 100644 --- a/pkg/infrastructure/sharedmem/debuger.go +++ b/pkg/infra/sharedmem/debuger.go @@ -2,6 +2,8 @@ package sharedmem import "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" +var _ DebuggerIface = (*Debugger)(nil) + type DebuggerIface interface { ListAutomation() map[int32]bool ListTalks() map[int32]model.Talks @@ -21,10 +23,10 @@ func (d Debugger) ListAutomation() map[int32]bool { func (d Debugger) ListTalks() map[int32]model.Talks { result := make(map[int32]model.Talks) - storageForTalksMutex.RLock() - defer storageForTalksMutex.RUnlock() - for k, v := range storageForTalks { - result[k] = v + storageForTrackMutex.RLock() + defer storageForTrackMutex.RUnlock() + for trackId, track := range storageForTrack { + result[trackId] = track.Talks } return result } diff --git a/pkg/infrastructure/sharedmem/reader.go b/pkg/infra/sharedmem/reader.go similarity index 64% rename from pkg/infrastructure/sharedmem/reader.go rename to pkg/infra/sharedmem/reader.go index d65932b..43382e6 100644 --- a/pkg/infrastructure/sharedmem/reader.go +++ b/pkg/infra/sharedmem/reader.go @@ -6,14 +6,16 @@ import ( "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" ) +var _ ReaderIface = (*Reader)(nil) + type ReaderIface interface { DisableAutomation(trackId int32) (bool, error) - Talks(trackId int32) (model.Talks, error) + Track(trackId int32) (*model.Track, error) } type Reader struct { UseStorageForDisableAutomation bool - UseStorageForTalks bool + UseStorageForTrack bool } func (r Reader) DisableAutomation(trackId int32) (bool, error) { @@ -29,15 +31,15 @@ func (r Reader) DisableAutomation(trackId int32) (bool, error) { return disabled, nil } -func (r Reader) Talks(trackId int32) (model.Talks, error) { - if !r.UseStorageForTalks { - return nil, fmt.Errorf("UseStorageForTalks was false") +func (r Reader) Track(trackId int32) (*model.Track, error) { + if !r.UseStorageForTrack { + return nil, fmt.Errorf("UseStorageForTrack was false") } - storageForTalksMutex.RLock() - defer storageForTalksMutex.RUnlock() - talks, ok := storageForTalks[trackId] + storageForTrackMutex.RLock() + defer storageForTrackMutex.RUnlock() + track, ok := storageForTrack[trackId] if !ok { return nil, fmt.Errorf("trackId %d is not found", trackId) } - return talks, nil + return &track, nil } diff --git a/pkg/infrastructure/sharedmem/storage.go b/pkg/infra/sharedmem/storage.go similarity index 52% rename from pkg/infrastructure/sharedmem/storage.go rename to pkg/infra/sharedmem/storage.go index 35af007..172bc2e 100644 --- a/pkg/infrastructure/sharedmem/storage.go +++ b/pkg/infra/sharedmem/storage.go @@ -10,11 +10,11 @@ import ( type StorageForDisableAutomation map[int32]bool // key is TrackId -type StorageForTalks map[int32]model.Talk +type StorageForTrack map[int32]model.Track var ( - storageForDisableAutomation = make(map[int32]bool) + storageForDisableAutomation = make(StorageForDisableAutomation) storageForDisableAutomationMutex sync.RWMutex - storageForTalks = make(map[int32]model.Talks) - storageForTalksMutex sync.RWMutex + storageForTrack = make(StorageForTrack) + storageForTrackMutex sync.RWMutex ) diff --git a/pkg/infrastructure/sharedmem/writer.go b/pkg/infra/sharedmem/writer.go similarity index 56% rename from pkg/infrastructure/sharedmem/writer.go rename to pkg/infra/sharedmem/writer.go index 0477ff8..a6863fd 100644 --- a/pkg/infrastructure/sharedmem/writer.go +++ b/pkg/infra/sharedmem/writer.go @@ -6,14 +6,16 @@ import ( "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" ) +var _ WriterIface = (*Writer)(nil) + type WriterIface interface { SetDisableAutomation(trackId int32, disabled bool) error - SetTalks(ttrackId int32, alks model.Talks) error + SetTrack(track model.Track) error } type Writer struct { UseStorageForDisableAutomation bool - UseStorageForTalks bool + UseStorageForTrack bool } func (w Writer) SetDisableAutomation(trackId int32, disabled bool) error { @@ -26,16 +28,12 @@ func (w Writer) SetDisableAutomation(trackId int32, disabled bool) error { return nil } -func (w Writer) SetTalks(trackId int32, talks model.Talks) error { - if !w.UseStorageForTalks { - return fmt.Errorf("UseStorageForTalks was false") - } - storageForTalksMutex.Lock() - defer storageForTalksMutex.Unlock() - currentTalk, _ := talks.GetCurrentTalk() - if currentTalk == nil { - return fmt.Errorf("Fail to GetCurrentTalk") +func (w Writer) SetTrack(track model.Track) error { + if !w.UseStorageForTrack { + return fmt.Errorf("UseStorageForTrack was false") } - storageForTalks[currentTalk.TrackId] = talks + storageForTrackMutex.Lock() + defer storageForTrackMutex.Unlock() + storageForTrack[track.Id] = track return nil } diff --git a/pkg/infrastructure/slack/slack.go b/pkg/infra/slack/client.go similarity index 71% rename from pkg/infrastructure/slack/slack.go rename to pkg/infra/slack/client.go index f629100..1f29187 100644 --- a/pkg/infrastructure/slack/slack.go +++ b/pkg/infra/slack/client.go @@ -7,26 +7,26 @@ import ( "golang.org/x/xerrors" ) -type ClientIface interface { +type Client interface { PostMessage(ctx context.Context, channel string, msg slack.Msg) error } -type Client struct { +type ClientImpl struct { client *slack.Client botUserId string } -func NewClient(botToken string) (ClientIface, error) { +func NewClient(botToken string) (Client, error) { client := slack.New(botToken) res, err := client.AuthTest() if err != nil { return nil, err } - return &Client{client, res.UserID}, nil + return &ClientImpl{client, res.UserID}, nil } -func (s *Client) PostMessage(ctx context.Context, channel string, msg slack.Msg) error { +func (s *ClientImpl) PostMessage(ctx context.Context, channel string, msg slack.Msg) error { _, _, err := s.client.PostMessageContext(ctx, channel, slack.MsgOptionText(msg.Text, false), slack.MsgOptionAttachments(msg.Attachments...), diff --git a/pkg/infrastructure/dreamkast/lib/iface.go b/pkg/infrastructure/dreamkast/lib/iface.go deleted file mode 100644 index 3849f18..0000000 --- a/pkg/infrastructure/dreamkast/lib/iface.go +++ /dev/null @@ -1,10 +0,0 @@ -package lib - -import "context" - -type DreamkastApi interface { - GenerateAuth0Token(ctx context.Context, auth0Domain, auth0ClientId, auth0ClientSecret, auth0Audience string) error - ListTracks(ctx context.Context, eventAbbr string) (ListTracksResp, error) - ListTalks(ctx context.Context, eventAbbr string, trackId int32) (ListTalksResp, error) - UpdateTalks(ctx context.Context, talkId int32, onAir bool) error -} diff --git a/pkg/metrics/cnd-operation-server.go b/pkg/metrics/cnd-operation-server.go new file mode 100644 index 0000000..7272f48 --- /dev/null +++ b/pkg/metrics/cnd-operation-server.go @@ -0,0 +1,25 @@ +package metrics + +import ( + "github.com/labstack/echo/v4" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + "golang.org/x/xerrors" +) + +func RunCndOperationServer(addr string) error { + m := echo.New() + reg := prometheus.NewRegistry() + RegisterCndOperationServer(reg) + m.GET("/metrics", + echo.WrapHandler(promhttp.HandlerFor(reg, promhttp.HandlerOpts{}))) + if err := m.Start(addr); err != nil { + return xerrors.Errorf("message: %w", err) + } + return nil +} + +func RegisterCndOperationServer(registry prometheus.Registerer) { + const subsystem = "server" + registerDreamkast(registry, subsystem) +} diff --git a/pkg/metrics/dreamkast.go b/pkg/metrics/dreamkast.go new file mode 100644 index 0000000..738c720 --- /dev/null +++ b/pkg/metrics/dreamkast.go @@ -0,0 +1,89 @@ +package metrics + +import ( + "context" + "time" + + "github.com/prometheus/client_golang/prometheus" +) + +// +// Metrics +// + +var ( + dreamkastRequestSummaryVec prometheus.SummaryVec +) + +func registerDreamkast(registry prometheus.Registerer, subsystem string) { + dreamkastRequestSummaryVec = *prometheus.NewSummaryVec(prometheus.SummaryOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "request", + }, []string{"endpointUrl", "kind"}) +} + +// +// Interface +// + +type DreamkastMetricsIface interface { + ListTracks(time.Duration) + ListTalks(time.Duration) + UpdateTalk(time.Duration) +} + +// +// Data Access Object +// + +type DreamkastMetricsDao struct { + endpointUrl string +} + +func NewDreamkastMetricsDao(endpointUrl string) *DreamkastMetricsDao { + return &DreamkastMetricsDao{endpointUrl} +} + +func (dao DreamkastMetricsDao) ListTracks(d time.Duration) { + dreamkastRequestSummaryVec. + WithLabelValues(dao.endpointUrl, "listTracks").Observe(float64(d)) +} + +func (dao DreamkastMetricsDao) ListTalks(d time.Duration) { + dreamkastRequestSummaryVec. + WithLabelValues(dao.endpointUrl, "listTalks").Observe(float64(d)) +} + +func (dao DreamkastMetricsDao) UpdateTalk(d time.Duration) { + dreamkastRequestSummaryVec. + WithLabelValues(dao.endpointUrl, "updateTalk").Observe(float64(d)) +} + +// +// Fake Object +// + +type DreamkastMetricsFake struct{} + +func (DreamkastMetricsFake) ListTracks(time.Duration) {} +func (DreamkastMetricsFake) ListTalks(time.Duration) {} +func (DreamkastMetricsFake) UpdateTalk(time.Duration) {} + +// +// Utilities +// + +var ctxKeyDreamkastMetrics = contextKey{} + +func SetDreamkastMetricsToCtx(ctx context.Context, m DreamkastMetricsIface) context.Context { + return context.WithValue(ctx, ctxKeyDreamkastMetrics, m) +} + +func DreamkastMetricsFromCtx(ctx context.Context) DreamkastMetricsIface { + dao, ok := ctx.Value(ctxKeyDreamkastMetrics).(DreamkastMetricsDao) + if !ok { + return &DreamkastMetricsFake{} + } + return dao +} diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go new file mode 100644 index 0000000..ce94b57 --- /dev/null +++ b/pkg/metrics/metrics.go @@ -0,0 +1,5 @@ +package metrics + +const namespace = "broadcast" + +type contextKey struct{} diff --git a/pkg/model/talk.go b/pkg/model/talk.go index 11b548b..75bcd11 100644 --- a/pkg/model/talk.go +++ b/pkg/model/talk.go @@ -21,6 +21,10 @@ const ( dateLayout = "2006-01-02" ) +// +// Talks +// + type Talks []Talk func (t Talk) convertTalkType(title string, presentationMethod *string) (TalkType, error) { @@ -48,15 +52,25 @@ func (t Talk) GetTalkType(title string, presentationMethod *string) (TalkType, e func (ts Talks) isStartNextTalkSoon() bool { now := nowFunc() - for _, talk := range ts { - if now.After(talk.StartAt) { - diffTime := time.Duration(talk.EndAt.Sub(now)) - if 0 < diffTime && diffTime <= utils.HowManyMinutesUntilNotify { - return true - } + nextTalk, err := ts.GetNextTalk() + if err != nil { + return false + } + return nextTalk.StartAt.Sub(now) <= untilNotify +} + +func (ts Talks) HasNotify(ctx context.Context, rc *db.RedisClient) (bool, error) { + // 次のtalkがもうすぐ始まるか判定し,まだ通知が行われていない場合は通知を行う. + if ts.isStartNextTalkSoon() { + result := rc.Client.Get(ctx, db.NextTalkNotificationKey) + if result.Err() != nil { + return false, result.Err() + } + if result != nil { + return false, nil } } - return false + return true, nil } func (ts Talks) HasNotify(ctx context.Context, rc *db.RedisClient) (bool, error) { @@ -74,6 +88,9 @@ func (ts Talks) HasNotify(ctx context.Context, rc *db.RedisClient) (bool, error) } func (ts Talks) GetCurrentTalk() (*Talk, error) { + if len(ts) == 0 { + return nil, fmt.Errorf("Talks is empty") + } now := nowFunc() for _, talk := range ts { if now.After(talk.StartAt) && now.Before(talk.EndAt) { @@ -83,27 +100,36 @@ func (ts Talks) GetCurrentTalk() (*Talk, error) { return nil, fmt.Errorf("current talk not found") } -func (ts Talks) GetNextTalk(currentTalk *Talk) (*Talk, error) { +func (ts Talks) GetNextTalk() (*Talk, error) { + if len(ts) == 0 { + return nil, fmt.Errorf("Talks is empty") + } + + currentTalk, err := ts.GetCurrentTalk() + if err != nil { + // When currentTalk is none, + // if now is before event then return Talks[0] else raise an error + now := nowFunc() + lastTalk := ts[len(ts)-1] + if now.After(lastTalk.EndAt) { + return nil, fmt.Errorf("talks has already finished") + } + return &ts[0], nil + } for i, talk := range ts { if talk.Id == currentTalk.Id { if i+1 == len(ts) { - return nil, fmt.Errorf("this talk is last") + return nil, fmt.Errorf("Current talk is last") } return &ts[i+1], nil } } - return nil, fmt.Errorf("next talk not found") + return nil, fmt.Errorf("Something Wrong") } -func (t Talk) GetActualStartAtAndEndAt(conferenceDayDate string, startAt, endAt time.Time) (time.Time, time.Time, error) { - cDate, err := time.Parse(dateLayout, conferenceDayDate) - if err != nil { - return time.Time{}, time.Time{}, err - } - return cDate.Add(time.Duration(startAt.Hour()*int(time.Hour) + startAt.Minute()*int(time.Minute) + startAt.Second()*int(time.Second))), - cDate.Add(time.Duration(endAt.Hour()*int(time.Hour) + endAt.Minute()*int(time.Minute) + endAt.Second()*int(time.Second))), - nil -} +// +// Talk +// type Talk struct { Id int32 @@ -116,3 +142,80 @@ type Talk struct { StartAt time.Time EndAt time.Time } + +func (t Talk) GetTalkType(title string, presentationMethod *string) (TalkType, error) { + return t.convertTalkType(title, presentationMethod) +} + +func (t Talk) GetTalkTypeName() string { + var typeName string + switch t.Type { + case TalkType_OnlineSession: + typeName = "オンライン登壇" + case TalkType_RecordingSession: + typeName = "事前収録" + case TalkType_Opening: + typeName = "Opening" + case TalkType_Ending: + typeName = "Closing" + case TalkType_Commercial: + typeName = "CM" + } + return typeName +} + +func (t Talk) IsOnDemand() bool { + return t.Type == TalkType_OnlineSession || t.Type == TalkType_Opening || t.Type == TalkType_Ending +} + +func (t Talk) GetActualStartAtAndEndAt(conferenceDayDate string, startAt, endAt time.Time) (time.Time, time.Time, error) { + cDate, err := time.Parse(dateLayout, conferenceDayDate) + if err != nil { + return time.Time{}, time.Time{}, err + } + return cDate.Add(time.Duration(startAt.Hour()*int(time.Hour) + startAt.Minute()*int(time.Minute) + startAt.Second()*int(time.Second))), + cDate.Add(time.Duration(endAt.Hour()*int(time.Hour) + endAt.Minute()*int(time.Minute) + endAt.Second()*int(time.Second))), + nil +} + +func (t Talk) convertTalkType(title string, presentationMethod *string) (TalkType, error) { + switch { + case presentationMethod == nil: + switch title { + case "Opening": + return TalkType_Opening, nil + case "休憩": + return TalkType_Commercial, nil + case "Closing": + return TalkType_Ending, nil + } + case *presentationMethod == "オンライン登壇": + return TalkType_OnlineSession, nil + case *presentationMethod == "事前収録": + return TalkType_RecordingSession, nil + } + return 0, fmt.Errorf("model.convertTalkType not found. title: %s, presentationMethod: %s", title, *presentationMethod) +} + +// +// CurrentAndNextTalk +// + +type CurrentAndNextTalk struct { + Current Talk + Next Talk +} + +func (m CurrentAndNextTalk) TrackId() int32 { + if m.Current.TrackId != 0 { + return m.Current.TrackId + } + return m.Next.TrackId +} + +func (m CurrentAndNextTalk) TrackName() string { + if m.Current.TrackName != "" { + return m.Current.TrackName + } + return m.Next.TrackName +} diff --git a/pkg/model/talk_test.go b/pkg/model/talk_test.go index 5245186..f4fa4b3 100644 --- a/pkg/model/talk_test.go +++ b/pkg/model/talk_test.go @@ -10,7 +10,10 @@ import ( "github.com/cloudnativedaysjp/cnd-operation-server/pkg/testutils" ) -const ISO8601ExtendedLayout = "2006-01-02T15:04:05" +const ( + test_ISO8601ExtendedLayout = "2006-01-02T15:04:05" + test_howManyMinutesUntilNotify = 5 * time.Minute +) func TestTalk_GetTalkType(t *testing.T) { talk := &Talk{} @@ -79,7 +82,7 @@ func TestTalk_GetTalkType(t *testing.T) { } func setTestTime(v string) time.Time { - pt, err := time.Parse(ISO8601ExtendedLayout, v) + pt, err := time.Parse(test_ISO8601ExtendedLayout, v) if err != nil { panic(err) } @@ -184,6 +187,17 @@ func TestTalk_HasNotify(t *testing.T) { StartAt: setTestTime("2022-10-01T12:00:00"), EndAt: setTestTime("2022-10-01T12:30:00"), }, + Talk{ + Id: 4, + TalkName: "talk4", + TrackId: 1, + TrackName: "track1", + EventAbbr: "test event", + SpeakerNames: []string{"speakerA", "speaker"}, + Type: 1, + StartAt: setTestTime("2022-10-01T12:30:00"), + EndAt: setTestTime("2022-10-01T13:00:00"), + }, }, want: true, wantErr: false, @@ -331,17 +345,6 @@ func TestTalk_GetNextTalk(t *testing.T) { }, { name: "not found next talk", - args: &Talk{ - Id: 999, - TalkName: "talk999", - TrackId: 1, - TrackName: "track1", - EventAbbr: "test event", - SpeakerNames: []string{"speakerA", "speaker"}, - Type: 1, - StartAt: setTestTime("2022-10-01T12:00:00"), - EndAt: setTestTime("2022-10-01T12:30:00"), - }, talks: Talks{ Talk{ Id: 1, @@ -381,17 +384,6 @@ func TestTalk_GetNextTalk(t *testing.T) { }, { name: "last talk", - args: &Talk{ - Id: 3, - TalkName: "talk3", - TrackId: 1, - TrackName: "track1", - EventAbbr: "test event", - SpeakerNames: []string{"speakerA", "speaker"}, - Type: 1, - StartAt: setTestTime("2022-10-01T12:00:00"), - EndAt: setTestTime("2022-10-01T12:30:00"), - }, talks: Talks{ Talk{ Id: 1, @@ -431,17 +423,6 @@ func TestTalk_GetNextTalk(t *testing.T) { }, { name: "found next talk", - args: &Talk{ - Id: 3, - TalkName: "talk3", - TrackId: 1, - TrackName: "track1", - EventAbbr: "test event", - SpeakerNames: []string{"speakerA", "speaker"}, - Type: 1, - StartAt: setTestTime("2022-10-01T12:00:00"), - EndAt: setTestTime("2022-10-01T12:30:00"), - }, talks: Talks{ Talk{ Id: 1, @@ -554,6 +535,7 @@ func TestTalk_GetActualStartAtAndEndAt(t *testing.T) { t.Errorf("Talk.GetActualStartAtAndEndAt() error = %v, wantStatAt = %v, wantEndAt = %v,", err, tt.wantStartAt, tt.wantEndAt) return } + }) } } diff --git a/pkg/model/track.go b/pkg/model/track.go new file mode 100644 index 0000000..4d6741e --- /dev/null +++ b/pkg/model/track.go @@ -0,0 +1,7 @@ +package model + +type Track struct { + Id int32 + Name string + Talks Talks +} diff --git a/pkg/notifier/controller.go b/pkg/notifier/controller.go index 6d3dfb3..e1601b2 100644 --- a/pkg/notifier/controller.go +++ b/pkg/notifier/controller.go @@ -7,48 +7,32 @@ import ( "github.com/go-logr/logr" "golang.org/x/xerrors" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/slack" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/slack" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" ) type Controller struct { logger logr.Logger - slackClients map[int32]slack.ClientIface + slackClients map[int32]slack.Client channelIds map[int32]string } func NewController(logger logr.Logger, - slackClients map[int32]slack.ClientIface, channelIds map[int32]string, + slackClients map[int32]slack.Client, channelIds map[int32]string, ) *Controller { return &Controller{logger, slackClients, channelIds} } -func (c *Controller) Receive(talk model.Talk) error { +func (c *Controller) Receive(m model.CurrentAndNextTalk) error { ctx := logr.NewContext(context.Background(), c.logger) - slackClient := c.slackClients[talk.TrackId] - switch talk.Type { - case model.TalkType_OnlineSession: - if err := slackClient.PostMessage(ctx, c.channelIds[talk.TrackId], viewOnlineSession(talk)); err != nil { - return xerrors.Errorf("message: %w", err) - } - case model.TalkType_RecordingSession: - if err := slackClient.PostMessage(ctx, c.channelIds[talk.TrackId], viewRecordingSession(talk)); err != nil { - return xerrors.Errorf("message: %w", err) - } - case model.TalkType_Commercial: - if err := slackClient.PostMessage(ctx, c.channelIds[talk.TrackId], viewCommercial(talk)); err != nil { - return xerrors.Errorf("message: %w", err) - } - case model.TalkType_Opening: - if err := slackClient.PostMessage(ctx, c.channelIds[talk.TrackId], viewOpening(talk)); err != nil { - return xerrors.Errorf("message: %w", err) - } - case model.TalkType_Ending: - if err := slackClient.PostMessage(ctx, c.channelIds[talk.TrackId], viewEnding(talk)); err != nil { - return xerrors.Errorf("message: %w", err) - } - default: - return fmt.Errorf("unknown talk type") + slackClient := c.slackClients[m.TrackId()] + slackChannelId, ok := c.channelIds[m.TrackId()] + if !ok { + c.logger.Info(fmt.Sprintf("notifier is disabled on trackId %d", m.TrackId())) + return nil + } + if err := slackClient.PostMessage(ctx, slackChannelId, ViewSession(m)); err != nil { + return xerrors.Errorf("message: %w", err) } return nil } diff --git a/pkg/notifier/notifier.go b/pkg/notifier/notifier.go index 4dd50c1..d03bc59 100644 --- a/pkg/notifier/notifier.go +++ b/pkg/notifier/notifier.go @@ -8,8 +8,8 @@ import ( "go.uber.org/zap" "golang.org/x/xerrors" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/slack" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/db" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/slack" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" ) @@ -20,7 +20,7 @@ type Config struct { Debug bool Targets []Target RedisHost string - NotificationEventReceiveChan <-chan model.Talk + NotificationEventReceiveChan <-chan model.CurrentAndNextTalk } type Target struct { @@ -43,7 +43,7 @@ func Run(ctx context.Context, conf Config) error { logger := zapr.NewLogger(zapLogger).WithName(componentName) ctx = logr.NewContext(ctx, logger) - slackClients := make(map[int32]slack.ClientIface) + slackClients := make(map[int32]slack.Client) channelIds := make(map[int32]string) redisClient, err := db.NewRedisClient(conf.RedisHost) @@ -53,6 +53,7 @@ func Run(ctx context.Context, conf Config) error { for _, target := range conf.Targets { slackClients[target.TrackId], err = slack.NewClient(target.SlackBotToken) if err != nil { + logger.Error(err, "slack.NewClient() was failed") return xerrors.Errorf("message: %w", err) } channelIds[target.TrackId] = target.SlackChannelId diff --git a/pkg/notifier/view.go b/pkg/notifier/view.go index 5bc8baf..64233d4 100644 --- a/pkg/notifier/view.go +++ b/pkg/notifier/view.go @@ -1,32 +1,164 @@ package notifier import ( + "fmt" + "strings" + "github.com/slack-go/slack" + seaman_api "github.com/cloudnativedaysjp/seaman/seaman/api" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" ) -func viewOnlineSession(talk model.Talk) slack.Msg { - // TODO (#6) - return slack.Msg{Text: "online session"} -} - -func viewRecordingSession(talk model.Talk) slack.Msg { - // TODO (#6) - return slack.Msg{Text: "recording session"} +func ViewSession(m model.CurrentAndNextTalk) slack.Msg { + result, _ := viewSession(m) + return result } -func viewCommercial(talk model.Talk) slack.Msg { - // TODO (#6) - return slack.Msg{Text: "commercial"} -} +func viewSession(m model.CurrentAndNextTalk) (slack.Msg, error) { + currentTalk := m.Current + nextTalk := m.Next -func viewOpening(talk model.Talk) slack.Msg { - // TODO (#6) - return slack.Msg{Text: "opening"} -} + accessory := &slack.Accessory{} + if currentTalk.IsOnDemand() || nextTalk.IsOnDemand() { + accessory = &slack.Accessory{ + ButtonElement: &slack.ButtonBlockElement{ + Type: slack.METButton, + ActionID: seaman_api.ActIdBroadcast_SceneNext, + Value: seaman_api.Track{Id: m.TrackId(), Name: m.TrackName()}.String(), + Text: &slack.TextBlockObject{ + Type: "plain_text", + Text: "Switching", + }, + Style: slack.StylePrimary, + Confirm: &slack.ConfirmationBlockObject{ + Title: &slack.TextBlockObject{ + Type: "plain_text", + Text: "Move to Next Scene", + }, + Text: &slack.TextBlockObject{ + Type: "plain_text", + Text: "Are you sure?", + }, + Confirm: &slack.TextBlockObject{ + Type: "plain_text", + Text: "OK", + }, + Deny: &slack.TextBlockObject{ + Type: "plain_text", + Text: "Cancel", + }, + }, + }, + } + } -func viewEnding(talk model.Talk) slack.Msg { - // TODO (#6) - return slack.Msg{Text: "ending"} + return castFromMapToMsg( + map[string]interface{}{ + "blocks": []interface{}{ + map[string]interface{}{ + "type": "divider", + }, + map[string]interface{}{ + "type": "context", + "elements": []interface{}{ + map[string]interface{}{ + "emoji": true, + "type": "plain_text", + "text": "Current Talk", + }, + }, + }, + map[string]interface{}{ + "type": "section", + "fields": []interface{}{ + map[string]interface{}{ + "type": "plain_text", + "text": fmt.Sprintf("Track %s", currentTalk.TrackName), + "emoji": true, + }, + map[string]interface{}{ + "type": "plain_text", + "text": fmt.Sprintf("%s - %s", + currentTalk.StartAt.Format("15:04"), + currentTalk.EndAt.Format("15:04"), + ), + "emoji": true, + }, + map[string]interface{}{ + "type": "plain_text", + "text": fmt.Sprintf("Type: %s", currentTalk.GetTalkTypeName()), + "emoji": true, + }, + map[string]interface{}{ + "emoji": true, + "type": "plain_text", + "text": fmt.Sprintf("Speaker: %s", + strings.Join(currentTalk.SpeakerNames, ", ")), + }, + }, + }, + map[string]interface{}{ + "type": "section", + "text": map[string]interface{}{ + "type": "mrkdwn", + "text": fmt.Sprintf("Title: <%s/%s/talks/%d|%s>", + eventUrlBase, currentTalk.EventAbbr, currentTalk.Id, currentTalk.TalkName), + }, + }, + map[string]interface{}{ + "type": "divider", + }, + map[string]interface{}{ + "type": "context", + "elements": []interface{}{ + map[string]interface{}{ + "type": "plain_text", + "text": "Next Talk", + "emoji": true, + }, + }, + }, + map[string]interface{}{ + "type": "section", + "fields": []interface{}{ + map[string]interface{}{ + "type": "plain_text", + "text": fmt.Sprintf("Track %s", nextTalk.TrackName), + "emoji": true, + }, + map[string]interface{}{ + "type": "plain_text", + "text": fmt.Sprintf("%s - %s", + nextTalk.StartAt.Format("15:04"), + nextTalk.EndAt.Format("15:04"), + ), + "emoji": true, + }, + map[string]interface{}{ + "type": "plain_text", + "text": fmt.Sprintf("Type: %s", nextTalk.GetTalkTypeName()), + "emoji": true, + }, + map[string]interface{}{ + "type": "plain_text", + "text": fmt.Sprintf("Speaker: %s", + strings.Join(nextTalk.SpeakerNames, ", ")), + "emoji": true, + }, + }, + }, + map[string]interface{}{ + "accessory": accessory, + "type": "section", + "text": map[string]interface{}{ + "type": "mrkdwn", + "text": fmt.Sprintf("Title: <%s/%s/talks/%d|%s>", + eventUrlBase, nextTalk.EventAbbr, nextTalk.Id, nextTalk.TalkName), + }, + }, + }, + }, + ) } diff --git a/pkg/notifier/view_helper.go b/pkg/notifier/view_helper.go new file mode 100644 index 0000000..1f742ab --- /dev/null +++ b/pkg/notifier/view_helper.go @@ -0,0 +1,32 @@ +package notifier + +import ( + "encoding/json" + + "github.com/slack-go/slack" +) + +const ( + // URL + eventUrlBase = "https://event.cloudnativedays.jp" +) + +func castFromMapToMsg(m map[string]interface{}) (slack.Msg, error) { + b, err := json.Marshal(m) + if err != nil { + return slack.Msg{}, err + } + var result slack.Msg + if err := json.Unmarshal(b, &result); err != nil { + return slack.Msg{}, err + } + return result, nil +} + +func castFromStringToMsg(s string) (slack.Msg, error) { + var result slack.Msg + if err := json.Unmarshal([]byte(s), &result); err != nil { + return slack.Msg{}, err + } + return result, nil +} diff --git a/pkg/notifier/view_test.go b/pkg/notifier/view_test.go new file mode 100644 index 0000000..97fb3b7 --- /dev/null +++ b/pkg/notifier/view_test.go @@ -0,0 +1,175 @@ +package notifier + +import ( + "testing" + "time" + + "github.com/google/go-cmp/cmp" + + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/model" +) + +func Test_viewSession(t *testing.T) { + t.Run("test", func(t *testing.T) { + expectedStr := ` +{ + "blocks": [ + { + "type": "divider" + }, + { + "type": "context", + "elements": [ + { + "type": "plain_text", + "text": "Current Talk", + "emoji": true + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "plain_text", + "text": "Track A", + "emoji": true + }, + { + "type": "plain_text", + "text": "10:00 - 11:00", + "emoji": true + }, + { + "type": "plain_text", + "text": "Type: オンライン登壇", + "emoji": true + }, + { + "type": "plain_text", + "text": "Speaker: kanata", + "emoji": true + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Title: " + } + }, + { + "type": "divider" + }, + { + "type": "context", + "elements": [ + { + "type": "plain_text", + "text": "Next Talk", + "emoji": true + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "plain_text", + "text": "Track A", + "emoji": true + }, + { + "type": "plain_text", + "text": "11:00 - 12:30", + "emoji": true + }, + { + "type": "plain_text", + "text": "Type: 事前収録", + "emoji": true + }, + { + "type": "plain_text", + "text": "Speaker: hoge, fuga", + "emoji": true + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Title: " + }, + "accessory": { + "type": "button", + "action_id": "broadcast_scenenext", + "value": "1__A", + "text": { + "type": "plain_text", + "text": "Switching" + }, + "style": "primary", + "confirm": { + "title": { + "type": "plain_text", + "text": "Move to Next Scene" + }, + "text": { + "type": "plain_text", + "text": "Are you sure?" + }, + "confirm": { + "type": "plain_text", + "text": "OK" + }, + "deny": { + "type": "plain_text", + "text": "Cancel" + } + } + } + } + ] +} +` + expected, err := castFromStringToMsg(expectedStr) + if err != nil { + t.Fatal(err) + } + + got, err := viewSession(model.CurrentAndNextTalk{ + Current: model.Talk{ + Id: 10001, + TalkName: "ものすごい発表", + TrackId: 1, + TrackName: "A", + StartAt: time.Date(2022, 10, 1, 10, 0, 0, 0, time.FixedZone("Asia/Tokyo", 9*60*60)), + EndAt: time.Date(2022, 10, 1, 11, 0, 0, 0, time.FixedZone("Asia/Tokyo", 9*60*60)), + Type: model.TalkType_OnlineSession, + SpeakerNames: []string{"kanata"}, + EventAbbr: "cndt2101", + }, + Next: model.Talk{ + Id: 10002, + TalkName: "さらにものすごい発表", + TrackId: 1, + TrackName: "A", + StartAt: time.Date(2022, 10, 1, 11, 0, 0, 0, time.FixedZone("Asia/Tokyo", 9*60*60)), + EndAt: time.Date(2022, 10, 1, 12, 30, 0, 0, time.FixedZone("Asia/Tokyo", 9*60*60)), + Type: model.TalkType_RecordingSession, + SpeakerNames: []string{"hoge", "fuga"}, + EventAbbr: "cndt2101", + }, + }) + if err != nil { + t.Errorf("error = %v", err) + return + } + if diff := cmp.Diff(expected, got); diff != "" { + t.Errorf(diff) + } + }) +} diff --git a/pkg/obswatcher/obswatcher.go b/pkg/obswatcher/obswatcher.go index 4ae2a50..ba2d14e 100644 --- a/pkg/obswatcher/obswatcher.go +++ b/pkg/obswatcher/obswatcher.go @@ -11,8 +11,8 @@ import ( "golang.org/x/sync/errgroup" "golang.org/x/xerrors" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/obsws" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/sharedmem" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/obsws" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/sharedmem" "github.com/cloudnativedaysjp/cnd-operation-server/pkg/utils" ) @@ -48,7 +48,7 @@ func Run(ctx context.Context, conf Config) error { logger := zapr.NewLogger(zapLogger).WithName(componentName) ctx = logr.NewContext(ctx, logger) - mr := &sharedmem.Reader{UseStorageForTalks: true, UseStorageForDisableAutomation: true} + mr := &sharedmem.Reader{UseStorageForDisableAutomation: true} eg, ctx := errgroup.WithContext(ctx) for _, obs := range conf.Obs { @@ -69,12 +69,15 @@ func Run(ctx context.Context, conf Config) error { } func watch(ctx context.Context, trackId int32, - obswsClient obsws.ClientIface, mr sharedmem.ReaderIface, + obswsClient obsws.Client, mr sharedmem.ReaderIface, ) func() error { return func() error { logger := utils.GetLogger(ctx).WithValues("trackId", trackId) - tick := time.NewTicker(syncPeriod) + tick := time.NewTicker(syncPeriod) + if err := procedure(ctx, trackId, obswsClient, mr); err != nil { + return xerrors.Errorf("message: %w", err) + } for { select { case <-ctx.Done(): @@ -90,7 +93,7 @@ func watch(ctx context.Context, trackId int32, } func procedure(ctx context.Context, trackId int32, - obswsClient obsws.ClientIface, mr sharedmem.ReaderIface, + obswsClient obsws.Client, mr sharedmem.ReaderIface, ) error { logger := utils.GetLogger(ctx).WithValues("trackId", trackId) @@ -107,15 +110,22 @@ func procedure(ctx context.Context, trackId int32, logger.Error(xerrors.Errorf("message: %w", err), "obswsClient.GetRemainingTimeOnCurrentScene() was failed") return nil } - remainingTime := t.Duration - t.Cursor - if float64(startPreparetionPeriod) > remainingTime { + remainingMilliSecond := t.DurationMilliSecond - t.CursorMilliSecond + + if float64(startPreparetionPeriod/time.Millisecond) < remainingMilliSecond { + logger.Info(fmt.Sprintf("remainingTime on current Scene's MediaInput is over %ds: continue", + startPreparetionPeriod/time.Second), + "duration", t.DurationMilliSecond/float64(time.Millisecond), + "cursor", t.CursorMilliSecond/float64(time.Millisecond)) return nil } - logger.Info(fmt.Sprintf("remainingTime on current Scene's MediaInput is within %d", - startPreparetionPeriod), "duration", t.Duration, "cursor", t.Cursor) + logger.Info(fmt.Sprintf("remainingTime on current Scene's MediaInput is within %ds", + startPreparetionPeriod/time.Second), + "duration", t.DurationMilliSecond/float64(time.Millisecond), + "cursor", t.CursorMilliSecond/float64(time.Millisecond)) // sleep until MediaInput is finished - time.Sleep(time.Duration(remainingTime) * time.Second) + time.Sleep(time.Duration(remainingMilliSecond) * time.Millisecond) if err := obswsClient.MoveSceneToNext(context.Background()); err != nil { logger.Error(xerrors.Errorf("message: %w", err), "obswsClient.MoveSceneToNext() on automated task was failed") return nil diff --git a/pkg/utils/const.go b/pkg/utils/const.go deleted file mode 100644 index 4e856e2..0000000 --- a/pkg/utils/const.go +++ /dev/null @@ -1,5 +0,0 @@ -package utils - -import "time" - -const HowManyMinutesUntilNotify = 5 * time.Minute diff --git a/pkg/ws-proxy/schema/track.pb.go b/pkg/ws-proxy/schema/track.pb.go index 4ae7ac8..540b54d 100644 --- a/pkg/ws-proxy/schema/track.pb.go +++ b/pkg/ws-proxy/schema/track.pb.go @@ -26,9 +26,10 @@ type Track struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TrackId int32 `protobuf:"varint,1,opt,name=trackId,proto3" json:"trackId,omitempty"` - ObsHost string `protobuf:"bytes,2,opt,name=obsHost,proto3" json:"obsHost,omitempty"` - Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + TrackId int32 `protobuf:"varint,1,opt,name=trackId,proto3" json:"trackId,omitempty"` + TrackName string `protobuf:"bytes,2,opt,name=trackName,proto3" json:"trackName,omitempty"` + ObsHost string `protobuf:"bytes,3,opt,name=obsHost,proto3" json:"obsHost,omitempty"` + Enabled bool `protobuf:"varint,4,opt,name=enabled,proto3" json:"enabled,omitempty"` } func (x *Track) Reset() { @@ -70,6 +71,13 @@ func (x *Track) GetTrackId() int32 { return 0 } +func (x *Track) GetTrackName() string { + if x != nil { + return x.TrackName + } + return "" +} + func (x *Track) GetObsHost() string { if x != nil { return x.ObsHost @@ -131,65 +139,18 @@ func (x *GetTrackRequest) GetTrackId() int32 { return 0 } -type GetTrackResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Track *Track `protobuf:"bytes,1,opt,name=track,proto3" json:"track,omitempty"` -} - -func (x *GetTrackResponse) Reset() { - *x = GetTrackResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetTrackResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetTrackResponse) ProtoMessage() {} - -func (x *GetTrackResponse) ProtoReflect() protoreflect.Message { - mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetTrackResponse.ProtoReflect.Descriptor instead. -func (*GetTrackResponse) Descriptor() ([]byte, []int) { - return file_pkg_ws_proxy_schema_track_proto_rawDescGZIP(), []int{2} -} - -func (x *GetTrackResponse) GetTrack() *Track { - if x != nil { - return x.Track - } - return nil -} - type ListTrackResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Track []*Track `protobuf:"bytes,1,rep,name=track,proto3" json:"track,omitempty"` + Tracks []*Track `protobuf:"bytes,1,rep,name=tracks,proto3" json:"tracks,omitempty"` } func (x *ListTrackResponse) Reset() { *x = ListTrackResponse{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[3] + mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -202,7 +163,7 @@ func (x *ListTrackResponse) String() string { func (*ListTrackResponse) ProtoMessage() {} func (x *ListTrackResponse) ProtoReflect() protoreflect.Message { - mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[3] + mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -215,12 +176,12 @@ func (x *ListTrackResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListTrackResponse.ProtoReflect.Descriptor instead. func (*ListTrackResponse) Descriptor() ([]byte, []int) { - return file_pkg_ws_proxy_schema_track_proto_rawDescGZIP(), []int{3} + return file_pkg_ws_proxy_schema_track_proto_rawDescGZIP(), []int{2} } -func (x *ListTrackResponse) GetTrack() []*Track { +func (x *ListTrackResponse) GetTracks() []*Track { if x != nil { - return x.Track + return x.Tracks } return nil } @@ -236,7 +197,7 @@ type SwitchAutomationRequest struct { func (x *SwitchAutomationRequest) Reset() { *x = SwitchAutomationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[4] + mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -249,7 +210,7 @@ func (x *SwitchAutomationRequest) String() string { func (*SwitchAutomationRequest) ProtoMessage() {} func (x *SwitchAutomationRequest) ProtoReflect() protoreflect.Message { - mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[4] + mi := &file_pkg_ws_proxy_schema_track_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -262,7 +223,7 @@ func (x *SwitchAutomationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SwitchAutomationRequest.ProtoReflect.Descriptor instead. func (*SwitchAutomationRequest) Descriptor() ([]byte, []int) { - return file_pkg_ws_proxy_schema_track_proto_rawDescGZIP(), []int{4} + return file_pkg_ws_proxy_schema_track_proto_rawDescGZIP(), []int{3} } func (x *SwitchAutomationRequest) GetTrackId() int32 { @@ -279,50 +240,46 @@ var file_pkg_ws_proxy_schema_track_proto_rawDesc = []byte{ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x55, 0x0a, 0x05, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x73, 0x0a, 0x05, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x62, 0x73, - 0x48, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x62, 0x73, 0x48, - 0x6f, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x2b, 0x0a, - 0x0f, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x10, 0x47, 0x65, - 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, - 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x05, 0x74, 0x72, - 0x61, 0x63, 0x6b, 0x22, 0x38, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, - 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x22, 0x33, 0x0a, - 0x17, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, - 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, - 0x49, 0x64, 0x32, 0xb0, 0x02, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, - 0x17, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x63, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, - 0x6b, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x10, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x11, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, - 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x64, - 0x61, 0x79, 0x73, 0x6a, 0x70, 0x2f, 0x63, 0x6e, 0x64, 0x2d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x77, - 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x72, 0x61, + 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x72, + 0x61, 0x63, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x62, 0x73, 0x48, 0x6f, + 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x62, 0x73, 0x48, 0x6f, 0x73, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x2b, 0x0a, 0x0f, 0x47, + 0x65, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, + 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, + 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, + 0x06, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x06, 0x74, 0x72, + 0x61, 0x63, 0x6b, 0x73, 0x22, 0x33, 0x0a, 0x17, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, + 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x32, 0x93, 0x02, 0x0a, 0x0c, 0x54, 0x72, + 0x61, 0x63, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x08, 0x47, 0x65, + 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x17, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, + 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0d, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x22, 0x00, + 0x12, 0x40, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x44, 0x0a, 0x10, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x75, 0x74, 0x6f, + 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, + 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x11, 0x44, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x41, 0x75, 0x74, + 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, + 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x22, 0x00, 0x42, + 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, + 0x6f, 0x75, 0x64, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x64, 0x61, 0x79, 0x73, 0x6a, 0x70, 0x2f, + 0x63, 0x6e, 0x64, 0x2d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x77, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x78, + 0x79, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -337,31 +294,29 @@ func file_pkg_ws_proxy_schema_track_proto_rawDescGZIP() []byte { return file_pkg_ws_proxy_schema_track_proto_rawDescData } -var file_pkg_ws_proxy_schema_track_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_pkg_ws_proxy_schema_track_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_pkg_ws_proxy_schema_track_proto_goTypes = []interface{}{ (*Track)(nil), // 0: schema.Track (*GetTrackRequest)(nil), // 1: schema.GetTrackRequest - (*GetTrackResponse)(nil), // 2: schema.GetTrackResponse - (*ListTrackResponse)(nil), // 3: schema.ListTrackResponse - (*SwitchAutomationRequest)(nil), // 4: schema.SwitchAutomationRequest - (*emptypb.Empty)(nil), // 5: google.protobuf.Empty + (*ListTrackResponse)(nil), // 2: schema.ListTrackResponse + (*SwitchAutomationRequest)(nil), // 3: schema.SwitchAutomationRequest + (*emptypb.Empty)(nil), // 4: google.protobuf.Empty } var file_pkg_ws_proxy_schema_track_proto_depIdxs = []int32{ - 0, // 0: schema.GetTrackResponse.track:type_name -> schema.Track - 0, // 1: schema.ListTrackResponse.track:type_name -> schema.Track - 1, // 2: schema.TrackService.GetTrack:input_type -> schema.GetTrackRequest - 5, // 3: schema.TrackService.ListTrack:input_type -> google.protobuf.Empty - 4, // 4: schema.TrackService.EnableAutomation:input_type -> schema.SwitchAutomationRequest - 4, // 5: schema.TrackService.DisableAutomation:input_type -> schema.SwitchAutomationRequest - 2, // 6: schema.TrackService.GetTrack:output_type -> schema.GetTrackResponse - 3, // 7: schema.TrackService.ListTrack:output_type -> schema.ListTrackResponse - 5, // 8: schema.TrackService.EnableAutomation:output_type -> google.protobuf.Empty - 5, // 9: schema.TrackService.DisableAutomation:output_type -> google.protobuf.Empty - 6, // [6:10] is the sub-list for method output_type - 2, // [2:6] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 0, // 0: schema.ListTrackResponse.tracks:type_name -> schema.Track + 1, // 1: schema.TrackService.GetTrack:input_type -> schema.GetTrackRequest + 4, // 2: schema.TrackService.ListTrack:input_type -> google.protobuf.Empty + 3, // 3: schema.TrackService.EnableAutomation:input_type -> schema.SwitchAutomationRequest + 3, // 4: schema.TrackService.DisableAutomation:input_type -> schema.SwitchAutomationRequest + 0, // 5: schema.TrackService.GetTrack:output_type -> schema.Track + 2, // 6: schema.TrackService.ListTrack:output_type -> schema.ListTrackResponse + 0, // 7: schema.TrackService.EnableAutomation:output_type -> schema.Track + 0, // 8: schema.TrackService.DisableAutomation:output_type -> schema.Track + 5, // [5:9] is the sub-list for method output_type + 1, // [1:5] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_pkg_ws_proxy_schema_track_proto_init() } @@ -395,18 +350,6 @@ func file_pkg_ws_proxy_schema_track_proto_init() { } } file_pkg_ws_proxy_schema_track_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetTrackResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pkg_ws_proxy_schema_track_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListTrackResponse); i { case 0: return &v.state @@ -418,7 +361,7 @@ func file_pkg_ws_proxy_schema_track_proto_init() { return nil } } - file_pkg_ws_proxy_schema_track_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_pkg_ws_proxy_schema_track_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SwitchAutomationRequest); i { case 0: return &v.state @@ -437,7 +380,7 @@ func file_pkg_ws_proxy_schema_track_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkg_ws_proxy_schema_track_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/ws-proxy/schema/track.proto b/pkg/ws-proxy/schema/track.proto index 6231ac1..6edf3a1 100644 --- a/pkg/ws-proxy/schema/track.proto +++ b/pkg/ws-proxy/schema/track.proto @@ -6,23 +6,21 @@ option go_package = "github.com/cloudnativedaysjp/cnd-operation-server/pkg/ws-pr import "google/protobuf/empty.proto"; service TrackService { - rpc GetTrack(GetTrackRequest) returns (GetTrackResponse) {} + rpc GetTrack(GetTrackRequest) returns (Track) {} rpc ListTrack(google.protobuf.Empty) returns (ListTrackResponse) {} - rpc EnableAutomation(SwitchAutomationRequest) - returns (google.protobuf.Empty) {} - rpc DisableAutomation(SwitchAutomationRequest) - returns (google.protobuf.Empty) {} + rpc EnableAutomation(SwitchAutomationRequest) returns (Track) {} + rpc DisableAutomation(SwitchAutomationRequest) returns (Track) {} } message Track { int32 trackId = 1; - string obsHost = 2; - bool enabled = 3; + string trackName = 2; + string obsHost = 3; + bool enabled = 4; } message GetTrackRequest { int32 trackId = 1; } -message GetTrackResponse { Track track = 1; } -message ListTrackResponse { repeated Track track = 1; } +message ListTrackResponse { repeated Track tracks = 1; } message SwitchAutomationRequest { int32 trackId = 1; } diff --git a/pkg/ws-proxy/schema/track_grpc.pb.go b/pkg/ws-proxy/schema/track_grpc.pb.go index 57ac631..1995264 100644 --- a/pkg/ws-proxy/schema/track_grpc.pb.go +++ b/pkg/ws-proxy/schema/track_grpc.pb.go @@ -23,10 +23,10 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type TrackServiceClient interface { - GetTrack(ctx context.Context, in *GetTrackRequest, opts ...grpc.CallOption) (*GetTrackResponse, error) + GetTrack(ctx context.Context, in *GetTrackRequest, opts ...grpc.CallOption) (*Track, error) ListTrack(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListTrackResponse, error) - EnableAutomation(ctx context.Context, in *SwitchAutomationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - DisableAutomation(ctx context.Context, in *SwitchAutomationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + EnableAutomation(ctx context.Context, in *SwitchAutomationRequest, opts ...grpc.CallOption) (*Track, error) + DisableAutomation(ctx context.Context, in *SwitchAutomationRequest, opts ...grpc.CallOption) (*Track, error) } type trackServiceClient struct { @@ -37,8 +37,8 @@ func NewTrackServiceClient(cc grpc.ClientConnInterface) TrackServiceClient { return &trackServiceClient{cc} } -func (c *trackServiceClient) GetTrack(ctx context.Context, in *GetTrackRequest, opts ...grpc.CallOption) (*GetTrackResponse, error) { - out := new(GetTrackResponse) +func (c *trackServiceClient) GetTrack(ctx context.Context, in *GetTrackRequest, opts ...grpc.CallOption) (*Track, error) { + out := new(Track) err := c.cc.Invoke(ctx, "/schema.TrackService/GetTrack", in, out, opts...) if err != nil { return nil, err @@ -55,8 +55,8 @@ func (c *trackServiceClient) ListTrack(ctx context.Context, in *emptypb.Empty, o return out, nil } -func (c *trackServiceClient) EnableAutomation(ctx context.Context, in *SwitchAutomationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) +func (c *trackServiceClient) EnableAutomation(ctx context.Context, in *SwitchAutomationRequest, opts ...grpc.CallOption) (*Track, error) { + out := new(Track) err := c.cc.Invoke(ctx, "/schema.TrackService/EnableAutomation", in, out, opts...) if err != nil { return nil, err @@ -64,8 +64,8 @@ func (c *trackServiceClient) EnableAutomation(ctx context.Context, in *SwitchAut return out, nil } -func (c *trackServiceClient) DisableAutomation(ctx context.Context, in *SwitchAutomationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) +func (c *trackServiceClient) DisableAutomation(ctx context.Context, in *SwitchAutomationRequest, opts ...grpc.CallOption) (*Track, error) { + out := new(Track) err := c.cc.Invoke(ctx, "/schema.TrackService/DisableAutomation", in, out, opts...) if err != nil { return nil, err @@ -77,10 +77,10 @@ func (c *trackServiceClient) DisableAutomation(ctx context.Context, in *SwitchAu // All implementations must embed UnimplementedTrackServiceServer // for forward compatibility type TrackServiceServer interface { - GetTrack(context.Context, *GetTrackRequest) (*GetTrackResponse, error) + GetTrack(context.Context, *GetTrackRequest) (*Track, error) ListTrack(context.Context, *emptypb.Empty) (*ListTrackResponse, error) - EnableAutomation(context.Context, *SwitchAutomationRequest) (*emptypb.Empty, error) - DisableAutomation(context.Context, *SwitchAutomationRequest) (*emptypb.Empty, error) + EnableAutomation(context.Context, *SwitchAutomationRequest) (*Track, error) + DisableAutomation(context.Context, *SwitchAutomationRequest) (*Track, error) mustEmbedUnimplementedTrackServiceServer() } @@ -88,16 +88,16 @@ type TrackServiceServer interface { type UnimplementedTrackServiceServer struct { } -func (UnimplementedTrackServiceServer) GetTrack(context.Context, *GetTrackRequest) (*GetTrackResponse, error) { +func (UnimplementedTrackServiceServer) GetTrack(context.Context, *GetTrackRequest) (*Track, error) { return nil, status.Errorf(codes.Unimplemented, "method GetTrack not implemented") } func (UnimplementedTrackServiceServer) ListTrack(context.Context, *emptypb.Empty) (*ListTrackResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListTrack not implemented") } -func (UnimplementedTrackServiceServer) EnableAutomation(context.Context, *SwitchAutomationRequest) (*emptypb.Empty, error) { +func (UnimplementedTrackServiceServer) EnableAutomation(context.Context, *SwitchAutomationRequest) (*Track, error) { return nil, status.Errorf(codes.Unimplemented, "method EnableAutomation not implemented") } -func (UnimplementedTrackServiceServer) DisableAutomation(context.Context, *SwitchAutomationRequest) (*emptypb.Empty, error) { +func (UnimplementedTrackServiceServer) DisableAutomation(context.Context, *SwitchAutomationRequest) (*Track, error) { return nil, status.Errorf(codes.Unimplemented, "method DisableAutomation not implemented") } func (UnimplementedTrackServiceServer) mustEmbedUnimplementedTrackServiceServer() {} diff --git a/pkg/ws-proxy/server/controller.go b/pkg/ws-proxy/server/controller.go index 188587a..ccbe6c5 100644 --- a/pkg/ws-proxy/server/controller.go +++ b/pkg/ws-proxy/server/controller.go @@ -9,8 +9,8 @@ import ( emptypb "github.com/golang/protobuf/ptypes/empty" "google.golang.org/protobuf/types/known/timestamppb" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/obsws" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/sharedmem" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/obsws" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/sharedmem" pb "github.com/cloudnativedaysjp/cnd-operation-server/pkg/ws-proxy/schema" ) @@ -20,50 +20,85 @@ type Controller struct { pb.UnimplementedDebugServiceServer Logger logr.Logger - ObsWsMap map[int32]obsws.ClientIface + ObsWsMap map[int32]obsws.Client MemWriter sharedmem.WriterIface + MemReader sharedmem.ReaderIface MemDebugger sharedmem.DebuggerIface } /* TrackService */ -func (c *Controller) GetTrack(ctx context.Context, in *pb.GetTrackRequest) (*pb.GetTrackResponse, error) { +func (c *Controller) GetTrack(ctx context.Context, in *pb.GetTrackRequest) (*pb.Track, error) { ws, ok := c.ObsWsMap[in.TrackId] if !ok { return nil, fmt.Errorf("no such trackId %d", in.TrackId) } + track, err := c.MemReader.Track(in.TrackId) + if err != nil { + // TODO: not found を返す + return nil, err + } + disabled, err := c.MemReader.DisableAutomation(in.TrackId) + if err != nil { + return nil, err + } - return &pb.GetTrackResponse{Track: &pb.Track{ - TrackId: in.TrackId, - ObsHost: ws.GetHost(), - }}, nil + return &pb.Track{ + TrackId: in.TrackId, + TrackName: track.Name, + ObsHost: ws.GetHost(), + Enabled: !disabled, + }, nil } func (c *Controller) ListTrack(ctx context.Context, in *emptypb.Empty) (*pb.ListTrackResponse, error) { var tracks []*pb.Track for trackId, ws := range c.ObsWsMap { + track, err := c.MemReader.Track(trackId) + if err != nil { + // TODO: not found を返す + return nil, err + } + disabled, err := c.MemReader.DisableAutomation(trackId) + if err != nil { + return nil, err + } tracks = append(tracks, &pb.Track{ - TrackId: trackId, - ObsHost: ws.GetHost(), + TrackId: trackId, + TrackName: track.Name, + ObsHost: ws.GetHost(), + Enabled: !disabled, }) } sort.SliceStable(tracks, func(i, j int) bool { return tracks[i].TrackId < tracks[j].TrackId }) - return &pb.ListTrackResponse{Track: tracks}, nil + return &pb.ListTrackResponse{Tracks: tracks}, nil } -func (c *Controller) EnableAutomation(ctx context.Context, in *pb.SwitchAutomationRequest) (*emptypb.Empty, error) { +func (c *Controller) EnableAutomation(ctx context.Context, in *pb.SwitchAutomationRequest) (*pb.Track, error) { + resp, err := c.GetTrack(ctx, &pb.GetTrackRequest{TrackId: in.TrackId}) + if err != nil { + // TODO: not found を返す + return nil, err + } if err := c.MemWriter.SetDisableAutomation(in.TrackId, false); err != nil { return nil, err } - return &emptypb.Empty{}, nil + resp.Enabled = true + return resp, nil } -func (c *Controller) DisableAutomation(ctx context.Context, in *pb.SwitchAutomationRequest) (*emptypb.Empty, error) { +func (c *Controller) DisableAutomation(ctx context.Context, in *pb.SwitchAutomationRequest) (*pb.Track, error) { + resp, err := c.GetTrack(ctx, &pb.GetTrackRequest{TrackId: in.TrackId}) + if err != nil { + // TODO: not found を返す + return nil, err + } if err := c.MemWriter.SetDisableAutomation(in.TrackId, true); err != nil { return nil, err } - return &emptypb.Empty{}, nil + resp.Enabled = false + return resp, nil } /* SceneService */ diff --git a/pkg/ws-proxy/server/server.go b/pkg/ws-proxy/server/server.go index b7540fc..24838ec 100644 --- a/pkg/ws-proxy/server/server.go +++ b/pkg/ws-proxy/server/server.go @@ -13,8 +13,8 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/reflection" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/obsws" - "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/sharedmem" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/obsws" + "github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/sharedmem" pb "github.com/cloudnativedaysjp/cnd-operation-server/pkg/ws-proxy/schema" ) @@ -47,7 +47,7 @@ func Run(ctx context.Context, conf Config) error { } logger := zapr.NewLogger(zapLogger).WithName(componentName) - obswsClientMap := make(map[int32]obsws.ClientIface) + obswsClientMap := make(map[int32]obsws.Client) for _, obs := range conf.Obs { obswsClient, err := obsws.NewObsWebSocketClient(obs.Host, obs.Password) if err != nil { @@ -62,6 +62,7 @@ func Run(ctx context.Context, conf Config) error { Logger: logger, ObsWsMap: obswsClientMap, MemWriter: sharedmem.Writer{UseStorageForDisableAutomation: true}, + MemReader: sharedmem.Reader{UseStorageForTrack: true, UseStorageForDisableAutomation: true}, MemDebugger: sharedmem.Debugger{}, } @@ -75,7 +76,7 @@ func Run(ctx context.Context, conf Config) error { pb.RegisterSceneServiceServer(s, controller) pb.RegisterTrackServiceServer(s, controller) pb.RegisterDebugServiceServer(s, controller) - if conf.Debug { + if conf.Development { reflection.Register(s) }