Update the topology definition for the given topology. If the topology doesn't exist,
create it. If it does, update it.

@param topologyName the name of the topology
@return Boolean - Success or Failure
485323
public Boolean updateTopology(TopologyAPI.Topology topology, String topologyName) {
    if (getTopology(topologyName) != null) {
      deleteTopology(topologyName);
    }
    return setTopology(topology, topologyName);
  }
747778
private static void submitTopologyToFile(TopologyAPI.Topology fTopology,
                                           Map<String, String> heronCmdOptions) {
    String dirName = heronCmdOptions.get(CMD_TOPOLOGY_DEFN_TEMPDIR);
    if (dirName == null || dirName.isEmpty()) {
      throw new TopologySubmissionException("Topology definition temp directory not specified. "
          + "Please set cmdline option: " + CMD_TOPOLOGY_DEFN_TEMPDIR);
    }

    String fileName =
        Paths.get(dirName, fTopology.getName() + TOPOLOGY_DEFINITION_SUFFIX).toString();

    try (FileOutputStream fos = new FileOutputStream(new File(fileName));
        BufferedOutputStream bos = new BufferedOutputStream(fos)) {
      byte[] topEncoding = fTopology.toByteArray();
      bos.write(topEncoding);
    } catch (IOException e) {
      throw new TopologySubmissionException("Error writing topology definition to temp directory: "
          + dirName, e);
    }
  }
326680
@Action(
            semantics = SemanticsOf.IDEMPOTENT,
            command = CommandReification.ENABLED,
            commandPersistence = CommandPersistence.NOT_PERSISTED
    )
    @ActionLayout(
            describedAs = "Change name directly (commandPersistence = NOT_PERSISTED, so none should be created)"
    )
    public SomeCommandAnnotatedObject changeNameCommandNotPersisted(
            @ParameterLayout(named = "New name")
            final String newName) {
        setName(newName);
        return this;
    }
1325532
public static final void nodeName(String name)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "nodeName", name);

        _nodeName = name;

        if (tc.isEntryEnabled())
            Tr.exit(tc, "nodeName");
    }
731565
public void heartbeatNode (String nodeName)
    {
        updatePartial(NodeRecord.getKey(nodeName),
                      NodeRecord.LAST_UPDATED, new Timestamp(System.currentTimeMillis()));
    }
344949
public void setTopologyStatus(TopologyAssignEvent event) throws Exception {
        StormClusterState stormClusterState = nimbusData.getStormClusterState();

        String topologyId = event.getTopologyId();
        String topologyName = event.getTopologyName();
        String group = event.getGroup();

        StormStatus status = new StormStatus(StatusType.active);
        if (event.getOldStatus() != null) {
            status = event.getOldStatus();
        }

        boolean isEnable = ConfigExtension.isEnablePerformanceMetrics(nimbusData.getConf());
        StormBase stormBase = stormClusterState.storm_base(topologyId, null);
        if (stormBase == null) {
            stormBase = new StormBase(topologyName, TimeUtils.current_time_secs(), status, group);
            stormBase.setEnableMonitor(isEnable);
            stormClusterState.activate_storm(topologyId, stormBase);
        } else {
            stormClusterState.update_storm(topologyId, status);
            stormClusterState.set_storm_monitor(topologyId, isEnable);

            // here exist one hack operation
            // when monitor/rebalance/startup topologyName is null
            if (topologyName == null) {
                event.setTopologyName(stormBase.getStormName());
            }
        }

        LOG.info("Update " + topologyId + " " + status);
    }
1103559
def update_ssh_key(self, name):
        # The `_ssh_key` is to avoid conflicts with MutableMapping.update.
        
        api = self.doapi_manager
        return api._ssh_key(api.request(self.url, method='PUT',
                                       data={"name": name})["ssh_key"])
179737
public Blob updateBlob(String bucketName, String blobName) {
    // [START updateBlob]
    Map<String, String> newMetadata = new HashMap<>();
    newMetadata.put("key", "value");
    storage.update(BlobInfo.newBuilder(bucketName, blobName).setMetadata(null).build());
    Blob blob =
        storage.update(BlobInfo.newBuilder(bucketName, blobName).setMetadata(newMetadata).build());
    // [END updateBlob]
    return blob;
  }
278307
@Override
   public Iterator<TopologyElementCalled> iterator() {
      Iterator<TopologyElementCalled> it = new Iterator<TopologyElementCalled>() {

         int currentIndex = 0;

         @Override
         public boolean hasNext() {
            return currentIndex < dependences.size();

         }

         @Override
         public TopologyElementCalled next() {
            TopologyElementCalled currentEl = dependences.get(currentIndex);
            currentIndex++;
            return currentEl;
         }

         @Override
         public void remove() {

         }
      };
      return it;
   }
592912
public Boolean setExecutionState(
      ExecutionEnvironment.ExecutionState executionState, String topologyName) {
    return awaitResult(delegate.setExecutionState(executionState, topologyName));
  }
559991
@Override
    public java.util.concurrent.Future<CreateTopicResult> createTopicAsync(String name) {

        return createTopicAsync(new CreateTopicRequest().withName(name));
    }
298643
public void loadTopology() {
        if (fake) {
            getView().updateHosts(deriveGroups(generateFakeDomain()), hostIndex);
        } else {
            Outcome<FunctionContext> outcome = new Outcome<FunctionContext>() {
                @Override
                public void onFailure(final FunctionContext context) {
                    Console.error("Unable to load topology", context.getErrorMessage()); // TODO i18n
                }

                @Override
                public void onSuccess(final FunctionContext context) {
                    List<HostInfo> hosts = context.pop();
                    getView().updateHosts(deriveGroups(hosts), hostIndex);
                }
            };
            new Async<FunctionContext>(Footer.PROGRESS_ELEMENT).waterfall(new FunctionContext(), outcome,
                    new TopologyFunctions.ReadHostsAndGroups(dispatcher),
                    new TopologyFunctions.ReadServerConfigs(dispatcher, beanFactory),
                    new TopologyFunctions.FindRunningServerInstances(dispatcher));
        }
    }
1058350
public Boolean updatePackingPlan(PackingPlans.PackingPlan packingPlan, String topologyName) {
    if (getPackingPlan(topologyName) != null) {
      deletePackingPlan(topologyName);
    }
    return setPackingPlan(packingPlan, topologyName);
  }
311152
def remove_node_from_topology(node_name)
      # load then update and save the node
      node = Chef::Node.load(node_name)

      if node['topo'] && node['topo']['name'] == @topo_name
        node.rm('topo', 'name')
        ui.info "Removing node #{node.name} from topology"
        node.save
      end
      node

    rescue Net::HTTPServerException => e
      raise unless e.to_s =~ /^404/
      # Node has not been created
    end
78343
protected String changeName(String name) {
        String retval=name;
        StringBuilder tmp;

        if(address != null) {
            tmp=new StringBuilder(address);
            retval=retval.replace(ADDR, tmp);
        }
        if(clusterName != null) {
            tmp=new StringBuilder(clusterName);
            retval=retval.replace(CLUSTER, tmp);
        }
        return retval;
    }
1321188
@Action()
    public SomeNotAuditedObject updateNameAndNumber(
            @ParameterLayout(named = "Name")
            final String name,
            @Parameter(optionality = Optionality.OPTIONAL)
            @ParameterLayout(named = "Number")
            final Integer number) {
        setName(name);
        setNumber(number);
        return this;
    }
211301
@VisibleForTesting
  void restartTopologyHandler(String topologyName) throws TopologyRuntimeManagementException {
    assert !potentialStaleExecutionData;
    Integer containerId = Context.topologyContainerId(config);
    Scheduler.RestartTopologyRequest restartTopologyRequest =
        Scheduler.RestartTopologyRequest.newBuilder()
            .setTopologyName(topologyName)
            .setContainerIndex(containerId)
            .build();
    // If we restart the container including TMaster, wee need to clean TMasterLocation,
    // since when starting up, TMaster expects no other existing TMaster,
    // i.e. TMasterLocation does not exist
    if (containerId == -1 || containerId == 0) {
      // get the instance of state manager to clean state
      SchedulerStateManagerAdaptor stateManager = Runtime.schedulerStateManagerAdaptor(runtime);
      Boolean result = stateManager.deleteTMasterLocation(topologyName);
      if (result == null || !result) {
        throw new TopologyRuntimeManagementException(
            "Failed to clear TMaster location. Check whether TMaster set it correctly.");
      }
    }

    if (!schedulerClient.restartTopology(restartTopologyRequest)) {
      throw new TopologyRuntimeManagementException(String.format(
          "Failed to restart topology '%s'", topologyName));
    }
    // Clean the connection when we are done.
    LOG.fine("Scheduler restarted topology successfully.");
  }