@Test public void logClusterRequestedUsageEvent() { util.logClusterRequestedUsageEvent(cluster); util.logClusterRequestedUsageEvent(null); }
public void logClusterRequestedUsageEvent(@Nullable Cluster cluster) { if (cluster == null || cluster.getId() == null) { return; } Stack stack = cluster.getStack(); if (stack == null) { return; } long timestamp = System.currentTimeMillis(); User creator = stack.getCreator(); String cloudPlatform = stack.getCloudPlatform(); UsageProto.CDPEnvironmentsEnvironmentType.Value cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.UNSET; if (cloudPlatform != null) { try { cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.valueOf(cloudPlatform.toUpperCase()); } catch (IllegalArgumentException e) { } } if (stack.getDatalakeResourceId() != null) { UsageProto.CDPDatahubClusterRequested.Builder protoBuilder = UsageProto.CDPDatahubClusterRequested.newBuilder(); protoBuilder.setClusterId(cluster.getId().toString()); protoBuilder.setDatalakeCrn(stack.getDatalakeResourceId().toString()); buildDatahubRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatahubClusterRequested(timestamp, protoBuilder.build()); } else { UsageProto.CDPDatalakeClusterRequested.Builder protoBuilder = UsageProto.CDPDatalakeClusterRequested.newBuilder(); protoBuilder.setDatalakeId(cluster.getId().toString()); buildDatalakeRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatalakeClusterRequested(timestamp, protoBuilder.build()); } }
UsageLoggingUtil { public void logClusterRequestedUsageEvent(@Nullable Cluster cluster) { if (cluster == null || cluster.getId() == null) { return; } Stack stack = cluster.getStack(); if (stack == null) { return; } long timestamp = System.currentTimeMillis(); User creator = stack.getCreator(); String cloudPlatform = stack.getCloudPlatform(); UsageProto.CDPEnvironmentsEnvironmentType.Value cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.UNSET; if (cloudPlatform != null) { try { cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.valueOf(cloudPlatform.toUpperCase()); } catch (IllegalArgumentException e) { } } if (stack.getDatalakeResourceId() != null) { UsageProto.CDPDatahubClusterRequested.Builder protoBuilder = UsageProto.CDPDatahubClusterRequested.newBuilder(); protoBuilder.setClusterId(cluster.getId().toString()); protoBuilder.setDatalakeCrn(stack.getDatalakeResourceId().toString()); buildDatahubRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatahubClusterRequested(timestamp, protoBuilder.build()); } else { UsageProto.CDPDatalakeClusterRequested.Builder protoBuilder = UsageProto.CDPDatalakeClusterRequested.newBuilder(); protoBuilder.setDatalakeId(cluster.getId().toString()); buildDatalakeRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatalakeClusterRequested(timestamp, protoBuilder.build()); } } }
UsageLoggingUtil { public void logClusterRequestedUsageEvent(@Nullable Cluster cluster) { if (cluster == null || cluster.getId() == null) { return; } Stack stack = cluster.getStack(); if (stack == null) { return; } long timestamp = System.currentTimeMillis(); User creator = stack.getCreator(); String cloudPlatform = stack.getCloudPlatform(); UsageProto.CDPEnvironmentsEnvironmentType.Value cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.UNSET; if (cloudPlatform != null) { try { cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.valueOf(cloudPlatform.toUpperCase()); } catch (IllegalArgumentException e) { } } if (stack.getDatalakeResourceId() != null) { UsageProto.CDPDatahubClusterRequested.Builder protoBuilder = UsageProto.CDPDatahubClusterRequested.newBuilder(); protoBuilder.setClusterId(cluster.getId().toString()); protoBuilder.setDatalakeCrn(stack.getDatalakeResourceId().toString()); buildDatahubRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatahubClusterRequested(timestamp, protoBuilder.build()); } else { UsageProto.CDPDatalakeClusterRequested.Builder protoBuilder = UsageProto.CDPDatalakeClusterRequested.newBuilder(); protoBuilder.setDatalakeId(cluster.getId().toString()); buildDatalakeRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatalakeClusterRequested(timestamp, protoBuilder.build()); } }  }
UsageLoggingUtil { public void logClusterRequestedUsageEvent(@Nullable Cluster cluster) { if (cluster == null || cluster.getId() == null) { return; } Stack stack = cluster.getStack(); if (stack == null) { return; } long timestamp = System.currentTimeMillis(); User creator = stack.getCreator(); String cloudPlatform = stack.getCloudPlatform(); UsageProto.CDPEnvironmentsEnvironmentType.Value cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.UNSET; if (cloudPlatform != null) { try { cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.valueOf(cloudPlatform.toUpperCase()); } catch (IllegalArgumentException e) { } } if (stack.getDatalakeResourceId() != null) { UsageProto.CDPDatahubClusterRequested.Builder protoBuilder = UsageProto.CDPDatahubClusterRequested.newBuilder(); protoBuilder.setClusterId(cluster.getId().toString()); protoBuilder.setDatalakeCrn(stack.getDatalakeResourceId().toString()); buildDatahubRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatahubClusterRequested(timestamp, protoBuilder.build()); } else { UsageProto.CDPDatalakeClusterRequested.Builder protoBuilder = UsageProto.CDPDatalakeClusterRequested.newBuilder(); protoBuilder.setDatalakeId(cluster.getId().toString()); buildDatalakeRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatalakeClusterRequested(timestamp, protoBuilder.build()); } }  void logClusterRequestedUsageEvent(@Nullable Cluster cluster); void logClusterStatusChangeUsageEvent(@Nullable Status oldClusterStatus, @Nullable Cluster cluster); }
UsageLoggingUtil { public void logClusterRequestedUsageEvent(@Nullable Cluster cluster) { if (cluster == null || cluster.getId() == null) { return; } Stack stack = cluster.getStack(); if (stack == null) { return; } long timestamp = System.currentTimeMillis(); User creator = stack.getCreator(); String cloudPlatform = stack.getCloudPlatform(); UsageProto.CDPEnvironmentsEnvironmentType.Value cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.UNSET; if (cloudPlatform != null) { try { cloudPlatformEnum = UsageProto.CDPEnvironmentsEnvironmentType.Value.valueOf(cloudPlatform.toUpperCase()); } catch (IllegalArgumentException e) { } } if (stack.getDatalakeResourceId() != null) { UsageProto.CDPDatahubClusterRequested.Builder protoBuilder = UsageProto.CDPDatahubClusterRequested.newBuilder(); protoBuilder.setClusterId(cluster.getId().toString()); protoBuilder.setDatalakeCrn(stack.getDatalakeResourceId().toString()); buildDatahubRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatahubClusterRequested(timestamp, protoBuilder.build()); } else { UsageProto.CDPDatalakeClusterRequested.Builder protoBuilder = UsageProto.CDPDatalakeClusterRequested.newBuilder(); protoBuilder.setDatalakeId(cluster.getId().toString()); buildDatalakeRequestedProto(cluster, stack, creator, cloudPlatformEnum, protoBuilder); usageReporter.cdpDatalakeClusterRequested(timestamp, protoBuilder.build()); } }  void logClusterRequestedUsageEvent(@Nullable Cluster cluster); void logClusterStatusChangeUsageEvent(@Nullable Status oldClusterStatus, @Nullable Cluster cluster);  }