use of com.microsoft.azure.toolkit.lib.common.operation.AzureOperationRef in project azure-maven-plugins by microsoft.
the class AzureMessage method getContextOperations.
@Nonnull
private static List<IAzureOperation> getContextOperations() {
final LinkedList<IAzureOperation> result = new LinkedList<>();
IAzureOperation current = AzureTaskContext.current().currentOperation();
while (Objects.nonNull(current)) {
if (current instanceof AzureOperationRef) {
result.addFirst(current);
final AzureOperation annotation = ((AzureOperationRef) current).getAnnotation(AzureOperation.class);
if (annotation.type() == AzureOperation.Type.ACTION) {
break;
}
}
current = current.getParent();
}
return result;
}
use of com.microsoft.azure.toolkit.lib.common.operation.AzureOperationRef in project azure-maven-plugins by microsoft.
the class AzureTelemeter method getParameterProperties.
private static Map<String, String> getParameterProperties(AzureOperationRef ref) {
final HashMap<String, String> properties = new HashMap<>();
final Object[] paramValues = ref.getParamValues();
final Parameter[] parameters = ref.getMethod().getParameters();
for (int i = 0; i < parameters.length; i++) {
final Parameter param = parameters[i];
final Object value = paramValues[i];
Optional.ofNullable(param.getAnnotation(Property.class)).map(Property::value).map(n -> Property.PARAM_NAME.equals(n) ? param.getName() : n).ifPresent((name) -> properties.put(name, Optional.ofNullable(value).map(Object::toString).orElse("")));
Optional.ofNullable(param.getAnnotation(Properties.class)).map(Properties::value).map(AzureTelemeter::instantiate).map(converter -> converter.convert(value)).ifPresent(properties::putAll);
}
return properties;
}
Aggregations