Class: UffizziCore::Api::Cli::V1::Projects::SecretsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UffizziCore::Api::Cli::V1::Projects::SecretsController
- Defined in:
- app/controllers/uffizzi_core/api/cli/v1/projects/secrets_controller.rb
Instance Method Summary collapse
-
#bulk_create ⇒ Object
Add secret to project.
-
#destroy ⇒ Object
Delete a secret from project by secret name.
-
#index ⇒ Object
Get secrets for the project.
Instance Method Details
#bulk_create ⇒ Object
Add secret to project
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/uffizzi_core/api/cli/v1/projects/secrets_controller.rb', line 25 def bulk_create secrets_form = UffizziCore::Api::Cli::V1::Secret::BulkAssignForm.new secrets_form.secrets = resource_project.secrets secrets_form.assign_secrets(secrets_params) return respond_with secrets_form unless secrets_form.valid? resource_project.secrets.replace(secrets_form.secrets) UffizziCore::ProjectService.update_compose_secrets(resource_project) respond_with resource_project.secrets, root: :secrets end |
#destroy ⇒ Object
Delete a secret from project by secret name
45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/uffizzi_core/api/cli/v1/projects/secrets_controller.rb', line 45 def destroy secret_name = CGI.unescape(params[:id]) secret = resource_project.secrets.find_by!(name: secret_name) UffizziCore::ProjectService.update_compose_secret_errors(resource_project, secret) secret.destroy head :no_content end |
#index ⇒ Object
Get secrets for the project
13 14 15 |
# File 'app/controllers/uffizzi_core/api/cli/v1/projects/secrets_controller.rb', line 13 def index respond_with resource_project.secrets, root: :secrets end |