All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.emc.vipr.client.core.ComputeVirtualPools Maven / Gradle / Ivy

There is a newer version: 3.5.0.0
Show newest version
/*
 * Copyright (c) 2015 EMC Corporation
 * All Rights Reserved
 */
package com.emc.vipr.client.core;

import static com.emc.vipr.client.core.util.ResourceUtils.defaultList;

import java.net.URI;
import java.util.List;

import com.emc.storageos.model.BulkIdParam;
import com.emc.storageos.model.NamedRelatedResourceRep;
import com.emc.storageos.model.auth.ACLAssignmentChanges;
import com.emc.storageos.model.auth.ACLEntry;
import com.emc.storageos.model.compute.ComputeElementListRestRep;
import com.emc.storageos.model.compute.ComputeElementRestRep;
import com.emc.storageos.model.quota.QuotaInfo;
import com.emc.storageos.model.quota.QuotaUpdateParam;
import com.emc.storageos.model.vpool.ComputeVirtualPoolBulkRep;
import com.emc.storageos.model.vpool.ComputeVirtualPoolCreateParam;
import com.emc.storageos.model.vpool.ComputeVirtualPoolElementUpdateParam;
import com.emc.storageos.model.vpool.ComputeVirtualPoolList;
import com.emc.storageos.model.vpool.ComputeVirtualPoolRestRep;
import com.emc.storageos.model.vpool.ComputeVirtualPoolUpdateParam;
import com.emc.vipr.client.ViPRCoreClient;
import com.emc.vipr.client.core.filters.ResourceFilter;
import com.emc.vipr.client.core.impl.PathConstants;
import com.emc.vipr.client.core.util.ResourceUtils;
import com.emc.vipr.client.impl.RestClient;

/**
 * Compute Virtual Pools resource.
 * 

* Base URL: /compute/vpools */ public class ComputeVirtualPools extends AbstractCoreBulkResources implements TopLevelResources, ACLResources, QuotaResources { public ComputeVirtualPools(ViPRCoreClient parent, RestClient client) { super(parent, client, ComputeVirtualPoolRestRep.class, PathConstants.COMPUTE_VPOOL_URL); } @Override public ComputeVirtualPools withInactive(boolean inactive) { return (ComputeVirtualPools) super.withInactive(inactive); } @Override protected List getBulkResources(BulkIdParam input) { ComputeVirtualPoolBulkRep response = client.post(ComputeVirtualPoolBulkRep.class, input, getBulkUrl()); return defaultList(response.getVirtualPools()); } /** * Gets a list of virtual pool references from the given url. * * @param url * the URL to retrieve. * @param args * the arguments for the URL. * @return the list of virtual pool references. */ protected List getList(String url, Object... args) { ComputeVirtualPoolList response = client.get(ComputeVirtualPoolList.class, url, args); return ResourceUtils.defaultList(response.getComputeVirtualPool()); } /** * Lists all compute virtual pools. *

* API Call: GET /compute/vpools * * @return the list of compute virtual pool references. */ @Override public List list() { return getList(baseUrl); } /** * Gets all compute virtual pools. * * @return the list of compute virtual pools. * * @see #list() * @see #getByRefs(java.util.Collection) */ @Override public List getAll() { return getAll(null); } /** * Gets all compute virtual pools, optionally filtering the results. * * @param filter * the resource filter to apply to the results as they are returned (optional). * @return the list of compute virtual pools. */ @Override public List getAll(ResourceFilter filter) { List refs = list(); return getByRefs(refs, filter); } /** * Creates a new compute virtual pool. *

* API Call: POST /compute/vpools * * @param input * the create configuration. * @return the newly created compute virtual pool. */ public ComputeVirtualPoolRestRep create(ComputeVirtualPoolCreateParam input) { return client.post(ComputeVirtualPoolRestRep.class, input, baseUrl); } /** * Updates a compute virtual pool. *

* API Call: PUT /compute/vpools/{id} * * @param id * the ID of the compute virtual pool to update. * @param input * the update configuration. * @return the updated compute virtual pool. */ public ComputeVirtualPoolRestRep update(URI id, ComputeVirtualPoolUpdateParam input) { return client.put(ComputeVirtualPoolRestRep.class, input, getIdUrl(), id); } /** * Deactivates a compute virtual pool. *

* API Call: POST /compute/vpools/{id}/deactivate * * @param id * the ID of the compute virtual pool to deactivate. */ public void deactivate(URI id) { doDeactivate(id); } public void deactivate(ComputeVirtualPoolRestRep pool) { deactivate(ResourceUtils.id(pool)); } @Override public List getACLs(URI id) { return doGetACLs(id); } @Override public List updateACLs(URI id, ACLAssignmentChanges aclChanges) { return doUpdateACLs(id, aclChanges); } @Override public QuotaInfo getQuota(URI id) { return doGetQuota(id); } @Override public QuotaInfo updateQuota(URI id, QuotaUpdateParam quota) { return doUpdateQuota(id, quota); } public List listComputeElements(URI id) { // TODO implement return defaultList(null); } /** * Lists the compute elements that would match a virtual compute pool with the given configuration. *

* API Call: POST /compute/vpools/matching-elements * * @param input * the configuration for a potential virtual compute pool. * @return the list of matching compute element references. */ public List listMatchingComputeElements(ComputeVirtualPoolCreateParam input) { ComputeElementListRestRep response = client.post(ComputeElementListRestRep.class, input, baseUrl + "/matching-compute-elements"); return defaultList(response.getList()); } /** * Updates a compute virtual pool. *

* API Call: PUT /compute/vpools/{id}/assign-matched-elements * * @param id * the ID of the compute virtual pool to update. * @param input * the update configuration. * @return the updated compute virtual pool. */ public ComputeVirtualPoolRestRep assignComputeElements(URI id, ComputeVirtualPoolElementUpdateParam input) { return client.put(ComputeVirtualPoolRestRep.class, input, getIdUrl() + "/assign-matched-elements", id); } /** * Lists elements of a compute virtual pool. *

* API Call: GET /compute/vpools/{id}/matched-elements * * @param id * the ID of the compute virtual pool . * @return the list of elements from the compute virtual pool. */ public ComputeElementListRestRep getMatchedComputeElements(URI id) { return client.get(ComputeElementListRestRep.class, getIdUrl() + "/compute-elements", id); } /** * Get a compute virtual pool. *

* API Call: GET /compute/vpools/{id} * * @param id * the ID of the compute virtual pool . * @return the list of elements from the compute virtual pool. */ public ComputeVirtualPoolRestRep getComputeVirtualPool(URI id) { return client.get(ComputeVirtualPoolRestRep.class, getIdUrl(), id); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy