From 30f998553770d555178e56a37cb347502b5111eb Mon Sep 17 00:00:00 2001 From: Francisco Souza Date: Fri, 26 Jul 2019 18:21:10 -0400 Subject: [PATCH 1/4] Rename import path to v2 Related to #239. --- config/config.go | 4 ++-- config/config_test.go | 2 +- db/dbtest/fake_db.go | 4 ++-- db/dbtest/fake_db_test.go | 2 +- db/redis/job.go | 4 ++-- db/redis/job_test.go | 6 +++--- db/redis/localpreset.go | 4 ++-- db/redis/localpreset_test.go | 6 +++--- db/redis/presetmap.go | 4 ++-- db/redis/presetmap_test.go | 6 +++--- db/redis/redis.go | 8 ++++---- db/redis/storage/redis.go | 2 +- db/repo.go | 2 +- go.mod | 2 +- main.go | 18 +++++++++--------- provider/bitmovin/bitmovin.go | 8 ++++---- provider/bitmovin/bitmovin_test.go | 6 +++--- provider/elastictranscoder/aws.go | 14 +++++++------- provider/elastictranscoder/aws_test.go | 6 +++--- .../elementalconductor/elementalconductor.go | 12 ++++++------ .../elementalconductor_fake_transcode_test.go | 4 ++-- .../elementalconductor_test.go | 6 +++--- provider/encodingcom/encodingcom.go | 12 ++++++------ provider/encodingcom/encodingcom_test.go | 6 +++--- provider/fake_provider_test.go | 4 ++-- provider/hybrik/hybrik.go | 8 ++++---- provider/mediaconvert/factory_test.go | 2 +- provider/mediaconvert/mediaconvert.go | 6 +++--- provider/mediaconvert/mediaconvert_test.go | 6 +++--- provider/mediaconvert/preset_mapping.go | 4 ++-- provider/provider.go | 6 +++--- provider/provider_test.go | 2 +- provider/zencoder/zencoder.go | 14 +++++++------- provider/zencoder/zencoder_test.go | 8 ++++---- service/fake_provider_test.go | 6 +++--- service/preset.go | 6 +++--- service/preset_params.go | 2 +- service/preset_responses.go | 2 +- service/preset_test.go | 6 +++--- service/presetmap.go | 4 ++-- service/presetmap_params.go | 4 ++-- service/presetmap_test.go | 6 +++--- service/provider.go | 4 ++-- service/provider_responses.go | 4 ++-- service/provider_test.go | 2 +- service/service.go | 10 +++++----- service/swagger_test.go | 2 +- service/transcode.go | 6 +++--- service/transcode_params.go | 4 ++-- service/transcode_responses.go | 4 ++-- service/transcode_test.go | 8 ++++---- swagger/handler.go | 2 +- 52 files changed, 145 insertions(+), 145 deletions(-) diff --git a/config/config.go b/config/config.go index 32d9e81f..84bfcf29 100644 --- a/config/config.go +++ b/config/config.go @@ -1,10 +1,10 @@ -package config // import "github.com/NYTimes/video-transcoding-api/config" +package config import ( "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" logging "github.com/fsouza/gizmo-stackdriver-logging" "github.com/kelseyhightower/envconfig" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) // Config is a struct to contain all the needed configuration for the diff --git a/config/config_test.go b/config/config_test.go index c7a7e0b0..675cbd96 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -5,10 +5,10 @@ import ( "testing" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" logging "github.com/fsouza/gizmo-stackdriver-logging" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) func TestLoadConfigFromEnv(t *testing.T) { diff --git a/db/dbtest/fake_db.go b/db/dbtest/fake_db.go index 9733cc0d..d8df8381 100644 --- a/db/dbtest/fake_db.go +++ b/db/dbtest/fake_db.go @@ -1,10 +1,10 @@ -package dbtest // import "github.com/NYTimes/video-transcoding-api/db/dbtest" +package dbtest import ( "errors" "time" - "github.com/NYTimes/video-transcoding-api/db" + "github.com/video-dev/video-transcoding-api/v2/db" ) type fakeRepository struct { diff --git a/db/dbtest/fake_db_test.go b/db/dbtest/fake_db_test.go index 274a9f1b..e10e5e6f 100644 --- a/db/dbtest/fake_db_test.go +++ b/db/dbtest/fake_db_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/NYTimes/video-transcoding-api/db" + "github.com/video-dev/video-transcoding-api/v2/db" ) const dbErrorMsg = "database error" diff --git a/db/redis/job.go b/db/redis/job.go index 6f4b509c..7c23f728 100644 --- a/db/redis/job.go +++ b/db/redis/job.go @@ -5,9 +5,9 @@ import ( "strconv" "time" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" "github.com/go-redis/redis" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) const jobsSetKey = "jobs" diff --git a/db/redis/job_test.go b/db/redis/job_test.go index a8c225c7..aac5688a 100644 --- a/db/redis/job_test.go +++ b/db/redis/job_test.go @@ -8,11 +8,11 @@ import ( "testing" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" "github.com/go-redis/redis" "github.com/kr/pretty" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) func TestCreateJob(t *testing.T) { diff --git a/db/redis/localpreset.go b/db/redis/localpreset.go index a6b190eb..f9cc7cc5 100644 --- a/db/redis/localpreset.go +++ b/db/redis/localpreset.go @@ -3,9 +3,9 @@ package redis import ( "errors" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" "github.com/go-redis/redis" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) const localPresetsSetKey = "localpresets" diff --git a/db/redis/localpreset_test.go b/db/redis/localpreset_test.go index ab1bbd95..5eb3215b 100644 --- a/db/redis/localpreset_test.go +++ b/db/redis/localpreset_test.go @@ -4,9 +4,9 @@ import ( "reflect" "testing" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) func TestCreateLocalPreset(t *testing.T) { diff --git a/db/redis/presetmap.go b/db/redis/presetmap.go index 4a31b45e..b42c6eb0 100644 --- a/db/redis/presetmap.go +++ b/db/redis/presetmap.go @@ -1,9 +1,9 @@ package redis import ( - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" "github.com/go-redis/redis" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) const presetmapsSetKey = "presetmaps" diff --git a/db/redis/presetmap_test.go b/db/redis/presetmap_test.go index f18f45ed..1d3cb2f4 100644 --- a/db/redis/presetmap_test.go +++ b/db/redis/presetmap_test.go @@ -4,9 +4,9 @@ import ( "reflect" "testing" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) func TestCreatePresetMap(t *testing.T) { diff --git a/db/redis/redis.go b/db/redis/redis.go index 8126802f..5e12b8c4 100644 --- a/db/redis/redis.go +++ b/db/redis/redis.go @@ -1,9 +1,9 @@ -package redis // import "github.com/NYTimes/video-transcoding-api/db/redis" +package redis import ( - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis/storage" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis/storage" ) // NewRepository creates a new Repository that uses Redis for persistence. diff --git a/db/redis/storage/redis.go b/db/redis/storage/redis.go index 2343c4dc..94e3be20 100644 --- a/db/redis/storage/redis.go +++ b/db/redis/storage/redis.go @@ -1,5 +1,5 @@ // Package storage provides a type for storing Go objects in Redis. -package storage // import "github.com/NYTimes/video-transcoding-api/db/redis/storage" +package storage import ( "errors" diff --git a/db/repo.go b/db/repo.go index 36343460..e063e0c4 100644 --- a/db/repo.go +++ b/db/repo.go @@ -1,4 +1,4 @@ -package db // import "github.com/NYTimes/video-transcoding-api/db" +package db import ( "errors" diff --git a/go.mod b/go.mod index 506f00e8..2e74503c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/NYTimes/video-transcoding-api +module github.com/video-dev/video-transcoding-api/v2 require ( github.com/NYTimes/gizmo v1.2.14 diff --git a/main.go b/main.go index f5801db4..b4d18545 100644 --- a/main.go +++ b/main.go @@ -5,16 +5,16 @@ import ( "log" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/config" - _ "github.com/NYTimes/video-transcoding-api/provider/bitmovin" - _ "github.com/NYTimes/video-transcoding-api/provider/elastictranscoder" - _ "github.com/NYTimes/video-transcoding-api/provider/elementalconductor" - _ "github.com/NYTimes/video-transcoding-api/provider/encodingcom" - _ "github.com/NYTimes/video-transcoding-api/provider/hybrik" - _ "github.com/NYTimes/video-transcoding-api/provider/mediaconvert" - _ "github.com/NYTimes/video-transcoding-api/provider/zencoder" - "github.com/NYTimes/video-transcoding-api/service" "github.com/google/gops/agent" + "github.com/video-dev/video-transcoding-api/v2/config" + _ "github.com/video-dev/video-transcoding-api/v2/provider/bitmovin" + _ "github.com/video-dev/video-transcoding-api/v2/provider/elastictranscoder" + _ "github.com/video-dev/video-transcoding-api/v2/provider/elementalconductor" + _ "github.com/video-dev/video-transcoding-api/v2/provider/encodingcom" + _ "github.com/video-dev/video-transcoding-api/v2/provider/hybrik" + _ "github.com/video-dev/video-transcoding-api/v2/provider/mediaconvert" + _ "github.com/video-dev/video-transcoding-api/v2/provider/zencoder" + "github.com/video-dev/video-transcoding-api/v2/service" ) func main() { diff --git a/provider/bitmovin/bitmovin.go b/provider/bitmovin/bitmovin.go index bf171e54..d4dd4ac2 100644 --- a/provider/bitmovin/bitmovin.go +++ b/provider/bitmovin/bitmovin.go @@ -1,4 +1,4 @@ -package bitmovin // import "github.com/NYTimes/video-transcoding-api/provider/bitmovin" +package bitmovin import ( "errors" @@ -11,13 +11,13 @@ import ( "strings" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/bitmovin/bitmovin-go/bitmovin" "github.com/bitmovin/bitmovin-go/bitmovintypes" "github.com/bitmovin/bitmovin-go/models" "github.com/bitmovin/bitmovin-go/services" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) // Name is the name used for registering the bitmovin provider in the diff --git a/provider/bitmovin/bitmovin_test.go b/provider/bitmovin/bitmovin_test.go index 997f6911..232daa08 100644 --- a/provider/bitmovin/bitmovin_test.go +++ b/provider/bitmovin/bitmovin_test.go @@ -10,12 +10,12 @@ import ( "testing" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/bitmovin/bitmovin-go/bitmovin" "github.com/bitmovin/bitmovin-go/bitmovintypes" "github.com/bitmovin/bitmovin-go/models" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) func TestFactoryIsRegistered(t *testing.T) { diff --git a/provider/elastictranscoder/aws.go b/provider/elastictranscoder/aws.go index 4afb7b48..aa37ba34 100644 --- a/provider/elastictranscoder/aws.go +++ b/provider/elastictranscoder/aws.go @@ -2,18 +2,18 @@ // uses AWS Elastic Transcoder for transcoding media files. // // It doesn't expose any public type. In order to use the provider, one must -// import this package and then grab the factory from the provider package: + // // import ( -// "github.com/NYTimes/video-transcoding-api/provider" -// "github.com/NYTimes/video-transcoding-api/provider/elastictranscoder" +// "github.com/video-dev/video-transcoding-api/v2/provider" +// "github.com/video-dev/video-transcoding-api/v2/provider/elastictranscoder" // ) // // func UseProvider() { // factory, err := provider.GetProviderFactory(elastictranscoder.Name) // // handle err and use factory to get an instance of the provider. // } -package elastictranscoder // import "github.com/NYTimes/video-transcoding-api/provider/elastictranscoder" +package elastictranscoder import ( "errors" @@ -24,14 +24,14 @@ import ( "strings" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/elastictranscoder" "github.com/aws/aws-sdk-go/service/elastictranscoder/elastictranscoderiface" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) const ( diff --git a/provider/elastictranscoder/aws_test.go b/provider/elastictranscoder/aws_test.go index b93ca5bd..a54eac9a 100644 --- a/provider/elastictranscoder/aws_test.go +++ b/provider/elastictranscoder/aws_test.go @@ -8,13 +8,13 @@ import ( "testing" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/service/elastictranscoder" "github.com/kr/pretty" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) func TestFactoryIsRegistered(t *testing.T) { diff --git a/provider/elementalconductor/elementalconductor.go b/provider/elementalconductor/elementalconductor.go index c8258e00..10f90a47 100644 --- a/provider/elementalconductor/elementalconductor.go +++ b/provider/elementalconductor/elementalconductor.go @@ -5,15 +5,15 @@ // import this package and then grab the factory from the provider package: // // import ( -// "github.com/NYTimes/video-transcoding-api/provider" -// "github.com/NYTimes/video-transcoding-api/provider/elementalconductor" +// "github.com/video-dev/video-transcoding-api/v2/provider" +// "github.com/video-dev/video-transcoding-api/v2/provider/elementalconductor" // ) // // func UseProvider() { // factory, err := provider.GetProviderFactory(elementalconductor.Name) // // handle err and use factory to get an instance of the provider. // } -package elementalconductor // import "github.com/NYTimes/video-transcoding-api/provider/elementalconductor" +package elementalconductor import ( "encoding/xml" @@ -23,10 +23,10 @@ import ( "strings" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/video-dev/go-elementalconductor" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) // Name is the name used for registering the Elemental Conductor provider in the diff --git a/provider/elementalconductor/elementalconductor_fake_transcode_test.go b/provider/elementalconductor/elementalconductor_fake_transcode_test.go index 7b04c0eb..5b555783 100644 --- a/provider/elementalconductor/elementalconductor_fake_transcode_test.go +++ b/provider/elementalconductor/elementalconductor_fake_transcode_test.go @@ -3,9 +3,9 @@ package elementalconductor import ( "strings" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/video-dev/go-elementalconductor" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/provider" ) type fakeElementalConductorClient struct { diff --git a/provider/elementalconductor/elementalconductor_test.go b/provider/elementalconductor/elementalconductor_test.go index 26babd64..34c2dadd 100644 --- a/provider/elementalconductor/elementalconductor_test.go +++ b/provider/elementalconductor/elementalconductor_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/video-dev/go-elementalconductor" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) func TestFactoryIsRegistered(t *testing.T) { diff --git a/provider/encodingcom/encodingcom.go b/provider/encodingcom/encodingcom.go index 69c779fc..cfca50af 100644 --- a/provider/encodingcom/encodingcom.go +++ b/provider/encodingcom/encodingcom.go @@ -5,15 +5,15 @@ // import this package and then grab the factory from the provider package: // // import ( -// "github.com/NYTimes/video-transcoding-api/provider" -// "github.com/NYTimes/video-transcoding-api/provider/encodingcom" +// "github.com/video-dev/video-transcoding-api/v2/provider" +// "github.com/video-dev/video-transcoding-api/v2/provider/encodingcom" // ) // // func UseProvider() { // factory, err := provider.GetProviderFactory(encodingcom.Name) // // handle err and use factory to get an instance of the provider. // } -package encodingcom // import "github.com/NYTimes/video-transcoding-api/provider/encodingcom" +package encodingcom import ( "errors" @@ -24,10 +24,10 @@ import ( "strconv" "strings" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/video-dev/go-encodingcom" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) // Name is the name used for registering the Encoding.com provider in the diff --git a/provider/encodingcom/encodingcom_test.go b/provider/encodingcom/encodingcom_test.go index d22bd350..731454fc 100644 --- a/provider/encodingcom/encodingcom_test.go +++ b/provider/encodingcom/encodingcom_test.go @@ -6,11 +6,11 @@ import ( "testing" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/kr/pretty" "github.com/video-dev/go-encodingcom" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) func TestFactoryIsRegistered(t *testing.T) { diff --git a/provider/fake_provider_test.go b/provider/fake_provider_test.go index fb6cfa34..92930a5f 100644 --- a/provider/fake_provider_test.go +++ b/provider/fake_provider_test.go @@ -1,8 +1,8 @@ package provider import ( - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" ) type fakeProvider struct { diff --git a/provider/hybrik/hybrik.go b/provider/hybrik/hybrik.go index d630a2c3..7d0455bd 100644 --- a/provider/hybrik/hybrik.go +++ b/provider/hybrik/hybrik.go @@ -1,4 +1,4 @@ -package hybrik // import "github.com/NYTimes/video-transcoding-api/provider/hybrik" +package hybrik import ( "encoding/json" @@ -8,10 +8,10 @@ import ( "strconv" "strings" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" hwrapper "github.com/hybrik/hybrik-sdk-go" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) const ( diff --git a/provider/mediaconvert/factory_test.go b/provider/mediaconvert/factory_test.go index fced110b..ed2f4974 100644 --- a/provider/mediaconvert/factory_test.go +++ b/provider/mediaconvert/factory_test.go @@ -5,11 +5,11 @@ import ( "reflect" "testing" - "github.com/NYTimes/video-transcoding-api/config" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/aws/external" "github.com/aws/aws-sdk-go-v2/service/mediaconvert" "github.com/google/go-cmp/cmp" + "github.com/video-dev/video-transcoding-api/v2/config" ) var cfgWithoutCredsAndRegion = config.Config{ diff --git a/provider/mediaconvert/mediaconvert.go b/provider/mediaconvert/mediaconvert.go index b142a934..c3663efb 100644 --- a/provider/mediaconvert/mediaconvert.go +++ b/provider/mediaconvert/mediaconvert.go @@ -7,13 +7,13 @@ import ( "strings" "sync" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/aws/external" "github.com/aws/aws-sdk-go-v2/service/mediaconvert" "github.com/pkg/errors" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) const ( diff --git a/provider/mediaconvert/mediaconvert_test.go b/provider/mediaconvert/mediaconvert_test.go index 15fd32f9..65523d16 100644 --- a/provider/mediaconvert/mediaconvert_test.go +++ b/provider/mediaconvert/mediaconvert_test.go @@ -4,12 +4,12 @@ import ( "reflect" "testing" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/mediaconvert" "github.com/google/go-cmp/cmp" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) var ( diff --git a/provider/mediaconvert/preset_mapping.go b/provider/mediaconvert/preset_mapping.go index 3b55df04..dfcd1da3 100644 --- a/provider/mediaconvert/preset_mapping.go +++ b/provider/mediaconvert/preset_mapping.go @@ -5,11 +5,11 @@ import ( "strconv" "strings" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/mediaconvert" "github.com/pkg/errors" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) func providerStatusFrom(status mediaconvert.JobStatus) provider.Status { diff --git a/provider/provider.go b/provider/provider.go index 2a1a6566..096455c0 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -1,4 +1,4 @@ -package provider // import "github.com/NYTimes/video-transcoding-api/provider" +package provider import ( "errors" @@ -6,8 +6,8 @@ import ( "sort" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" ) var ( diff --git a/provider/provider_test.go b/provider/provider_test.go index 89650ea2..c89218f2 100644 --- a/provider/provider_test.go +++ b/provider/provider_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/NYTimes/video-transcoding-api/config" + "github.com/video-dev/video-transcoding-api/v2/config" ) func noopFactory(*config.Config) (TranscodingProvider, error) { diff --git a/provider/zencoder/zencoder.go b/provider/zencoder/zencoder.go index f9b1414c..ce8b025d 100644 --- a/provider/zencoder/zencoder.go +++ b/provider/zencoder/zencoder.go @@ -5,15 +5,15 @@ // import this package and then grab the factory from the provider package: // // import ( -// "github.com/NYTimes/video-transcoding-api/provider" -// "github.com/NYTimes/video-transcoding-api/provider/zencoder" +// "github.com/video-dev/video-transcoding-api/v2/provider" +// "github.com/video-dev/video-transcoding-api/v2/provider/zencoder" // ) // // func UseProvider() { // factory, err := provider.GetProviderFactory(Zencoder.Name) // // handle err and use factory to get an instance of the provider. // } -package zencoder // import "github.com/NYTimes/video-transcoding-api/provider/zencoder" +package zencoder import ( "fmt" @@ -25,10 +25,10 @@ import ( "strings" "time" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis" - "github.com/NYTimes/video-transcoding-api/provider" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis" + "github.com/video-dev/video-transcoding-api/v2/provider" "github.com/video-dev/zencoder" ) diff --git a/provider/zencoder/zencoder_test.go b/provider/zencoder/zencoder_test.go index a98e21a8..346927ab 100644 --- a/provider/zencoder/zencoder_test.go +++ b/provider/zencoder/zencoder_test.go @@ -6,11 +6,11 @@ import ( "reflect" "testing" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/dbtest" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/kr/pretty" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/dbtest" + "github.com/video-dev/video-transcoding-api/v2/provider" "github.com/video-dev/zencoder" ) diff --git a/service/fake_provider_test.go b/service/fake_provider_test.go index aa4d7b59..abd3e472 100644 --- a/service/fake_provider_test.go +++ b/service/fake_provider_test.go @@ -1,9 +1,9 @@ package service import ( - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) func init() { diff --git a/service/preset.go b/service/preset.go index e27d3cd9..2d9cb779 100644 --- a/service/preset.go +++ b/service/preset.go @@ -7,9 +7,9 @@ import ( "net/http" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" - "github.com/NYTimes/video-transcoding-api/swagger" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) // swagger:route DELETE /presets/{name} presets deletePreset diff --git a/service/preset_params.go b/service/preset_params.go index 7df8594a..ce12794a 100644 --- a/service/preset_params.go +++ b/service/preset_params.go @@ -1,7 +1,7 @@ package service import ( - "github.com/NYTimes/video-transcoding-api/db" + "github.com/video-dev/video-transcoding-api/v2/db" ) type newPresetInput struct { diff --git a/service/preset_responses.go b/service/preset_responses.go index 8e778156..569579c5 100644 --- a/service/preset_responses.go +++ b/service/preset_responses.go @@ -3,7 +3,7 @@ package service import ( "net/http" - "github.com/NYTimes/video-transcoding-api/swagger" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) type newPresetResponse struct { diff --git a/service/preset_test.go b/service/preset_test.go index ff3858ce..a007db5e 100644 --- a/service/preset_test.go +++ b/service/preset_test.go @@ -9,10 +9,10 @@ import ( "testing" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/dbtest" "github.com/sirupsen/logrus" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/dbtest" ) func TestNewPreset(t *testing.T) { diff --git a/service/presetmap.go b/service/presetmap.go index 88429ced..ff81fa90 100644 --- a/service/presetmap.go +++ b/service/presetmap.go @@ -4,8 +4,8 @@ import ( "net/http" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/swagger" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) // swagger:route POST /presetmaps presets newPreset diff --git a/service/presetmap_params.go b/service/presetmap_params.go index a40a7b07..0fbba3b2 100644 --- a/service/presetmap_params.go +++ b/service/presetmap_params.go @@ -7,8 +7,8 @@ import ( "io" "net/http" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/swagger" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) // JSON-encoded preset returned on the newPreset and getPreset operations. diff --git a/service/presetmap_test.go b/service/presetmap_test.go index f9b67171..4bf00e2b 100644 --- a/service/presetmap_test.go +++ b/service/presetmap_test.go @@ -9,10 +9,10 @@ import ( "testing" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/dbtest" "github.com/sirupsen/logrus" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/dbtest" ) func TestNewPresetMap(t *testing.T) { diff --git a/service/provider.go b/service/provider.go index 30f739ca..55ba56e4 100644 --- a/service/provider.go +++ b/service/provider.go @@ -4,8 +4,8 @@ import ( "net/http" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/provider" - "github.com/NYTimes/video-transcoding-api/swagger" + "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) // swagger:route GET /providers providers listProviders diff --git a/service/provider_responses.go b/service/provider_responses.go index 2c8d7c87..94e8dd9e 100644 --- a/service/provider_responses.go +++ b/service/provider_responses.go @@ -3,8 +3,8 @@ package service import ( "net/http" - "github.com/NYTimes/video-transcoding-api/provider" - "github.com/NYTimes/video-transcoding-api/swagger" + "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) // response for the listProviders operation. Contains the list of providers diff --git a/service/provider_test.go b/service/provider_test.go index cb7cd83f..f93ffd90 100644 --- a/service/provider_test.go +++ b/service/provider_test.go @@ -8,8 +8,8 @@ import ( "testing" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/config" "github.com/sirupsen/logrus" + "github.com/video-dev/video-transcoding-api/v2/config" ) func TestListProviders(t *testing.T) { diff --git a/service/service.go b/service/service.go index fcc851f4..4e53a3fa 100644 --- a/service/service.go +++ b/service/service.go @@ -1,4 +1,4 @@ -package service // import "github.com/NYTimes/video-transcoding-api/service" +package service import ( "fmt" @@ -6,13 +6,13 @@ import ( "github.com/NYTimes/gizmo/server" "github.com/NYTimes/gziphandler" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/redis" - "github.com/NYTimes/video-transcoding-api/swagger" "github.com/fsouza/ctxlogger" "github.com/gorilla/handlers" "github.com/sirupsen/logrus" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/redis" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) // TranscodingService will implement server.JSONService and handle all requests diff --git a/service/swagger_test.go b/service/swagger_test.go index 4e8b96bb..99271904 100644 --- a/service/swagger_test.go +++ b/service/swagger_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/config" "github.com/sirupsen/logrus" + "github.com/video-dev/video-transcoding-api/v2/config" ) func TestSwaggerManifest(t *testing.T) { diff --git a/service/transcode.go b/service/transcode.go index 7a4acdd8..f9c30b6e 100644 --- a/service/transcode.go +++ b/service/transcode.go @@ -9,9 +9,9 @@ import ( "path/filepath" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" - "github.com/NYTimes/video-transcoding-api/swagger" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) // swagger:route POST /jobs jobs newJob diff --git a/service/transcode_params.go b/service/transcode_params.go index 23ea755a..c3187b7f 100644 --- a/service/transcode_params.go +++ b/service/transcode_params.go @@ -5,8 +5,8 @@ import ( "errors" "io" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/provider" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/provider" ) // NewTranscodeJobInputPayload makes up the parameters available for diff --git a/service/transcode_responses.go b/service/transcode_responses.go index 6f55a993..29f6b21f 100644 --- a/service/transcode_responses.go +++ b/service/transcode_responses.go @@ -3,8 +3,8 @@ package service import ( "net/http" - "github.com/NYTimes/video-transcoding-api/provider" - "github.com/NYTimes/video-transcoding-api/swagger" + "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/swagger" ) // PartialJob is the simple response given to an API diff --git a/service/transcode_test.go b/service/transcode_test.go index 37bfeea4..4dd00e32 100644 --- a/service/transcode_test.go +++ b/service/transcode_test.go @@ -10,11 +10,11 @@ import ( "testing" "github.com/NYTimes/gizmo/server" - "github.com/NYTimes/video-transcoding-api/config" - "github.com/NYTimes/video-transcoding-api/db" - "github.com/NYTimes/video-transcoding-api/db/dbtest" - "github.com/NYTimes/video-transcoding-api/provider" "github.com/sirupsen/logrus" + "github.com/video-dev/video-transcoding-api/v2/config" + "github.com/video-dev/video-transcoding-api/v2/db" + "github.com/video-dev/video-transcoding-api/v2/db/dbtest" + "github.com/video-dev/video-transcoding-api/v2/provider" ) func TestTranscode(t *testing.T) { diff --git a/swagger/handler.go b/swagger/handler.go index e1ebcf12..6eca83d7 100644 --- a/swagger/handler.go +++ b/swagger/handler.go @@ -1,4 +1,4 @@ -package swagger // import "github.com/NYTimes/video-transcoding-api/swagger" +package swagger import ( "net/http" From c95bb7592a3318cf8e99e1ba6e21c7a12e2d612f Mon Sep 17 00:00:00 2001 From: Francisco Souza Date: Fri, 26 Jul 2019 18:21:24 -0400 Subject: [PATCH 2/4] provider: remove elastictranscoder Related to #239. --- README.md | 14 - config/config.go | 10 - config/config_test.go | 14 - go.mod | 1 - go.sum | 62 +- main.go | 1 - provider/elastictranscoder/aws.go | 419 ------ .../aws_fake_transcode_test.go | 170 --- provider/elastictranscoder/aws_test.go | 1165 ----------------- 9 files changed, 2 insertions(+), 1854 deletions(-) delete mode 100644 provider/elastictranscoder/aws.go delete mode 100644 provider/elastictranscoder/aws_fake_transcode_test.go delete mode 100644 provider/elastictranscoder/aws_test.go diff --git a/README.md b/README.md index 31025991..00dc34da 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ The Video Transcoding API provides an agnostic API to transcode media assets across different cloud services. Currently, it supports the following providers: -- [Amazon Elastic Transcoder](https://aws.amazon.com/elastictranscoder/) - [Bitmovin](http://bitmovin.com) - [Elemental Conductor](http://www.elementaltechnologies.com/products/elemental-conductor) - [Encoding.com](http://encoding.com) @@ -25,19 +24,6 @@ environment variables: ### Providers configuration -#### For [Amazon Elastic Transcoder](https://aws.amazon.com/elastictranscoder/) - -``` -export AWS_ACCESS_KEY_ID=your.access.key.id -export AWS_SECRET_ACCESS_KEY=your.secret.access.key -export AWS_REGION="us-east-1" -export ELASTICTRANSCODER_PIPELINE_ID="yourpipeline-id" -``` - -Please notice that for Elastic Transcoder you don't specify the destination -bucket, as it is [defined in the Elastic Transcoder -Pipeline](https://docs.aws.amazon.com/elastictranscoder/latest/developerguide/pipeline-settings.html#pipeline-settings-configure-transcoded-bucket). - #### For [Bitmovin](http://bitmovin.com) ``` diff --git a/config/config.go b/config/config.go index 84bfcf29..8d448e57 100644 --- a/config/config.go +++ b/config/config.go @@ -15,7 +15,6 @@ type Config struct { DefaultSegmentDuration uint `envconfig:"DEFAULT_SEGMENT_DURATION" default:"5"` Redis *storage.Config EncodingCom *EncodingCom - ElasticTranscoder *ElasticTranscoder ElementalConductor *ElementalConductor Hybrik *Hybrik Zencoder *Zencoder @@ -41,15 +40,6 @@ type Zencoder struct { Destination string `envconfig:"ZENCODER_DESTINATION"` } -// ElasticTranscoder represents the set of configurations for the Elastic -// Transcoder provider. -type ElasticTranscoder struct { - AccessKeyID string `envconfig:"AWS_ACCESS_KEY_ID"` - SecretAccessKey string `envconfig:"AWS_SECRET_ACCESS_KEY"` - Region string `envconfig:"AWS_REGION"` - PipelineID string `envconfig:"ELASTICTRANSCODER_PIPELINE_ID"` -} - // ElementalConductor represents the set of configurations for the Elemental // Conductor provider. type ElementalConductor struct { diff --git a/config/config_test.go b/config/config_test.go index 675cbd96..dbc08475 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -29,7 +29,6 @@ func TestLoadConfigFromEnv(t *testing.T) { "AWS_ACCESS_KEY_ID": "AKIANOTREALLY", "AWS_SECRET_ACCESS_KEY": "secret-key", "AWS_REGION": "us-east-1", - "ELASTICTRANSCODER_PIPELINE_ID": "mypipeline", "ELEMENTALCONDUCTOR_HOST": "elemental-server", "ELEMENTALCONDUCTOR_USER_LOGIN": "myuser", "ELEMENTALCONDUCTOR_API_KEY": "secret-key", @@ -83,12 +82,6 @@ func TestLoadConfigFromEnv(t *testing.T) { PresetPath: "transcoding-api-presets", }, Zencoder: &Zencoder{}, - ElasticTranscoder: &ElasticTranscoder{ - AccessKeyID: "AKIANOTREALLY", - SecretAccessKey: "secret-key", - Region: "us-east-1", - PipelineID: "mypipeline", - }, ElementalConductor: &ElementalConductor{ Host: "elemental-server", UserLogin: "myuser", @@ -151,7 +144,6 @@ func TestLoadConfigFromEnvWithDefaults(t *testing.T) { "AWS_ACCESS_KEY_ID": "AKIANOTREALLY", "AWS_SECRET_ACCESS_KEY": "secret-key", "AWS_REGION": "us-east-1", - "ELASTICTRANSCODER_PIPELINE_ID": "mypipeline", "ELEMENTALCONDUCTOR_HOST": "elemental-server", "ELEMENTALCONDUCTOR_USER_LOGIN": "myuser", "ELEMENTALCONDUCTOR_API_KEY": "secret-key", @@ -187,12 +179,6 @@ func TestLoadConfigFromEnvWithDefaults(t *testing.T) { Destination: "https://safe-stuff", StatusEndpoint: "http://status.encoding.com", }, - ElasticTranscoder: &ElasticTranscoder{ - AccessKeyID: "AKIANOTREALLY", - SecretAccessKey: "secret-key", - Region: "us-east-1", - PipelineID: "mypipeline", - }, ElementalConductor: &ElementalConductor{ Host: "elemental-server", UserLogin: "myuser", diff --git a/go.mod b/go.mod index 2e74503c..1907dcc4 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/video-dev/video-transcoding-api/v2 require ( github.com/NYTimes/gizmo v1.2.14 github.com/NYTimes/gziphandler v1.1.1 - github.com/aws/aws-sdk-go v1.23.3 github.com/aws/aws-sdk-go-v2 v0.10.0 github.com/bitmovin/bitmovin-go v1.29.0 github.com/fsouza/ctxlogger v1.5.8 diff --git a/go.sum b/go.sum index f11dc45d..d204745a 100644 --- a/go.sum +++ b/go.sum @@ -1,47 +1,23 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.30.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 h1:ROfEUZz+Gh5pa62DJWXSaonyu3StP6EA6lPEXPI6mCo= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -contrib.go.opencensus.io/exporter/ocagent v0.6.0/go.mod h1:zmKjrJcdo0aYcVS7bmEeSEBLPA9YJp5bjrofdU3pIXs= contrib.go.opencensus.io/exporter/stackdriver v0.12.2/go.mod h1:iwB6wGarfphGGe/e5CWqyUk/cLzKnWsOKPVW3no6OTw= contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DataDog/zstd v1.3.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.3.6-0.20190409195224-796139022798/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Gurpartap/logrus-stack v0.0.0-20170710170904-89c00d8a28f4 h1:vdT7QwBhJJEVNFMBNhRSFDRCB6O16T28VhvqRgqFyn8= github.com/Gurpartap/logrus-stack v0.0.0-20170710170904-89c00d8a28f4/go.mod h1:SvXOG8ElV28oAiG9zv91SDe5+9PfIr7PPccpr8YyXNs= -github.com/NYTimes/gizmo v1.2.13 h1:E8N8UXlOiRFD7jmpbR2q+ODxs8TlRf4yNTl1b6YVqto= -github.com/NYTimes/gizmo v1.2.13/go.mod h1:EVueweNcfm9LqrtNwpJE0VtnrQjkKKeCzVhEcrT1+pM= github.com/NYTimes/gizmo v1.2.14 h1:JvS7HxJI8QRgifnxPyCDof8tGYy0nz6eO93UWqZ2ypo= github.com/NYTimes/gizmo v1.2.14/go.mod h1:gb8iDOhy/u7Go0HsGgc7rQ9m3tA7bgbUndgeX4my1Ns= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/NYTimes/logrotate v1.0.0 h1:6jFGbon6jOtpy3t3kwZZKS4Gdmf1C/Wv5J4ll4Xn5yk= github.com/NYTimes/logrotate v1.0.0/go.mod h1:GxNz1cSw1c6t99PXoZlw+nm90H6cyQyrH66pjVv7x88= -github.com/Shopify/sarama v1.20.1/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v1.23.1/go.mod h1:XLH1GYJnLVE0XCr6KdJGVJRTwY30moWNJ4sERjXX6fs= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20170410192909-ea383cf3ba6e/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.22.0 h1:e88V6+dSEyBibUy0ekOydtTfNWzqG3hrtCR8SF6UqqY= -github.com/aws/aws-sdk-go v1.22.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.22.1 h1://WJvJi9iq/i5TWHuK3hIC23xCZYH7Qv7SIN2vZVqxY= -github.com/aws/aws-sdk-go v1.22.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.22.2 h1:uYP58k2Cd9y1qBy8CxTe5ADmdi4kANm8Ul8ch3kkIcQ= -github.com/aws/aws-sdk-go v1.22.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.22.3 h1:6hh+6uqguPNPLtnb6rYLJnonwixttKMbvZYWVUdms98= -github.com/aws/aws-sdk-go v1.22.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.22.4 h1:Mcq67g9mZEBvBuj/x7mF9KCyw5M8/4I/cjQPkdCsq0I= -github.com/aws/aws-sdk-go v1.22.4/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.23.0 h1:ilfJN/vJtFo1XDFxB2YMBYGeOvGZl6Qow17oyD4+Z9A= -github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.23.1 h1:MXfB75PkuWJJmZMCQ40haFUuOIIGt1FuiWtPBXy8URA= -github.com/aws/aws-sdk-go v1.23.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.23.2 h1:QSdnxlC29v6b2+C6mkriHhElh02ZlsRBoPX15SOZ6jU= -github.com/aws/aws-sdk-go v1.23.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.23.3 h1:Ty/4P6tOFJkDnKDrFJWnveznvESblf8QOheD1CwQPDU= -github.com/aws/aws-sdk-go v1.23.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.10.0 h1:qxZ7TyWFEIucMPQR2qymRx7JZ+hWF0N8HyCWh0XKh6Q= github.com/aws/aws-sdk-go-v2 v0.10.0/go.mod h1:cpXCmy3BB+lqwGweJjdawczHW3a+g8QgcFHcoOVoHao= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= @@ -52,7 +28,6 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -66,15 +41,10 @@ github.com/fluent/fluent-logger-golang v1.4.0 h1:uT1Lzz5yFV16YvDwWbjX6s3AYngnJz8 github.com/fluent/fluent-logger-golang v1.4.0/go.mod h1:2/HCT/jTy78yGyeNGQLGQsjF3zzzAuy6Xlk6FCMV5eU= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsouza/ctxlogger v1.5.7 h1:DhyLAfmgDpaUp/3aa71NHFcUs13/uu8GKyvHC9pH0IU= -github.com/fsouza/ctxlogger v1.5.7/go.mod h1:kzKQDXb9zfDx4l7s1FWTE37Oee9krkOnV6os+T2RC08= github.com/fsouza/ctxlogger v1.5.8 h1:WeCzJZNkXx2QbQn4ae3tVU58zBcPGMA+o7ykYqhU74o= github.com/fsouza/ctxlogger v1.5.8/go.mod h1:lZ2fh22JdnuMCgYmJOZqq32peZgwhEL+R6X3+MILHvc= -github.com/fsouza/gizmo-stackdriver-logging v1.3.0 h1:9Oj6+VWGSHRG6mDRGhwNRKxtwqb15I4kAXlIlpwY92k= -github.com/fsouza/gizmo-stackdriver-logging v1.3.0/go.mod h1:aa9jncdWMsq4dOoOlyueqBaovtSeg1tVUiaoMVzbjt4= github.com/fsouza/gizmo-stackdriver-logging v1.3.1 h1:/Ly7X0CWRN+VwLOctlewtt9Bvg+OwtFd/76VPEAyj/M= github.com/fsouza/gizmo-stackdriver-logging v1.3.1/go.mod h1:cvIA5UbpvKN+pZir82dMhwPouAmytECQHrCDfdXbpow= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= @@ -94,7 +64,6 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= @@ -108,7 +77,6 @@ github.com/google/gops v0.3.6/go.mod h1:RZ1rH95wsAGX4vMWKmqBOIWynmWisBf4QFdgT/k/ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA= @@ -118,7 +86,6 @@ github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/ github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U= github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/grpc-gateway v1.9.4/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= @@ -131,7 +98,6 @@ github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0 github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro= github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kelseyhightower/envconfig v1.3.0 h1:IvRS4f2VcIQy6j4ORGIf9145T/AsUB+oY8LyvN8BXNM= @@ -142,17 +108,13 @@ github.com/keybase/go-ps v0.0.0-20161005175911-668c8856d999 h1:2d+FLQbz4xRTi36DO github.com/keybase/go-ps v0.0.0-20161005175911-668c8856d999/go.mod h1:hY+WOq6m2FpbvyrI93sMaypsttvaIL5nhVR92dTMUcQ= github.com/knq/jwt v0.0.0-20180925223530-fc44a4704737 h1:1xIW/VaRuKqTia61AXVrIFt2wDeIgXyVmSFU6wX1cx4= github.com/knq/jwt v0.0.0-20180925223530-fc44a4704737/go.mod h1:H6bRgq8JMACag/WS+QyO3B00Hx9JZTF/zUHxNhzkxqo= -github.com/knq/pemutil v0.0.0-20180607233853-a6a7785bc45a h1:IPa47OrAMfRqw3RENZIMQF4rwU7doG3rNmvdzeeVYYQ= -github.com/knq/pemutil v0.0.0-20180607233853-a6a7785bc45a/go.mod h1:2VjBu5gkjU1wG99pRhJ+zm/P4bHnjdRY0CIMP9Gvn7Q= github.com/knq/pemutil v0.0.0-20181215144041-fb6fad722528 h1:W50e/aaqE/OF4zTsWRfLtkHzX44jNgIz8w1rKNV0dfg= github.com/knq/pemutil v0.0.0-20181215144041-fb6fad722528/go.mod h1:2VjBu5gkjU1wG99pRhJ+zm/P4bHnjdRY0CIMP9Gvn7Q= -github.com/knq/sdhook v0.0.0-20190114230312-41b9ccbff0b5 h1:K/XIPlDNzUOLjG4qPhSatnVlmma7kfB8tpUiQukjkJ0= -github.com/knq/sdhook v0.0.0-20190114230312-41b9ccbff0b5/go.mod h1:xneOdR9bxZt/0EInYiWOz9U07+AimqnjxFxRyndR8/0= github.com/knq/sdhook v0.0.0-20190801142816-0b7fa827d09a h1:ISpJvNQW7atuiFtuI4eYn+7OR6LkebeEg66toOw+0tM= github.com/knq/sdhook v0.0.0-20190801142816-0b7fa827d09a/go.mod h1:YActjSMTbqNCLzYRAgL+4cP6LHj46roJGtFl/iIKBRI= -github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= 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.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -175,7 +137,6 @@ github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -188,24 +149,17 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.0.0-20181218105931-67670fe90761 h1:z6tvbDJ5OLJ48FFmnksv04a78maSTRBUIhkdHYV5Y98= -github.com/prometheus/common v0.0.0-20181218105931-67670fe90761/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7 h1:80VN+vGkqM773Br/uNNTSheo3KatTgV8IpjIKjvVLng= github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= -github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME= github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= @@ -228,7 +182,6 @@ go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e/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-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -240,9 +193,7 @@ golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHl 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-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181017193950-04a2e542c03f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/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= @@ -254,7 +205,6 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8 golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/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-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -271,8 +221,6 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181019160139-8e24a49d80f8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/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-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= @@ -282,8 +230,6 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b h1:ag/x1USPSsqHud38I9BAC88qd golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug= golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 h1:LepdCS8Gf/MVejFIt8lsiexZATdoGVyp5bcyS+rYoUI= -golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= @@ -298,7 +244,6 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 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= -google.golang.org/api v0.0.0-20181021000519-a2651947f503/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0 h1:9sdfJOzWlkqPltHAuzT2Cp+yrBeY1KRVYgms8soxMwM= @@ -322,9 +267,8 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo= @@ -332,10 +276,8 @@ gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eR gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4= gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM= gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/main.go b/main.go index b4d18545..19107d56 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,6 @@ import ( "github.com/google/gops/agent" "github.com/video-dev/video-transcoding-api/v2/config" _ "github.com/video-dev/video-transcoding-api/v2/provider/bitmovin" - _ "github.com/video-dev/video-transcoding-api/v2/provider/elastictranscoder" _ "github.com/video-dev/video-transcoding-api/v2/provider/elementalconductor" _ "github.com/video-dev/video-transcoding-api/v2/provider/encodingcom" _ "github.com/video-dev/video-transcoding-api/v2/provider/hybrik" diff --git a/provider/elastictranscoder/aws.go b/provider/elastictranscoder/aws.go deleted file mode 100644 index aa37ba34..00000000 --- a/provider/elastictranscoder/aws.go +++ /dev/null @@ -1,419 +0,0 @@ -// Package elastictranscoder provides a implementation of the provider that -// uses AWS Elastic Transcoder for transcoding media files. -// -// It doesn't expose any public type. In order to use the provider, one must - -// -// import ( -// "github.com/video-dev/video-transcoding-api/v2/provider" -// "github.com/video-dev/video-transcoding-api/v2/provider/elastictranscoder" -// ) -// -// func UseProvider() { -// factory, err := provider.GetProviderFactory(elastictranscoder.Name) -// // handle err and use factory to get an instance of the provider. -// } -package elastictranscoder - -import ( - "errors" - "fmt" - "path/filepath" - "regexp" - "strconv" - "strings" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/elastictranscoder" - "github.com/aws/aws-sdk-go/service/elastictranscoder/elastictranscoderiface" - "github.com/video-dev/video-transcoding-api/v2/config" - "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" -) - -const ( - // Name is the name used for registering the Elastic Transcoder - // provider in the registry of providers. - Name = "elastictranscoder" - - defaultAWSRegion = "us-east-1" - hlsPlayList = "HLSv3" -) - -var ( - errAWSInvalidConfig = errors.New("invalid Elastic Transcoder config. Please define the configuration entries in the config file or environment variables") - s3Pattern = regexp.MustCompile(`^s3://`) -) - -func init() { - provider.Register(Name, elasticTranscoderFactory) -} - -type awsProvider struct { - c elastictranscoderiface.ElasticTranscoderAPI - config *config.ElasticTranscoder -} - -func (p *awsProvider) Transcode(job *db.Job) (*provider.JobStatus, error) { - var adaptiveStreamingOutputs []db.TranscodeOutput - source := p.normalizeSource(job.SourceMedia) - params := elastictranscoder.CreateJobInput{ - PipelineId: aws.String(p.config.PipelineID), - Input: &elastictranscoder.JobInput{Key: aws.String(source)}, - } - params.Outputs = make([]*elastictranscoder.CreateJobOutput, len(job.Outputs)) - for i, output := range job.Outputs { - presetID, ok := output.Preset.ProviderMapping[Name] - if !ok { - return nil, provider.ErrPresetMapNotFound - } - presetQuery := &elastictranscoder.ReadPresetInput{ - Id: aws.String(presetID), - } - presetOutput, err := p.c.ReadPreset(presetQuery) - if err != nil { - return nil, err - } - if presetOutput.Preset == nil || presetOutput.Preset.Container == nil { - return nil, fmt.Errorf("misconfigured preset: %s", presetID) - } - var isAdaptiveStreamingPreset bool - if *presetOutput.Preset.Container == "ts" { - isAdaptiveStreamingPreset = true - adaptiveStreamingOutputs = append(adaptiveStreamingOutputs, output) - } - params.Outputs[i] = &elastictranscoder.CreateJobOutput{ - PresetId: aws.String(presetID), - Key: p.outputKey(job, output.FileName, isAdaptiveStreamingPreset), - } - if isAdaptiveStreamingPreset { - params.Outputs[i].SegmentDuration = aws.String(strconv.Itoa(int(job.StreamingParams.SegmentDuration))) - } - } - - if len(adaptiveStreamingOutputs) > 0 { - playlistFileName := job.StreamingParams.PlaylistFileName - playlistFileName = strings.TrimRight(playlistFileName, filepath.Ext(playlistFileName)) - jobPlaylist := elastictranscoder.CreateJobPlaylist{ - Format: aws.String(hlsPlayList), - Name: aws.String(job.ID + "/" + playlistFileName), - } - - jobPlaylist.OutputKeys = make([]*string, len(adaptiveStreamingOutputs)) - for i, output := range adaptiveStreamingOutputs { - jobPlaylist.OutputKeys[i] = p.outputKey(job, output.FileName, true) - } - - params.Playlists = []*elastictranscoder.CreateJobPlaylist{&jobPlaylist} - } - resp, err := p.c.CreateJob(¶ms) - if err != nil { - return nil, err - } - return &provider.JobStatus{ - ProviderName: Name, - ProviderJobID: aws.StringValue(resp.Job.Id), - Status: provider.StatusQueued, - }, nil -} - -func (p *awsProvider) normalizeSource(source string) string { - if s3Pattern.MatchString(source) { - source = strings.Replace(source, "s3://", "", 1) - parts := strings.SplitN(source, "/", 2) - return parts[len(parts)-1] - } - return source -} - -func (p *awsProvider) outputKey(job *db.Job, fileName string, adaptive bool) *string { - if adaptive { - fileName = strings.TrimRight(fileName, filepath.Ext(fileName)) - } - return aws.String(job.ID + "/" + fileName) -} - -func (p *awsProvider) createVideoPreset(preset db.Preset) *elastictranscoder.VideoParameters { - videoPreset := elastictranscoder.VideoParameters{ - DisplayAspectRatio: aws.String("auto"), - FrameRate: aws.String("auto"), - SizingPolicy: aws.String("Fill"), - PaddingPolicy: aws.String("Pad"), - Codec: &preset.Video.Codec, - KeyframesMaxDist: &preset.Video.GopSize, - CodecOptions: map[string]*string{ - "Profile": aws.String(strings.ToLower(preset.Video.Profile)), - "Level": &preset.Video.ProfileLevel, - "MaxReferenceFrames": aws.String("2"), - }, - } - if preset.Video.Width != "" { - videoPreset.MaxWidth = &preset.Video.Width - } else { - videoPreset.MaxWidth = aws.String("auto") - } - if preset.Video.Height != "" { - videoPreset.MaxHeight = &preset.Video.Height - } else { - videoPreset.MaxHeight = aws.String("auto") - } - normalizedVideoBitRate, _ := strconv.Atoi(preset.Video.Bitrate) - videoBitrate := strconv.Itoa(normalizedVideoBitRate / 1000) - videoPreset.BitRate = &videoBitrate - switch preset.Video.Codec { - case "h264": - videoPreset.Codec = aws.String("H.264") - case "vp8", "vp9": - videoPreset.Codec = aws.String(preset.Video.Codec) - delete(videoPreset.CodecOptions, "MaxReferenceFrames") - delete(videoPreset.CodecOptions, "Level") - // Recommended profile value is zero, based on: - // http://www.webmproject.org/docs/encoder-parameters/ - videoPreset.CodecOptions["Profile"] = aws.String("0") - } - if preset.Video.GopMode == "fixed" { - videoPreset.FixedGOP = aws.String("true") - } - return &videoPreset -} - -func (p *awsProvider) createThumbsPreset() *elastictranscoder.Thumbnails { - thumbsPreset := &elastictranscoder.Thumbnails{ - PaddingPolicy: aws.String("Pad"), - Format: aws.String("png"), - Interval: aws.String("1"), - SizingPolicy: aws.String("Fill"), - MaxWidth: aws.String("auto"), - MaxHeight: aws.String("auto"), - } - return thumbsPreset -} - -func (p *awsProvider) createAudioPreset(preset db.Preset) *elastictranscoder.AudioParameters { - audioPreset := &elastictranscoder.AudioParameters{ - Codec: &preset.Audio.Codec, - Channels: aws.String("auto"), - SampleRate: aws.String("auto"), - } - - normalizedAudioBitRate, _ := strconv.Atoi(preset.Audio.Bitrate) - audioBitrate := strconv.Itoa(normalizedAudioBitRate / 1000) - audioPreset.BitRate = &audioBitrate - - switch preset.Audio.Codec { - case "aac": - audioPreset.Codec = aws.String("AAC") - case "libvorbis": - audioPreset.Codec = aws.String("vorbis") - } - - return audioPreset -} - -func (p *awsProvider) CreatePreset(preset db.Preset) (string, error) { - presetInput := elastictranscoder.CreatePresetInput{ - Name: &preset.Name, - Description: &preset.Description, - } - if preset.Container == "m3u8" { - presetInput.Container = aws.String("ts") - } else { - presetInput.Container = &preset.Container - } - presetInput.Video = p.createVideoPreset(preset) - presetInput.Audio = p.createAudioPreset(preset) - presetInput.Thumbnails = p.createThumbsPreset() - presetOutput, err := p.c.CreatePreset(&presetInput) - if err != nil { - return "", err - } - return *presetOutput.Preset.Id, nil -} - -func (p *awsProvider) GetPreset(presetID string) (interface{}, error) { - readPresetInput := &elastictranscoder.ReadPresetInput{ - Id: aws.String(presetID), - } - readPresetOutput, err := p.c.ReadPreset(readPresetInput) - if err != nil { - return nil, err - } - return readPresetOutput, err -} - -func (p *awsProvider) DeletePreset(presetID string) error { - presetInput := elastictranscoder.DeletePresetInput{ - Id: &presetID, - } - _, err := p.c.DeletePreset(&presetInput) - return err -} - -func (p *awsProvider) JobStatus(job *db.Job) (*provider.JobStatus, error) { - id := job.ProviderJobID - resp, err := p.c.ReadJob(&elastictranscoder.ReadJobInput{Id: aws.String(id)}) - if err != nil { - return nil, err - } - totalJobs := len(resp.Job.Outputs) - completedJobs := float64(0) - outputs := make(map[string]interface{}, totalJobs) - for _, output := range resp.Job.Outputs { - outputStatus := p.statusMap(aws.StringValue(output.Status)) - switch outputStatus { - case provider.StatusFinished, provider.StatusCanceled, provider.StatusFailed: - completedJobs++ - } - outputs[aws.StringValue(output.Key)] = aws.StringValue(output.StatusDetail) - } - outputDestination, err := p.getOutputDestination(job, resp.Job) - if err != nil { - outputDestination = err.Error() - } - outputFiles, err := p.getOutputFiles(resp.Job) - if err != nil { - return nil, err - } - var sourceInfo provider.SourceInfo - if resp.Job.Input.DetectedProperties != nil { - sourceInfo = provider.SourceInfo{ - Duration: time.Duration(aws.Int64Value(resp.Job.Input.DetectedProperties.DurationMillis)) * time.Millisecond, - Height: aws.Int64Value(resp.Job.Input.DetectedProperties.Height), - Width: aws.Int64Value(resp.Job.Input.DetectedProperties.Width), - } - } - statusMessage := "" - if len(resp.Job.Outputs) > 0 { - statusMessage = aws.StringValue(resp.Job.Outputs[0].StatusDetail) - if strings.Contains(statusMessage, ":") { - errorMessage := strings.SplitN(statusMessage, ":", 2)[1] - statusMessage = strings.TrimSpace(errorMessage) - } - } - return &provider.JobStatus{ - ProviderJobID: aws.StringValue(resp.Job.Id), - Status: p.statusMap(aws.StringValue(resp.Job.Status)), - StatusMessage: statusMessage, - Progress: completedJobs / float64(totalJobs) * 100, - ProviderStatus: map[string]interface{}{"outputs": outputs}, - SourceInfo: sourceInfo, - Output: provider.JobOutput{ - Destination: outputDestination, - Files: outputFiles, - }, - }, nil -} - -func (p *awsProvider) getOutputDestination(job *db.Job, awsJob *elastictranscoder.Job) (string, error) { - readPipelineOutput, err := p.c.ReadPipeline(&elastictranscoder.ReadPipelineInput{ - Id: awsJob.PipelineId, - }) - if err != nil { - return "", err - } - return fmt.Sprintf("s3://%s/%s", - aws.StringValue(readPipelineOutput.Pipeline.OutputBucket), - job.ID, - ), nil -} - -func (p *awsProvider) getOutputFiles(job *elastictranscoder.Job) ([]provider.OutputFile, error) { - pipeline, err := p.c.ReadPipeline(&elastictranscoder.ReadPipelineInput{ - Id: job.PipelineId, - }) - if err != nil { - return nil, err - } - files := make([]provider.OutputFile, 0, len(job.Outputs)+len(job.Playlists)) - for _, output := range job.Outputs { - preset, err := p.c.ReadPreset(&elastictranscoder.ReadPresetInput{ - Id: output.PresetId, - }) - if err != nil { - return nil, err - } - filePath := fmt.Sprintf("s3://%s/%s%s", - aws.StringValue(pipeline.Pipeline.OutputBucket), - aws.StringValue(job.OutputKeyPrefix), - aws.StringValue(output.Key), - ) - container := aws.StringValue(preset.Preset.Container) - if container == "ts" { - continue - } - file := provider.OutputFile{ - Path: filePath, - Container: container, - VideoCodec: aws.StringValue(preset.Preset.Video.Codec), - Width: aws.Int64Value(output.Width), - Height: aws.Int64Value(output.Height), - } - files = append(files, file) - } - for _, playlist := range job.Playlists { - filePath := fmt.Sprintf("s3://%s/%s%s", - aws.StringValue(pipeline.Pipeline.OutputBucket), - aws.StringValue(job.OutputKeyPrefix), - aws.StringValue(playlist.Name)+".m3u8", - ) - files = append(files, provider.OutputFile{Path: filePath, Container: "m3u8"}) - } - return files, nil -} - -func (p *awsProvider) statusMap(awsStatus string) provider.Status { - switch awsStatus { - case "Submitted": - return provider.StatusQueued - case "Progressing": - return provider.StatusStarted - case "Complete": - return provider.StatusFinished - case "Canceled": - return provider.StatusCanceled - default: - return provider.StatusFailed - } -} - -func (p *awsProvider) CancelJob(id string) error { - _, err := p.c.CancelJob(&elastictranscoder.CancelJobInput{Id: aws.String(id)}) - return err -} - -func (p *awsProvider) Healthcheck() error { - _, err := p.c.ReadPipeline(&elastictranscoder.ReadPipelineInput{ - Id: aws.String(p.config.PipelineID), - }) - return err -} - -func (p *awsProvider) Capabilities() provider.Capabilities { - return provider.Capabilities{ - InputFormats: []string{"h264"}, - OutputFormats: []string{"mp4", "hls", "webm"}, - Destinations: []string{"s3"}, - } -} - -func elasticTranscoderFactory(cfg *config.Config) (provider.TranscodingProvider, error) { - if cfg.ElasticTranscoder.AccessKeyID == "" || cfg.ElasticTranscoder.SecretAccessKey == "" || cfg.ElasticTranscoder.PipelineID == "" { - return nil, errAWSInvalidConfig - } - creds := credentials.NewStaticCredentials(cfg.ElasticTranscoder.AccessKeyID, cfg.ElasticTranscoder.SecretAccessKey, "") - region := cfg.ElasticTranscoder.Region - if region == "" { - region = defaultAWSRegion - } - awsSession, err := session.NewSession(aws.NewConfig().WithCredentials(creds).WithRegion(region)) - if err != nil { - return nil, err - } - return &awsProvider{ - c: elastictranscoder.New(awsSession), - config: cfg.ElasticTranscoder, - }, nil -} diff --git a/provider/elastictranscoder/aws_fake_transcode_test.go b/provider/elastictranscoder/aws_fake_transcode_test.go deleted file mode 100644 index 54f57f47..00000000 --- a/provider/elastictranscoder/aws_fake_transcode_test.go +++ /dev/null @@ -1,170 +0,0 @@ -package elastictranscoder - -import ( - "crypto/rand" - "errors" - "fmt" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/elastictranscoder" -) - -type failure struct { - op string - err error -} - -type fakeElasticTranscoder struct { - *elastictranscoder.ElasticTranscoder - jobs map[string]*elastictranscoder.CreateJobInput - canceledJobs []elastictranscoder.CancelJobInput - failures chan failure -} - -func newFakeElasticTranscoder() *fakeElasticTranscoder { - return &fakeElasticTranscoder{ - ElasticTranscoder: &elastictranscoder.ElasticTranscoder{}, - failures: make(chan failure, 1), - jobs: make(map[string]*elastictranscoder.CreateJobInput), - } -} - -func (c *fakeElasticTranscoder) CreateJob(input *elastictranscoder.CreateJobInput) (*elastictranscoder.CreateJobResponse, error) { - if err := c.getError("CreateJob"); err != nil { - return nil, err - } - input.Input.DetectedProperties = &elastictranscoder.DetectedProperties{ - DurationMillis: aws.Int64(120e3), - FileSize: aws.Int64(60356779), - Width: aws.Int64(1920), - Height: aws.Int64(1080), - } - id := fmt.Sprintf("job-%x", generateID()) - c.jobs[id] = input - return &elastictranscoder.CreateJobResponse{ - Job: &elastictranscoder.Job{ - Id: aws.String(id), - Input: input.Input, - PipelineId: input.PipelineId, - Status: aws.String("Submitted"), - }, - }, nil -} - -func (c *fakeElasticTranscoder) CreatePreset(input *elastictranscoder.CreatePresetInput) (*elastictranscoder.CreatePresetOutput, error) { - presetID := *input.Name + "-abc123" - return &elastictranscoder.CreatePresetOutput{ - Preset: &elastictranscoder.Preset{ - Audio: input.Audio, - Container: input.Container, - Description: input.Description, - Name: input.Name, - Id: &presetID, - Thumbnails: input.Thumbnails, - Video: input.Video, - }, - }, nil -} - -func (c *fakeElasticTranscoder) ReadPreset(input *elastictranscoder.ReadPresetInput) (*elastictranscoder.ReadPresetOutput, error) { - container := "mp4" - codec := "H.264" - if strings.Contains(*input.Id, "hls") { - container = "ts" - } - if strings.Contains(*input.Id, "webm") { - container = "webm" - codec = "VP8" - } - return &elastictranscoder.ReadPresetOutput{ - Preset: &elastictranscoder.Preset{ - Id: input.Id, - Name: input.Id, - Container: aws.String(container), - Video: &elastictranscoder.VideoParameters{Codec: aws.String(codec)}, - }, - }, nil -} - -func (c *fakeElasticTranscoder) ReadJob(input *elastictranscoder.ReadJobInput) (*elastictranscoder.ReadJobOutput, error) { - if err := c.getError("ReadJob"); err != nil { - return nil, err - } - createJobInput, ok := c.jobs[*input.Id] - if !ok { - return nil, errors.New("job not found") - } - outputs := make([]*elastictranscoder.JobOutput, len(createJobInput.Outputs)) - for i, createJobOutput := range createJobInput.Outputs { - outputs[i] = &elastictranscoder.JobOutput{ - Key: createJobOutput.Key, - Status: aws.String("Complete"), - StatusDetail: aws.String("it's finished!"), - PresetId: aws.String(fmt.Sprintf("preset-%s", aws.StringValue(createJobOutput.Key))), - Width: aws.Int64(0), - Height: aws.Int64(720), - } - } - playlists := make([]*elastictranscoder.Playlist, len(createJobInput.Playlists)) - for i, createJobPlaylist := range createJobInput.Playlists { - playlists[i] = &elastictranscoder.Playlist{ - Name: createJobPlaylist.Name, - Format: createJobPlaylist.Format, - OutputKeys: createJobPlaylist.OutputKeys, - } - } - return &elastictranscoder.ReadJobOutput{ - Job: &elastictranscoder.Job{ - Id: input.Id, - Input: createJobInput.Input, - PipelineId: createJobInput.PipelineId, - Status: aws.String("Complete"), - Outputs: outputs, - Playlists: playlists, - }, - }, nil -} - -func (c *fakeElasticTranscoder) ReadPipeline(input *elastictranscoder.ReadPipelineInput) (*elastictranscoder.ReadPipelineOutput, error) { - if err := c.getError("ReadPipeline"); err != nil { - return nil, err - } - return &elastictranscoder.ReadPipelineOutput{ - Pipeline: &elastictranscoder.Pipeline{ - Id: input.Id, - Name: aws.String("nice pipeline"), - OutputBucket: aws.String("some bucket"), - }, - }, nil -} - -func (c *fakeElasticTranscoder) CancelJob(input *elastictranscoder.CancelJobInput) (*elastictranscoder.CancelJobOutput, error) { - if err := c.getError("CancelJob"); err != nil { - return nil, err - } - c.canceledJobs = append(c.canceledJobs, *input) - return &elastictranscoder.CancelJobOutput{}, nil -} - -func (c *fakeElasticTranscoder) prepareFailure(op string, err error) { - c.failures <- failure{op: op, err: err} -} - -func (c *fakeElasticTranscoder) getError(op string) error { - select { - case prepFailure := <-c.failures: - if prepFailure.op == op { - return prepFailure.err - } - c.failures <- prepFailure - default: - } - return nil -} - -func generateID() []byte { - var b [4]byte - rand.Read(b[:]) - return b[:] -} diff --git a/provider/elastictranscoder/aws_test.go b/provider/elastictranscoder/aws_test.go deleted file mode 100644 index a54eac9a..00000000 --- a/provider/elastictranscoder/aws_test.go +++ /dev/null @@ -1,1165 +0,0 @@ -package elastictranscoder - -import ( - "errors" - "os" - "reflect" - "regexp" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/service/elastictranscoder" - "github.com/kr/pretty" - "github.com/video-dev/video-transcoding-api/v2/config" - "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" -) - -func TestFactoryIsRegistered(t *testing.T) { - _, err := provider.GetProviderFactory(Name) - if err != nil { - t.Fatal(err) - } -} - -func TestElasticTranscoderProvider(t *testing.T) { - cfg := config.Config{ - ElasticTranscoder: &config.ElasticTranscoder{ - AccessKeyID: "AKIANOTREALLY", - SecretAccessKey: "really-secret", - PipelineID: "mypipeline", - Region: "sa-east-1", - }, - } - provider, err := elasticTranscoderFactory(&cfg) - if err != nil { - t.Fatal(err) - } - elasticProvider := provider.(*awsProvider) - if !reflect.DeepEqual(*elasticProvider.config, *cfg.ElasticTranscoder) { - t.Errorf("ElasticTranscoderProvider: did not store the proper config. Want %#v. Got %#v.", cfg.ElasticTranscoder, elasticProvider.config) - } - expectedCreds := credentials.Value{AccessKeyID: "AKIANOTREALLY", SecretAccessKey: "really-secret"} - creds, err := elasticProvider.c.(*elastictranscoder.ElasticTranscoder).Config.Credentials.Get() - if err != nil { - t.Fatal(err) - } - - // provider is not relevant - creds.ProviderName = expectedCreds.ProviderName - if !reflect.DeepEqual(creds, expectedCreds) { - t.Errorf("ElasticTranscoderProvider: wrogn credentials. Want %#v. Got %#v.", expectedCreds, creds) - } - - region := *elasticProvider.c.(*elastictranscoder.ElasticTranscoder).Config.Region - if region != cfg.ElasticTranscoder.Region { - t.Errorf("ElasticTranscoderProvider: wrong region. Want %q. Got %q.", cfg.ElasticTranscoder.Region, region) - } -} - -func TestElasticTranscoderProviderDefaultRegion(t *testing.T) { - cfg := config.Config{ - ElasticTranscoder: &config.ElasticTranscoder{ - AccessKeyID: "AKIANOTREALLY", - SecretAccessKey: "really-secret", - PipelineID: "mypipeline", - }, - } - provider, err := elasticTranscoderFactory(&cfg) - if err != nil { - t.Fatal(err) - } - elasticProvider := provider.(*awsProvider) - if !reflect.DeepEqual(*elasticProvider.config, *cfg.ElasticTranscoder) { - t.Errorf("ElasticTranscoderProvider: did not store the proper config. Want %#v. Got %#v.", cfg.ElasticTranscoder, elasticProvider.config) - } - expectedCreds := credentials.Value{AccessKeyID: "AKIANOTREALLY", SecretAccessKey: "really-secret"} - creds, err := elasticProvider.c.(*elastictranscoder.ElasticTranscoder).Config.Credentials.Get() - if err != nil { - t.Fatal(err) - } - - // provider is not relevant - creds.ProviderName = expectedCreds.ProviderName - if !reflect.DeepEqual(creds, expectedCreds) { - t.Errorf("ElasticTranscoderProvider: wrogn credentials. Want %#v. Got %#v.", expectedCreds, creds) - } - - region := *elasticProvider.c.(*elastictranscoder.ElasticTranscoder).Config.Region - if region != "us-east-1" { - t.Errorf("ElasticTranscoderProvider: wrong region. Want %q. Got %q.", "us-east-1", region) - } -} - -func TestElasticTranscoderProviderValidation(t *testing.T) { - tests := []struct { - accessKeyID string - secretAccessKey string - pipelineID string - }{ - {"", "", ""}, - {"AKIANOTREALLY", "", ""}, - {"", "very-secret", ""}, - {"", "", "superpipeline"}, - {"AKIANOTREALLY", "very-secret", ""}, - } - for _, test := range tests { - cfg := config.Config{ - ElasticTranscoder: &config.ElasticTranscoder{ - AccessKeyID: test.accessKeyID, - SecretAccessKey: test.secretAccessKey, - PipelineID: test.pipelineID, - }, - } - provider, err := elasticTranscoderFactory(&cfg) - if provider != nil { - t.Errorf("Got unexpected non-nil provider: %#v", provider) - } - if err != errAWSInvalidConfig { - t.Errorf("Wrong error returned. Want errAWSInvalidConfig. Got %#v", err) - } - } -} - -func TestAWSTranscode(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - source := "dir/file.mov" - outputs := []db.TranscodeOutput{ - { - FileName: "output-720p.mp4", - Preset: db.PresetMap{ - Name: "mp4_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0001", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "mp4"}, - }, - }, - { - FileName: "output-720p.webm", - Preset: db.PresetMap{ - Name: "webm_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0002", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "webm"}, - }, - }, - { - FileName: "output-1080p.mov", - Preset: db.PresetMap{ - Name: "mov_1080p", - ProviderMapping: map[string]string{ - Name: "93239832-0003", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "mov"}, - }, - }, - } - - jobStatus, err := prov.Transcode(&db.Job{ - ID: "job-123", - SourceMedia: source, - Outputs: outputs, - StreamingParams: db.StreamingParams{}, - }) - if err != nil { - t.Fatal(err) - } - if m, _ := regexp.MatchString(`^job-[a-f0-9]{8}$`, jobStatus.ProviderJobID); !m { - t.Errorf("Elastic Transcoder: invalid id returned - %q", jobStatus.ProviderJobID) - } - if jobStatus.Status != provider.StatusQueued { - t.Errorf("Elastic Transcoder: wrong status returned. Want queued. Got %v", jobStatus.Status) - } - if jobStatus.ProviderName != Name { - t.Errorf("Elastic Transcoder: wrong provider name returned. Want %q. Got %q", Name, jobStatus.ProviderName) - } - - if len(fakeTranscoder.jobs) != 1 { - t.Fatal("Did not send any job request to the server.") - } - jobInput := fakeTranscoder.jobs[jobStatus.ProviderJobID] - - expectedJobInput := elastictranscoder.CreateJobInput{ - PipelineId: aws.String("mypipeline"), - Input: &elastictranscoder.JobInput{ - Key: aws.String(source), - DetectedProperties: &elastictranscoder.DetectedProperties{ - DurationMillis: aws.Int64(120e3), - FileSize: aws.Int64(60356779), - Height: aws.Int64(1080), - Width: aws.Int64(1920), - }, - }, - Outputs: []*elastictranscoder.CreateJobOutput{ - {PresetId: aws.String("93239832-0001"), Key: aws.String("job-123/output-720p.mp4")}, - {PresetId: aws.String("93239832-0002"), Key: aws.String("job-123/output-720p.webm")}, - {PresetId: aws.String("93239832-0003"), Key: aws.String("job-123/output-1080p.mov")}, - }, - } - if !reflect.DeepEqual(*jobInput, expectedJobInput) { - t.Errorf("Elastic Transcoder: wrong input\nWant %#v\nGot %#v", expectedJobInput, *jobInput) - } -} - -func TestAWSTranscodeAdaptiveStreaming(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - source := "dir/file.mov" - outputs := []db.TranscodeOutput{ - { - FileName: "output_360p_hls/video.m3u8", - Preset: db.PresetMap{ - Name: "hls_360p", - ProviderMapping: map[string]string{ - Name: "93239832-0001-hls", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "hls"}, - }, - }, - { - FileName: "output_480p_hls/video.m3u8", - Preset: db.PresetMap{ - Name: "hls_480p", - ProviderMapping: map[string]string{ - Name: "93239832-0002-hls", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "hls"}, - }, - }, - { - FileName: "output_720p_hls/video.m3u8", - Preset: db.PresetMap{ - Name: "hls_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0003-hls", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "hls"}, - }, - }, - } - - jobStatus, err := prov.Transcode(&db.Job{ - ID: "job-123", - SourceMedia: source, - Outputs: outputs, - StreamingParams: db.StreamingParams{ - PlaylistFileName: "video.m3u8", - Protocol: "asdf", - SegmentDuration: 3, - }, - }) - if err != nil { - t.Fatal(err) - } - if m, _ := regexp.MatchString(`^job-[a-f0-9]{8}$`, jobStatus.ProviderJobID); !m { - t.Errorf("Elastic Transcoder: invalid id returned - %q", jobStatus.ProviderJobID) - } - if jobStatus.Status != provider.StatusQueued { - t.Errorf("Elastic Transcoder: wrong status returned. Want queued. Got %v", jobStatus.Status) - } - if jobStatus.ProviderName != Name { - t.Errorf("Elastic Transcoder: wrong provider name returned. Want %q. Got %q", Name, jobStatus.ProviderName) - } - - if len(fakeTranscoder.jobs) != 1 { - t.Fatal("Did not send any job request to the server.") - } - jobInput := fakeTranscoder.jobs[jobStatus.ProviderJobID] - - expectedJobInput := elastictranscoder.CreateJobInput{ - PipelineId: aws.String("mypipeline"), - Input: &elastictranscoder.JobInput{ - Key: aws.String(source), - DetectedProperties: &elastictranscoder.DetectedProperties{ - DurationMillis: aws.Int64(120e3), - FileSize: aws.Int64(60356779), - Height: aws.Int64(1080), - Width: aws.Int64(1920), - }, - }, - Outputs: []*elastictranscoder.CreateJobOutput{ - {PresetId: aws.String("93239832-0001-hls"), Key: aws.String("job-123/output_360p_hls/video"), SegmentDuration: aws.String("3")}, - {PresetId: aws.String("93239832-0002-hls"), Key: aws.String("job-123/output_480p_hls/video"), SegmentDuration: aws.String("3")}, - {PresetId: aws.String("93239832-0003-hls"), Key: aws.String("job-123/output_720p_hls/video"), SegmentDuration: aws.String("3")}, - }, - Playlists: []*elastictranscoder.CreateJobPlaylist{ - { - Format: aws.String("HLSv3"), - Name: aws.String("job-123/video"), - OutputKeys: []*string{ - aws.String("job-123/output_360p_hls/video"), - aws.String("job-123/output_480p_hls/video"), - aws.String("job-123/output_720p_hls/video"), - }, - }, - }, - } - if !reflect.DeepEqual(*jobInput, expectedJobInput) { - t.Errorf("Elastic Transcoder: wrong input\nWant %#v\nGot %#v", expectedJobInput, *jobInput) - } -} - -func TestAWSTranscodeAdaptiveAndNonAdaptiveStreaming(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - source := "dir/file.mov" - outputs := []db.TranscodeOutput{ - { - FileName: "hls/output_hls_360p/video.m3u8", - Preset: db.PresetMap{ - Name: "hls_360p", - ProviderMapping: map[string]string{ - Name: "93239832-0001-hls", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "hls"}, - }, - }, - { - FileName: "hls/output_hls_480p/video.m3u8", - Preset: db.PresetMap{ - Name: "hls_480p", - ProviderMapping: map[string]string{ - Name: "93239832-0002-hls", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "hls"}, - }, - }, - { - FileName: "hls/output_hls_720p/video.m3u8", - Preset: db.PresetMap{ - Name: "hls_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0003-hls", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "hls"}, - }, - }, - { - FileName: "output_720p.mp4", - Preset: db.PresetMap{ - Name: "mp4_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0004", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "mp4"}, - }, - }, - } - - jobStatus, err := prov.Transcode(&db.Job{ - ID: "job-123", - SourceMedia: source, - Outputs: outputs, - StreamingParams: db.StreamingParams{ - PlaylistFileName: "hls/video.m3u8", - Protocol: "asdf", - SegmentDuration: 3, - }, - }) - if err != nil { - t.Fatal(err) - } - if m, _ := regexp.MatchString(`^job-[a-f0-9]{8}$`, jobStatus.ProviderJobID); !m { - t.Errorf("Elastic Transcoder: invalid id returned - %q", jobStatus.ProviderJobID) - } - if jobStatus.Status != provider.StatusQueued { - t.Errorf("Elastic Transcoder: wrong status returned. Want queued. Got %v", jobStatus.Status) - } - if jobStatus.ProviderName != Name { - t.Errorf("Elastic Transcoder: wrong provider name returned. Want %q. Got %q", Name, jobStatus.ProviderName) - } - - if len(fakeTranscoder.jobs) != 1 { - t.Fatal("Did not send any job request to the server.") - } - jobInput := fakeTranscoder.jobs[jobStatus.ProviderJobID] - - expectedJobInput := elastictranscoder.CreateJobInput{ - PipelineId: aws.String("mypipeline"), - Input: &elastictranscoder.JobInput{ - Key: aws.String(source), - DetectedProperties: &elastictranscoder.DetectedProperties{ - DurationMillis: aws.Int64(120e3), - FileSize: aws.Int64(60356779), - Height: aws.Int64(1080), - Width: aws.Int64(1920), - }, - }, - Outputs: []*elastictranscoder.CreateJobOutput{ - {PresetId: aws.String("93239832-0001-hls"), Key: aws.String("job-123/hls/output_hls_360p/video"), SegmentDuration: aws.String("3")}, - {PresetId: aws.String("93239832-0002-hls"), Key: aws.String("job-123/hls/output_hls_480p/video"), SegmentDuration: aws.String("3")}, - {PresetId: aws.String("93239832-0003-hls"), Key: aws.String("job-123/hls/output_hls_720p/video"), SegmentDuration: aws.String("3")}, - {PresetId: aws.String("93239832-0004"), Key: aws.String("job-123/output_720p.mp4")}, - }, - Playlists: []*elastictranscoder.CreateJobPlaylist{ - { - Format: aws.String("HLSv3"), - Name: aws.String("job-123/hls/video"), - OutputKeys: []*string{ - aws.String("job-123/hls/output_hls_360p/video"), - aws.String("job-123/hls/output_hls_480p/video"), - aws.String("job-123/hls/output_hls_720p/video"), - }, - }, - }, - } - if !reflect.DeepEqual(*jobInput, expectedJobInput) { - t.Errorf("Elastic Transcoder: wrong input\nWant %#v\nGot %#v", expectedJobInput, *jobInput) - } -} - -func TestAWSTranscodeNormalizedSource(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - source := "s3://bucketname/some/dir/with/subdir/file.mov" - outputs := []db.TranscodeOutput{ - { - FileName: "output_720p.mp4", - Preset: db.PresetMap{ - Name: "mp4_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0001", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "mp4"}, - }, - }, - { - FileName: "output_1080p.webm", - Preset: db.PresetMap{ - Name: "webm_1080p", - ProviderMapping: map[string]string{ - Name: "93239832-0002", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "webm"}, - }, - }, - } - jobStatus, err := prov.Transcode(&db.Job{ - ID: "job-1", - SourceMedia: source, - Outputs: outputs, - StreamingParams: db.StreamingParams{}, - }) - if err != nil { - t.Fatal(err) - } - if m, _ := regexp.MatchString(`^job-[a-f0-9]{8}$`, jobStatus.ProviderJobID); !m { - t.Errorf("Elastic Transcoder: invalid id returned - %q", jobStatus.ProviderJobID) - } - if jobStatus.Status != provider.StatusQueued { - t.Errorf("Elastic Transcoder: wrong status returned. Want queued. Got %v", jobStatus.Status) - } - if jobStatus.ProviderName != Name { - t.Errorf("Elastic Transcoder: wrong provider name returned. Want %q. Got %q", Name, jobStatus.ProviderName) - } - - if len(fakeTranscoder.jobs) != 1 { - t.Fatal("Did not send any job request to the server.") - } - jobInput := fakeTranscoder.jobs[jobStatus.ProviderJobID] - - expectedJobInput := elastictranscoder.CreateJobInput{ - PipelineId: aws.String("mypipeline"), - Input: &elastictranscoder.JobInput{ - Key: aws.String("some/dir/with/subdir/file.mov"), - DetectedProperties: &elastictranscoder.DetectedProperties{ - DurationMillis: aws.Int64(120e3), - FileSize: aws.Int64(60356779), - Height: aws.Int64(1080), - Width: aws.Int64(1920), - }, - }, - Outputs: []*elastictranscoder.CreateJobOutput{ - {PresetId: aws.String("93239832-0001"), Key: aws.String("job-1/output_720p.mp4")}, - {PresetId: aws.String("93239832-0002"), Key: aws.String("job-1/output_1080p.webm")}, - }, - } - if !reflect.DeepEqual(*jobInput, expectedJobInput) { - t.Errorf("Elastic Transcoder: wrong input\nWant %#v\nGot %#v", expectedJobInput, *jobInput) - } -} - -func TestAWSTranscodePresetNotFound(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - source := "s3://bucketname/some/dir/with/subdir/file.mov" - outputs := []db.TranscodeOutput{ - { - FileName: "output_720p.mp4", - Preset: db.PresetMap{ - Name: "mp4_720p", - ProviderMapping: map[string]string{"other": "irrelevant"}, - OutputOpts: db.OutputOptions{Extension: "mp4"}, - }, - }, - } - jobStatus, err := prov.Transcode(&db.Job{ - ID: "job-123", - SourceMedia: source, - Outputs: outputs, - StreamingParams: db.StreamingParams{}, - }) - if err != provider.ErrPresetMapNotFound { - t.Errorf("Wrong error returned. Want %#v. Got %#v", provider.ErrPresetMapNotFound, err) - } - if jobStatus != nil { - t.Errorf("Got unexpected non-nil JobStatus: %#v", jobStatus) - } -} - -func TestAWSTranscodeAWSFailureInAmazon(t *testing.T) { - prepErr := errors.New("something went wrong") - fakeTranscoder := newFakeElasticTranscoder() - fakeTranscoder.prepareFailure("CreateJob", prepErr) - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - source := "dir/file.mp4" - jobStatus, err := prov.Transcode(&db.Job{ - ID: "job-123", - SourceMedia: source, - StreamingParams: db.StreamingParams{}, - }) - if jobStatus != nil { - t.Errorf("Got unexpected non-nil status: %#v", jobStatus) - } - if err != prepErr { - t.Errorf("Got wrong error. Want %q. Got %q", prepErr.Error(), err.Error()) - } -} - -func TestAWSJobStatus(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - outputs := []db.TranscodeOutput{ - { - FileName: "output_720p.mp4", - Preset: db.PresetMap{ - Name: "mp4_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0001", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "mp4"}, - }, - }, - { - FileName: "output_720p.webm", - Preset: db.PresetMap{ - Name: "webm_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0002", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "webm"}, - }, - }, - { - FileName: "hls/output_720p.m3u8", - Preset: db.PresetMap{ - Name: "hls_720p", - ProviderMapping: map[string]string{ - Name: "hls-93239832-0003", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "m3u8"}, - }, - }, - } - source := "dir/file.mov" - jobStatus, err := prov.Transcode(&db.Job{ - ID: "job-123", - SourceMedia: source, - Outputs: outputs, - StreamingParams: db.StreamingParams{ - PlaylistFileName: "hls/index.m3u8", - SegmentDuration: 3, - Protocol: "hls", - }, - }) - if err != nil { - t.Fatal(err) - } - jobStatus, err = prov.JobStatus(&db.Job{ID: "job-123", ProviderJobID: jobStatus.ProviderJobID}) - if err != nil { - t.Fatal(err) - } - expectedJobStatus := provider.JobStatus{ - ProviderJobID: jobStatus.ProviderJobID, - Status: provider.StatusFinished, - StatusMessage: "it's finished!", - Progress: 100, - ProviderStatus: map[string]interface{}{ - "outputs": map[string]interface{}{ - "job-123/output_720p.mp4": "it's finished!", - "job-123/output_720p.webm": "it's finished!", - "job-123/hls/output_720p": "it's finished!", - }, - }, - SourceInfo: provider.SourceInfo{ - Duration: 120 * time.Second, - Width: 1920, - Height: 1080, - }, - Output: provider.JobOutput{ - Destination: "s3://some bucket/job-123", - Files: []provider.OutputFile{ - { - Path: "s3://some bucket/job-123/output_720p.mp4", - Container: "mp4", - VideoCodec: "H.264", - Width: 0, - Height: 720, - }, - { - Path: "s3://some bucket/job-123/output_720p.webm", - Container: "webm", - VideoCodec: "VP8", - Width: 0, - Height: 720, - }, - { - Path: "s3://some bucket/job-123/hls/index.m3u8", - Container: "m3u8", - }, - }, - }, - } - if !reflect.DeepEqual(*jobStatus, expectedJobStatus) { - t.Errorf("Wrong JobStatus\nWant %#v\nGot %#v", expectedJobStatus, *jobStatus) - } -} - -func TestAWSJobStatusNoDetectedProperties(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - outputs := []db.TranscodeOutput{ - { - FileName: "output_720p.mp4", - Preset: db.PresetMap{ - Name: "mp4_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0001", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "mp4"}, - }, - }, - { - FileName: "output_720p.webm", - Preset: db.PresetMap{ - Name: "webm_720p", - ProviderMapping: map[string]string{ - Name: "93239832-0002", - "other": "irrelevant", - }, - OutputOpts: db.OutputOptions{Extension: "webm"}, - }, - }, - } - jobStatus, err := prov.Transcode(&db.Job{ - ID: "job-123", - SourceMedia: "dir/file.mov", - Outputs: outputs, - StreamingParams: db.StreamingParams{}, - }) - if err != nil { - t.Fatal(err) - } - fakeTranscoder.jobs[jobStatus.ProviderJobID].Input.DetectedProperties = nil - jobStatus, err = prov.JobStatus(&db.Job{ID: "job-123", ProviderJobID: jobStatus.ProviderJobID}) - if err != nil { - t.Fatal(err) - } - expectedJobStatus := provider.JobStatus{ - ProviderJobID: jobStatus.ProviderJobID, - Status: provider.StatusFinished, - StatusMessage: "it's finished!", - Progress: 100, - ProviderStatus: map[string]interface{}{ - "outputs": map[string]interface{}{ - "job-123/output_720p.mp4": "it's finished!", - "job-123/output_720p.webm": "it's finished!", - }, - }, - Output: provider.JobOutput{ - Destination: "s3://some bucket/job-123", - Files: []provider.OutputFile{ - { - Path: "s3://some bucket/job-123/output_720p.mp4", - Container: "mp4", - VideoCodec: "H.264", - Width: 0, - Height: 720, - }, - { - Path: "s3://some bucket/job-123/output_720p.webm", - Container: "webm", - VideoCodec: "VP8", - Width: 0, - Height: 720, - }, - }, - }, - } - if !reflect.DeepEqual(*jobStatus, expectedJobStatus) { - t.Errorf("Wrong JobStatus\nWant %#v\nGot %#v", expectedJobStatus, *jobStatus) - } -} - -func TestAWSCreatePreset(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - - inputPreset := db.Preset{ - Name: "preset_name", - Description: "description here", - Container: "mp4", - RateControl: "VBR", - Video: db.VideoPreset{ - Profile: "Main", - ProfileLevel: "3.1", - Height: "720", - Codec: "h264", - Bitrate: "2500000", - GopSize: "90", - GopMode: "fixed", - InterlaceMode: "progressive", - }, - Audio: db.AudioPreset{ - Codec: "aac", - Bitrate: "64000", - }, - } - - presetID, _ := prov.CreatePreset(inputPreset) - - if !reflect.DeepEqual(presetID, "preset_name-abc123") { - t.Errorf("CreatePreset: want %s. Got %s", presetID, "preset_name-abc123") - } -} - -func TestCreateVideoPreset(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - tests := []struct { - givenTestCase string - givenPreset db.Preset - expectedVideoParams *elastictranscoder.VideoParameters - }{ - { - "H.264 preset", - db.Preset{ - Container: "m3u8", - Video: db.VideoPreset{ - Profile: "Main", - ProfileLevel: "3.1", - Codec: "h264", - }, - }, - &elastictranscoder.VideoParameters{ - BitRate: aws.String("0"), - Codec: aws.String("H.264"), - CodecOptions: map[string]*string{ - "MaxReferenceFrames": aws.String("2"), - "Profile": aws.String("main"), - "Level": aws.String("3.1"), - }, - DisplayAspectRatio: aws.String("auto"), - FrameRate: aws.String("auto"), - KeyframesMaxDist: aws.String(""), - MaxHeight: aws.String("auto"), - MaxWidth: aws.String("auto"), - PaddingPolicy: aws.String("Pad"), - SizingPolicy: aws.String("Fill"), - }, - }, - { - "WEBM vp8 preset", - db.Preset{ - Container: "webm", - Video: db.VideoPreset{ - Codec: "vp8", - GopSize: "90", - }, - }, - &elastictranscoder.VideoParameters{ - BitRate: aws.String("0"), - Codec: aws.String("vp8"), - CodecOptions: map[string]*string{ - "Profile": aws.String("0"), - }, - DisplayAspectRatio: aws.String("auto"), - FrameRate: aws.String("auto"), - KeyframesMaxDist: aws.String("90"), - MaxHeight: aws.String("auto"), - MaxWidth: aws.String("auto"), - PaddingPolicy: aws.String("Pad"), - SizingPolicy: aws.String("Fill"), - }, - }, - { - "WEBM vp9 preset", - db.Preset{ - Container: "webm", - Video: db.VideoPreset{ - Codec: "vp9", - GopSize: "90", - }, - }, - &elastictranscoder.VideoParameters{ - BitRate: aws.String("0"), - Codec: aws.String("vp9"), - CodecOptions: map[string]*string{ - "Profile": aws.String("0"), - }, - DisplayAspectRatio: aws.String("auto"), - FrameRate: aws.String("auto"), - KeyframesMaxDist: aws.String("90"), - MaxHeight: aws.String("auto"), - MaxWidth: aws.String("auto"), - PaddingPolicy: aws.String("Pad"), - SizingPolicy: aws.String("Fill"), - }, - }, - { - "MP4 preset", - db.Preset{ - Container: "mp4", - Video: db.VideoPreset{ - Profile: "Main", - ProfileLevel: "3.1", - Codec: "h264", - GopSize: "90", - }, - }, - &elastictranscoder.VideoParameters{ - BitRate: aws.String("0"), - Codec: aws.String("H.264"), - CodecOptions: map[string]*string{ - "MaxReferenceFrames": aws.String("2"), - "Profile": aws.String("main"), - "Level": aws.String("3.1"), - }, - DisplayAspectRatio: aws.String("auto"), - FrameRate: aws.String("auto"), - KeyframesMaxDist: aws.String("90"), - MaxHeight: aws.String("auto"), - MaxWidth: aws.String("auto"), - PaddingPolicy: aws.String("Pad"), - SizingPolicy: aws.String("Fill"), - }, - }, - } - for _, test := range tests { - videoParams := prov.createVideoPreset(test.givenPreset) - if !reflect.DeepEqual(test.expectedVideoParams, videoParams) { - t.Errorf("%s: CreateVideoPreset: want %s. Got %s", test.givenTestCase, test.expectedVideoParams, videoParams) - pretty.Fdiff(os.Stderr, videoParams, test.expectedVideoParams) - } - } -} - -func TestCreateAudioPreset(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - tests := []struct { - givenTestCase string - givenPreset db.Preset - expectedAudioParams *elastictranscoder.AudioParameters - }{ - { - "AAC preset", - db.Preset{ - Audio: db.AudioPreset{ - Codec: "aac", - }, - }, - &elastictranscoder.AudioParameters{ - BitRate: aws.String("0"), - Channels: aws.String("auto"), - Codec: aws.String("AAC"), - SampleRate: aws.String("auto"), - }, - }, - { - "libvorbis preset", - db.Preset{ - Audio: db.AudioPreset{ - Codec: "libvorbis", - }, - }, - &elastictranscoder.AudioParameters{ - BitRate: aws.String("0"), - Channels: aws.String("auto"), - Codec: aws.String("vorbis"), - SampleRate: aws.String("auto"), - }, - }, - } - for _, test := range tests { - audioParams := prov.createAudioPreset(test.givenPreset) - if !reflect.DeepEqual(test.expectedAudioParams, audioParams) { - t.Errorf("%s: CreateAudioPreset: want %s. Got %s", test.givenTestCase, test.expectedAudioParams, audioParams) - pretty.Fdiff(os.Stderr, audioParams, test.expectedAudioParams) - } - } -} - -func TestAWSJobStatusNotFound(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - provider := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - jobStatus, err := provider.JobStatus(&db.Job{ProviderJobID: "idk"}) - if err == nil { - t.Fatal("Got unexpected error") - } - expectedErrMsg := "job not found" - if err.Error() != expectedErrMsg { - t.Errorf("Got wrong error message. Want %q. Got %q", expectedErrMsg, err.Error()) - } - if jobStatus != nil { - t.Errorf("Got unexpected non-nil JobStatus: %#v", jobStatus) - } -} - -func TestAWSJobStatusInternalError(t *testing.T) { - prepErr := errors.New("failed to get job status") - fakeTranscoder := newFakeElasticTranscoder() - fakeTranscoder.prepareFailure("ReadJob", prepErr) - provider := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - jobStatus, err := provider.JobStatus(&db.Job{ProviderJobID: "idk"}) - if jobStatus != nil { - t.Errorf("Got unexpected non-nil JobStatus: %#v", jobStatus) - } - if err != prepErr { - t.Errorf("Got wrong error. Want %q. Got %q", prepErr.Error(), err.Error()) - } -} - -func TestAWSStatusMap(t *testing.T) { - tests := []struct { - input string - output provider.Status - }{ - {"Submitted", provider.StatusQueued}, - {"Progressing", provider.StatusStarted}, - {"Canceled", provider.StatusCanceled}, - {"Error", provider.StatusFailed}, - {"Complete", provider.StatusFinished}, - {"unknown", provider.StatusFailed}, - } - var prov awsProvider - for _, test := range tests { - result := prov.statusMap(test.input) - if result != test.output { - t.Errorf("statusMap(%q): wrong result. Want %q. Got %q", test.input, test.output, result) - } - } -} - -func TestCancelJob(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - prov := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - err := prov.CancelJob("idk") - if err != nil { - t.Fatal(err) - } - if id := aws.StringValue(fakeTranscoder.canceledJobs[0].Id); id != "idk" { - t.Errorf("wrong job canceled. Want %q. Got %q", "idk", id) - } -} - -func TestCancelJobInternalError(t *testing.T) { - prepErr := errors.New("failed to cancel job") - fakeTranscoder := newFakeElasticTranscoder() - fakeTranscoder.prepareFailure("CancelJob", prepErr) - provider := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - err := provider.CancelJob("idk") - if err != prepErr { - t.Errorf("wrong error returned.\nWant %#v\nGot %#v", prepErr, err) - } -} - -func TestHealthcheck(t *testing.T) { - fakeTranscoder := newFakeElasticTranscoder() - provider := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - err := provider.Healthcheck() - if err != nil { - t.Fatal(err) - } -} - -func TestHealthcheckFailure(t *testing.T) { - prepErr := errors.New("something went wrong") - fakeTranscoder := newFakeElasticTranscoder() - fakeTranscoder.prepareFailure("ReadPipeline", prepErr) - provider := &awsProvider{ - c: fakeTranscoder, - config: &config.ElasticTranscoder{ - AccessKeyID: "AKIA", - SecretAccessKey: "secret", - Region: "sa-east-1", - PipelineID: "mypipeline", - }, - } - err := provider.Healthcheck() - if err != prepErr { - t.Errorf("Wrong error returned. Want %#v.Got %#v", prepErr, err) - } -} - -func TestCapabilities(t *testing.T) { - var prov awsProvider - expected := provider.Capabilities{ - InputFormats: []string{"h264"}, - OutputFormats: []string{"mp4", "hls", "webm"}, - Destinations: []string{"s3"}, - } - cap := prov.Capabilities() - if !reflect.DeepEqual(cap, expected) { - t.Errorf("Capabilities: want %#v. Got %#v", expected, cap) - } -} From 2b9515f6c044a4bb264430f38bc8a6a8850fddf0 Mon Sep 17 00:00:00 2001 From: Francisco Souza Date: Fri, 2 Aug 2019 11:44:33 -0400 Subject: [PATCH 3/4] v2: make providers internal --- go.sum | 1 + {provider => internal/provider}/bitmovin/bitmovin.go | 2 +- .../provider}/bitmovin/bitmovin_test.go | 2 +- {provider => internal/provider}/description.go | 0 .../provider}/elementalconductor/client.go | 0 .../elementalconductor/elementalconductor.go | 6 +++--- .../elementalconductor_fake_transcode_test.go | 2 +- .../elementalconductor/elementalconductor_test.go | 2 +- .../provider}/elementalconductor/fake_server_test.go | 0 .../provider}/encodingcom/encodingcom.go | 6 +++--- .../provider}/encodingcom/encodingcom_server_test.go | 0 .../provider}/encodingcom/encodingcom_test.go | 2 +- .../provider}/fake_provider_test.go | 0 {provider => internal/provider}/hybrik/hybrik.go | 2 +- .../provider}/mediaconvert/factory_test.go | 0 .../provider}/mediaconvert/fake_client_test.go | 0 .../provider}/mediaconvert/mediaconvert.go | 2 +- .../provider}/mediaconvert/mediaconvert_test.go | 2 +- .../provider}/mediaconvert/preset_mapping.go | 2 +- {provider => internal/provider}/provider.go | 0 {provider => internal/provider}/provider_test.go | 0 {provider => internal/provider}/zencoder/zencoder.go | 6 +++--- .../provider}/zencoder/zencoder_fake_test.go | 0 .../provider}/zencoder/zencoder_test.go | 2 +- main.go | 12 ++++++------ service/fake_provider_test.go | 2 +- service/preset.go | 2 +- service/provider.go | 2 +- service/provider_responses.go | 2 +- service/transcode.go | 2 +- service/transcode_params.go | 2 +- service/transcode_responses.go | 2 +- service/transcode_test.go | 2 +- 33 files changed, 34 insertions(+), 33 deletions(-) rename {provider => internal/provider}/bitmovin/bitmovin.go (99%) rename {provider => internal/provider}/bitmovin/bitmovin_test.go (99%) rename {provider => internal/provider}/description.go (100%) rename {provider => internal/provider}/elementalconductor/client.go (100%) rename {provider => internal/provider}/elementalconductor/elementalconductor.go (97%) rename {provider => internal/provider}/elementalconductor/elementalconductor_fake_transcode_test.go (96%) rename {provider => internal/provider}/elementalconductor/elementalconductor_test.go (99%) rename {provider => internal/provider}/elementalconductor/fake_server_test.go (100%) rename {provider => internal/provider}/encodingcom/encodingcom.go (98%) rename {provider => internal/provider}/encodingcom/encodingcom_server_test.go (100%) rename {provider => internal/provider}/encodingcom/encodingcom_test.go (99%) rename {provider => internal/provider}/fake_provider_test.go (100%) rename {provider => internal/provider}/hybrik/hybrik.go (99%) rename {provider => internal/provider}/mediaconvert/factory_test.go (100%) rename {provider => internal/provider}/mediaconvert/fake_client_test.go (100%) rename {provider => internal/provider}/mediaconvert/mediaconvert.go (99%) rename {provider => internal/provider}/mediaconvert/mediaconvert_test.go (99%) rename {provider => internal/provider}/mediaconvert/preset_mapping.go (99%) rename {provider => internal/provider}/provider.go (100%) rename {provider => internal/provider}/provider_test.go (100%) rename {provider => internal/provider}/zencoder/zencoder.go (98%) rename {provider => internal/provider}/zencoder/zencoder_fake_test.go (100%) rename {provider => internal/provider}/zencoder/zencoder_test.go (99%) diff --git a/go.sum b/go.sum index d204745a..61c2ee6b 100644 --- a/go.sum +++ b/go.sum @@ -172,6 +172,7 @@ github.com/video-dev/go-elementalconductor v1.0.0 h1:vnWf1sAXgdTKhsHhAWOwKMBCPA+ github.com/video-dev/go-elementalconductor v1.0.0/go.mod h1:DwQxx5JUDRY0+/6OcAROOaOEUW6/FnOCDBkTVnWuJTM= github.com/video-dev/go-encodingcom v1.0.0 h1:OiVfdy9qUrKGfOID5TYwoBzvObNx9EQNI041ZA0kZ38= github.com/video-dev/go-encodingcom v1.0.0/go.mod h1:7O86jGr922w65EzPw83u2w36Mm+S90zdy4stfYFxelg= +github.com/video-dev/video-transcoding-api v1.7.0 h1:UmX/QFEKiypxzkGCmlVOc7AvMkuVr8KIg3qMxtYeOGs= github.com/video-dev/zencoder v0.0.0-20161215190743-745874544382 h1:n83HJM7e1ECRGC6Q9Wb28Jmh/GwT973/r7x71QGyJrc= github.com/video-dev/zencoder v0.0.0-20161215190743-745874544382/go.mod h1:g2dR9hNY37gibhlC+b7noeckKKQ4yyTFAKb6V28oRZA= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= diff --git a/provider/bitmovin/bitmovin.go b/internal/provider/bitmovin/bitmovin.go similarity index 99% rename from provider/bitmovin/bitmovin.go rename to internal/provider/bitmovin/bitmovin.go index d4dd4ac2..ca9e7c10 100644 --- a/provider/bitmovin/bitmovin.go +++ b/internal/provider/bitmovin/bitmovin.go @@ -17,7 +17,7 @@ import ( "github.com/bitmovin/bitmovin-go/services" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) // Name is the name used for registering the bitmovin provider in the diff --git a/provider/bitmovin/bitmovin_test.go b/internal/provider/bitmovin/bitmovin_test.go similarity index 99% rename from provider/bitmovin/bitmovin_test.go rename to internal/provider/bitmovin/bitmovin_test.go index 232daa08..de534bc9 100644 --- a/provider/bitmovin/bitmovin_test.go +++ b/internal/provider/bitmovin/bitmovin_test.go @@ -15,7 +15,7 @@ import ( "github.com/bitmovin/bitmovin-go/models" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) func TestFactoryIsRegistered(t *testing.T) { diff --git a/provider/description.go b/internal/provider/description.go similarity index 100% rename from provider/description.go rename to internal/provider/description.go diff --git a/provider/elementalconductor/client.go b/internal/provider/elementalconductor/client.go similarity index 100% rename from provider/elementalconductor/client.go rename to internal/provider/elementalconductor/client.go diff --git a/provider/elementalconductor/elementalconductor.go b/internal/provider/elementalconductor/elementalconductor.go similarity index 97% rename from provider/elementalconductor/elementalconductor.go rename to internal/provider/elementalconductor/elementalconductor.go index 10f90a47..c7feb3c5 100644 --- a/provider/elementalconductor/elementalconductor.go +++ b/internal/provider/elementalconductor/elementalconductor.go @@ -5,8 +5,8 @@ // import this package and then grab the factory from the provider package: // // import ( -// "github.com/video-dev/video-transcoding-api/v2/provider" -// "github.com/video-dev/video-transcoding-api/v2/provider/elementalconductor" +// "github.com/video-dev/video-transcoding-api/v2/internal/provider" +// "github.com/video-dev/video-transcoding-api/v2/internal/provider/elementalconductor" // ) // // func UseProvider() { @@ -26,7 +26,7 @@ import ( "github.com/video-dev/go-elementalconductor" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) // Name is the name used for registering the Elemental Conductor provider in the diff --git a/provider/elementalconductor/elementalconductor_fake_transcode_test.go b/internal/provider/elementalconductor/elementalconductor_fake_transcode_test.go similarity index 96% rename from provider/elementalconductor/elementalconductor_fake_transcode_test.go rename to internal/provider/elementalconductor/elementalconductor_fake_transcode_test.go index 5b555783..2753e59d 100644 --- a/provider/elementalconductor/elementalconductor_fake_transcode_test.go +++ b/internal/provider/elementalconductor/elementalconductor_fake_transcode_test.go @@ -5,7 +5,7 @@ import ( "github.com/video-dev/go-elementalconductor" "github.com/video-dev/video-transcoding-api/v2/config" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) type fakeElementalConductorClient struct { diff --git a/provider/elementalconductor/elementalconductor_test.go b/internal/provider/elementalconductor/elementalconductor_test.go similarity index 99% rename from provider/elementalconductor/elementalconductor_test.go rename to internal/provider/elementalconductor/elementalconductor_test.go index 34c2dadd..03837a33 100644 --- a/provider/elementalconductor/elementalconductor_test.go +++ b/internal/provider/elementalconductor/elementalconductor_test.go @@ -9,7 +9,7 @@ import ( "github.com/video-dev/go-elementalconductor" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) func TestFactoryIsRegistered(t *testing.T) { diff --git a/provider/elementalconductor/fake_server_test.go b/internal/provider/elementalconductor/fake_server_test.go similarity index 100% rename from provider/elementalconductor/fake_server_test.go rename to internal/provider/elementalconductor/fake_server_test.go diff --git a/provider/encodingcom/encodingcom.go b/internal/provider/encodingcom/encodingcom.go similarity index 98% rename from provider/encodingcom/encodingcom.go rename to internal/provider/encodingcom/encodingcom.go index cfca50af..3fbae4a5 100644 --- a/provider/encodingcom/encodingcom.go +++ b/internal/provider/encodingcom/encodingcom.go @@ -5,8 +5,8 @@ // import this package and then grab the factory from the provider package: // // import ( -// "github.com/video-dev/video-transcoding-api/v2/provider" -// "github.com/video-dev/video-transcoding-api/v2/provider/encodingcom" +// "github.com/video-dev/video-transcoding-api/v2/internal/provider" +// "github.com/video-dev/video-transcoding-api/v2/internal/provider/encodingcom" // ) // // func UseProvider() { @@ -27,7 +27,7 @@ import ( "github.com/video-dev/go-encodingcom" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) // Name is the name used for registering the Encoding.com provider in the diff --git a/provider/encodingcom/encodingcom_server_test.go b/internal/provider/encodingcom/encodingcom_server_test.go similarity index 100% rename from provider/encodingcom/encodingcom_server_test.go rename to internal/provider/encodingcom/encodingcom_server_test.go diff --git a/provider/encodingcom/encodingcom_test.go b/internal/provider/encodingcom/encodingcom_test.go similarity index 99% rename from provider/encodingcom/encodingcom_test.go rename to internal/provider/encodingcom/encodingcom_test.go index 731454fc..bdf63d5b 100644 --- a/provider/encodingcom/encodingcom_test.go +++ b/internal/provider/encodingcom/encodingcom_test.go @@ -10,7 +10,7 @@ import ( "github.com/video-dev/go-encodingcom" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) func TestFactoryIsRegistered(t *testing.T) { diff --git a/provider/fake_provider_test.go b/internal/provider/fake_provider_test.go similarity index 100% rename from provider/fake_provider_test.go rename to internal/provider/fake_provider_test.go diff --git a/provider/hybrik/hybrik.go b/internal/provider/hybrik/hybrik.go similarity index 99% rename from provider/hybrik/hybrik.go rename to internal/provider/hybrik/hybrik.go index 7d0455bd..67503dde 100644 --- a/provider/hybrik/hybrik.go +++ b/internal/provider/hybrik/hybrik.go @@ -11,7 +11,7 @@ import ( hwrapper "github.com/hybrik/hybrik-sdk-go" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) const ( diff --git a/provider/mediaconvert/factory_test.go b/internal/provider/mediaconvert/factory_test.go similarity index 100% rename from provider/mediaconvert/factory_test.go rename to internal/provider/mediaconvert/factory_test.go diff --git a/provider/mediaconvert/fake_client_test.go b/internal/provider/mediaconvert/fake_client_test.go similarity index 100% rename from provider/mediaconvert/fake_client_test.go rename to internal/provider/mediaconvert/fake_client_test.go diff --git a/provider/mediaconvert/mediaconvert.go b/internal/provider/mediaconvert/mediaconvert.go similarity index 99% rename from provider/mediaconvert/mediaconvert.go rename to internal/provider/mediaconvert/mediaconvert.go index c3663efb..5975674f 100644 --- a/provider/mediaconvert/mediaconvert.go +++ b/internal/provider/mediaconvert/mediaconvert.go @@ -13,7 +13,7 @@ import ( "github.com/pkg/errors" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) const ( diff --git a/provider/mediaconvert/mediaconvert_test.go b/internal/provider/mediaconvert/mediaconvert_test.go similarity index 99% rename from provider/mediaconvert/mediaconvert_test.go rename to internal/provider/mediaconvert/mediaconvert_test.go index 65523d16..edf2682e 100644 --- a/provider/mediaconvert/mediaconvert_test.go +++ b/internal/provider/mediaconvert/mediaconvert_test.go @@ -9,7 +9,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) var ( diff --git a/provider/mediaconvert/preset_mapping.go b/internal/provider/mediaconvert/preset_mapping.go similarity index 99% rename from provider/mediaconvert/preset_mapping.go rename to internal/provider/mediaconvert/preset_mapping.go index dfcd1da3..23c40009 100644 --- a/provider/mediaconvert/preset_mapping.go +++ b/internal/provider/mediaconvert/preset_mapping.go @@ -9,7 +9,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/mediaconvert" "github.com/pkg/errors" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) func providerStatusFrom(status mediaconvert.JobStatus) provider.Status { diff --git a/provider/provider.go b/internal/provider/provider.go similarity index 100% rename from provider/provider.go rename to internal/provider/provider.go diff --git a/provider/provider_test.go b/internal/provider/provider_test.go similarity index 100% rename from provider/provider_test.go rename to internal/provider/provider_test.go diff --git a/provider/zencoder/zencoder.go b/internal/provider/zencoder/zencoder.go similarity index 98% rename from provider/zencoder/zencoder.go rename to internal/provider/zencoder/zencoder.go index ce8b025d..6b188264 100644 --- a/provider/zencoder/zencoder.go +++ b/internal/provider/zencoder/zencoder.go @@ -5,8 +5,8 @@ // import this package and then grab the factory from the provider package: // // import ( -// "github.com/video-dev/video-transcoding-api/v2/provider" -// "github.com/video-dev/video-transcoding-api/v2/provider/zencoder" +// "github.com/video-dev/video-transcoding-api/v2/internal/provider" +// "github.com/video-dev/video-transcoding-api/v2/internal/provider/zencoder" // ) // // func UseProvider() { @@ -28,7 +28,7 @@ import ( "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" "github.com/video-dev/video-transcoding-api/v2/db/redis" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" "github.com/video-dev/zencoder" ) diff --git a/provider/zencoder/zencoder_fake_test.go b/internal/provider/zencoder/zencoder_fake_test.go similarity index 100% rename from provider/zencoder/zencoder_fake_test.go rename to internal/provider/zencoder/zencoder_fake_test.go diff --git a/provider/zencoder/zencoder_test.go b/internal/provider/zencoder/zencoder_test.go similarity index 99% rename from provider/zencoder/zencoder_test.go rename to internal/provider/zencoder/zencoder_test.go index 346927ab..624ca478 100644 --- a/provider/zencoder/zencoder_test.go +++ b/internal/provider/zencoder/zencoder_test.go @@ -10,7 +10,7 @@ import ( "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" "github.com/video-dev/video-transcoding-api/v2/db/dbtest" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" "github.com/video-dev/zencoder" ) diff --git a/main.go b/main.go index 19107d56..1b5468a0 100644 --- a/main.go +++ b/main.go @@ -7,12 +7,12 @@ import ( "github.com/NYTimes/gizmo/server" "github.com/google/gops/agent" "github.com/video-dev/video-transcoding-api/v2/config" - _ "github.com/video-dev/video-transcoding-api/v2/provider/bitmovin" - _ "github.com/video-dev/video-transcoding-api/v2/provider/elementalconductor" - _ "github.com/video-dev/video-transcoding-api/v2/provider/encodingcom" - _ "github.com/video-dev/video-transcoding-api/v2/provider/hybrik" - _ "github.com/video-dev/video-transcoding-api/v2/provider/mediaconvert" - _ "github.com/video-dev/video-transcoding-api/v2/provider/zencoder" + _ "github.com/video-dev/video-transcoding-api/v2/internal/provider/bitmovin" + _ "github.com/video-dev/video-transcoding-api/v2/internal/provider/elementalconductor" + _ "github.com/video-dev/video-transcoding-api/v2/internal/provider/encodingcom" + _ "github.com/video-dev/video-transcoding-api/v2/internal/provider/hybrik" + _ "github.com/video-dev/video-transcoding-api/v2/internal/provider/mediaconvert" + _ "github.com/video-dev/video-transcoding-api/v2/internal/provider/zencoder" "github.com/video-dev/video-transcoding-api/v2/service" ) diff --git a/service/fake_provider_test.go b/service/fake_provider_test.go index abd3e472..68e43768 100644 --- a/service/fake_provider_test.go +++ b/service/fake_provider_test.go @@ -3,7 +3,7 @@ package service import ( "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) func init() { diff --git a/service/preset.go b/service/preset.go index 2d9cb779..a889140c 100644 --- a/service/preset.go +++ b/service/preset.go @@ -8,7 +8,7 @@ import ( "github.com/NYTimes/gizmo/server" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" "github.com/video-dev/video-transcoding-api/v2/swagger" ) diff --git a/service/provider.go b/service/provider.go index 55ba56e4..54daaeaa 100644 --- a/service/provider.go +++ b/service/provider.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/NYTimes/gizmo/server" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" "github.com/video-dev/video-transcoding-api/v2/swagger" ) diff --git a/service/provider_responses.go b/service/provider_responses.go index 94e8dd9e..131569ab 100644 --- a/service/provider_responses.go +++ b/service/provider_responses.go @@ -3,7 +3,7 @@ package service import ( "net/http" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" "github.com/video-dev/video-transcoding-api/v2/swagger" ) diff --git a/service/transcode.go b/service/transcode.go index f9c30b6e..f2b42b92 100644 --- a/service/transcode.go +++ b/service/transcode.go @@ -10,7 +10,7 @@ import ( "github.com/NYTimes/gizmo/server" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" "github.com/video-dev/video-transcoding-api/v2/swagger" ) diff --git a/service/transcode_params.go b/service/transcode_params.go index c3187b7f..bda7ed02 100644 --- a/service/transcode_params.go +++ b/service/transcode_params.go @@ -6,7 +6,7 @@ import ( "io" "github.com/video-dev/video-transcoding-api/v2/db" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) // NewTranscodeJobInputPayload makes up the parameters available for diff --git a/service/transcode_responses.go b/service/transcode_responses.go index 29f6b21f..1d9e8170 100644 --- a/service/transcode_responses.go +++ b/service/transcode_responses.go @@ -3,7 +3,7 @@ package service import ( "net/http" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" "github.com/video-dev/video-transcoding-api/v2/swagger" ) diff --git a/service/transcode_test.go b/service/transcode_test.go index 4dd00e32..44feae4a 100644 --- a/service/transcode_test.go +++ b/service/transcode_test.go @@ -14,7 +14,7 @@ import ( "github.com/video-dev/video-transcoding-api/v2/config" "github.com/video-dev/video-transcoding-api/v2/db" "github.com/video-dev/video-transcoding-api/v2/db/dbtest" - "github.com/video-dev/video-transcoding-api/v2/provider" + "github.com/video-dev/video-transcoding-api/v2/internal/provider" ) func TestTranscode(t *testing.T) { From 6436075866678bc42edc22581d9fc3b4710cebe9 Mon Sep 17 00:00:00 2001 From: Francisco Souza Date: Fri, 2 Aug 2019 11:46:28 -0400 Subject: [PATCH 4/4] doc: cleanup some old swagger stuff --- doc.go | 21 -- swagger.json | 846 --------------------------------------------------- 2 files changed, 867 deletions(-) delete mode 100644 swagger.json diff --git a/doc.go b/doc.go index 2ae2088c..69fd6b5a 100644 --- a/doc.go +++ b/doc.go @@ -2,25 +2,4 @@ // // HTTP API for transcoding media files into different formats using pluggable // providers. -// -// ## Currently supported providers -// -// + [Amazon Elastic Transcoder](https://aws.amazon.com/elastictranscoder/) -// + [Elemental Conductor](https://www.elementaltechnologies.com/products/elemental-conductor) -// + [Encoding.com](http://api.encoding.com) -// + [Zencoder](http://zencoder.com) -// -// Schemes: http -// BasePath: / -// Version: 1.0.0 -// License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html -// -// Consumes: -// - application/json -// -// -// Produces: -// - application/json -// -// swagger:meta package main diff --git a/swagger.json b/swagger.json deleted file mode 100644 index b353bb6a..00000000 --- a/swagger.json +++ /dev/null @@ -1,846 +0,0 @@ -{ - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "schemes": [ - "http" - ], - "swagger": "2.0", - "info": { - "description": "HTTP API for transcoding media files into different formats using pluggable\nproviders.\n\n## Currently supported providers\n\n+ [Amazon Elastic Transcoder](https://aws.amazon.com/elastictranscoder/)\n+ [Elemental Conductor](https://www.elementaltechnologies.com/products/elemental-conductor)\n+ [Encoding.com](http://api.encoding.com)\n+ [Zencoder](http://zencoder.com)", - "title": "video-transcoding-api", - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - }, - "version": "1.0.0" - }, - "basePath": "/", - "paths": { - "/jobs": { - "post": { - "tags": [ - "jobs" - ], - "summary": "Creates a new transcoding job.", - "operationId": "newJob", - "parameters": [ - { - "name": "Payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/NewTranscodeJobInputPayload" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/job" - }, - "400": { - "$ref": "#/responses/invalidJob" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - }, - "/jobs/{jobId}": { - "get": { - "description": "It also queries the provider to get the status of the job.", - "tags": [ - "jobs" - ], - "summary": "Finds a trancode job using its ID.", - "operationId": "getJob", - "parameters": [ - { - "type": "string", - "x-go-name": "JobID", - "name": "jobId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/jobStatus" - }, - "404": { - "$ref": "#/responses/jobNotFound" - }, - "410": { - "$ref": "#/responses/jobNotFoundInTheProvider" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - }, - "/jobs/{jobId}/cancel": { - "post": { - "tags": [ - "jobs" - ], - "summary": "Creates a new transcoding job.", - "operationId": "cancelJob", - "parameters": [ - { - "type": "string", - "x-go-name": "JobID", - "name": "jobId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/jobStatus" - }, - "404": { - "$ref": "#/responses/jobNotFound" - }, - "410": { - "$ref": "#/responses/jobNotFoundInTheProvider" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - }, - "/presetmaps": { - "get": { - "tags": [ - "presets" - ], - "summary": "List available presets on the API.", - "operationId": "listPresetMaps", - "responses": { - "200": { - "$ref": "#/responses/listPresetMaps" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - }, - "post": { - "tags": [ - "presets" - ], - "summary": "Creates a new preset in the API.", - "operationId": "newPreset", - "parameters": [ - { - "name": "Payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PresetMap" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/preset" - }, - "400": { - "$ref": "#/responses/invalidPreset" - }, - "409": { - "$ref": "#/responses/presetAlreadyExists" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - }, - "/presetmaps/{name}": { - "get": { - "tags": [ - "presets" - ], - "summary": "Finds a preset using its name.", - "operationId": "getPreset", - "parameters": [ - { - "type": "string", - "x-go-name": "Name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/preset" - }, - "404": { - "$ref": "#/responses/presetNotFound" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - }, - "put": { - "tags": [ - "presets" - ], - "summary": "Updates a presetmap using its name.", - "operationId": "updatePreset", - "parameters": [ - { - "type": "string", - "x-go-name": "Name", - "name": "name", - "in": "path", - "required": true - }, - { - "name": "Payload", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PresetMap" - } - } - ], - "responses": { - "200": { - "$ref": "#/responses/preset" - }, - "400": { - "$ref": "#/responses/invalidPreset" - }, - "404": { - "$ref": "#/responses/presetNotFound" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - }, - "delete": { - "tags": [ - "presets" - ], - "summary": "Deletes a presetmap by name.", - "operationId": "deletePresetMap", - "parameters": [ - { - "type": "string", - "x-go-name": "Name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/emptyResponse" - }, - "404": { - "$ref": "#/responses/presetNotFound" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - }, - "/presets": { - "post": { - "tags": [ - "presets" - ], - "summary": "Creates a new preset on given providers.", - "operationId": "Output", - "responses": { - "200": { - "$ref": "#/responses/newPresetOutputs" - }, - "400": { - "$ref": "#/responses/invalidPreset" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - }, - "/presets/{name}": { - "delete": { - "tags": [ - "presets" - ], - "summary": "Deletes a preset by name.", - "operationId": "deletePreset", - "parameters": [ - { - "type": "string", - "x-go-name": "Name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/deletePresetOutputs" - }, - "404": { - "$ref": "#/responses/presetNotFound" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - }, - "/providers": { - "get": { - "description": "Describe available providers in the API, including their name, capabilities\nand health state.", - "tags": [ - "providers" - ], - "operationId": "listProviders", - "responses": { - "200": { - "$ref": "#/responses/listProviders" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - }, - "/providers/{name}": { - "get": { - "description": "Describe available providers in the API, including their name, capabilities\nand health state.", - "tags": [ - "providers" - ], - "operationId": "getProvider", - "parameters": [ - { - "type": "string", - "x-go-name": "Name", - "name": "name", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/provider" - }, - "404": { - "$ref": "#/responses/providerNotFound" - }, - "500": { - "$ref": "#/responses/genericError" - } - } - } - } - }, - "definitions": { - "Capabilities": { - "description": "Capabilities describes the available features in the provider. It specificie\nwhich input and output formats the provider supports, along with\nsupported destinations.", - "type": "object", - "properties": { - "destinations": { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "Destinations" - }, - "input": { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "InputFormats" - }, - "output": { - "type": "array", - "items": { - "type": "string" - }, - "x-go-name": "OutputFormats" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/provider" - }, - "Description": { - "description": "It contains the name of the provider, along with its current heath status\nand its capabilities.", - "type": "object", - "title": "Description fully describes a provider.", - "properties": { - "capabilities": { - "x-go-name": "Capabilities", - "$ref": "#/definitions/Capabilities" - }, - "enabled": { - "type": "boolean", - "x-go-name": "Enabled" - }, - "health": { - "x-go-name": "Health", - "$ref": "#/definitions/Health" - }, - "name": { - "type": "string", - "x-go-name": "Name" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/provider" - }, - "Duration": { - "description": "A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.", - "type": "integer", - "format": "int64", - "x-go-package": "time" - }, - "ErrorResponse": { - "description": "ErrorResponse represents the basic error returned by the API on operation\nfailures.", - "type": "object", - "properties": { - "error": { - "description": "the error message\n\nin: body", - "type": "string", - "x-go-name": "Message" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/swagger" - }, - "Health": { - "description": "Health describes the current health status of the provider. If indicates\nwhether the provider is healthy or not, and if it's not healthy, it includes\na message explaining what's wrong.", - "type": "object", - "properties": { - "message": { - "type": "string", - "x-go-name": "Message" - }, - "ok": { - "type": "boolean", - "x-go-name": "OK" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/provider" - }, - "JobOutput": { - "type": "object", - "title": "JobOutput represents information about a job output.", - "properties": { - "destination": { - "type": "string", - "x-go-name": "Destination" - }, - "files": { - "type": "array", - "items": { - "$ref": "#/definitions/OutputFile" - }, - "x-go-name": "Files" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/provider" - }, - "JobStatus": { - "description": "JobStatus is the representation of the status as the provide sees it. The\nprovider is able to add customized information in the ProviderStatus field.", - "type": "object", - "properties": { - "output": { - "x-go-name": "Output", - "$ref": "#/definitions/JobOutput" - }, - "progress": { - "type": "number", - "format": "double", - "x-go-name": "Progress" - }, - "providerJobId": { - "type": "string", - "x-go-name": "ProviderJobID" - }, - "providerName": { - "type": "string", - "x-go-name": "ProviderName" - }, - "providerStatus": { - "type": "object", - "additionalProperties": { - "type": "object" - }, - "x-go-name": "ProviderStatus" - }, - "sourceInfo": { - "x-go-name": "SourceInfo", - "$ref": "#/definitions/SourceInfo" - }, - "status": { - "x-go-name": "Status", - "$ref": "#/definitions/Status" - }, - "statusMessage": { - "type": "string", - "x-go-name": "StatusMessage" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/provider" - }, - "NewTranscodeJobInputPayload": { - "description": "NewTranscodeJobInputPayload makes up the parameters available for\nspecifying a new transcoding job", - "type": "object", - "properties": { - "outputs": { - "description": "list of outputs in this job", - "type": "array", - "items": { - "type": "object", - "properties": { - "fileName": { - "type": "string", - "x-go-name": "FileName" - }, - "preset": { - "type": "string", - "x-go-name": "Preset" - } - } - }, - "x-go-name": "Outputs" - }, - "provider": { - "description": "provider to use in this job", - "type": "string", - "x-go-name": "Provider" - }, - "source": { - "description": "source media for the transcoding job.", - "type": "string", - "x-go-name": "Source" - }, - "streamingParams": { - "description": "provider Adaptive Streaming parameters", - "x-go-name": "StreamingParams", - "$ref": "#/definitions/StreamingParams" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/service" - }, - "OutputFile": { - "type": "object", - "title": "OutputFile represents an output file in a given job.", - "properties": { - "container": { - "type": "string", - "x-go-name": "Container" - }, - "fileSize": { - "type": "integer", - "format": "int64", - "x-go-name": "FileSize" - }, - "height": { - "type": "integer", - "format": "int64", - "x-go-name": "Height" - }, - "path": { - "type": "string", - "x-go-name": "Path" - }, - "videoCodec": { - "type": "string", - "x-go-name": "VideoCodec" - }, - "width": { - "type": "integer", - "format": "int64", - "x-go-name": "Width" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/provider" - }, - "OutputOptions": { - "description": "This type includes only configuration parameters that are not defined in\nproviders (like the extension of the output file).", - "type": "object", - "title": "OutputOptions is the set of options for the output file.", - "required": [ - "extension" - ], - "properties": { - "extension": { - "description": "extension for the output file, it's usually attached to the\ncontainer (for example, webm for VP, mp4 for MPEG-4 and ts for HLS).\n\nThe dot should not be part of the extension, i.e. use \"webm\" instead\nof \".webm\".", - "type": "string", - "x-go-name": "Extension" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/db" - }, - "PartialJob": { - "description": "PartialJob is the simple response given to an API\ncall that creates a new transcoding job", - "type": "object", - "properties": { - "jobId": { - "description": "unique identifier of the job", - "type": "string", - "uniqueItems": true, - "x-go-name": "JobID" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/service" - }, - "PresetMap": { - "description": "Each presetmap is just an aggregator of provider presets, where each preset in\nthe API maps to a preset on each provider", - "type": "object", - "title": "PresetMap represents the preset that is persisted in the repository of the\nTranscoding API", - "required": [ - "name", - "providerMapping", - "output" - ], - "properties": { - "name": { - "description": "name of the presetmap", - "type": "string", - "uniqueItems": true, - "x-go-name": "Name" - }, - "output": { - "description": "set of options in the output file for this preset.", - "x-go-name": "OutputOpts", - "$ref": "#/definitions/OutputOptions" - }, - "providerMapping": { - "description": "mapping of provider name to provider's internal preset id.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-go-name": "ProviderMapping" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/db" - }, - "SourceInfo": { - "description": "SourceInfo contains information about media transcoded using the Transcoding\nAPI.", - "type": "object", - "properties": { - "duration": { - "description": "Duration of the media", - "x-go-name": "Duration", - "$ref": "#/definitions/Duration" - }, - "height": { - "description": "Dimension of the media, in pixels", - "type": "integer", - "format": "int64", - "x-go-name": "Height" - }, - "videoCodec": { - "description": "Codec used for video medias", - "type": "string", - "x-go-name": "VideoCodec" - }, - "width": { - "type": "integer", - "format": "int64", - "x-go-name": "Width" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/provider" - }, - "Status": { - "type": "string", - "title": "Status is the status of a transcoding job.", - "x-go-package": "github.com/NYTimes/video-transcoding-api/provider" - }, - "StreamingParams": { - "description": "StreamingParams represents the params necessary to create Adaptive Streaming jobs", - "type": "object", - "required": [ - "segmentDuration", - "protocol", - "playlistFileName" - ], - "properties": { - "playlistFileName": { - "description": "the playlist file name", - "type": "string", - "x-go-name": "PlaylistFileName" - }, - "protocol": { - "description": "the protocol name (hls or dash)", - "type": "string", - "x-go-name": "Protocol" - }, - "segmentDuration": { - "description": "duration of the segment", - "type": "integer", - "format": "uint64", - "x-go-name": "SegmentDuration" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/db" - }, - "deletePresetOutput": { - "type": "object", - "properties": { - "error": { - "type": "string", - "x-go-name": "Error" - }, - "presetId": { - "type": "string", - "x-go-name": "PresetID" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/service" - }, - "newPresetOutput": { - "type": "object", - "properties": { - "Error": { - "type": "string" - }, - "PresetID": { - "type": "string" - } - }, - "x-go-package": "github.com/NYTimes/video-transcoding-api/service" - } - }, - "responses": { - "deletePresetOutputs": { - "description": "list of the results of the attempt to delete a preset\nin each provider.", - "schema": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/deletePresetOutput" - } - }, - "headers": { - "presetMap": { - "type": "string" - } - } - }, - "emptyResponse": { - "description": "emptyResponse represents an empty response returned by the API, it's\ncomposed only by the HTTP status code." - }, - "genericError": { - "description": "ErrorResponse represents the basic error returned by the API on operation\nfailures." - }, - "invalidJob": { - "description": "error returned when the given job data is not valid.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "invalidPreset": { - "description": "error returned when the given preset data is not valid.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "job": { - "description": "JSON-encoded version of the Job, includes only the id of the job, that can\nbe used for querying the current status of the job.", - "schema": { - "$ref": "#/definitions/PartialJob" - } - }, - "jobNotFound": { - "description": "error returned the given job id could not be found on the API.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "jobNotFoundInTheProvider": { - "description": "error returned when the given job id could not be found on the underlying\nprovider.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "jobStatus": { - "description": "JSON-encoded JobStatus, containing status information given by the\nunderlying provider.", - "schema": { - "$ref": "#/definitions/JobStatus" - } - }, - "listPresetMaps": { - "description": "response for the listPresetMaps operation. It's actually a JSON-encoded object\ninstead of an array, in the format `presetName: presetObject`", - "schema": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/PresetMap" - } - } - }, - "listProviders": { - "description": "response for the listProviders operation. Contains the list of providers\nalphabetically ordered.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "newPresetOutputs": { - "description": "list of the results of the attempt to create a preset\nin each provider.", - "schema": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/newPresetOutput" - } - }, - "headers": { - "PresetMap": { - "type": "string" - } - } - }, - "preset": { - "description": "JSON-encoded preset returned on the newPreset and getPreset operations.", - "schema": { - "$ref": "#/definitions/PresetMap" - } - }, - "presetAlreadyExists": { - "description": "error returned when trying to create a new preset using a name that is\nalready in-use.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "presetNotFound": { - "description": "error returned when the given preset name is not found on the API (either on\ngetPreset or deletePreset operations).", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "provider": { - "description": "response for the getProvider operation.", - "schema": { - "$ref": "#/definitions/Description" - } - }, - "providerNotFound": { - "description": "error returned when the given provider name is not found in the API.", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - } - } -} \ No newline at end of file