@com.fasterxml.jackson.annotation.JsonIgnore public Builder copy(CreateTagDetails o) { Builder copiedBuilder = name(o.getName()) .description(o.getDescription()) .freeformTags(o.getFreeformTags()) .definedTags(o.getDefinedTags()) .isCostTracking(o.getIsCostTracking()); copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); return copiedBuilder; } }
public CreateTagDetails build() { CreateTagDetails __instance__ = new CreateTagDetails( name, description, freeformTags, definedTags, isCostTracking); __instance__.__explicitlySet__.addAll(__explicitlySet__); return __instance__; }
public static Tag createTag( Identity client, String tagNamespaceId, String name, String description, boolean isCostTracking) { CreateTagDetails createTagDetails = CreateTagDetails.builder() .isCostTracking(isCostTracking) .name(name) .description(description) .build(); try { Tag tag = client.createTag( CreateTagRequest.builder() .createTagDetails(createTagDetails) .tagNamespaceId(tagNamespaceId) .build()) .getTag(); if (tag == null) { throw new RuntimeException( "Tag creation fails with " + createTagDetails.toString()); } System.out.println("Tag" + createTagDetails.getName() + " created successfully"); return tag; } catch (Exception ex) { throw new RuntimeException("Tag creation fails with error:" + ex.getMessage()); } }