Class SDKBaremetalCloudClient
- java.lang.Object
-
- com.oracle.cloud.baremetal.jenkins.client.SDKBaremetalCloudClient
-
- All Implemented Interfaces:
BaremetalCloudClient
,AutoCloseable
public class SDKBaremetalCloudClient extends Object implements BaremetalCloudClient
An implementation of ComputeCloudClient using the JAX-RS client API.
-
-
Constructor Summary
Constructors Constructor Description SDKBaremetalCloudClient(com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider instancePrincipalsProvider, String regionId, int maxAsyncThreads, String instancePrincipalsTenantId)
SDKBaremetalCloudClient(com.oracle.bmc.auth.SimpleAuthenticationDetailsProvider provider, String regionId, int maxAsyncThreads)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
authenticate()
void
close()
com.oracle.bmc.core.model.Instance
createInstance(String name, BaremetalCloudAgentTemplate template)
Creates an instance with the specified templateList<com.oracle.bmc.identity.model.AvailabilityDomain>
getAvailabilityDomainsList(String compartmentId)
Get the available domain responseList<com.oracle.bmc.identity.model.Compartment>
getCompartmentsList()
Get the compartment listList<com.oracle.bmc.core.model.Image>
getImagesList(String compartmentId)
Get the available image listString
getInstanceIp(BaremetalCloudAgentTemplate template, String instanceId)
Get an instance public or private ip with the specified instance idcom.oracle.bmc.core.model.Instance.LifecycleState
getInstanceState(String instanceId)
Check instance's stateInteger[]
getMinMaxMemory(String compartmentId, String availableDomain, String imageId, String shape)
Get the memory options of Flex shapesInteger[]
getMinMaxOcpus(String compartmentId, String availableDomain, String imageId, String shape)
Get the OCPUs optionsList<com.oracle.bmc.core.model.NetworkSecurityGroup>
getNsgIdsList(String compartmentId)
Get the network security group listList<com.oracle.bmc.core.model.Shape>
getShapesList(String compartmentId, String availableDomain, String imageId)
Get the shape listList<com.oracle.bmc.core.model.Instance>
getStoppedInstances(String compartmentId, String availableDomain)
Get a list of stopped instances on OCIcom.oracle.bmc.core.responses.GetSubnetResponse
getSubNet(String subnetId)
Get the sub netList<com.oracle.bmc.core.model.Subnet>
getSubNetList(String compartmentId, String vcnId)
Get the sub net listList<com.oracle.bmc.identity.model.TagNamespaceSummary>
getTagNamespaces(String compartmentId)
Start instance with the specified instance idcom.oracle.bmc.identity.model.Tenancy
getTenant()
Get root compartmentList<com.oracle.bmc.core.model.Vcn>
getVcnList(String compartmentId)
Get the Virtual Cloud Network listcom.oracle.bmc.core.model.Instance
startInstance(String instanceId)
Start instance with the specified instance idString
stopInstance(String instanceId)
Stop instance with the specified instance idString
terminateInstance(String instanceId)
Terminate instance with the specified instance idcom.oracle.bmc.core.model.Instance
waitForInstanceProvisioningToComplete(String instanceId)
Creates an instance with the specified instance idcom.oracle.bmc.core.model.Instance
waitForInstanceTerminationToComplete(String instanceId)
Wait for the termination with the specified instance id to complete
-
-
-
Constructor Detail
-
SDKBaremetalCloudClient
public SDKBaremetalCloudClient(com.oracle.bmc.auth.SimpleAuthenticationDetailsProvider provider, String regionId, int maxAsyncThreads)
-
-
Method Detail
-
authenticate
public void authenticate() throws com.oracle.bmc.model.BmcException
- Specified by:
authenticate
in interfaceBaremetalCloudClient
- Throws:
com.oracle.bmc.model.BmcException
- if an error occurs
-
createInstance
public com.oracle.bmc.core.model.Instance createInstance(String name, BaremetalCloudAgentTemplate template) throws Exception
Description copied from interface:BaremetalCloudClient
Creates an instance with the specified template- Specified by:
createInstance
in interfaceBaremetalCloudClient
- Parameters:
name
- instance nametemplate
- the instance configuration- Returns:
- Instance
- Throws:
Exception
- if an error occurs
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
waitForInstanceProvisioningToComplete
public com.oracle.bmc.core.model.Instance waitForInstanceProvisioningToComplete(String instanceId) throws Exception
Description copied from interface:BaremetalCloudClient
Creates an instance with the specified instance id- Specified by:
waitForInstanceProvisioningToComplete
in interfaceBaremetalCloudClient
- Parameters:
instanceId
- the instance id created before- Returns:
- Instance
- Throws:
Exception
- if an error occurs
-
getInstanceIp
public String getInstanceIp(BaremetalCloudAgentTemplate template, String instanceId) throws Exception
Description copied from interface:BaremetalCloudClient
Get an instance public or private ip with the specified instance id- Specified by:
getInstanceIp
in interfaceBaremetalCloudClient
- Parameters:
template
- baremetal cloud agent templateinstanceId
- the instance id created before- Returns:
- the instance ip
- Throws:
Exception
- if an error occurs
-
getTenant
public com.oracle.bmc.identity.model.Tenancy getTenant() throws Exception
Description copied from interface:BaremetalCloudClient
Get root compartment- Specified by:
getTenant
in interfaceBaremetalCloudClient
- Returns:
- tenancy
- Throws:
Exception
- if an error occurs
-
getCompartmentsList
public List<com.oracle.bmc.identity.model.Compartment> getCompartmentsList() throws Exception
Description copied from interface:BaremetalCloudClient
Get the compartment list- Specified by:
getCompartmentsList
in interfaceBaremetalCloudClient
- Returns:
- compartment list
- Throws:
Exception
- if an error occurs
-
getAvailabilityDomainsList
public List<com.oracle.bmc.identity.model.AvailabilityDomain> getAvailabilityDomainsList(String compartmentId) throws Exception
Description copied from interface:BaremetalCloudClient
Get the available domain response- Specified by:
getAvailabilityDomainsList
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the compartment id- Returns:
- ad list
- Throws:
Exception
- if an error occurs
-
getImagesList
public List<com.oracle.bmc.core.model.Image> getImagesList(String compartmentId) throws Exception
Description copied from interface:BaremetalCloudClient
Get the available image list- Specified by:
getImagesList
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the compartment id- Returns:
- image list
- Throws:
Exception
- if an error occurs
-
getShapesList
public List<com.oracle.bmc.core.model.Shape> getShapesList(String compartmentId, String availableDomain, String imageId) throws Exception
Description copied from interface:BaremetalCloudClient
Get the shape list- Specified by:
getShapesList
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the compartment idavailableDomain
- available domainimageId
- image id- Returns:
- shape list
- Throws:
Exception
- if an error occurs
-
getMinMaxOcpus
public Integer[] getMinMaxOcpus(String compartmentId, String availableDomain, String imageId, String shape) throws Exception
Description copied from interface:BaremetalCloudClient
Get the OCPUs options- Specified by:
getMinMaxOcpus
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the compartment idavailableDomain
- available domainimageId
- image idshape
- shape name- Returns:
- an array with min (array[0]) and max (array[1])
- Throws:
Exception
- if an error occurs
-
getMinMaxMemory
public Integer[] getMinMaxMemory(String compartmentId, String availableDomain, String imageId, String shape) throws Exception
Description copied from interface:BaremetalCloudClient
Get the memory options of Flex shapes- Specified by:
getMinMaxMemory
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the compartment idavailableDomain
- available domainimageId
- image idshape
- shape name- Returns:
- an array with min (array[0]) and max (array[1])
- Throws:
Exception
- if an error occurs
-
getVcnList
public List<com.oracle.bmc.core.model.Vcn> getVcnList(String compartmentId) throws Exception
Description copied from interface:BaremetalCloudClient
Get the Virtual Cloud Network list- Specified by:
getVcnList
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the tenant id- Returns:
- vcn list
- Throws:
Exception
- if an error occurs
-
getSubNetList
public List<com.oracle.bmc.core.model.Subnet> getSubNetList(String compartmentId, String vcnId) throws Exception
Description copied from interface:BaremetalCloudClient
Get the sub net list- Specified by:
getSubNetList
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the tenant idvcnId
- vcn id- Returns:
- subnet list
- Throws:
Exception
- if an error occurs
-
getNsgIdsList
public List<com.oracle.bmc.core.model.NetworkSecurityGroup> getNsgIdsList(String compartmentId) throws Exception
Description copied from interface:BaremetalCloudClient
Get the network security group list- Specified by:
getNsgIdsList
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the compartment id- Returns:
- network security group list
- Throws:
Exception
- if an error occurs
-
getSubNet
public com.oracle.bmc.core.responses.GetSubnetResponse getSubNet(String subnetId) throws Exception
Description copied from interface:BaremetalCloudClient
Get the sub net- Specified by:
getSubNet
in interfaceBaremetalCloudClient
- Parameters:
subnetId
- subnet id- Returns:
- GetSubnetResponse
- Throws:
Exception
- if an error occurs
-
terminateInstance
public String terminateInstance(String instanceId) throws Exception
Description copied from interface:BaremetalCloudClient
Terminate instance with the specified instance id- Specified by:
terminateInstance
in interfaceBaremetalCloudClient
- Parameters:
instanceId
- the instance id created before- Returns:
- Opc Request Id
- Throws:
Exception
- if an error occurs
-
waitForInstanceTerminationToComplete
public com.oracle.bmc.core.model.Instance waitForInstanceTerminationToComplete(String instanceId) throws Exception
Description copied from interface:BaremetalCloudClient
Wait for the termination with the specified instance id to complete- Specified by:
waitForInstanceTerminationToComplete
in interfaceBaremetalCloudClient
- Parameters:
instanceId
- the instance id created before- Returns:
- Instance
- Throws:
Exception
- if an error occurs
-
getInstanceState
public com.oracle.bmc.core.model.Instance.LifecycleState getInstanceState(String instanceId) throws Exception
Description copied from interface:BaremetalCloudClient
Check instance's state- Specified by:
getInstanceState
in interfaceBaremetalCloudClient
- Parameters:
instanceId
- the instance id created before- Returns:
- Instance.LifecycleState
- Throws:
Exception
- if an error occurs
-
getStoppedInstances
public List<com.oracle.bmc.core.model.Instance> getStoppedInstances(String compartmentId, String availableDomain) throws Exception
Description copied from interface:BaremetalCloudClient
Get a list of stopped instances on OCI- Specified by:
getStoppedInstances
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the compartment idavailableDomain
- available domain- Returns:
- Instance.LifecycleState
- Throws:
Exception
- if an error occurs
-
stopInstance
public String stopInstance(String instanceId) throws Exception
Description copied from interface:BaremetalCloudClient
Stop instance with the specified instance id- Specified by:
stopInstance
in interfaceBaremetalCloudClient
- Parameters:
instanceId
- the instance id created before- Returns:
- Instance.LifecycleState
- Throws:
Exception
- if an error occurs
-
startInstance
public com.oracle.bmc.core.model.Instance startInstance(String instanceId) throws Exception
Description copied from interface:BaremetalCloudClient
Start instance with the specified instance id- Specified by:
startInstance
in interfaceBaremetalCloudClient
- Parameters:
instanceId
- the instance id created before- Returns:
- Instance.LifecycleState
- Throws:
Exception
- if an error occurs
-
getTagNamespaces
public List<com.oracle.bmc.identity.model.TagNamespaceSummary> getTagNamespaces(String compartmentId) throws Exception
Description copied from interface:BaremetalCloudClient
Start instance with the specified instance id- Specified by:
getTagNamespaces
in interfaceBaremetalCloudClient
- Parameters:
compartmentId
- the compartment id- Returns:
- tag namespace summary list
- Throws:
Exception
- if an error occurs
-
-