Live Structure
This commit is contained in:
@@ -143,11 +143,6 @@ type GeoPoint struct {
|
||||
Longitude float64 `json:"longitude,omitempty" bson:"longitude,omitempty"`
|
||||
}
|
||||
|
||||
type Credentials struct {
|
||||
Login string `json:"login,omitempty" bson:"login,omitempty"`
|
||||
Pass string `json:"password,omitempty" bson:"password,omitempty"`
|
||||
}
|
||||
|
||||
type ResourceInstance[T ResourcePartnerITF] struct {
|
||||
utils.AbstractObject
|
||||
Location GeoPoint `json:"location,omitempty" bson:"location,omitempty"`
|
||||
|
||||
@@ -17,7 +17,11 @@ type ResourceMongoAccessor[T ResourceInterface] struct {
|
||||
|
||||
// New creates a new instance of the computeMongoAccessor
|
||||
func NewAccessor[T ResourceInterface](t tools.DataType, request *tools.APIRequest, g func() utils.DBObject) *ResourceMongoAccessor[T] {
|
||||
if !slices.Contains([]tools.DataType{tools.COMPUTE_RESOURCE, tools.STORAGE_RESOURCE, tools.PROCESSING_RESOURCE, tools.WORKFLOW_RESOURCE, tools.DATA_RESOURCE}, t) {
|
||||
if !slices.Contains([]tools.DataType{
|
||||
tools.COMPUTE_RESOURCE, tools.STORAGE_RESOURCE,
|
||||
tools.PROCESSING_RESOURCE, tools.WORKFLOW_RESOURCE,
|
||||
tools.DATA_RESOURCE,
|
||||
}, t) {
|
||||
return nil
|
||||
}
|
||||
return &ResourceMongoAccessor[T]{
|
||||
|
||||
@@ -43,7 +43,6 @@ func (abs *StorageResource) ConvertToPricedResource(t tools.DataType, request *t
|
||||
|
||||
type StorageResourceInstance struct {
|
||||
ResourceInstance[*StorageResourcePartnership]
|
||||
Credentials *Credentials `json:"credentials,omitempty" bson:"credentials,omitempty"`
|
||||
Source string `bson:"source,omitempty" json:"source,omitempty"` // Source is the source of the storage
|
||||
Path string `bson:"path,omitempty" json:"path,omitempty"` // Path is the store folders in the source
|
||||
Local bool `bson:"local" json:"local"`
|
||||
@@ -56,7 +55,6 @@ type StorageResourceInstance struct {
|
||||
}
|
||||
|
||||
func (ri *StorageResourceInstance) ClearEnv() {
|
||||
ri.Credentials = nil
|
||||
ri.Env = []models.Param{}
|
||||
ri.Inputs = []models.Param{}
|
||||
ri.Outputs = []models.Param{}
|
||||
|
||||
@@ -39,7 +39,6 @@ func TestStorageResource_ConvertToPricedResource_InvalidType(t *testing.T) {
|
||||
|
||||
func TestStorageResourceInstance_ClearEnv(t *testing.T) {
|
||||
inst := &resources.StorageResourceInstance{
|
||||
Credentials: &resources.Credentials{Login: "test"},
|
||||
ResourceInstance: resources.ResourceInstance[*resources.StorageResourcePartnership]{
|
||||
Env: []models.Param{{Attr: "A"}},
|
||||
Inputs: []models.Param{{Attr: "B"}},
|
||||
@@ -48,7 +47,6 @@ func TestStorageResourceInstance_ClearEnv(t *testing.T) {
|
||||
}
|
||||
|
||||
inst.ClearEnv()
|
||||
assert.Nil(t, inst.Credentials)
|
||||
assert.Empty(t, inst.Env)
|
||||
assert.Empty(t, inst.Inputs)
|
||||
assert.Empty(t, inst.Outputs)
|
||||
|
||||
Reference in New Issue
Block a user