forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for custom project-domain resource attributes. (#22)
- Loading branch information
Showing
31 changed files
with
851 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package impl | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/lyft/flyteadmin/pkg/manager/impl/validation" | ||
"github.com/lyft/flyteadmin/pkg/repositories/transformers" | ||
|
||
"github.com/lyft/flyteadmin/pkg/manager/interfaces" | ||
"github.com/lyft/flyteadmin/pkg/repositories" | ||
runtimeInterfaces "github.com/lyft/flyteadmin/pkg/runtime/interfaces" | ||
"github.com/lyft/flyteidl/gen/pb-go/flyteidl/admin" | ||
) | ||
|
||
type ProjectDomainManager struct { | ||
db repositories.RepositoryInterface | ||
config runtimeInterfaces.Configuration | ||
} | ||
|
||
func (m *ProjectDomainManager) UpdateProjectDomain( | ||
ctx context.Context, request admin.ProjectDomainAttributesUpdateRequest) ( | ||
*admin.ProjectDomainAttributesUpdateResponse, error) { | ||
if err := validation.ValidateProjectDomainAttributesUpdateRequest(request); err != nil { | ||
return nil, err | ||
} | ||
|
||
model, err := transformers.ToProjectDomainModel(*request.Attributes) | ||
if err != nil { | ||
return nil, err | ||
} | ||
err = m.db.ProjectDomainRepo().CreateOrUpdate(ctx, model) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &admin.ProjectDomainAttributesUpdateResponse{}, nil | ||
} | ||
|
||
func NewProjectDomainManager( | ||
db repositories.RepositoryInterface, config runtimeInterfaces.Configuration) interfaces.ProjectDomainInterface { | ||
return &ProjectDomainManager{ | ||
db: db, | ||
config: config, | ||
} | ||
} |
Oops, something went wrong.