本文整理汇总了Java中org.cloudfoundry.client.lib.domain.CloudOrganization类的典型用法代码示例。如果您正苦于以下问题:Java CloudOrganization类的具体用法?Java CloudOrganization怎么用?Java CloudOrganization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudOrganization类属于org.cloudfoundry.client.lib.domain包,在下文中一共展示了CloudOrganization类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getOrganization
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
/**
* Get organization by given name.
*
* @param orgName
* @param required
* @return CloudOrganization instance
*/
public CloudOrganization getOrganization(String orgName, boolean required) {
Map<String, Object> urlVars = new HashMap<String, Object>();
String urlPath = "/v2/organizations?inline-relations-depth=1&q=name:{name}";
urlVars.put("name", orgName);
CloudOrganization org = null;
List<Map<String, Object>> resourceList = getAllResources(urlPath, urlVars);
if (resourceList.size() > 0) {
Map<String, Object> resource = resourceList.get(0);
org = resourceMapper.mapResource(resource, CloudOrganization.class);
}
if (org == null && required) {
throw new CloudFoundryException(HttpStatus.NOT_FOUND, "Not Found", "Organization '" + orgName + "' not found.");
}
return org;
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:25,代码来源:CloudControllerClientImpl.java
示例2: getOrganizationUsers
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
@Override
public Map<String, CloudUser> getOrganizationUsers(String orgName) {
String urlPath = "/v2/organizations/{guid}/users";
CloudOrganization organization = getOrganization(orgName);
UUID orgGuid = organization.getMeta().getGuid();
Map<String, Object> urlVars = new HashMap<String, Object>();
urlVars.put("guid", orgGuid);
List<Map<String, Object>> resourceList = getAllResources(urlPath, urlVars);
Map<String, CloudUser> orgUsers = new HashMap<String, CloudUser>();
for (Map<String, Object> resource : resourceList) {
CloudUser user = resourceMapper.mapResource(resource, CloudUser.class);
orgUsers.put(user.getUsername(), user);
}
return orgUsers;
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:18,代码来源:CloudControllerClientImpl.java
示例3: getSpaceUserGuids
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
private List<UUID> getSpaceUserGuids(String orgName, String spaceName, String urlPath) {
if (orgName == null || spaceName == null) {
assertSpaceProvided("get space users");
}
UUID spaceGuid;
if (spaceName == null) {
spaceGuid = sessionSpace.getMeta().getGuid();
} else {
CloudOrganization organization = (orgName == null ? sessionSpace.getOrganization() : getOrganization(orgName));
spaceGuid = getSpaceGuid(spaceName, organization.getMeta().getGuid());
}
Map<String, Object> urlVars = new HashMap<String, Object>();
urlVars.put("guid", spaceGuid);
List<UUID> managersGuid = new ArrayList<UUID>();
List<Map<String, Object>> resourceList = getAllResources(urlPath, urlVars);
for (Map<String, Object> resource : resourceList) {
UUID userGuid = resourceMapper.getGuidOfResource(resource);
managersGuid.add(userGuid);
}
return managersGuid;
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:25,代码来源:CloudControllerClientImpl.java
示例4: setQuotaToOrg
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
@Test
public void setQuotaToOrg() throws Exception {
assumeTrue(CCNG_USER_IS_ADMIN);
// get old quota to restore after test
CloudOrganization org = connectedClient.getOrganization(CCNG_USER_ORG, true);
CloudQuota oldQuota = org.getQuota();
// create and set test_quota to org
CloudQuota cloudQuota = new CloudQuota(null, CCNG_QUOTA_NAME_TEST);
connectedClient.createQuota(cloudQuota);
connectedClient.setQuotaToOrg(CCNG_USER_ORG, CCNG_QUOTA_NAME_TEST);
// get the bound quota of org
org = connectedClient.getOrganization(CCNG_USER_ORG, true);
CloudQuota newQuota = org.getQuota();
// bound quota should be equals to test_quota
assertEquals(CCNG_QUOTA_NAME_TEST, newQuota.getName());
// restore org to default quota
connectedClient.setQuotaToOrg(CCNG_USER_ORG, oldQuota.getName());
connectedClient.deleteQuota(CCNG_QUOTA_NAME_TEST);
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:25,代码来源:CloudFoundryClientTest.java
示例5: setUpMocks
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
private void setUpMocks() {
DefaultOAuth2AccessToken accessToken = new DefaultOAuth2AccessToken("testTokenValue");
accessToken.setScope(new HashSet<>());
CloudSpace space = new CloudSpace(null, SPACE, new CloudOrganization(null, ORG));
List<CloudSpace> spaces = new ArrayList<>();
if (hasAccess) {
spaces.add(space);
}
userInfo = new UserInfo(USER_ID, USERNAME, accessToken);
List<String> spaceDevelopersList = new ArrayList<>();
if (hasPermissions) {
spaceDevelopersList.add(USER_ID);
}
when(client.getSpaces()).thenReturn(spaces);
when(client.getSpaceDevelopers2(ORG, SPACE)).thenReturn(spaceDevelopersList);
when(clientProvider.getCloudFoundryClient(userInfo.getToken())).thenReturn(client);
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:19,代码来源:AuthorizationUtilTest.java
示例6: getCloudFoundryClientAsAdmin
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
@Bean(name = "cloudFoundryClientAsAdmin")
public CloudFoundryClient getCloudFoundryClientAsAdmin() throws MalformedURLException {
if (this.cfAdminUser == null
|| this.cfAdminUser.isEmpty()
|| this.cfAdminPassword == null
|| this.cfAdminPassword.isEmpty()
|| this.cloudControllerUrl == null
|| this.cloudControllerUrl.isEmpty()
|| this.noCloudFoundryAccess) {
return null;
}
CloudOrganization cloudOrganization = this.getOrg();
CloudSpace cloudSpace = this.getSpace();
if (cloudOrganization == null || cloudSpace == null) {
return null;
}
logger.info(String.format("Creating new CloudFoundry client using admin access with org '%s' and space '%s'", cloudOrganization.getName(), cloudSpace.getName()));
return cloudFoundryClientFactory.createCloudFoundryClient(this.cfAdminUser, this.cfAdminPassword, this.cloudControllerUrl, cloudOrganization.getName(), cloudSpace.getName());
}
开发者ID:cloudfoundry-community,项目名称:oauth-register-broker,代码行数:20,代码来源:AppConfig.java
示例7: getCloudFoundryClientAsAdmin
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
@Bean(name = "cloudFoundryClientAsAdmin")
public CloudFoundryClient getCloudFoundryClientAsAdmin() throws MalformedURLException {
if (this.cfAdminUser == null
|| this.cfAdminUser.isEmpty()
|| this.cfAdminPassword == null
|| this.cfAdminPassword.isEmpty()
|| this.cloudControllerUrl == null
|| this.cloudControllerUrl.isEmpty()
|| this.noCloudFoundryAccess) {
return null;
}
CloudOrganization cloudOrganization = this.getOrg();
CloudSpace cloudSpace = this.getSpace();
if (cloudOrganization == null || cloudSpace == null) {
return null;
}
logger.debug(String.format("Creating new CloudFoundry client using admin access with org '%s' and space '%s'", cloudOrganization.getName(), cloudSpace.getName()));
return cloudFoundryClientFactory.createCloudFoundryClient(this.cfAdminUser, this.cfAdminPassword, this.cloudControllerUrl, cloudOrganization.getName(), cloudSpace.getName());
}
开发者ID:orange-cloudfoundry,项目名称:db-dumper-service,代码行数:20,代码来源:AppConfig.java
示例8: setInput
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
public void setInput() {
if (cloudSpaceServerDelegate != null && orgsSpacesViewer != null && !orgsSpacesViewer.getTree().isDisposed()) {
List<CloudOrganization> orgInput = cloudSpaceServerDelegate.getCurrentSpacesDescriptor() != null ? cloudSpaceServerDelegate
.getCurrentSpacesDescriptor().getOrgsAndSpaces().getOrgs()
: null;
if (orgInput == null) {
orgInput = new ArrayList<CloudOrganization>();
}
CloudOrganization[] organizationInput = orgInput.toArray(new CloudOrganization[orgInput.size()]);
orgsSpacesViewer.setInput(organizationInput);
// Expand all first, so that child elements can be selected
orgsSpacesViewer.setExpandedElements(organizationInput);
setInitialSelectionInViewer();
}
}
开发者ID:eclipse,项目名称:cft,代码行数:19,代码来源:CloudSpacesSelectionPart.java
示例9: setValues
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
protected void setValues() {
orgIDtoSpaces = new HashMap<String, List<CloudSpace>>();
orgIDtoOrg = new HashMap<String, CloudOrganization>();
// Parse the orgs and restructure the spaces per org for quick lookup,
// as the original list of spaces is flat and does
// not convey the org -> spaces structure.
for (CloudSpace clSpace : originalSpaces) {
CloudOrganization org = clSpace.getOrganization();
List<CloudSpace> spaces = orgIDtoSpaces.get(org.getName());
if (spaces == null) {
spaces = new ArrayList<CloudSpace>();
orgIDtoSpaces.put(org.getName(), spaces);
orgIDtoOrg.put(org.getName(), org);
}
spaces.add(clSpace);
}
}
开发者ID:eclipse,项目名称:cft,代码行数:19,代码来源:CloudOrgsAndSpaces.java
示例10: getSpaces
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
public List<CloudSpace> getSpaces() {
List<CloudSpace> spaces = new ArrayList<CloudSpace>();
String urlPath = API_BASE+"/spaces?inline-relations-depth=1";
try {
List<JSONObject> jspaces = ResponseObject.getResources(urlPath, token);
for (JSONObject jspace : jspaces) {
JSONObject entity = jspace.getJSONObject(ENTITY);
Meta meta = new Meta(jspace.getJSONObject(METADATA));
JSONObject orgEntity = entity.getJSONObject("organization");
CloudOrganization org = new CloudOrganization(orgEntity.getJSONObject(METADATA),
orgEntity.getJSONObject(ENTITY));
CloudSpace space = new CloudSpace(meta,entity.getString("name"),org);
spaces.add(space);
}
}
catch (Throwable e) {
e.printStackTrace();
}
return spaces;
}
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:22,代码来源:CloudFoundryClient.java
示例11: getOrganizations
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
public List<CloudOrganization> getOrganizations() {
String urlPath = API_BASE+"/organizations?inline-relations-depth=0";
List<CloudOrganization> orgs = new ArrayList<CloudOrganization>();
try {
List<JSONObject>entities = ResponseObject.getResources(urlPath, token);
for (JSONObject entity : entities) {
orgs.add(new CloudOrganization(entity.getJSONObject(METADATA),
entity.getJSONObject(ENTITY)));
}
}
catch (Throwable t) {
t.printStackTrace();
}
return orgs;
}
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:17,代码来源:CloudFoundryClient.java
示例12: getDomainsForOrg
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
public List<CloudDomain> getDomainsForOrg(CloudOrganization org) {
List<CloudDomain> domains = new ArrayList<CloudDomain>();
String urlPath = API_BASE+"/organizations/"+org.getMeta().getGuid().toString()+"/domains";
try {
List<JSONObject> ja = ResponseObject.getResources(urlPath, token);
for (JSONObject resource : ja) {
JSONObject meta = resource.getJSONObject(METADATA);
JSONObject entity = resource.getJSONObject(ENTITY);
domains.add(new CloudDomain(new Meta(meta),entity.getString("name"),org));
}
}
catch (Throwable t) {
t.printStackTrace();
}
return domains;
}
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:17,代码来源:CloudFoundryClient.java
示例13: getOrganizations
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
@Override
public List<CloudOrganization> getOrganizations() {
String urlPath = "/v2/organizations?inline-relations-depth=0";
List<Map<String, Object>> resourceList = getAllResources(urlPath);
List<CloudOrganization> orgs = new ArrayList<CloudOrganization>();
for (Map<String, Object> resource : resourceList) {
orgs.add(resourceMapper.mapResource(resource, CloudOrganization.class));
}
return orgs;
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:11,代码来源:CloudControllerClientImpl.java
示例14: setQuotaToOrg
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
/**
* Set quota to organization
*
* @param orgName
* @param quotaName
*/
@Override
public void setQuotaToOrg(String orgName, String quotaName) {
CloudQuota quota = this.getQuota(quotaName);
CloudOrganization org = this.getOrganization(orgName);
doSetQuotaToOrg(org.getMeta().getGuid(), quota.getMeta().getGuid());
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:14,代码来源:CloudControllerClientImpl.java
示例15: associateRoleWithSpace
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
private void associateRoleWithSpace(String orgName, String spaceName, String userGuid, String urlPath) {
assertSpaceProvided("associate roles");
CloudOrganization organization = (orgName == null ? sessionSpace.getOrganization() : getOrganization(orgName));
UUID orgGuid = organization.getMeta().getGuid();
UUID spaceGuid = getSpaceGuid(spaceName, orgGuid);
HashMap<String, Object> spaceRequest = new HashMap<String, Object>();
spaceRequest.put("guid", spaceGuid);
String userId = (userGuid == null ? getCurrentUserId() : userGuid);
getRestTemplate().put(getUrl(urlPath), spaceRequest, spaceGuid, userId);
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:15,代码来源:CloudControllerClientImpl.java
示例16: doGetDomains
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
private List<CloudDomain> doGetDomains(CloudOrganization org) {
Map<String, Object> urlVars = new HashMap<String, Object>();
String urlPath = "/v2";
if (org != null) {
urlVars.put("org", org.getMeta().getGuid());
urlPath = urlPath + "/organizations/{org}";
}
urlPath = urlPath + "/domains";
return doGetDomains(urlPath, urlVars);
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:11,代码来源:CloudControllerClientImpl.java
示例17: validateSpaceAndOrg
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
private CloudSpace validateSpaceAndOrg(String spaceName, String orgName, CloudControllerClientImpl client) {
List<CloudSpace> spaces = client.getSpaces();
for (CloudSpace space : spaces) {
if (space.getName().equals(spaceName)) {
CloudOrganization org = space.getOrganization();
if (orgName == null || org.getName().equals(orgName)) {
return space;
}
}
}
throw new IllegalArgumentException("No matching organization and space found for org: " + orgName + " space: " + "" + spaceName);
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:15,代码来源:CloudControllerClientImpl.java
示例18: mapOrganizationResource
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
private CloudOrganization mapOrganizationResource(Map<String, Object> resource) {
Boolean billingEnabled = getEntityAttribute(resource, "billing_enabled", Boolean.class);
Map<String, Object> quotaDefinition = getEmbeddedResource(resource, "quota_definition");
CloudQuota quota = null;
if (quotaDefinition != null) {
quota = mapQuotaResource(quotaDefinition);
}
return new CloudOrganization(getMeta(resource), getNameOfResource(resource), quota, billingEnabled);
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:10,代码来源:CloudEntityResourceMapper.java
示例19: mapSpaceResource
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
private CloudSpace mapSpaceResource(Map<String, Object> resource) {
Map<String, Object> organizationMap = getEmbeddedResource(resource, "organization");
CloudOrganization organization = null;
if (organizationMap != null) {
organization = mapOrganizationResource(organizationMap);
}
return new CloudSpace(getMeta(resource), getNameOfResource(resource), organization);
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:9,代码来源:CloudEntityResourceMapper.java
示例20: testGetSpaceIdSupplier1
import org.cloudfoundry.client.lib.domain.CloudOrganization; //导入依赖的package包/类
@Test
public void testGetSpaceIdSupplier1() {
CloudOrganization org = new CloudOrganization(new Meta(null, null, null), ORG_NAME);
CloudSpace space = new CloudSpace(new Meta(NameUtil.getUUID(SPACE_NAME), null, null), SPACE_NAME, org);
when(client.getSpaces()).thenReturn(Arrays.asList(space));
assertEquals("cc51b819-7428-3ab7-9cef-9e94fe778cc9", step.getSpaceIdSupplier(client).apply(ORG_NAME, SPACE_NAME));
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:10,代码来源:ProcessDescriptorStepTest.java
注:本文中的org.cloudfoundry.client.lib.domain.CloudOrganization类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论