private String getNameFromScopeNameOrArn(final String scopeNameOrArn) {
   final String scopeName;
   if (scopeNameOrArn != null
       && scopeType != null
       && AutoScalingResourceName.isResourceName().apply(scopeNameOrArn)) {
     scopeName = AutoScalingResourceName.parse(scopeNameOrArn, type).getName(scopeType);
   } else {
     scopeName = scopeNameOrArn;
   }
   return scopeName;
 }
 public AOP update(
     final OwnerFullName ownerFullName,
     @Nullable final String scopeNameOrArn,
     final String nameOrArn,
     final Callback<AOP> updateCallback)
     throws AutoScalingMetadataException {
   final AOP example;
   if (AutoScalingResourceName.isResourceName().apply(nameOrArn)) {
     example = exampleWithUuid(AutoScalingResourceName.parse(nameOrArn, type).getUuid());
   } else {
     final String scopeName = getNameFromScopeNameOrArn(scopeNameOrArn);
     example = exampleWithName(ownerFullName, scopeName, nameOrArn);
   }
   return updateByExample(example, ownerFullName, nameOrArn, updateCallback);
 }
 public final <T> T lookup(
     final OwnerFullName ownerFullName,
     @Nullable final String scopeNameOrArn,
     final String nameOrArn,
     final Function<? super AOP, T> transform)
     throws AutoScalingMetadataException {
   if (AutoScalingResourceName.isResourceName().apply(nameOrArn)) {
     return lookupByUuid(
         AutoScalingResourceName.parse(nameOrArn, type).getUuid(),
         Predicates.alwaysTrue(),
         transform);
   } else {
     final String scopeName = getNameFromScopeNameOrArn(scopeNameOrArn);
     return lookupByName(ownerFullName, scopeName, nameOrArn, transform);
   }
 }
 @Override
 public boolean delete(final AutoScalingMetadata metadata) throws AutoScalingMetadataException {
   if (metadata instanceof AutoScalingMetadataWithResourceName) {
     try {
       return Transactions.delete(
           exampleWithUuid(
               AutoScalingResourceName.parse(
                       ((AutoScalingMetadataWithResourceName) metadata).getArn(), type)
                   .getUuid()));
     } catch (NoSuchElementException e) {
       return false;
     } catch (Exception e) {
       throw new AutoScalingMetadataException(
           "Error deleting " + typeDescription + " '" + describe(metadata) + "'", e);
     }
   } else {
     return super.delete(metadata);
   }
 }