diff --git a/cmd/aro/rp.go b/cmd/aro/rp.go index ddc508177..6bab14707 100644 --- a/cmd/aro/rp.go +++ b/cmd/aro/rp.go @@ -27,7 +27,7 @@ func rp(ctx context.Context, log *logrus.Entry) error { return err } - db, err := database.NewDatabase(ctx, env, uuid, "ARO") + db, err := database.NewDatabase(env, uuid, "ARO") if err != nil { return err } diff --git a/hack/db/db.go b/hack/db/db.go index edec83123..e00c4d48c 100644 --- a/hack/db/db.go +++ b/hack/db/db.go @@ -28,7 +28,7 @@ func run(ctx context.Context, log *logrus.Entry) error { return err } - db, err := database.NewDatabase(ctx, env, "", "ARO") + db, err := database.NewDatabase(env, "", "ARO") if err != nil { return err } diff --git a/pkg/database/asyncoperations.go b/pkg/database/asyncoperations.go index 204fdc686..b8aaa2022 100644 --- a/pkg/database/asyncoperations.go +++ b/pkg/database/asyncoperations.go @@ -4,7 +4,6 @@ package database // Licensed under the Apache License 2.0. import ( - "context" "fmt" "net/http" "strings" @@ -26,7 +25,7 @@ type AsyncOperations interface { } // NewAsyncOperations returns a new AsyncOperations -func NewAsyncOperations(ctx context.Context, uuid string, dbc cosmosdb.DatabaseClient, dbid, collid string) (AsyncOperations, error) { +func NewAsyncOperations(uuid string, dbc cosmosdb.DatabaseClient, dbid, collid string) (AsyncOperations, error) { collc := cosmosdb.NewCollectionClient(dbc, dbid) return &asyncOperations{ diff --git a/pkg/database/database.go b/pkg/database/database.go index 253f04972..5e03aad28 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -4,7 +4,6 @@ package database // Licensed under the Apache License 2.0. import ( - "context" "crypto/tls" "net/http" "time" @@ -24,8 +23,8 @@ type Database struct { } // NewDatabase returns a new Database -func NewDatabase(ctx context.Context, env env.Interface, uuid, dbid string) (db *Database, err error) { - databaseAccount, masterKey := env.CosmosDB(ctx) +func NewDatabase(env env.Interface, uuid, dbid string) (db *Database, err error) { + databaseAccount, masterKey := env.CosmosDB() h := &codec.JsonHandle{ BasicHandle: codec.BasicHandle{ @@ -55,17 +54,17 @@ func NewDatabase(ctx context.Context, env env.Interface, uuid, dbid string) (db db = &Database{} - db.AsyncOperations, err = NewAsyncOperations(ctx, uuid, dbc, dbid, "AsyncOperations") + db.AsyncOperations, err = NewAsyncOperations(uuid, dbc, dbid, "AsyncOperations") if err != nil { return nil, err } - db.OpenShiftClusters, err = NewOpenShiftClusters(ctx, uuid, dbc, dbid, "OpenShiftClusters") + db.OpenShiftClusters, err = NewOpenShiftClusters(uuid, dbc, dbid, "OpenShiftClusters") if err != nil { return nil, err } - db.Subscriptions, err = NewSubscriptions(ctx, uuid, dbc, dbid, "Subscriptions") + db.Subscriptions, err = NewSubscriptions(uuid, dbc, dbid, "Subscriptions") if err != nil { return nil, err } diff --git a/pkg/database/openshiftclusters.go b/pkg/database/openshiftclusters.go index 11898bae0..7eb06622f 100644 --- a/pkg/database/openshiftclusters.go +++ b/pkg/database/openshiftclusters.go @@ -4,7 +4,6 @@ package database // Licensed under the Apache License 2.0. import ( - "context" "fmt" "net/http" "strings" @@ -34,7 +33,7 @@ type OpenShiftClusters interface { } // NewOpenShiftClusters returns a new OpenShiftClusters -func NewOpenShiftClusters(ctx context.Context, uuid string, dbc cosmosdb.DatabaseClient, dbid, collid string) (OpenShiftClusters, error) { +func NewOpenShiftClusters(uuid string, dbc cosmosdb.DatabaseClient, dbid, collid string) (OpenShiftClusters, error) { collc := cosmosdb.NewCollectionClient(dbc, dbid) triggers := []*cosmosdb.Trigger{ diff --git a/pkg/database/subscriptions.go b/pkg/database/subscriptions.go index 8304720a4..2bbcfa95b 100644 --- a/pkg/database/subscriptions.go +++ b/pkg/database/subscriptions.go @@ -4,7 +4,6 @@ package database // Licensed under the Apache License 2.0. import ( - "context" "fmt" "net/http" "strings" @@ -29,7 +28,7 @@ type Subscriptions interface { } // NewSubscriptions returns a new Subscriptions -func NewSubscriptions(ctx context.Context, uuid string, dbc cosmosdb.DatabaseClient, dbid, collid string) (Subscriptions, error) { +func NewSubscriptions(uuid string, dbc cosmosdb.DatabaseClient, dbid, collid string) (Subscriptions, error) { collc := cosmosdb.NewCollectionClient(dbc, dbid) triggers := []*cosmosdb.Trigger{ diff --git a/pkg/env/env.go b/pkg/env/env.go index 1f4426347..764a36555 100644 --- a/pkg/env/env.go +++ b/pkg/env/env.go @@ -23,7 +23,7 @@ type Interface interface { clientauthorizer.ClientAuthorizer instancemetadata.InstanceMetadata - CosmosDB(context.Context) (string, string) + CosmosDB() (string, string) DNS() dns.Manager FPAuthorizer(string, string) (autorest.Authorizer, error) GetSecret(context.Context, string) (*rsa.PrivateKey, []*x509.Certificate, error) diff --git a/pkg/env/prod.go b/pkg/env/prod.go index c5d3860bb..5b45699e5 100644 --- a/pkg/env/prod.go +++ b/pkg/env/prod.go @@ -138,7 +138,7 @@ func (p *prod) populateCosmosDB(ctx context.Context, rpAuthorizer autorest.Autho return nil } -func (p *prod) CosmosDB(context.Context) (string, string) { +func (p *prod) CosmosDB() (string, string) { return p.cosmosDBAccountName, p.cosmosDBPrimaryMasterKey }