-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves: ZSTAC-66623 Change-Id: I6467666238676e6d666175747477786a71677963 (cherry picked from commit 4cad010) <fix>[sns]: add support for reporting changes in license addons Resolves: ZSTAC-67100 Change-Id: I716c767578626b6e756361696b6e671007717a6f (cherry picked from commit c86b6e7) <feature>[externalservice]: marketplace Resolves: ZHCI-2514 Change-Id: I6773796b76736d6b64777a786c787a787a637371 (cherry picked from commit 4b82f3f) (cherry picked from commit 14d27cc)
- Loading branch information
1 parent
eece50a
commit 037686f
Showing
17 changed files
with
281 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
core/src/main/java/org/zstack/core/externalservice/AbstractLocalExternalSystemdService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.zstack.core.externalservice; | ||
|
||
import org.zstack.utils.Bash; | ||
|
||
public abstract class AbstractLocalExternalSystemdService extends AbstractLocalExternalService{ | ||
abstract public String getSystemdServiceName(); | ||
|
||
public void sysctl(String ctl) { | ||
new Bash() { | ||
@Override | ||
protected void scripts() { | ||
setE(); | ||
run("systemctl %s %s", ctl, getSystemdServiceName()); | ||
} | ||
}.execute(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
sdk/src/main/java/org/zstack/sdk/SSOServerTokenInventory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.zstack.sdk; | ||
|
||
|
||
|
||
public class SSOServerTokenInventory { | ||
|
||
public java.lang.String uuid; | ||
public void setUuid(java.lang.String uuid) { | ||
this.uuid = uuid; | ||
} | ||
public java.lang.String getUuid() { | ||
return this.uuid; | ||
} | ||
|
||
public java.lang.String accessToken; | ||
public void setAccessToken(java.lang.String accessToken) { | ||
this.accessToken = accessToken; | ||
} | ||
public java.lang.String getAccessToken() { | ||
return this.accessToken; | ||
} | ||
|
||
public java.lang.String idToken; | ||
public void setIdToken(java.lang.String idToken) { | ||
this.idToken = idToken; | ||
} | ||
public java.lang.String getIdToken() { | ||
return this.idToken; | ||
} | ||
|
||
public java.lang.String refreshToken; | ||
public void setRefreshToken(java.lang.String refreshToken) { | ||
this.refreshToken = refreshToken; | ||
} | ||
public java.lang.String getRefreshToken() { | ||
return this.refreshToken; | ||
} | ||
|
||
public java.lang.String userUuid; | ||
public void setUserUuid(java.lang.String userUuid) { | ||
this.userUuid = userUuid; | ||
} | ||
public java.lang.String getUserUuid() { | ||
return this.userUuid; | ||
} | ||
|
||
public java.sql.Timestamp createDate; | ||
public void setCreateDate(java.sql.Timestamp createDate) { | ||
this.createDate = createDate; | ||
} | ||
public java.sql.Timestamp getCreateDate() { | ||
return this.createDate; | ||
} | ||
|
||
public java.sql.Timestamp lastOpDate; | ||
public void setLastOpDate(java.sql.Timestamp lastOpDate) { | ||
this.lastOpDate = lastOpDate; | ||
} | ||
public java.sql.Timestamp getLastOpDate() { | ||
return this.lastOpDate; | ||
} | ||
|
||
} |
92 changes: 92 additions & 0 deletions
92
sdk/src/main/java/org/zstack/sdk/TokenIntrospectionAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package org.zstack.sdk; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.zstack.sdk.*; | ||
|
||
public class TokenIntrospectionAction extends AbstractAction { | ||
|
||
private static final HashMap<String, Parameter> parameterMap = new HashMap<>(); | ||
|
||
private static final HashMap<String, Parameter> nonAPIParameterMap = new HashMap<>(); | ||
|
||
public static class Result { | ||
public ErrorCode error; | ||
public org.zstack.sdk.TokenIntrospectionResult value; | ||
|
||
public Result throwExceptionIfError() { | ||
if (error != null) { | ||
throw new ApiException( | ||
String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details) | ||
); | ||
} | ||
|
||
return this; | ||
} | ||
} | ||
|
||
@Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) | ||
public java.lang.String token; | ||
|
||
@Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false) | ||
public java.lang.String tokenType; | ||
|
||
@Param(required = false) | ||
public java.util.List systemTags; | ||
|
||
@Param(required = false) | ||
public java.util.List userTags; | ||
|
||
@NonAPIParam | ||
public boolean isSuppressCredentialCheck = true; | ||
|
||
@Param(required = false) | ||
public String requestIp; | ||
|
||
|
||
private Result makeResult(ApiResult res) { | ||
Result ret = new Result(); | ||
if (res.error != null) { | ||
ret.error = res.error; | ||
return ret; | ||
} | ||
|
||
org.zstack.sdk.TokenIntrospectionResult value = res.getResult(org.zstack.sdk.TokenIntrospectionResult.class); | ||
ret.value = value == null ? new org.zstack.sdk.TokenIntrospectionResult() : value; | ||
|
||
return ret; | ||
} | ||
|
||
public Result call() { | ||
ApiResult res = ZSClient.call(this); | ||
return makeResult(res); | ||
} | ||
|
||
public void call(final Completion<Result> completion) { | ||
ZSClient.call(this, new InternalCompletion() { | ||
@Override | ||
public void complete(ApiResult res) { | ||
completion.complete(makeResult(res)); | ||
} | ||
}); | ||
} | ||
|
||
protected Map<String, Parameter> getParameterMap() { | ||
return parameterMap; | ||
} | ||
|
||
protected Map<String, Parameter> getNonAPIParameterMap() { | ||
return nonAPIParameterMap; | ||
} | ||
|
||
protected RestInfo getRestInfo() { | ||
RestInfo info = new RestInfo(); | ||
info.httpMethod = "POST"; | ||
info.path = "/token/introspect"; | ||
info.needSession = false; | ||
info.needPoll = false; | ||
info.parameterName = "params"; | ||
return info; | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
sdk/src/main/java/org/zstack/sdk/TokenIntrospectionResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.zstack.sdk; | ||
|
||
|
||
|
||
public class TokenIntrospectionResult { | ||
public boolean active; | ||
public void setActive(boolean active) { | ||
this.active = active; | ||
} | ||
public boolean getActive() { | ||
return this.active; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.