use of io.opentelemetry.proto.common.v1.KeyValue in project cloudstack by apache.
the class LicenseAssignmentManagerMO method isFeatureSupported.
public boolean isFeatureSupported(String featureKey, ManagedObjectReference hostMor) throws Exception {
boolean featureSupported = false;
// Retrieve host license properties
List<KeyAnyValue> props = getHostLicenseProperties(hostMor);
// Check host license properties to see if specified feature is supported by the license.
for (KeyAnyValue prop : props) {
String key = prop.getKey();
if (key.equalsIgnoreCase(LICENSE_INFO_FEATURE)) {
KeyValue propValue = (KeyValue) prop.getValue();
if (propValue.getKey().equalsIgnoreCase(featureKey)) {
featureSupported = true;
break;
}
}
}
return featureSupported;
}
use of io.opentelemetry.proto.common.v1.KeyValue in project cs-actions by CloudSlang.
the class DeployOvfTemplateService method createLeaseSetup.
protected ImmutablePair<ManagedObjectReference, OvfCreateImportSpecResult> createLeaseSetup(final ConnectionResources connectionResources, final VmInputs vmInputs, final String templatePath, final Map<String, String> ovfNetworkMap, final Map<String, String> ovfPropertyMap) throws Exception {
final ManagedObjectReference ovfManager = getOvfManager(connectionResources);
final VmUtils vmUtils = new VmUtils();
final ManagedObjectReference resourcePool;
if (StringUtilities.isBlank(vmInputs.getClusterName())) {
resourcePool = vmUtils.getMorResourcePool(vmInputs.getResourcePool(), connectionResources);
} else {
ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName());
resourcePool = vmUtils.getMorResourcePoolFromCluster(connectionResources, clusterMor, vmInputs.getResourcePool());
}
final ManagedObjectReference hostMor = vmUtils.getMorHost(vmInputs.getHostname(), connectionResources, null);
final ManagedObjectReference datastoreMor = vmUtils.getMorDataStore(vmInputs.getDataStore(), connectionResources, null, vmInputs);
final ManagedObjectReference folderMor = vmUtils.getMorFolder(vmInputs.getFolderName(), connectionResources);
final List<OvfNetworkMapping> ovfNetworkMappings = getOvfNetworkMappings(ovfNetworkMap, connectionResources);
final List<KeyValue> ovfPropertyMappings = getOvfPropertyMappings(ovfPropertyMap);
final OvfCreateImportSpecResult importSpecResult = connectionResources.getVimPortType().createImportSpec(ovfManager, getOvfTemplateAsString(templatePath), resourcePool, datastoreMor, getOvfCreateImportSpecParams(vmInputs, hostMor, ovfNetworkMappings, ovfPropertyMappings));
checkImportSpecResultForErrors(importSpecResult);
final ManagedObjectReference httpNfcLease = OvfUtils.getHttpNfcLease(connectionResources, importSpecResult.getImportSpec(), resourcePool, hostMor, folderMor);
return ImmutablePair.of(httpNfcLease, importSpecResult);
}
use of io.opentelemetry.proto.common.v1.KeyValue in project cs-actions by CloudSlang.
the class DeployOvfTemplateService method getOvfPropertyMappings.
private List<KeyValue> getOvfPropertyMappings(final Map<String, String> ovfPropertyMap) {
final List<KeyValue> mappings = new ArrayList<>();
for (Map.Entry<String, String> entry : ovfPropertyMap.entrySet()) {
final KeyValue keyValue = new KeyValue();
keyValue.setKey(entry.getKey());
keyValue.setValue(entry.getValue());
mappings.add(keyValue);
}
return mappings;
}
use of io.opentelemetry.proto.common.v1.KeyValue in project wavefront-proxy by wavefrontHQ.
the class OtlpProtobufUtils method annotationsFromAttributes.
@VisibleForTesting
static List<Annotation> annotationsFromAttributes(List<KeyValue> attributesList) {
List<Annotation> annotations = new ArrayList<>();
for (KeyValue attribute : attributesList) {
String key = attribute.getKey().equals(SOURCE_KEY) ? "_source" : attribute.getKey();
Annotation.Builder annotationBuilder = Annotation.newBuilder().setKey(key);
if (!attribute.hasValue()) {
annotationBuilder.setValue("");
} else {
annotationBuilder.setValue(fromAnyValue(attribute.getValue()));
}
annotations.add(annotationBuilder.build());
}
return annotations;
}
use of io.opentelemetry.proto.common.v1.KeyValue in project wavefront-proxy by wavefrontHQ.
the class OtlpProtobufUtilsTest method transformSpanSetsSourceFromResourceAttributesNotSpanAttributes.
@Test
public void transformSpanSetsSourceFromResourceAttributesNotSpanAttributes() {
List<KeyValue> resourceAttrs = Collections.singletonList(otlpAttribute("source", "a-src"));
Span otlpSpan = OtlpTestHelpers.otlpSpanGenerator().addAttributes(otlpAttribute("source", "span-level")).build();
actualSpan = OtlpProtobufUtils.transformSpan(otlpSpan, resourceAttrs, null, null, "ignored");
assertEquals("a-src", actualSpan.getSource());
assertThat(actualSpan.getAnnotations(), not(hasItem(new Annotation("source", "a-src"))));
assertThat(actualSpan.getAnnotations(), hasItem(new Annotation("_source", "span-level")));
}
Aggregations