
com.cloudbees.api.cr.ReferencedResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudbees-api-client Show documentation
Show all versions of cloudbees-api-client Show documentation
The CloudBees API Client library for Java
package com.cloudbees.api.cr;
import org.codehaus.jackson.annotate.JsonProperty;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
* JSON data-bound bean for a referenced cloud resource.
*
* @author Kohsuke Kawaguchi
*/
public class ReferencedResource {
@JsonProperty
public String url;
@JsonProperty
public List types;
public CloudResource toCloudResource(CloudResource context) throws MalformedURLException {
CloudResource cr = new CloudResource(new URL(url), context.getCredential());
cr.setTypes(types);
return cr;
}
public static ReferencedResource of(CloudResource cr) {
ReferencedResource rr = new ReferencedResource();
rr.url = cr.getUrl().toExternalForm();
rr.types = new ArrayList(CloudResource.typesOf(cr.getClass()));
return rr;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy