Skip to content

Commit

Permalink
feat: enable environments, deployed versions and released versions en…
Browse files Browse the repository at this point in the history
…dpoints without a feature toggle required
  • Loading branch information
bethesque committed Jul 17, 2021
1 parent 8129023 commit 84a59c1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
18 changes: 8 additions & 10 deletions lib/pact_broker/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,14 @@ def self.build_api(application_context = PactBroker::ApplicationContext.default_

add ["contracts", "publish"], Api::Resources::PublishContracts, { resource_name: "publish_contracts" }

if PactBroker.feature_enabled?(:environments)
add ["environments"], Api::Resources::Environments, { resource_name: "environments" }
add ["environments", :environment_uuid], Api::Resources::Environment, { resource_name: "environment" }
add ["environments", :environment_uuid, "deployed-versions", "currently-deployed"], Api::Resources::CurrentlyDeployedVersionsForEnvironment, { resource_name: "environment_currently_deployed_deployed_versions" }
add ["environments", :environment_uuid, "released-versions", "currently-supported"], Api::Resources::CurrentlySupportedVersionsForEnvironment, { resource_name: "environment_currently_supported_released_versions" }
add ["pacticipants", :pacticipant_name, "versions", :pacticipant_version_number, "deployed-versions", "environment", :environment_uuid], Api::Resources::DeployedVersionsForVersionAndEnvironment, { resource_name: "deployed_versions_for_version_and_environment" }
add ["pacticipants", :pacticipant_name, "versions", :pacticipant_version_number, "released-versions", "environment", :environment_uuid], Api::Resources::ReleasedVersionsForVersionAndEnvironment, { resource_name: "released_versions_for_version_and_environment" }
add ["released-versions", :uuid], Api::Resources::ReleasedVersion, { resource_name: "released_version" }
add ["deployed-versions", :uuid], Api::Resources::DeployedVersion, { resource_name: "deployed_version" }
end
add ["environments"], Api::Resources::Environments, { resource_name: "environments" }
add ["environments", :environment_uuid], Api::Resources::Environment, { resource_name: "environment" }
add ["environments", :environment_uuid, "deployed-versions", "currently-deployed"], Api::Resources::CurrentlyDeployedVersionsForEnvironment, { resource_name: "environment_currently_deployed_deployed_versions" }
add ["environments", :environment_uuid, "released-versions", "currently-supported"], Api::Resources::CurrentlySupportedVersionsForEnvironment, { resource_name: "environment_currently_supported_released_versions" }
add ["pacticipants", :pacticipant_name, "versions", :pacticipant_version_number, "deployed-versions", "environment", :environment_uuid], Api::Resources::DeployedVersionsForVersionAndEnvironment, { resource_name: "deployed_versions_for_version_and_environment" }
add ["pacticipants", :pacticipant_name, "versions", :pacticipant_version_number, "released-versions", "environment", :environment_uuid], Api::Resources::ReleasedVersionsForVersionAndEnvironment, { resource_name: "released_versions_for_version_and_environment" }
add ["released-versions", :uuid], Api::Resources::ReleasedVersion, { resource_name: "released_version" }
add ["deployed-versions", :uuid], Api::Resources::DeployedVersion, { resource_name: "deployed_version" }

add ["integrations"], Api::Resources::Integrations, {resource_name: "integrations"}
add ["integrations", "provider", :provider_name, "consumer", :consumer_name], Api::Resources::Integration, {resource_name: "integration"}
Expand Down
22 changes: 10 additions & 12 deletions lib/pact_broker/api/resources/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,17 @@ def links
}]
}

if PactBroker.feature_enabled?(:environments)
links_hash["pb:environments"] = {
title: "Environments",
href: environments_url(base_url),
templated: false
}
links_hash["pb:environments"] = {
title: "Environments",
href: environments_url(base_url),
templated: false
}

links_hash["pb:environment"] = {
title: "Environment",
href: environments_url(base_url) + "/{uuid}",
templated: true
}
end
links_hash["pb:environment"] = {
title: "Environment",
href: environments_url(base_url) + "/{uuid}",
templated: true
}

if PactBroker.feature_enabled?("disable_pacts_for_verification", true)
links_hash.delete("pb:provider-pacts-for-verification")
Expand Down

0 comments on commit 84a59c1

Please sign in to comment.