topoConf = Utils.merge(conf, topoConf); if (credentials == null) { credentials = new Credentials(Collections.emptyMap()); String realUser = (String) topoConf.get(Config.TOPOLOGY_SUBMITTER_USER); String expectedOwner = null; if (credentials.is_set_topoOwner()) { expectedOwner = credentials.get_topoOwner(); } else { Principal p = ReqContext.context().principal(); Map<String, String> mergedCreds = origCreds.get_creds(); mergedCreds.putAll(credentials.get_creds()); credentials.set_creds(mergedCreds);
@Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof Credentials) return this.equals((Credentials)that); return false; }
/** * Performs a deep copy on <i>other</i>. */ public Credentials(Credentials other) { if (other.is_set_creds()) { java.util.Map<java.lang.String,java.lang.String> __this__creds = new java.util.HashMap<java.lang.String,java.lang.String>(other.creds); this.creds = __this__creds; } if (other.is_set_topoOwner()) { this.topoOwner = other.topoOwner; } }
public java.lang.Object getFieldValue(_Fields field) { switch (field) { case CREDS: return get_creds(); case TOPO_OWNER: return get_topoOwner(); } throw new java.lang.IllegalStateException(); }
public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case CREDS: if (value == null) { unset_creds(); } else { set_creds((java.util.Map<java.lang.String,java.lang.String>)value); } break; case TOPO_OWNER: if (value == null) { unset_topoOwner(); } else { set_topoOwner((java.lang.String)value); } break; } }
Credentials origCreds = state.credentials(id, null); if (origCreds != null) { Map<String, String> origCredsMap = origCreds.get_creds(); Map<String, String> newCredsMap = new HashMap<>(origCredsMap); for (ICredentialsRenewer renewer : renewers) { state.setCredentials(id, new Credentials(newCredsMap), topoConf);
@Override public void read(org.apache.storm.thrift.protocol.TProtocol prot, SubmitOptions struct) throws org.apache.storm.thrift.TException { org.apache.storm.thrift.protocol.TTupleProtocol iprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot; struct.initial_status = org.apache.storm.generated.TopologyInitialStatus.findByValue(iprot.readI32()); struct.set_initial_status_isSet(true); java.util.BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.creds = new Credentials(); struct.creds.read(iprot); struct.set_creds_isSet(true); } } }
public Credentials deepCopy() { return new Credentials(this); }
@Override public void run(String[] args, Map<String, Object> conf, String command) throws Exception { // We are pretending to be nimbus here. IStormClusterState state = ClusterUtils.mkStormClusterState(conf, new ClusterStateContext(DaemonType.NIMBUS, conf)); for (String topologyId: args) { System.out.println(topologyId + ":"); Credentials creds = state.credentials(topologyId, null); if (creds != null) { for (String key : creds.get_creds().keySet()) { System.out.println("\t" + key); } } } }
public void validate() throws org.apache.storm.thrift.TException { // check for required fields if (!is_set_creds()) { throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'creds' is unset! Struct:" + toString()); } // check for sub-struct validity }
struct.set_creds_isSet(true); } else { org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); if (schemeField.type == org.apache.storm.thrift.protocol.TType.STRING) { struct.topoOwner = iprot.readString(); struct.set_topoOwner_isSet(true); } else { org.apache.storm.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
public void setFieldValue(_Fields field, Object value) { switch (field) { case CREDS: if (value == null) { unset_creds(); } else { set_creds((Map<String,String>)value); } break; } }
try (NimbusClient client = NimbusClient.getConfiguredClient(conf)) { LOG.info("Uploading new credentials to {}", name); Credentials creds = new Credentials(fullCreds); if (expectedUser != null) { creds.set_topoOwner(expectedUser);
public boolean equals(Credentials that) { if (that == null) return false; boolean this_present_creds = true && this.is_set_creds(); boolean that_present_creds = true && that.is_set_creds(); if (this_present_creds || that_present_creds) { if (!(this_present_creds && that_present_creds)) return false; if (!this.creds.equals(that.creds)) return false; } return true; }
public void write(org.apache.storm.thrift.protocol.TProtocol oprot, Credentials struct) throws org.apache.storm.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.creds != null) { oprot.writeFieldBegin(CREDS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.storm.thrift.protocol.TMap(org.apache.storm.thrift.protocol.TType.STRING, org.apache.storm.thrift.protocol.TType.STRING, struct.creds.size())); for (java.util.Map.Entry<java.lang.String, java.lang.String> _iter600 : struct.creds.entrySet()) { oprot.writeString(_iter600.getKey()); oprot.writeString(_iter600.getValue()); } oprot.writeMapEnd(); } oprot.writeFieldEnd(); } if (struct.topoOwner != null) { if (struct.is_set_topoOwner()) { oprot.writeFieldBegin(TOPO_OWNER_FIELD_DESC); oprot.writeString(struct.topoOwner); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
struct.set_creds_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
@Override public void read(org.apache.storm.thrift.protocol.TProtocol prot, Credentials struct) throws org.apache.storm.thrift.TException { org.apache.storm.thrift.protocol.TTupleProtocol iprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot; { org.apache.storm.thrift.protocol.TMap _map602 = new org.apache.storm.thrift.protocol.TMap(org.apache.storm.thrift.protocol.TType.STRING, org.apache.storm.thrift.protocol.TType.STRING, iprot.readI32()); struct.creds = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map602.size); java.lang.String _key603; java.lang.String _val604; for (int _i605 = 0; _i605 < _map602.size; ++_i605) { _key603 = iprot.readString(); _val604 = iprot.readString(); struct.creds.put(_key603, _val604); } } struct.set_creds_isSet(true); java.util.BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.topoOwner = iprot.readString(); struct.set_topoOwner_isSet(true); } } }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { read(new org.apache.storm.thrift.protocol.TCompactProtocol(new org.apache.storm.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.storm.thrift.TException te) { throw new java.io.IOException(te); } }
@Override public java.lang.String toString() { java.lang.StringBuilder sb = new java.lang.StringBuilder("Credentials("); boolean first = true; sb.append("creds:"); if (this.creds == null) { sb.append("null"); } else { sb.append(this.creds); } first = false; if (is_set_topoOwner()) { if (!first) sb.append(", "); sb.append("topoOwner:"); if (this.topoOwner == null) { sb.append("null"); } else { sb.append(this.topoOwner); } first = false; } sb.append(")"); return sb.toString(); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, Credentials struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; { org.apache.thrift.protocol.TMap _map554 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.creds = new HashMap<String,String>(2*_map554.size); String _key555; String _val556; for (int _i557 = 0; _i557 < _map554.size; ++_i557) { _key555 = iprot.readString(); _val556 = iprot.readString(); struct.creds.put(_key555, _val556); } } struct.set_creds_isSet(true); } }