Search in sources :

Example 56 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method fileSystemMirrors.

public static void fileSystemMirrors(String fileSystemId) {
    URI id = uri(fileSystemId);
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileProtectionRestRep targetFileSystems = client.fileSystems().get(id).getProtection();
    List<FileShareRestRep> fileMirrors = new ArrayList<FileShareRestRep>();
    for (VirtualArrayRelatedResourceRep virtualResource : targetFileSystems.getTargetFileSystems()) {
        fileMirrors.add(client.fileSystems().get(virtualResource.getId()));
    }
    String personality = targetFileSystems.getPersonality();
    // The code will be refactored once 1:n or cascaded FS replication is supported
    if (!fileMirrors.isEmpty()) {
        FileShareRestRep fsRestRep = fileMirrors.get(0);
        fsRestRep.getProtection().setMirrorStatus(targetFileSystems.getMirrorStatus());
    }
    // Verify the replication is at fs level or not
    boolean replicationAtFs = false;
    FileShareRestRep fs = client.fileSystems().get(id);
    if (fs != null) {
        FilePolicyRestRep replicationPolicy = getReplicationPolicy(client, fs);
        if (replicationPolicy != null) {
            if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(replicationPolicy.getAppliedAt())) {
                replicationAtFs = true;
            }
            renderArgs.put("replicationPolicy", replicationPolicy);
        }
        renderArgs.put("replicationAtFsLevel", replicationAtFs);
    }
    renderArgs.put("personality", personality);
    renderArgs.put("fileMirrors", fileMirrors);
    renderArgs.put("fileSystemId", fileSystemId);
    render();
}
Also used : FileProtectionRestRep(com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ArrayList(java.util.ArrayList) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep)

Example 57 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileSystems method mirrorOperationFileSystem.

@FlashException(referrer = { "fileSystem" })
public static void mirrorOperationFileSystem(String fileSystemId, String mirrorOperation) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileCopy copy = new FileCopy();
    copy.setType(LOCAL_MIRROR);
    FileReplicationParam param = new FileReplicationParam();
    List<FileCopy> listCopy = new ArrayList();
    listCopy.add(copy);
    param.setCopies(listCopy);
    URI fileSystemUri = URI.create(fileSystemId);
    if ("refresh".equalsIgnoreCase(mirrorOperation)) {
        client.fileSystems().refreshFileContinuousCopies(fileSystemUri, param);
    }
    if ("stop".equalsIgnoreCase(mirrorOperation)) {
        client.fileSystems().stopFileContinuousCopies(fileSystemUri, param);
    }
    if ("pause".equalsIgnoreCase(mirrorOperation)) {
        client.fileSystems().pauseFileContinuousCopies(fileSystemUri, param);
    }
    if ("resume".equalsIgnoreCase(mirrorOperation)) {
        client.fileSystems().resumeContinousCopies(fileSystemUri, param);
    }
    fileSystem(fileSystemId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileReplicationParam(com.emc.storageos.model.file.FileReplicationParam) ArrayList(java.util.ArrayList) FileCopy(com.emc.storageos.model.file.FileCopy) URI(java.net.URI) FlashException(controllers.util.FlashException)

Example 58 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class ObjectBuckets method addBucketAcl.

public static void addBucketAcl(String bucketId, BucketACLForm bucketACL, String formAccessControlList) {
    if (formAccessControlList == null || formAccessControlList.isEmpty()) {
        flash.error(MessagesUtils.get("resources.bucket.acl.invalid.settings"));
        listBucketACL(bucketId);
    }
    ObjectBucketACLUpdateParams updateParam = createObjectBucketACLUpdateParams(formAccessControlList);
    ViPRCoreClient client = BourneUtil.getViprClient();
    try {
        client.objectBuckets().updateBucketACL(uri(bucketId), updateParam);
    } catch (Exception e) {
        flash.error(e.getMessage(), null);
        listBucketACL(bucketId);
    }
    flash.success(MessagesUtils.get(ADDED));
    listBucketACL(bucketId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ObjectBucketACLUpdateParams(com.emc.storageos.model.object.ObjectBucketACLUpdateParams) FlashException(controllers.util.FlashException) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException)

Example 59 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class ObjectBuckets method delete.

private static void delete(List<URI> ids, String deleteType) {
    if (ids != null) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        List<Task<BucketRestRep>> tasks = Lists.newArrayList();
        for (URI id : ids) {
            boolean forceDelete = false;
            Task<BucketRestRep> task = client.objectBuckets().deactivate(id, new BucketDeleteParam(forceDelete, deleteType));
            tasks.add(task);
        }
        if (!tasks.isEmpty()) {
            flash.put("info", MessagesUtils.get("resources.buckets.deactivate", tasks.size()));
        }
    }
    buckets(null);
}
Also used : Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) BucketDeleteParam(com.emc.storageos.model.object.BucketDeleteParam) URI(java.net.URI)

Example 60 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class ObjectBuckets method deleteBucket.

@FlashException(referrer = { "bucket" })
public static void deleteBucket(String bucketId, String deleteType) {
    if (StringUtils.isNotBlank(bucketId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        boolean forceDelete = false;
        Task<BucketRestRep> task = client.objectBuckets().deactivate(uri(bucketId), new BucketDeleteParam(forceDelete, deleteType));
        flash.put("info", MessagesUtils.get("resources.bucket.deactivate"));
    }
    bucket(bucketId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) BucketDeleteParam(com.emc.storageos.model.object.BucketDeleteParam) FlashException(controllers.util.FlashException)

Aggregations

ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)225 Asset (com.emc.sa.asset.annotation.Asset)72 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)66 URI (java.net.URI)66 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)49 FlashException (controllers.util.FlashException)48 AssetOption (com.emc.vipr.model.catalog.AssetOption)41 ArrayList (java.util.ArrayList)34 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)29 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)27 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)24 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)20 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)15 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)15 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)13 HashSet (java.util.HashSet)13 Task (com.emc.vipr.client.Task)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)10 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)8