@com.fasterxml.jackson.annotation.JsonIgnore public Builder copy(Cluster o) { Builder copiedBuilder = id(o.getId()) .name(o.getName()) .compartmentId(o.getCompartmentId()) .vcnId(o.getVcnId()) .kubernetesVersion(o.getKubernetesVersion()) .options(o.getOptions()) .metadata(o.getMetadata()) .lifecycleState(o.getLifecycleState()) .lifecycleDetails(o.getLifecycleDetails()) .endpoints(o.getEndpoints()) .availableKubernetesUpgrades(o.getAvailableKubernetesUpgrades()); copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); return copiedBuilder; } }
public Cluster build() { Cluster __instance__ = new Cluster( id, name, compartmentId, vcnId, kubernetesVersion, options, metadata, lifecycleState, lifecycleDetails, endpoints, availableKubernetesUpgrades); __instance__.__explicitlySet__.addAll(__explicitlySet__); return __instance__; }
/** * Deletes a cluster and waits for it to be deleted. * * @param containerEngineClient the service client to use to delete the cluster * @param clusterId the ID of the cluster to be deleted * */ private static void deleteCluster( ContainerEngineClient containerEngineClient, String clusterId) { try { DeleteClusterResponse deleteClusterReponse = containerEngineClient.deleteCluster( DeleteClusterRequest.builder().clusterId(clusterId).build()); String workRequestId = deleteClusterReponse.getOpcWorkRequestId(); GetWorkRequestResponse workRequestResponse = waitForWorkRequestFinished(containerEngineClient, workRequestId); if (isWorkRequestInSuccessState(workRequestResponse)) { GetClusterResponse getResponse = containerEngineClient.getCluster( GetClusterRequest.builder().clusterId(clusterId).build()); System.out.println( "Cluster lifecycle state is " + getResponse.getCluster().getLifecycleState()); } } catch (Exception e) { System.err.println("Caught Exception while delete cluster: " + e.getMessage()); } }
/** * Update a cluster and waits for it to become active * * @param containerEngineClient the service client to use to delete the cluster * @param clusterId the cluster ID * @param newClusterName The new cluster name * * @throws Exception if there is an error waiting on the cluster to be updated */ private static void updateCluster( ContainerEngineClient containerEngineClient, String clusterId, String newClusterName) throws Exception { UpdateClusterResponse updateClusterResponse = containerEngineClient.updateCluster( UpdateClusterRequest.builder() .clusterId(clusterId) .updateClusterDetails( UpdateClusterDetails.builder().name(newClusterName).build()) .build()); String workRequestId = updateClusterResponse.getOpcWorkRequestId(); GetWorkRequestResponse workRequestResponse = waitForWorkRequestFinished(containerEngineClient, workRequestId); if (isWorkRequestInSuccessState(workRequestResponse)) { GetClusterResponse getResponse = containerEngineClient.getCluster( GetClusterRequest.builder().clusterId(clusterId).build()); Cluster cluster = getResponse.getCluster(); System.out.println("Cluster name is changed to " + cluster.getName()); } }
/** * Deletes a cluster and waits for it to be deleted. * * @param containerEngineClient the service client to use to delete the cluster * @param cluster the cluster to delete * * @throws Exception if there is an error waiting on the cluster to be deleted */ private static void deleteCluster(ContainerEngineClient containerEngineClient, String clusterId) throws Exception { DeleteClusterResponse deleteClusterReponse = containerEngineClient.deleteCluster( DeleteClusterRequest.builder().clusterId(clusterId).build()); String workRequestId = deleteClusterReponse.getOpcWorkRequestId(); GetWorkRequestResponse workRequestResponse = waitForWorkRequestFinished(containerEngineClient, workRequestId); if (isWorkRequestInSuccessState(workRequestResponse)) { GetClusterResponse getResponse = containerEngineClient.getCluster( GetClusterRequest.builder().clusterId(clusterId).build()); System.out.println( "Cluster lifecycle state is " + getResponse.getCluster().getLifecycleState()); } }