removed @API and @Permission annotations and added @SwaggerDefinition and @Authorization annotations

merge-requests/1/head
GPrathap 8 years ago
parent 93ed31c584
commit 3d971d2bb7

@ -16,9 +16,14 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; package org.wso2.carbon.device.mgt.iot.androidsense.service.impl;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
@ -27,7 +32,21 @@ import javax.ws.rs.*;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@DeviceType(value = "android_sense") @DeviceType(value = "android_sense")
@API(name = "android_sense", version = "1.0.0", context = "/android_sense", tags = {"android_sense"}) @SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "android_sense"),
@ExtensionProperty(name = "context", value = "/android_sense"),
})
}
),
tags = {
@Tag(name = "android_sense", description = "")
}
)
public interface AndroidSenseService { public interface AndroidSenseService {
/** /**

@ -18,7 +18,12 @@
package org.wso2.carbon.device.mgt.iot.arduino.service.impl; package org.wso2.carbon.device.mgt.iot.arduino.service.impl;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
@ -26,7 +31,21 @@ import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "arduino", version = "1.0.0", context = "/arduino", tags = {"arduino"}) @SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "arduino"),
@ExtensionProperty(name = "context", value = "/arduino"),
})
}
),
tags = {
@Tag(name = "arduino", description = "")
}
)
@DeviceType(value = "arduino") @DeviceType(value = "arduino")
public interface ArduinoService { public interface ArduinoService {

@ -18,7 +18,11 @@
package org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl; package org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
@ -27,7 +31,21 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "raspberrypi", version = "1.0.0", context = "/raspberrypi", tags = {"raspberrypi"}) @SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "raspberrypi"),
@ExtensionProperty(name = "context", value = "/raspberrypi"),
})
}
),
tags = {
@Tag(name = "raspberrypi", description = "")
}
)
@DeviceType(value = "raspberrypi") @DeviceType(value = "raspberrypi")
public interface RaspberryPiService { public interface RaspberryPiService {

@ -18,7 +18,11 @@
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl; package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
@ -33,7 +37,21 @@ import javax.ws.rs.core.Response;
* the transport 'Connectors' [XMPP & MQTT] specific to the VirtualFirealarm device-type in order to communicate with * the transport 'Connectors' [XMPP & MQTT] specific to the VirtualFirealarm device-type in order to communicate with
* such devices and to receive messages form it. * such devices and to receive messages form it.
*/ */
@API(name = "virtual_firealarm", version = "1.0.0", context = "/virtual_firealarm", tags = {"virtual_firealarm"}) @SwaggerDefinition(
info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "virtual_firealarm"),
@ExtensionProperty(name = "context", value = "/virtual_firealarm"),
})
}
),
tags = {
@Tag(name = "virtual_firealarm", description = "")
}
)
@DeviceType(value = "virtual_firealarm") @DeviceType(value = "virtual_firealarm")
public interface VirtualFireAlarmService { public interface VirtualFireAlarmService {

@ -18,10 +18,19 @@
*/ */
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*; import io.swagger.annotations.SwaggerDefinition;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.Info;
import org.wso2.carbon.apimgt.annotations.api.Permission; import io.swagger.annotations.ExtensionProperty;
import org.wso2.carbon.apimgt.annotations.api.Scope; import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.mdm.services.android.bean.wrapper.*; import org.wso2.carbon.mdm.services.android.bean.wrapper.*;
@ -34,10 +43,23 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@API(name = "Android Device Management Administrative Service", version = "1.0.0", @SwaggerDefinition(
context = "/api/device-mgt/android/v1.0/admin/devices", info = @Info(
tags = {"devicemgt_android"}) version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name",
value = "Android Device Management Administrative Service"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/android/v1.0/admin/devices"),
})
}
),
tags = {
@Tag(name = "devicemgt_android", description = "")
}
)
@Path("/admin/devices") @Path("/admin/devices")
@Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.") @Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@ -53,7 +75,15 @@ public interface DeviceManagementAdminService {
notes = "Using this API you have the option of hard locking an Android device, where the Administrator " + notes = "Using this API you have the option of hard locking an Android device, where the Administrator " +
"permanently locks the device or screen locking an Android device.", "permanently locks the device or screen locking an Android device.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/lock",
description = "Lock Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -93,7 +123,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while locking the device.") "Server error occurred while locking the device.")
}) })
@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning-device/operations/android/lock")
Response configureDeviceLock( Response configureDeviceLock(
@ApiParam( @ApiParam(
name = "deviceLock", name = "deviceLock",
@ -112,7 +141,16 @@ public interface DeviceManagementAdminService {
responseContainer = "List", responseContainer = "List",
notes = "Unlock devices that were locked permanently using the hard lock operation. Devices that are hard locked can only be unlocked by the EMM administrator.", notes = "Unlock devices that were locked permanently using the hard lock operation. Devices that are hard locked can only be unlocked by the EMM administrator.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service") tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/unlock",
description = "Unlock Device") }
)
}
)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 201, code = 201,
@ -151,7 +189,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while unlocking the device.") "Server error occurred while unlocking the device.")
}) })
@Permission(name = "Unlock Device", permission = "/device-mgt/devices/owning-device/operations/android/unlock")
Response configureDeviceUnlock( Response configureDeviceUnlock(
@ApiParam( @ApiParam(
name = "deviceIDs", name = "deviceIDs",
@ -170,7 +207,16 @@ public interface DeviceManagementAdminService {
notes = "Request location coordinates of Android devices. \n" + notes = "Request location coordinates of Android devices. \n" +
"Example: In situations where you have lost your device and need to find out where it is, you can use this REST API to get the location of the device.", "Example: In situations where you have lost your device and need to find out where it is, you can use this REST API to get the location of the device.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service") tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/location",
description = "Get Device Location") }
)
}
)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 201, code = 201,
@ -208,7 +254,6 @@ public interface DeviceManagementAdminService {
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new get-location operation.")}) "Server error occurred while adding a new get-location operation.")})
@Permission(name = "Get Device Location", permission = "/device-mgt/devices/owning-device/operations/android/location")
Response getDeviceLocation( Response getDeviceLocation(
@ApiParam( @ApiParam(
name = "deviceIDs", name = "deviceIDs",
@ -224,7 +269,15 @@ public interface DeviceManagementAdminService {
value = "Clearing the Password on Android Devices", value = "Clearing the Password on Android Devices",
notes = "Clear the password on Android devices", notes = "Clear the password on Android devices",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service." tags = "Android Device Management Administrative Service.",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/clear-password",
description = "Clear Password of Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -264,7 +317,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new clear password operation.") "Server error occurred while adding a new clear password operation.")
}) })
@Permission(name = "Clear Password of Device", permission = "/device-mgt/devices/owning-device/operations/android/clear-password")
Response removePassword( Response removePassword(
@ApiParam(name = "deviceIDs", @ApiParam(name = "deviceIDs",
value = "Provide the ID of the Android device. Multiple device IDs can be added by using comma separated values. ", value = "Provide the ID of the Android device. Multiple device IDs can be added by using comma separated values. ",
@ -278,7 +330,13 @@ public interface DeviceManagementAdminService {
value = "Enabling or Disabling the Camera on Android Devices", value = "Enabling or Disabling the Camera on Android Devices",
notes = "Enable or disable the camera on Android devices.", notes = "Enable or disable the camera on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/operations/android/camera", description = "Manage Camera") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -318,7 +376,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding the new camera control operation.") "Server error occurred while adding the new camera control operation.")
}) })
@Permission(name = "Manage Camera", permission = "/device-mgt/devices/owning-device/operations/android/camera")
Response configureCamera( Response configureCamera(
@ApiParam( @ApiParam(
name = "cameraControl", name = "cameraControl",
@ -340,7 +397,15 @@ public interface DeviceManagementAdminService {
" executed it will be in the Android operation queue until the device calls the server to retrieve " + " executed it will be in the Android operation queue until the device calls the server to retrieve " +
"the list of operations that needs to be executed on the device", "the list of operations that needs to be executed on the device",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/info",
description = "Get Device Information") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -380,7 +445,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device info operation.") "Server error occurred while adding a new device info operation.")
}) })
@Permission(name = "Get Device Information", permission = "/device-mgt/devices/owning-device/operations/android/info")
Response getDeviceInformation( Response getDeviceInformation(
@ApiParam( @ApiParam(
name = "deviceIds", name = "deviceIds",
@ -399,7 +463,15 @@ public interface DeviceManagementAdminService {
" executed it will be in the Android operation queue until the device calls the server to retrieve " + " executed it will be in the Android operation queue until the device calls the server to retrieve " +
"the list of operations that needs to be executed on the device.", "the list of operations that needs to be executed on the device.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/logcat",
description = "Get Logs") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -439,7 +511,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device logcat operation.") "Server error occurred while adding a new device logcat operation.")
}) })
@Permission(name = "Get Logs", permission = "/device-mgt/devices/owning-device/operations/android/logcat")
Response getDeviceLogcat( Response getDeviceLogcat(
@ApiParam( @ApiParam(
name = "deviceIds", name = "deviceIds",
@ -457,7 +528,15 @@ public interface DeviceManagementAdminService {
notes = "Enterprise wipe is the process of deleting enterprise related data on a device while keeping the " + notes = "Enterprise wipe is the process of deleting enterprise related data on a device while keeping the " +
"personal data intact. You are able to enterprise wipe Android devices using this REST API.", "personal data intact. You are able to enterprise wipe Android devices using this REST API.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/enterprise-wipe",
description = "Enterprise Wipe") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -496,7 +575,6 @@ public interface DeviceManagementAdminService {
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding the enterprise wipe operation.")}) "Server error occurred while adding the enterprise wipe operation.")})
@Permission(name = "Enterprise Wipe", permission = "/device-mgt/devices/owning-device/operations/android/enterprise-wipe")
Response wipeDevice( Response wipeDevice(
@ApiParam( @ApiParam(
name = "deviceIDs", name = "deviceIDs",
@ -513,7 +591,15 @@ public interface DeviceManagementAdminService {
notes = "Factory rest or erase all the data stored on the Android devices " + notes = "Factory rest or erase all the data stored on the Android devices " +
"to restore them back to the original system.", "to restore them back to the original system.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/wipe",
description = "Factory Reset") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -552,7 +638,6 @@ public interface DeviceManagementAdminService {
code = 500, code = 500,
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding the device wipe operation.")}) "Server error occurred while adding the device wipe operation.")})
@Permission(name = "Factory Reset", permission = "/device-mgt/devices/owning-device/operations/android/wipe")
Response wipeData( Response wipeData(
@ApiParam( @ApiParam(
name = "wipeData", name = "wipeData",
@ -573,7 +658,15 @@ public interface DeviceManagementAdminService {
"until the device calls the server to retrieve the list of operations that needs to be executed " + "until the device calls the server to retrieve the list of operations that needs to be executed " +
"on the device.", "on the device.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/applications",
description = "Get Installed Application") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -613,7 +706,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding the new get-applications operation.") "Server error occurred while adding the new get-applications operation.")
}) })
@Permission(name = "Get Installed Application", permission = "/device-mgt/devices/owning-device/operations/android/applications")
Response getApplications( Response getApplications(
@ApiParam( @ApiParam(
name = "deviceIDs", name = "deviceIDs",
@ -629,7 +721,15 @@ public interface DeviceManagementAdminService {
value = "Ringing Android Devices", value = "Ringing Android Devices",
notes = "Ring Android devices.", notes = "Ring Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/ring",
description = "Ring Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -669,7 +769,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device ring operation.") "Server error occurred while adding a new device ring operation.")
}) })
@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning-device/operations/android/ring")
Response ringDevice( Response ringDevice(
@ApiParam( @ApiParam(
name = "deviceIDs", name = "deviceIDs",
@ -685,7 +784,15 @@ public interface DeviceManagementAdminService {
value = "Rebooting Android Devices", value = "Rebooting Android Devices",
notes = "Reboot or restart your Android devices.", notes = "Reboot or restart your Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/reboot",
description = "Reboot Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -725,7 +832,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding the new device reboot operation.") "Server error occurred while adding the new device reboot operation.")
}) })
@Permission(name = "Reboot Device", permission = "/device-mgt/devices/owning-device/operations/android/reboot")
Response rebootDevice( Response rebootDevice(
@ApiParam( @ApiParam(
name = "deviceIDs", name = "deviceIDs",
@ -740,7 +846,15 @@ public interface DeviceManagementAdminService {
value = "Muting Android Devices", value = "Muting Android Devices",
notes = "Mute or enable a silent profile for Android devices.", notes = "Mute or enable a silent profile for Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/mute",
description = "Mute Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -781,7 +895,6 @@ public interface DeviceManagementAdminService {
"Server error occurred while adding a new device mute operation.") "Server error occurred while adding a new device mute operation.")
}) })
@Path("/mute") @Path("/mute")
@Permission(name = "Mute Device", permission = "/device-mgt/devices/owning-device/operations/android/mute")
Response muteDevice( Response muteDevice(
@ApiParam( @ApiParam(
name = "deviceIDs", name = "deviceIDs",
@ -799,7 +912,15 @@ public interface DeviceManagementAdminService {
notes = "Install an application on an Android device. If the device you are installing the application has the WSO2 system service application installed," + notes = "Install an application on an Android device. If the device you are installing the application has the WSO2 system service application installed," +
" the application installation will happen in silent mode, else the device user's consent will be required.", " the application installation will happen in silent mode, else the device user's consent will be required.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/install-app",
description = "Install Applications") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -839,7 +960,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new install-application operation.") "Server error occurred while adding a new install-application operation.")
}) })
@Permission(name = "Install Applications", permission = "/device-mgt/devices/owning-device/operations/android/install-app")
Response installApplication( Response installApplication(
@ApiParam( @ApiParam(
name = "applicationInstallation", name = "applicationInstallation",
@ -860,7 +980,15 @@ public interface DeviceManagementAdminService {
" has the WSO2 system service application installed, the application update will happen in silent " + " has the WSO2 system service application installed, the application update will happen in silent " +
"mode, else the device user's consent is required.", "mode, else the device user's consent is required.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/update-app",
description = "Update installed applications") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -900,7 +1028,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding the new update-application operation.") "Server error occurred while adding the new update-application operation.")
}) })
@Permission(name = "Update installed applications", permission = "/device-mgt/devices/owning-device/operations/android/update-app")
Response updateApplication( Response updateApplication(
@ApiParam( @ApiParam(
name = "applicationUpdate", name = "applicationUpdate",
@ -918,7 +1045,15 @@ public interface DeviceManagementAdminService {
value = "Uninstalling an Application from Android Devices", value = "Uninstalling an Application from Android Devices",
notes = "Uninstall an application from Android devices.", notes = "Uninstall an application from Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/uninstall-app",
description = "Uninstall Applications") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -958,7 +1093,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new uninstall-application operation.") "Server error occurred while adding a new uninstall-application operation.")
}) })
@Permission(name = "Uninstall Applications", permission = "/device-mgt/devices/owning-device/operations/android/uninstall-app")
Response uninstallApplication( Response uninstallApplication(
@ApiParam( @ApiParam(
name = "applicationUninstallation", name = "applicationUninstallation",
@ -980,7 +1114,15 @@ public interface DeviceManagementAdminService {
" Android operating systems and after, the blacklisted apps will be hidden. Blacklisting can be used on both BYOD and " + " Android operating systems and after, the blacklisted apps will be hidden. Blacklisting can be used on both BYOD and " +
"COPE devices. Applications can be blacklisted via the application restriction policy too.", "COPE devices. Applications can be blacklisted via the application restriction policy too.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/blacklist-app",
description = "Blacklist Applications") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1020,7 +1162,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding the new blacklist-applications operation.") "Server error occurred while adding the new blacklist-applications operation.")
}) })
@Permission(name = "Blacklist Applications", permission = "/device-mgt/devices/owning-device/operations/android/blacklist-app")
Response blacklistApplications( Response blacklistApplications(
@ApiParam( @ApiParam(
name = "blacklistApplications", name = "blacklistApplications",
@ -1038,7 +1179,15 @@ public interface DeviceManagementAdminService {
value = "UUpgrading Firmware of Android Devices", value = "UUpgrading Firmware of Android Devices",
notes = "Upgrade the firmware of Android devices.", notes = "Upgrade the firmware of Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/upgrade",
description = "Upgrade Firmware") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1078,7 +1227,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new upgrade firmware operation.") "Server error occurred while adding a new upgrade firmware operation.")
}) })
@Permission(name = "Upgrade Firmware", permission = "/device-mgt/devices/owning-device/operations/android/upgrade")
Response upgradeFirmware( Response upgradeFirmware(
@ApiParam( @ApiParam(
name = "upgradeFirmware", name = "upgradeFirmware",
@ -1098,7 +1246,15 @@ public interface DeviceManagementAdminService {
value = "Configuring VPN on Android devices", value = "Configuring VPN on Android devices",
notes = "Configure VPN on Android devices.", notes = "Configure VPN on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/vpn",
description = "Add VPN") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1138,7 +1294,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while configuring the VPN.") "Server error occurred while configuring the VPN.")
}) })
@Permission(name = "Add VPN", permission = "/device-mgt/devices/owning-device/operations/android/vpn")
Response configureVPN( Response configureVPN(
@ApiParam( @ApiParam(
name = "vpnBean", name = "vpnBean",
@ -1154,7 +1309,15 @@ public interface DeviceManagementAdminService {
value = "Sending a Notification to Android Devices", value = "Sending a Notification to Android Devices",
notes = "Send a notification or message to Android devices.", notes = "Send a notification or message to Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/send-notification",
description = "Send Notifications") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1194,7 +1357,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new send notification operation.") "Server error occurred while adding a new send notification operation.")
}) })
@Permission(name = "Send Notifications", permission = "/device-mgt/devices/owning-device/operations/android/send-notification")
Response sendNotification( Response sendNotification(
@ApiParam( @ApiParam(
name = "notification", name = "notification",
@ -1211,7 +1373,15 @@ public interface DeviceManagementAdminService {
value = "Configuring Wi-Fi on Android Devices", value = "Configuring Wi-Fi on Android Devices",
notes = "Configure Wi-Fi on Android devices.", notes = "Configure Wi-Fi on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/wifi",
description = "Add Wifi Configuration") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1251,7 +1421,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while configuring Wi-Fi.") "Server error occurred while configuring Wi-Fi.")
}) })
@Permission(name = "Add Wifi Configuration", permission = "/device-mgt/devices/owning-device/operations/android/wifi")
Response configureWifi( Response configureWifi(
@ApiParam( @ApiParam(
name = "wifi", name = "wifi",
@ -1269,7 +1438,15 @@ public interface DeviceManagementAdminService {
value = "Encrypting Storage on Android Devices", value = "Encrypting Storage on Android Devices",
notes = "Encrypt the data stored on Android devices.", notes = "Encrypt the data stored on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/encrypt",
description = "Encrypt Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1309,7 +1486,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new encrypt storage operation.") "Server error occurred while adding a new encrypt storage operation.")
}) })
@Permission(name = "Encrypt Device", permission = "/device-mgt/devices/owning-device/operations/android/encrypt")
Response encryptStorage( Response encryptStorage(
@ApiParam( @ApiParam(
name = "encryption", name = "encryption",
@ -1327,7 +1503,15 @@ public interface DeviceManagementAdminService {
value = "Changing the Lock Code on Android Devices", value = "Changing the Lock Code on Android Devices",
notes = "Change the lock code on Android devices.", notes = "Change the lock code on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/change-lock-code",
description = "Change Password of Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1367,7 +1551,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new change lock code operation.") "Server error occurred while adding a new change lock code operation.")
}) })
@Permission(name = "Change Password of Device", permission = "/device-mgt/devices/owning-device/operations/android/change-lock-code")
Response changeLockCode( Response changeLockCode(
@ApiParam( @ApiParam(
name = "lockCode", name = "lockCode",
@ -1385,7 +1568,15 @@ public interface DeviceManagementAdminService {
value = "Setting a Password Policy on Android Devices", value = "Setting a Password Policy on Android Devices",
notes = "Set a password policy on Android devices.", notes = "Set a password policy on Android devices.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/password-policy",
description = "Set Password Policy") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1425,7 +1616,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new set password policy operation.") "Server error occurred while adding a new set password policy operation.")
}) })
@Permission(name = "Set Password Policy", permission = "/device-mgt/devices/owning-device/operations/android/password-policy")
Response setPasswordPolicy( Response setPasswordPolicy(
@ApiParam( @ApiParam(
name = "passwordPolicy", name = "passwordPolicy",
@ -1441,7 +1631,15 @@ public interface DeviceManagementAdminService {
value = "Setting a Web Clip on Android Devices", value = "Setting a Web Clip on Android Devices",
notes = "Set a web clip on Android devices. A web clip is used to add a bookmark to a web application.", notes = "Set a web clip on Android devices. A web clip is used to add a bookmark to a web application.",
response = Activity.class, response = Activity.class,
tags = "Android Device Management Administrative Service" tags = "Android Device Management Administrative Service",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(
scope = "/device-mgt/devices/owning-device/operations/android/webclip",
description = "Add Webclips") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -1481,7 +1679,6 @@ public interface DeviceManagementAdminService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding adding a the set web clip operation.") "Server error occurred while adding adding a the set web clip operation.")
}) })
@Permission(name = "Add Webclips", permission = "/device-mgt/devices/owning-device/operations/android/webclip")
Response setWebClip( Response setWebClip(
@ApiParam( @ApiParam(
name = "webClip", name = "webClip",

@ -18,9 +18,20 @@
*/ */
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*; import io.swagger.annotations.SwaggerDefinition;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.Info;
import org.wso2.carbon.apimgt.annotations.api.Permission; import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication;
import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice;
@ -34,10 +45,21 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@API(name = "Android Device Management", version = "1.0.0", @SwaggerDefinition(
context = "/api/device-mgt/android/v1.0/devices", info = @Info(
tags = {"devicemgt_android"}) version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Android Device Management"),
@ExtensionProperty(name = "context", value = "/api/device-mgt/android/v1.0/devices"),
})
}
),
tags = {
@Tag(name = "devicemgt_android", description = "")
}
)
@Api(value = "Android Device Management", @Api(value = "Android Device Management",
description = "This carries all the resources related to the Android device management functionalities.") description = "This carries all the resources related to the Android device management functionalities.")
@Path("/devices") @Path("/devices")
@ -53,7 +75,14 @@ public interface DeviceManagementService {
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating the Application Details on Android Devices", value = "Updating the Application Details on Android Devices",
notes = "Update the details of the applications that are installed on Android devices.", notes = "Update the details of the applications that are installed on Android devices.",
tags = "Android Device Management" tags = "Android Device Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
description = "Enroll Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -88,7 +117,6 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while updating the application list.") "Server error occurred while updating the application list.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response updateApplicationList( Response updateApplicationList(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -114,7 +142,15 @@ public interface DeviceManagementService {
" While getting the pending operations the details of the operations executed at the device end is shared with the server. " + " While getting the pending operations the details of the operations executed at the device end is shared with the server. " +
"The server then updates the status of the operations that were carried out on the device.", "The server then updates the status of the operations that were carried out on the device.",
response = Operation.class, response = Operation.class,
tags = "Android Device Management") tags = "Android Device Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
description = "Enroll Device") }
)
}
)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
@ -144,7 +180,6 @@ public interface DeviceManagementService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the list of pending operations.") message = "Internal Server Error. \n Server error occurred while fetching the list of pending operations.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response getPendingOperations( Response getPendingOperations(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -173,7 +208,14 @@ public interface DeviceManagementService {
" the Android Agent on the device, before being able to register the device with WSO2 EMM. Instead," + " the Android Agent on the device, before being able to register the device with WSO2 EMM. Instead," +
" you can use this REST API to register an Android device with WSO2 EMM, without having to install" + " you can use this REST API to register an Android device with WSO2 EMM, without having to install" +
" an Android Agent. This API can be mainly used to test the device enrollment process.", " an Android Agent. This API can be mainly used to test the device enrollment process.",
tags = "Android Device Management" tags = "Android Device Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
description = "Enroll Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -212,7 +254,6 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while adding a new device.") "Server error occurred while adding a new device.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response enrollDevice(@ApiParam( Response enrollDevice(@ApiParam(
name = "device", name = "device",
value = "The properties required to enroll a device.") value = "The properties required to enroll a device.")
@ -224,7 +265,14 @@ public interface DeviceManagementService {
httpMethod = "GET", httpMethod = "GET",
value = "Getting the Registration Status of an Android Device", value = "Getting the Registration Status of an Android Device",
notes = "Use this REST API to retrieve the registration status of an Android device.", notes = "Use this REST API to retrieve the registration status of an Android device.",
tags = "Android Device Management" tags = "Android Device Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
description = "Enroll Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -253,7 +301,6 @@ public interface DeviceManagementService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the enrollment status of the Android device.") message = "Internal Server Error. \n Server error occurred while fetching the enrollment status of the Android device.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response isEnrolled( Response isEnrolled(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -273,7 +320,14 @@ public interface DeviceManagementService {
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating the Registration Details of an Android Device", value = "Updating the Registration Details of an Android Device",
notes = "Use this REST API to update the registration details of an Android device.", notes = "Use this REST API to update the registration details of an Android device.",
tags = "Android Device Management" tags = "Android Device Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
description = "Enroll Device") }
)
}
) )
@ApiResponses( @ApiResponses(
value = { value = {
@ -309,7 +363,6 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while updating the device enrollment.") "Server error occurred while updating the device enrollment.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response modifyEnrollment( Response modifyEnrollment(
@ApiParam( @ApiParam(
name = "id", name = "id",
@ -325,7 +378,13 @@ public interface DeviceManagementService {
httpMethod = "DELETE", httpMethod = "DELETE",
value = "Unregistering an Android Device", value = "Unregistering an Android Device",
notes = "Use this REST API to unregister an Android device.", notes = "Use this REST API to unregister an Android device.",
tags = "Android Device Management" tags = "Android Device Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/disenroll/android", description = "Disenroll Device") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -339,7 +398,6 @@ public interface DeviceManagementService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while dis-enrolling the device.") "Server error occurred while dis-enrolling the device.")
}) })
@Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/android")
Response disEnrollDevice( Response disEnrollDevice(
@ApiParam( @ApiParam(
name = "id", name = "id",

@ -18,9 +18,19 @@
*/ */
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*; import io.swagger.annotations.SwaggerDefinition;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.Info;
import org.wso2.carbon.apimgt.annotations.api.Permission; import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration; import org.wso2.carbon.mdm.services.android.bean.AndroidPlatformConfiguration;
import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException;
@ -30,10 +40,23 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "Android Configuration Management", version = "1.0.0", @SwaggerDefinition(
context = "/api/device-mgt/android/v1.0/configuration", info = @Info(
tags = {"devicemgt_android"}) version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name",
value = "Android Configuration Management"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/android/v1.0/configuration"),
})
}
),
tags = {
@Tag(name = "devicemgt_android", description = "")
}
)
@Api(value = "Android Configuration Management", description = "This API carries all the resource used to mange the Android platform configurations.") @Api(value = "Android Configuration Management", description = "This API carries all the resource used to mange the Android platform configurations.")
@Path("/configuration") @Path("/configuration")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@ -47,7 +70,14 @@ public interface DeviceTypeConfigurationService {
value = "Getting Android Platform Configurations", value = "Getting Android Platform Configurations",
notes = "Get the Android platform configuration details using this REST API.", notes = "Get the Android platform configuration details using this REST API.",
response = PlatformConfiguration.class, response = PlatformConfiguration.class,
tags = "Android Configuration Management" tags = "Android Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/view",
description = "View Configurations") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -80,7 +110,6 @@ public interface DeviceTypeConfigurationService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the Android platform configuration.") message = "Internal Server Error. \n Server error occurred while fetching the Android platform configuration.")
}) })
@Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view")
Response getConfiguration( Response getConfiguration(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",
@ -97,7 +126,14 @@ public interface DeviceTypeConfigurationService {
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating Android Platform Configurations", value = "Updating Android Platform Configurations",
notes = "Update the Android platform configurations using this REST API.", notes = "Update the Android platform configurations using this REST API.",
tags = "Android Configuration Management" tags = "Android Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/manage",
description = "Manage Configurations") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -132,7 +168,6 @@ public interface DeviceTypeConfigurationService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while modifying the Android platform configuration.") "Server error occurred while modifying the Android platform configuration.")
}) })
@Permission(name = "Manage Configurations", permission = "/device-mgt/platform-configurations/manage")
Response updateConfiguration( Response updateConfiguration(
@ApiParam(name = "configuration", @ApiParam(name = "configuration",
value = "The properties to update the Android platform configurations.") value = "The properties to update the Android platform configurations.")
@ -148,7 +183,15 @@ public interface DeviceTypeConfigurationService {
notes = "Use this REST API to retrieve the license agreement that is used for the Android device " + notes = "Use this REST API to retrieve the license agreement that is used for the Android device " +
"registration process.", "registration process.",
response = String.class, response = String.class,
tags = "Android Configuration Management") tags = "Android Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
description = "Enroll Device") }
)
}
)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
@ -180,7 +223,6 @@ public interface DeviceTypeConfigurationService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the Android license configuration.") message = "Internal Server Error. \n Server error occurred while fetching the Android license configuration.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/android")
Response getLicense( Response getLicense(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",

@ -18,10 +18,19 @@
*/ */
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.*; import io.swagger.annotations.SwaggerDefinition;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.Info;
import org.wso2.carbon.apimgt.annotations.api.Permission; import io.swagger.annotations.ExtensionProperty;
import org.wso2.carbon.apimgt.annotations.api.Scope; import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper; import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper;
@ -31,10 +40,21 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "Android Event Receiver", version = "1.0.0", @SwaggerDefinition(
context = "/api/device-mgt/android/v1.0/events", info = @Info(
tags = {"devicemgt_android"}) version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Android Event Receiver"),
@ExtensionProperty(name = "context", value = "/api/device-mgt/android/v1.0/events"),
})
}
),
tags = {
@Tag(name = "devicemgt_android", description = "")
}
)
@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs. To enable event publishing/retrieving you need to" + @Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs. To enable event publishing/retrieving you need to" +
" configure WSO2 EMM as explained in https://docs.wso2.com/display/EMM220/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " + " configure WSO2 EMM as explained in https://docs.wso2.com/display/EMM220/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " +
"https://docs.wso2.com/display/EMM220/Creating+a+New+Event+Stream+and+Receiver") "https://docs.wso2.com/display/EMM220/Creating+a+New+Event+Stream+and+Receiver")
@ -51,7 +71,14 @@ public interface EventReceiverService {
httpMethod = "POST", httpMethod = "POST",
value = "Publishing Events", value = "Publishing Events",
notes = "Publish events received by the WSO2 EMM Android client to the WSO2 Data Analytics Server (DAS) using this API.", notes = "Publish events received by the WSO2 EMM Android client to the WSO2 Data Analytics Server (DAS) using this API.",
tags = "Event Receiver" tags = "Event Receiver",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
description = "Publish Events to DAS") }
)
}
) )
@ApiResponses( @ApiResponses(
value = { value = {
@ -91,7 +118,6 @@ public interface EventReceiverService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while publishing events.") "Server error occurred while publishing events.")
}) })
@Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/enroll/android")
Response publishEvents( Response publishEvents(
@ApiParam( @ApiParam(
name = "eventBeanWrapper", name = "eventBeanWrapper",
@ -110,7 +136,14 @@ public interface EventReceiverService {
"(This cannot be combined with the to and from parameters).", "(This cannot be combined with the to and from parameters).",
response = DeviceState.class, response = DeviceState.class,
responseContainer = "List", responseContainer = "List",
tags = "Event Receiver" tags = "Event Receiver",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/android",
description = "Publish Events to DAS") }
)
}
) )
@ApiResponses( @ApiResponses(
value = { value = {
@ -140,7 +173,6 @@ public interface EventReceiverService {
code = 500, code = 500,
message = "Error occurred while getting the published events for the specified device.") message = "Error occurred while getting the published events for the specified device.")
}) })
@Permission(name = "Publish Events to DAS", permission = "/device-mgt/devices/enroll/android")
Response retrieveAlerts( Response retrieveAlerts(
@ApiParam( @ApiParam(
name = "id", name = "id",

@ -18,9 +18,20 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services; package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.*; import io.swagger.annotations.SwaggerDefinition;
import org.wso2.carbon.apimgt.annotations.api.API; import io.swagger.annotations.Info;
import org.wso2.carbon.apimgt.annotations.api.Permission; import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.AuthorizationScope;
import io.swagger.annotations.Authorization;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
@ -34,9 +45,23 @@ import javax.ws.rs.core.Response;
* Windows Platform Configuration REST-API implementation. * Windows Platform Configuration REST-API implementation.
* All end points supports JSON, XMl with content negotiation. * All end points supports JSON, XMl with content negotiation.
*/ */
@API(name = "Windows Configuration Management", version = "1.0.0",
context = "/api/device-mgt/windows/v1.0/services/configuration", @SwaggerDefinition(
tags = {"windows"}) info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows Configuration Management"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/windows/v1.0/services/configuration"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@Api(value = "Windows Configuration Management", @Api(value = "Windows Configuration Management",
description = "This carries all the resources related to Windows configurations management functionalities") description = "This carries all the resources related to Windows configurations management functionalities")
@WebService @WebService
@ -52,7 +77,14 @@ public interface ConfigurationMgtService {
value = "Getting Windows Platform Configurations", value = "Getting Windows Platform Configurations",
notes = "Get the Windows platform configuration details using this REST API.", notes = "Get the Windows platform configuration details using this REST API.",
response = PlatformConfiguration.class, response = PlatformConfiguration.class,
tags = "Windows Configuration Management" tags = "Windows Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/platform-configurations/view",
description = "View Configurations") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -85,7 +117,6 @@ public interface ConfigurationMgtService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the Windows platform configuration.") message = "Internal Server Error. \n Server error occurred while fetching the Windows platform configuration.")
}) })
@Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view")
PlatformConfiguration getConfiguration() throws WindowsConfigurationException; PlatformConfiguration getConfiguration() throws WindowsConfigurationException;
/** /**
@ -102,7 +133,14 @@ public interface ConfigurationMgtService {
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating Windows Platform Configurations", value = "Updating Windows Platform Configurations",
notes = "Update the Windows platform configurations using this REST API.", notes = "Update the Windows platform configurations using this REST API.",
tags = "Windows Configuration Management" tags = "Windows Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/configurations/manage",
description = "Manage Configurations") }
)
}
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
@ -137,7 +175,6 @@ public interface ConfigurationMgtService {
message = "Internal Server Error. \n " + message = "Internal Server Error. \n " +
"Server error occurred while modifying the Windows platform configurations.") "Server error occurred while modifying the Windows platform configurations.")
}) })
@Permission(name = "Manage Configurations", permission = "/device-mgt/configurations/manage")
Message updateConfiguration Message updateConfiguration
( @ApiParam( ( @ApiParam(
name = "configuration", name = "configuration",
@ -154,7 +191,15 @@ public interface ConfigurationMgtService {
notes = "Use this REST API to retrieve the license agreement that is used for the Windows device " + notes = "Use this REST API to retrieve the license agreement that is used for the Windows device " +
"registration process.", "registration process.",
response = String.class, response = String.class,
tags = "Windows Configuration Management") tags = "Windows Configuration Management",
authorizations = {
@Authorization(
value="permission",
scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/windows",
description = "Enroll Device") }
)
}
)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse( @ApiResponse(
code = 200, code = 200,
@ -186,7 +231,6 @@ public interface ConfigurationMgtService {
code = 500, code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the Windows license configuration.") message = "Internal Server Error. \n Server error occurred while fetching the Windows license configuration.")
}) })
@Permission(name = "Enroll Device", permission = "/device-mgt/devices/enroll/windows")
Response getLicense( Response getLicense(
@ApiParam( @ApiParam(
name = "If-Modified-Since", name = "If-Modified-Since",

@ -18,8 +18,12 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services; package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
@ -38,9 +42,24 @@ import java.util.List;
*/ */
@Api(value = "Windows Device Management Administrative Service", @Api(value = "Windows Device Management Administrative Service",
description = "Device management related admin APIs.") description = "Device management related admin APIs.")
@API(name = "Windows Device Management Administrative Service", version = "1.0.0",
context = "/api/device-mgt/windows/v1.0/admin/devices", @SwaggerDefinition(
tags = {"devicemgt_windows"}) info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name",
value = "Windows Device Management Administrative Service"),
@ExtensionProperty(name = "context",
value = "/api/device-mgt/windows/v1.0/admin/devices"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@WebService @WebService
@Path("/admin/devices") @Path("/admin/devices")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)

@ -18,8 +18,12 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services; package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
@ -40,9 +44,22 @@ import java.util.List;
*/ */
@Api(value = "Windows Device Management", @Api(value = "Windows Device Management",
description = "This carries all the resources related to Windows device management functionalities") description = "This carries all the resources related to Windows device management functionalities")
@API(name = "Windows Device Management", version = "1.0.0",
context = "/api/device-mgt/windows/v1.0/devices", @SwaggerDefinition(
tags = {"devicemgt_windows"}) info = @Info(
version = "1.0.0",
title = "",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "name", value = "Windows Device Management"),
@ExtensionProperty(name = "context", value = "/api/device-mgt/windows/v1.0/devices"),
})
}
),
tags = {
@Tag(name = "devicemgt_windows", description = "")
}
)
@WebService @WebService
@Path("/devices") @Path("/devices")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})

Loading…
Cancel
Save