Skip to content

Commit

Permalink
Fixed commit merge conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Prasanna Dangalla committed Feb 10, 2024
1 parent 4825e50 commit b222704
Show file tree
Hide file tree
Showing 13 changed files with 24,008 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -766,14 +766,8 @@ public Set<Scope> getScopesForApplicationSubscription(String username, int appli
throws APIManagementException {

Subscriber subscriber = new Subscriber(username);
Set<Pair<String, String>> scopeKeySet = apiMgtDAO.getScopesForApplicationSubscription(subscriber, applicationId,
organization);
Map<String, Scope> scopeToKeyMap = new HashMap<>();
for (Pair<String, String> scopeEntry : scopeKeySet) {
Scope scope = APIUtil.getScopeByName(scopeEntry.getRight(), scopeEntry.getLeft());
scopeToKeyMap.put(scopeEntry.getRight(), scope);
}
return new LinkedHashSet<>(scopeToKeyMap.values());
Set<String> scopeKeySet = apiMgtDAO.getScopesForApplicationSubscription(subscriber, applicationId);
return new LinkedHashSet<>(APIUtil.getScopes(scopeKeySet, organization).values());
}

public Integer getSubscriptionCount(Subscriber subscriber, String applicationName, String groupingId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ public boolean equals(java.lang.Object o) {
Objects.equals(status, API.status) &&
Objects.equals(organization, API.organization) &&
Objects.equals(isDefaultVersion, API.isDefaultVersion) &&
Objects.equals(securityScheme, API.securityScheme) &&
Objects.equals(apiPolicies, API.apiPolicies) &&
Objects.equals(urlMappings, API.urlMappings);
Objects.equals(urlMappings, API.urlMappings) &&
Objects.equals(securityScheme, API.securityScheme);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package org.wso2.carbon.apimgt.rest.api.admin.v1;

import org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ErrorDTO;
import org.wso2.carbon.apimgt.rest.api.admin.v1.dto.SearchResultListDTO;
import org.wso2.carbon.apimgt.rest.api.admin.v1.ApisApiService;
import org.wso2.carbon.apimgt.rest.api.admin.v1.impl.ApisApiServiceImpl;
import org.wso2.carbon.apimgt.api.APIManagementException;

import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.inject.Inject;

import io.swagger.annotations.*;
import java.io.InputStream;

import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;

import java.util.Map;
import java.util.List;
import javax.validation.constraints.*;
@Path("/apis")

@Api(description = "the apis API")




public class ApisApi {

@Context MessageContext securityContext;

ApisApiService delegate = new ApisApiServiceImpl();


@GET


@Produces({ "application/json" })
@ApiOperation(value = "Retrieve/Search APIs ", notes = "This operation provides you a list of available APIs qualifying under a given search condition. Each retrieved API is represented with a minimal amount of attributes. If you want to get complete details of an API, you need to use **Get details of an API** operation. ", response = SearchResultListDTO.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:admin", description = "Manage all admin operations"),
@AuthorizationScope(scope = "apim:api_provider_change", description = "Retrieve and manage applications")
})
}, tags={ "APIs", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. List of qualifying APIs is returned. ", response = SearchResultListDTO.class),
@ApiResponse(code = 304, message = "Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). ", response = Void.class),
@ApiResponse(code = 406, message = "Not Acceptable. The requested media type is not supported.", response = ErrorDTO.class) })
public Response getAllAPIs( @ApiParam(value = "Maximum size of resource array to return. ", defaultValue="25") @DefaultValue("25") @QueryParam("limit") Integer limit, @ApiParam(value = "Starting point within the complete list of items qualified. ", defaultValue="0") @DefaultValue("0") @QueryParam("offset") Integer offset, @ApiParam(value = "**Search and get all apis in admin portal**. You can search by proving a keyword. ") @QueryParam("query") String query, @ApiParam(value = "Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource. " )@HeaderParam("If-None-Match") String ifNoneMatch) throws APIManagementException{
return delegate.getAllAPIs(limit, offset, query, ifNoneMatch, securityContext);
}

@POST
@Path("/{apiId}/change-provider")

@Produces({ "application/json" })
@ApiOperation(value = "Update the api provider", notes = "Update the api provider ", response = Void.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:admin", description = "Manage all admin operations"),
@AuthorizationScope(scope = "apim:api_provider_change", description = "Retrieve and manage applications")
})
}, tags={ "Api Provider Change" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. Api Provider updated. ", response = Void.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid request or validation error.", response = ErrorDTO.class),
@ApiResponse(code = 404, message = "Not Found. The specified resource does not exist.", response = ErrorDTO.class) })
public Response providerNamePost( @NotNull @ApiParam(value = "",required=true) @QueryParam("provider") String provider, @ApiParam(value = "**API ID** consisting of the **UUID** of the API. ",required=true) @PathParam("apiId") String apiId) throws APIManagementException{
return delegate.providerNamePost(provider, apiId, securityContext);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.wso2.carbon.apimgt.rest.api.admin.v1;

import org.wso2.carbon.apimgt.rest.api.admin.v1.*;
import org.wso2.carbon.apimgt.rest.api.admin.v1.dto.*;

import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;

import org.wso2.carbon.apimgt.api.APIManagementException;

import org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ErrorDTO;
import org.wso2.carbon.apimgt.rest.api.admin.v1.dto.SearchResultListDTO;

import java.util.List;

import java.io.InputStream;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;


public interface ApisApiService {
public Response getAllAPIs(Integer limit, Integer offset, String query, String ifNoneMatch, MessageContext messageContext) throws APIManagementException;
public Response providerNamePost(String provider, String apiId, MessageContext messageContext) throws APIManagementException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public Response globalKeyManagersGet() throws APIManagementException{
@ApiOperation(value = "Delete a Global Key Manager", notes = "Delete a Global Key Manager by keyManager id ", response = Void.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:admin", description = "Manage all admin operations"),
@AuthorizationScope(scope = "apim:admin_operations", description = "Manage API categories and Key Managers related operations")
@AuthorizationScope(scope = "apim:admin_operations", description = "Manage API categories and Key Managers related operations"),
@AuthorizationScope(scope = "apim:keymanagers_manage", description = "Manage Key Managers")
})
}, tags={ "Global Key Manager (Individual)", })
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public Response keyManagersGet() throws APIManagementException{
@ApiOperation(value = "Delete a Key Manager", notes = "Delete a Key Manager by keyManager id ", response = Void.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:admin", description = "Manage all admin operations"),
@AuthorizationScope(scope = "apim:admin_operations", description = "Manage API categories and Key Managers related operations"),
@AuthorizationScope(scope = "apim:keymanagers_manage", description = "Manage Key Managers")
@AuthorizationScope(scope = "apim:admin_operations", description = "Manage API categories and Key Managers related operations")
})
}, tags={ "Key Manager (Individual)", })
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
package org.wso2.carbon.apimgt.rest.api.admin.v1.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.*;


