/** * Copy method to populate the builder with values from the given instance. * @return this builder instance */ public Builder copy(CreateCompartmentResponse o) { opcRequestId(o.getOpcRequestId()); etag(o.getEtag()); compartment(o.getCompartment()); return this; } }
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; } }
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; }