-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugins): Add remote extensions field to a plugin info release (#…
…917) * feat(plugins): Add remote extensions field to plugin info * chore(plugins): Addressing comments
- Loading branch information
Showing
4 changed files
with
121 additions
and
1 deletion.
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
73 changes: 73 additions & 0 deletions
73
...ore/src/main/java/com/netflix/spinnaker/front50/model/plugins/remote/RemoteExtension.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,73 @@ | ||
package com.netflix.spinnaker.front50.model.plugins.remote; | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import com.netflix.spinnaker.front50.model.plugins.PluginInfo; | ||
import com.netflix.spinnaker.front50.model.plugins.remote.stage.StageRemoteExtensionConfig; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.validator.constraints.URL; | ||
|
||
/** | ||
* A Spinnaker plugin's remote extension configuration. | ||
* | ||
* <p>This model is used by Spinnaker to determine which extension points and services require | ||
* remote extension point configuration. | ||
* | ||
* <p>The plugin release {@link PluginInfo.Release#requires} field is used to inform Spinnaker which | ||
* service to use in configuring the extension point {@link #type} and additionally if the remote | ||
* extension is compatible with the running version of the Spinnaker service. | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
public class RemoteExtension { | ||
|
||
/** | ||
* The remote extension type. The remote extension is configured in the service that implements | ||
* this extension type. | ||
*/ | ||
@Nonnull private String type; | ||
|
||
/** Identifier of the remote extension. Used for tracing. */ | ||
@Nonnull private String id; | ||
|
||
/** | ||
* Outbound transport configuration for the remote extension point; the protocol to address it | ||
* with and the necessary configuration. | ||
*/ | ||
@Nonnull private RemoteExtensionTransport transport = new RemoteExtensionTransport(); | ||
|
||
/** Configures the remote extension point. */ | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.EXTERNAL_PROPERTY, | ||
property = "type") | ||
@JsonSubTypes({@JsonSubTypes.Type(value = StageRemoteExtensionConfig.class, name = "stage")}) | ||
@Nullable | ||
public RemoteExtensionConfig config; | ||
|
||
/** Root remote extension configuration type. */ | ||
public interface RemoteExtensionConfig {} | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public static class RemoteExtensionTransport { | ||
|
||
@Nonnull private Http http = new Http(); | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public static class Http { | ||
|
||
/** URL for remote extension invocation. */ | ||
@URL @Nonnull private String url; | ||
|
||
/** A placeholder for misc. configuration for the underlying HTTP client. */ | ||
@Nonnull private Map<String, Object> config = new HashMap<>(); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../com/netflix/spinnaker/front50/model/plugins/remote/stage/StageRemoteExtensionConfig.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,25 @@ | ||
package com.netflix.spinnaker.front50.model.plugins.remote.stage; | ||
|
||
import com.netflix.spinnaker.front50.model.plugins.remote.RemoteExtension.RemoteExtensionConfig; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import javax.annotation.Nonnull; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public class StageRemoteExtensionConfig implements RemoteExtensionConfig { | ||
|
||
/** Represents stage type. */ | ||
@Nonnull private String type; | ||
|
||
/** Label to use on the Spinnaker UI while configuring pipeline stages. */ | ||
@Nonnull private String label; | ||
|
||
/** Description to use on the Spinnaker UI while configuring pipeline stages. */ | ||
@Nonnull private String description; | ||
|
||
/** Map of stage parameter names and default values. */ | ||
@Nonnull private Map<String, Object> parameters = new HashMap<>(); | ||
} |
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