import io.swagger.annotations.*;
import java.util.Objects;

import javax.xml.bind.annotation.*;
import org.wso2.carbon.apimgt.rest.api.common.annotations.Scope;
import com.fasterxml.jackson.annotation.JsonCreator;

import javax.validation.Valid;



public class ApiResultDTO {

private String provider = null;
private String name = null;
private String version = null;
private String id = null;

/**
**/
public ApiResultDTO provider(String provider) {
this.provider = provider;
return this;
}


@ApiModelProperty(value = "")
@JsonProperty("provider")
public String getProvider() {
return provider;
}
public void setProvider(String provider) {
this.provider = provider;
}

/**
**/
public ApiResultDTO name(String name) {
this.name = name;
return this;
}


@ApiModelProperty(value = "")
@JsonProperty("name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}

/**
**/
public ApiResultDTO version(String version) {
this.version = version;
return this;
}


@ApiModelProperty(value = "")
@JsonProperty("version")
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}

/**
**/
public ApiResultDTO id(String id) {
this.id = id;
return this;
}


@ApiModelProperty(value = "")
@JsonProperty("id")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ApiResultDTO apiResult = (ApiResultDTO) o;
return Objects.equals(provider, apiResult.provider) &&
Objects.equals(name, apiResult.name) &&
Objects.equals(version, apiResult.version) &&
Objects.equals(id, apiResult.id);
}

@Override
public int hashCode() {
return Objects.hash(provider, name, version, id);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ApiResultDTO {\n");

sb.append(" provider: ").append(toIndentedString(provider)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" version: ").append(toIndentedString(version)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

Loading

0 comments on commit b222704

Please sign in to comment.