com.amazonaws.services.cloudformation.model.Output.getOutputKey()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中com.amazonaws.services.cloudformation.model.Output.getOutputKey()方法的一些代码示例,展示了Output.getOutputKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.getOutputKey()方法的具体详情如下:
包路径:com.amazonaws.services.cloudformation.model.Output
类名称:Output
方法名:getOutputKey

Output.getOutputKey介绍

[英]The key associated with the output.
[中]与输出关联的键。

代码示例

代码示例来源:origin: aws/aws-sdk-java

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getOutputKey() == null) ? 0 : getOutputKey().hashCode());
  hashCode = prime * hashCode + ((getOutputValue() == null) ? 0 : getOutputValue().hashCode());
  hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
  hashCode = prime * hashCode + ((getExportName() == null) ? 0 : getExportName().hashCode());
  return hashCode;
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
 * redacted from this string using a placeholder value.
 *
 * @return A string representation of this object.
 *
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  sb.append("{");
  if (getOutputKey() != null)
    sb.append("OutputKey: ").append(getOutputKey()).append(",");
  if (getOutputValue() != null)
    sb.append("OutputValue: ").append(getOutputValue()).append(",");
  if (getDescription() != null)
    sb.append("Description: ").append(getDescription()).append(",");
  if (getExportName() != null)
    sb.append("ExportName: ").append(getExportName());
  sb.append("}");
  return sb.toString();
}

代码示例来源:origin: aws/aws-sdk-java

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (obj == null)
    return false;
  if (obj instanceof Output == false)
    return false;
  Output other = (Output) obj;
  if (other.getOutputKey() == null ^ this.getOutputKey() == null)
    return false;
  if (other.getOutputKey() != null && other.getOutputKey().equals(this.getOutputKey()) == false)
    return false;
  if (other.getOutputValue() == null ^ this.getOutputValue() == null)
    return false;
  if (other.getOutputValue() != null && other.getOutputValue().equals(this.getOutputValue()) == false)
    return false;
  if (other.getDescription() == null ^ this.getDescription() == null)
    return false;
  if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
    return false;
  if (other.getExportName() == null ^ this.getExportName() == null)
    return false;
  if (other.getExportName() != null && other.getExportName().equals(this.getExportName()) == false)
    return false;
  return true;
}

代码示例来源:origin: ingenieux/beanstalker

private String resolvePropertyName(Output o) {
 // TODO Handle Globs + Eventual Replacements
 if (outputMapping.containsKey(o.getOutputKey())) {
  final String replacementKey = outputMapping.get(o.getOutputKey());
  getLog().info("There's a <outputMapping/> entry for '" + o.getOutputKey() + "' (set to '" + replacementKey + "') declared. Using it instead.");
  return replacementKey;
 }
 return "cloudformation.stack." + o.getOutputKey();
}

代码示例来源:origin: classmethod/gradle-aws-plugin

public String findStackOutputValue(String stackName, String key) {
  Optional<Output> output = getStackOutputs(stackName).stream()
    .filter(p -> p.getOutputKey().equals(key))
    .findAny();
  if (output.isPresent() == false) {
    logger.warn("WARN: output {} for stack {} is not found", key, stackName);
  }
  return output.map(Output::getOutputValue).orElse(null);
}

代码示例来源:origin: gofore/aws-training

/**
 * Gets the given stack's output by its key.
 * 
 * @param stackName the stack name
 * @param outputKey the output key
 * @return future of stack's output of failed future if stack or output does not exist
 */
public CompletableFuture<Output> getStackOutput(String stackName, String outputKey) {
  return getStackOutputs(stackName)
      .thenApply(findFirst(o -> o.getOutputKey().equals(outputKey)))
      .thenApply(Optional::get);
}

代码示例来源:origin: gradle.plugin.com.alexmartin.plugins.AwsPlugin/aws-gradle-plugin

public static String getStackOutput(String stackName, String key){
    DescribeStacksRequest describeStacksRequest = new DescribeStacksRequest();
    describeStacksRequest.withStackName(stackName);
    DescribeStacksResult describeStacksResult = client.describeStacks(describeStacksRequest);
    List<Output> outputs = describeStacksResult.getStacks().get(0).getOutputs();
    Optional<Output> output = outputs.stream()
        .filter(index -> index.getOutputKey().equals(key))
        .findFirst();
    return output.map(Output::getOutputValue)
        .orElseThrow(() -> new RuntimeException("Did not find stack output."));
  }
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-cloudformation

@Override
public int hashCode() {
  final int prime = 31;
  int hashCode = 1;
  hashCode = prime * hashCode + ((getOutputKey() == null) ? 0 : getOutputKey().hashCode());
  hashCode = prime * hashCode + ((getOutputValue() == null) ? 0 : getOutputValue().hashCode());
  hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
  hashCode = prime * hashCode + ((getExportName() == null) ? 0 : getExportName().hashCode());
  return hashCode;
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-cloudformation

/**
 * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
 * redacted from this string using a placeholder value.
 *
 * @return A string representation of this object.
 *
 * @see java.lang.Object#toString()
 */
@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  sb.append("{");
  if (getOutputKey() != null)
    sb.append("OutputKey: ").append(getOutputKey()).append(",");
  if (getOutputValue() != null)
    sb.append("OutputValue: ").append(getOutputValue()).append(",");
  if (getDescription() != null)
    sb.append("Description: ").append(getDescription()).append(",");
  if (getExportName() != null)
    sb.append("ExportName: ").append(getExportName());
  sb.append("}");
  return sb.toString();
}

