зеркало из https://github.com/Azure/ARO-RP.git
remove unused contexts in database layer
This commit is contained in:
Родитель
63dc6f8120
Коммит
224a09da61
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче