public class KubernetesResource extends Object implements IResource, ResourcePropertyKeys
ANNOTATIONS, APIVERSION, CREATION_TIMESTAMP, FROM, KIND, LABELS, METADATA, METADATA_NAME, METADATA_NAMESPACE, METADATA_RESOURCE_VERSION, METADATA_UID, NAME, NAMESPACE, OBJECTS, PORTS, PROTOCOL, RESOURCE_VERSION, TYPE, VALUE| Constructor and Description |
|---|
KubernetesResource(org.jboss.dmr.ModelNode node,
IClient client,
Map<String,String[]> overrideProperties) |
| Modifier and Type | Method and Description |
|---|---|
<T extends ICapability,R> |
accept(CapabilityVisitor<T,R> visitor,
R unsupportedValue)
Uses the given visitor to access the desired capability if it is supported
|
void |
addLabel(String key,
String value)
Add or update a label;
|
protected boolean |
asBoolean(org.jboss.dmr.ModelNode node,
String property) |
protected boolean |
asBoolean(String property) |
protected int |
asInt(org.jboss.dmr.ModelNode node,
String key) |
protected int |
asInt(String key) |
protected Map<String,String> |
asMap(String property) |
protected Set |
asSet(String property,
org.jboss.dmr.ModelType type) |
protected String |
asString(org.jboss.dmr.ModelNode node,
String subKey) |
protected String |
asString(String property) |
boolean |
equals(Object obj) |
protected org.jboss.dmr.ModelNode |
get(org.jboss.dmr.ModelNode node,
String key) |
protected org.jboss.dmr.ModelNode |
get(String key) |
String |
getAnnotation(String key)
Retrieves the annotated value for the given key
|
Map<String,String> |
getAnnotations()
Retrieves the annotations associated with the resource
|
String |
getApiVersion()
The api version of the resource as found at apiVersion
|
Set<Class<? extends ICapability>> |
getCapabilities() |
<T extends ICapability> |
getCapability(Class<T> capability)
Gets the capability of the desired type
|
IClient |
getClient() |
String |
getCreationTimeStamp()
Returns the timestamp of when this resource was created
|
protected Map<String,String> |
getEnvMap(String key) |
String |
getKind()
The kind of the resource as would be found at kind
|
Map<String,String> |
getLabels()
Retrieves the labels associated with the resource
|
Map<String,String> |
getMetadata() |
protected Map<Class<? extends ICapability>,ICapability> |
getModifiableCapabilities() |
String |
getName()
Returns the identifier for this resource
|
INamespace |
getNamespace()
Return the namespace of the resource
|
String |
getNamespaceName()
Returns the scope of this resource
|
org.jboss.dmr.ModelNode |
getNode() |
protected String[] |
getPath(String key) |
IProject |
getProject()
Return the project of the resource
|
Map<String,String[]> |
getPropertyKeys() |
String |
getResourceVersion() |
protected boolean |
has(String key) |
int |
hashCode() |
boolean |
isAnnotatedWith(String key)
Returns
true if the resource is annotated with the given key |
void |
refresh() |
void |
removeAnnotation(String name)
Removes the resource annotation
|
protected void |
set(org.jboss.dmr.ModelNode node,
String key,
boolean value) |
protected void |
set(org.jboss.dmr.ModelNode node,
String key,
int value) |
protected void |
set(org.jboss.dmr.ModelNode node,
String key,
String value) |
protected void |
set(String key,
boolean value) |
protected void |
set(String key,
int value) |
protected void |
set(String key,
Map<String,String> values) |
protected void |
set(String property,
Set<String> values) |
protected void |
set(String property,
String... values) |
protected void |
set(String key,
String value) |
void |
setAnnotation(String name,
String value)
Set the resource annotation
|
protected void |
setEnvMap(String key,
Map<String,String> values) |
void |
setName(String name) |
void |
setNamespace(String namespace) |
void |
setNode(org.jboss.dmr.ModelNode node) |
boolean |
supports(Class<? extends ICapability> capability)
Determines if the client supports the desired capability
|
String |
toJson()
The JSON representation
|
String |
toJson(boolean compact)
The JSON representation
|
String |
toPrettyString() |
String |
toString() |
public String getResourceVersion()
getResourceVersion in interface IResourcepublic Map<String,String> getMetadata()
getMetadata in interface IResourcepublic <T extends ICapability> T getCapability(Class<T> capability)
ICapablegetCapability in interface ICapablepublic Set<Class<? extends ICapability>> getCapabilities()
getCapabilities in interface IResourceprotected Map<Class<? extends ICapability>,ICapability> getModifiableCapabilities()
public boolean supports(Class<? extends ICapability> capability)
ICapablepublic <T extends ICapability,R> R accept(CapabilityVisitor<T,R> visitor, R unsupportedValue)
ICapablepublic IProject getProject()
IResourcegetProject in interface IResourcepublic INamespace getNamespace()
IResourcegetNamespace in interface IResourcepublic Map<String,String> getAnnotations()
IResourcegetAnnotations in interface IAnnotatablegetAnnotations in interface IResourcepublic String getAnnotation(String key)
IResourcegetAnnotation in interface IAnnotatablegetAnnotation in interface IResourcepublic void setAnnotation(String name, String value)
IResourcesetAnnotation in interface IAnnotatablesetAnnotation in interface IResourcepublic void removeAnnotation(String name)
IResourceremoveAnnotation in interface IResourcepublic boolean isAnnotatedWith(String key)
IResourcetrue if the resource is annotated with the given keyisAnnotatedWith in interface IAnnotatableisAnnotatedWith in interface IResourcepublic IClient getClient()
public void setNode(org.jboss.dmr.ModelNode node)
public org.jboss.dmr.ModelNode getNode()
public void refresh()
public String getKind()
IKindablepublic String getApiVersion()
IApiVersionablegetApiVersion in interface IApiVersionablepublic String getCreationTimeStamp()
IResourcegetCreationTimeStamp in interface IResourcepublic String getName()
IResourcepublic void setName(String name)
public String getNamespaceName()
IResourcegetNamespaceName in interface IResourcepublic void setNamespace(String namespace)
public void addLabel(String key, String value)
IResourcepublic Map<String,String> getLabels()
IResourceprotected boolean has(String key)
protected org.jboss.dmr.ModelNode get(String key)
protected org.jboss.dmr.ModelNode get(org.jboss.dmr.ModelNode node,
String key)
protected void set(String key, int value)
protected void set(org.jboss.dmr.ModelNode node,
String key,
int value)
protected void set(String key, boolean value)
protected void set(org.jboss.dmr.ModelNode node,
String key,
boolean value)
protected int asInt(String key)
protected int asInt(org.jboss.dmr.ModelNode node,
String key)
protected boolean asBoolean(org.jboss.dmr.ModelNode node,
String property)
protected boolean asBoolean(String property)
public String toPrettyString()
public String toJson()
JSONSerializeabletoJson in interface JSONSerializeablepublic String toJson(boolean compact)
JSONSerializeabletoJson in interface JSONSerializeablecompact - true if it should be compact; false otherwiseCopyright © 2019 Red Hat, Inc. All Rights Reserved.