代码示例来源:origin: gradle.plugin.com.github.kaklakariada.aws/aws-sam-gradle

private void logStackOutput() {
  getStackOutput().forEach(
      output -> logger.lifecycle("Stack output {} = {}", output.getOutputKey(), output.getOutputValue()));
}

代码示例来源:origin: org.wso2.testgrid/org.wso2.testgrid.infrastructure

private Properties getCloudformationOutputs(AmazonCloudFormation cloudFormation, CreateStackResult stack) {
  DescribeStacksRequest describeStacksRequest = new DescribeStacksRequest();
  describeStacksRequest.setStackName(stack.getStackId());
  final DescribeStacksResult describeStacksResult = cloudFormation
      .describeStacks(describeStacksRequest);
  Properties outputProps = new Properties();
  for (Stack st : describeStacksResult.getStacks()) {
    StringBuilder outputsStr = new StringBuilder("Infrastructure/Deployment outputs {\n");
    for (Output output : st.getOutputs()) {
      outputProps.setProperty(output.getOutputKey(), output.getOutputValue());
      outputsStr.append(output.getOutputKey()).append("=").append(output.getOutputValue()).append("\n");
    }
    //Log cfn outputs
    logger.info(outputsStr.toString() + "\n}");
  }
  return outputProps;
}

代码示例来源:origin: gradle.plugin.com.github.kaklakariada.aws/aws-sam-gradle

@TaskAction
  public void writeStackOutput() {
    final DeployService deployService = new DeployService(config, getLogger());
    final List<Output> output = deployService.getStackOutput();
    final Properties prop = new Properties();
    output.forEach(o -> prop.setProperty(o.getOutputKey(), o.getOutputValue()));

    getLogger().info("Writing {} stack outputs to {}", prop.size(), outputFile);

    try (Writer writer = new OutputStreamWriter(new FileOutputStream(outputFile), StandardCharsets.UTF_8)) {
      prop.store(writer, "Output of stack " + config.getStackName());
    } catch (final IOException e) {
      throw new DeploymentException("Error writing to file " + outputFile, e);
    }
  }
}

代码示例来源:origin: jenkinsci/pipeline-aws-plugin

public Map<String, String> describeOutputs() {
  DescribeStacksResult result = this.client.describeStacks(new DescribeStacksRequest().withStackName(this.stack));
  Stack cfnStack = result.getStacks().get(0);
  Map<String, String> map = new HashMap<>();
  for (Output output : cfnStack.getOutputs()) {
    map.put(output.getOutputKey(), output.getOutputValue());
  }
  return map;
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-cloudformation

@Override
public boolean equals(Object obj) {
  if (this == obj)
    return true;
  if (obj == null)
    return false;
  if (obj instanceof Output == false)
    return false;
  Output other = (Output) obj;
  if (other.getOutputKey() == null ^ this.getOutputKey() == null)
    return false;
  if (other.getOutputKey() != null && other.getOutputKey().equals(this.getOutputKey()) == false)
    return false;
  if (other.getOutputValue() == null ^ this.getOutputValue() == null)
    return false;
  if (other.getOutputValue() != null && other.getOutputValue().equals(this.getOutputValue()) == false)
    return false;
  if (other.getDescription() == null ^ this.getDescription() == null)
    return false;
  if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
    return false;
  if (other.getExportName() == null ^ this.getExportName() == null)
    return false;
  if (other.getExportName() != null && other.getExportName().equals(this.getExportName()) == false)
    return false;
  return true;
}

代码示例来源:origin: classmethod/gradle-aws-plugin

private void printOutputs(Stack stack) {
    getLogger().info("==== Outputs ====");
    stack.getOutputs().stream()
      .forEach(o -> getLogger().info("{} ({}) = {}", o.getOutputKey(), o.getDescription(), o.getOutputValue()));
  }
}

代码示例来源:origin: cagataygurturk/lambadaframework

public CloudFormationOutput getStackOutputs(AmazonCloudFormation stackbuilder,
                      String stackName) {
  DescribeStacksRequest wait = new DescribeStacksRequest();
  wait.setStackName(stackName);
  List<Stack> stacks = getCloudFormationClient().describeStacks(wait).getStacks();
  CloudFormationOutput cloudFormationOutput = new CloudFormationOutput();
  for (Stack stack : stacks) {
    if (stack.getStackName().equals(stackName)) {
      stack.getOutputs().forEach(output -> {
        if (output.getOutputKey().equals(LAMBDA_EXECUTION_IAM_RESOURCE_NAME)) {
          cloudFormationOutput.setLambdaExecutionRole(output.getOutputValue());
        }
        if (output.getOutputKey().equals(LAMBDA_EXECUTION_NAME)) {
          cloudFormationOutput.setLambdaFunctionArn(output.getOutputValue());
        }
      });
      return cloudFormationOutput;
    }
  }
  throw new RuntimeException("Unknown Cloudformation error. Try deploying.");
}

代码示例来源:origin: jenkinsci/jenkins-cloudformation-plugin

List<Output> outputs = stack.getOutputs();
for (Output output : outputs) {
  stackOutput.put(output.getOutputKey(), output.getOutputValue());

相关文章