Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(beta-api): promote handlers to v2.1 API #833

Merged
merged 8 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@

@Module(includes = {GraphModule.class})
public abstract class HttpApiBetaModule {
@Binds
@IntoSet
abstract RequestHandler bindDiscoveryGetHandler(DiscoveryGetHandler handler);

@Binds
@IntoSet
Expand All @@ -74,32 +71,4 @@ abstract RequestHandler bindProbeTemplateUploadBodyHandler(
@Binds
@IntoSet
abstract RequestHandler bindTargetProbesGetHandler(TargetProbesGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindAuthTokenPostHandler(AuthTokenPostHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindAuthTokenPostBodyHandler(AuthTokenPostBodyHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindTargetRecordingGetHandler(TargetRecordingGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindTargetReportGetHandler(TargetReportGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindTargetTemplateGetHandler(TargetTemplateGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindRecordingGetHandler(RecordingGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindReportGetHandler(ReportGetHandler handler);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.net.MalformedURLException;
import java.net.SocketException;
Expand Down Expand Up @@ -63,7 +63,6 @@
import io.cryostat.net.web.WebServer;
import io.cryostat.net.web.http.AbstractAuthenticatedRequestHandler;
import io.cryostat.net.web.http.RequestHandler;
import io.cryostat.net.web.http.api.v2.ApiException;

import com.nimbusds.jose.JOSEException;
import com.nimbusds.jwt.JWT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.util.Set;

Expand Down Expand Up @@ -66,7 +66,7 @@ public int getPriority() {

@Override
public ApiVersion apiVersion() {
return ApiVersion.BETA;
return ApiVersion.V2_1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.net.URI;
import java.net.URISyntaxException;
Expand All @@ -52,10 +52,6 @@
import io.cryostat.net.web.http.AbstractAuthenticatedRequestHandler;
import io.cryostat.net.web.http.HttpMimeType;
import io.cryostat.net.web.http.api.ApiVersion;
import io.cryostat.net.web.http.api.v2.AbstractV2RequestHandler;
import io.cryostat.net.web.http.api.v2.ApiException;
import io.cryostat.net.web.http.api.v2.IntermediateResponse;
import io.cryostat.net.web.http.api.v2.RequestParameters;

import com.google.gson.Gson;
import dagger.Lazy;
Expand Down Expand Up @@ -84,7 +80,7 @@ class AuthTokenPostHandler extends AbstractV2RequestHandler<Map<String, String>>

@Override
public ApiVersion apiVersion() {
return ApiVersion.BETA;
return ApiVersion.V2_1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.util.EnumSet;
import java.util.Set;
Expand All @@ -46,9 +46,6 @@
import io.cryostat.net.security.ResourceAction;
import io.cryostat.net.web.http.HttpMimeType;
import io.cryostat.net.web.http.api.ApiVersion;
import io.cryostat.net.web.http.api.v2.AbstractV2RequestHandler;
import io.cryostat.net.web.http.api.v2.IntermediateResponse;
import io.cryostat.net.web.http.api.v2.RequestParameters;
import io.cryostat.platform.PlatformClient;
import io.cryostat.platform.discovery.EnvironmentNode;

Expand All @@ -72,7 +69,7 @@ public boolean requiresAuthentication() {

@Override
public ApiVersion apiVersion() {
return ApiVersion.BETA;
return ApiVersion.V2_1;
}

@Override
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/io/cryostat/net/web/http/api/v2/HttpApiV2Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,36 @@ abstract RequestHandler bindTargetCredentialsDeleteHandler(
@Binds
@IntoSet
abstract RequestHandler bindRulesPostBodyHandler(RulesPostBodyHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindDiscoveryGetHandler(DiscoveryGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindAuthTokenPostHandler(AuthTokenPostHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindAuthTokenPostBodyHandler(AuthTokenPostBodyHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindTargetRecordingGetHandler(TargetRecordingGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindTargetReportGetHandler(TargetReportGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindTargetTemplateGetHandler(TargetTemplateGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindRecordingGetHandler(RecordingGetHandler handler);

@Binds
@IntoSet
abstract RequestHandler bindReportGetHandler(ReportGetHandler handler);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.nio.file.Path;
import java.util.EnumSet;
Expand Down Expand Up @@ -78,7 +78,7 @@ class RecordingGetHandler extends AbstractJwtConsumingHandler {

@Override
public ApiVersion apiVersion() {
return ApiVersion.BETA;
return ApiVersion.V2_1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.nio.file.Path;
import java.util.EnumSet;
Expand Down Expand Up @@ -86,7 +86,7 @@ class ReportGetHandler extends AbstractJwtConsumingHandler {

@Override
public ApiVersion apiVersion() {
return ApiVersion.BETA;
return ApiVersion.V2_1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -55,7 +55,6 @@
import io.cryostat.net.web.WebServer;
import io.cryostat.net.web.http.HttpMimeType;
import io.cryostat.net.web.http.api.ApiVersion;
import io.cryostat.net.web.http.api.v2.ApiException;

import com.nimbusds.jwt.JWT;
import dagger.Lazy;
Expand All @@ -82,7 +81,7 @@ class TargetRecordingGetHandler extends AbstractJwtConsumingHandler {

@Override
public ApiVersion apiVersion() {
return ApiVersion.BETA;
return ApiVersion.V2_1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.util.EnumSet;
import java.util.Set;
Expand Down Expand Up @@ -87,7 +87,7 @@ class TargetReportGetHandler extends AbstractJwtConsumingHandler {

@Override
public ApiVersion apiVersion() {
return ApiVersion.BETA;
return ApiVersion.V2_1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.util.EnumSet;
import java.util.Set;
Expand Down Expand Up @@ -76,7 +76,7 @@ class TargetTemplateGetHandler extends AbstractJwtConsumingHandler {

@Override
public ApiVersion apiVersion() {
return ApiVersion.BETA;
return ApiVersion.V2_1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.net.URL;
import java.net.UnknownHostException;
Expand All @@ -54,7 +54,6 @@
import io.cryostat.net.security.jwt.AssetJwtHelper;
import io.cryostat.net.web.WebServer;
import io.cryostat.net.web.http.api.ApiVersion;
import io.cryostat.net.web.http.api.v2.ApiException;

import com.nimbusds.jwt.JWT;
import com.nimbusds.jwt.JWTClaimsSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.cryostat.net.web.http.api.beta;
package io.cryostat.net.web.http.api.v2;

import java.net.URL;
import java.util.Map;
Expand All @@ -48,9 +48,6 @@
import io.cryostat.net.web.WebServer;
import io.cryostat.net.web.http.HttpMimeType;
import io.cryostat.net.web.http.api.ApiVersion;
import io.cryostat.net.web.http.api.v2.ApiException;
import io.cryostat.net.web.http.api.v2.IntermediateResponse;
import io.cryostat.net.web.http.api.v2.RequestParameters;

import com.google.gson.Gson;
import io.vertx.core.MultiMap;
Expand Down Expand Up @@ -86,13 +83,13 @@ void setup() {
@Nested
class ApiSpec {
@Test
void shouldBeBetaApi() {
MatcherAssert.assertThat(handler.apiVersion(), Matchers.equalTo(ApiVersion.BETA));
void shouldBeV2_1Api() {
MatcherAssert.assertThat(handler.apiVersion(), Matchers.equalTo(ApiVersion.V2_1));
}

@Test
void shouldUseExpectedPath() {
MatcherAssert.assertThat(handler.path(), Matchers.equalTo("/api/beta/auth/token"));
MatcherAssert.assertThat(handler.path(), Matchers.equalTo("/api/v2.1/auth/token"));
}

@Test
Expand Down
Loading