private static Compartment createChildCompartment( Identity client, String compartmentId, String name) { CreateCompartmentDetails createCompartmentDetails = CreateCompartmentDetails.builder() .compartmentId(compartmentId) .name(name) .description(name) .build(); Compartment compartment = client.createCompartment( CreateCompartmentRequest.builder() .createCompartmentDetails(createCompartmentDetails) .build()) .getCompartment(); if (compartment == null) { throw new RuntimeException( "Compartment creation fails with " + createCompartmentDetails.toString()); } System.out.println("Compartment " + compartment.getName() + " created successfully"); return compartment; }
@com.fasterxml.jackson.annotation.JsonIgnore public Builder copy(CreateCompartmentDetails o) { Builder copiedBuilder = compartmentId(o.getCompartmentId()) .name(o.getName()) .description(o.getDescription()) .freeformTags(o.getFreeformTags()) .definedTags(o.getDefinedTags()); copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); return copiedBuilder; } }
private static Compartment createCompartment( Identity client, String compartmentId, String name) { CreateCompartmentDetails createCompartmentDetails = CreateCompartmentDetails.builder() .compartmentId(compartmentId) .name(name) .description(name) .build(); Compartment compartment = client.createCompartment( CreateCompartmentRequest.builder() .createCompartmentDetails(createCompartmentDetails) .build()) .getCompartment(); if (compartment == null) { throw new RuntimeException( "Compartment creation fails with " + createCompartmentDetails.toString()); } System.out.println("Compartment " + compartment.getName() + " created successfully"); return compartment; } }
/** * Create a new builder. */ public static Builder builder() { return new Builder(); }