-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from dream11/release-20230309
Release 20230309
- Loading branch information
Showing
17 changed files
with
471 additions
and
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,16 @@ | ||
package component | ||
|
||
// Component interface | ||
type Component struct { | ||
Name string `yaml:"name,omitempty" json:"name,omitempty"` | ||
Type string `yaml:"type,omitempty" json:"type,omitempty"` | ||
Version string `yaml:"version,omitempty" json:"version,omitempty"` | ||
Config interface{} `yaml:"config,omitempty" json:"config,omitempty"` | ||
Deployment interface{} `yaml:"deployment_config,omitempty" json:"deployment_config,omitempty"` | ||
Scaling interface{} `yaml:"scaling_config,omitempty" json:"scaling_config,omitempty"` | ||
Discovery interface{} `yaml:"discovery_config,omitempty" json:"discovery_config,omitempty"` | ||
DeploymentPlatformMapping interface{} `yaml:"behaviour,omitempty" json:"behaviour,omitempty"` | ||
type Operation struct { | ||
Name string `yaml:"name,omitempty" json:"name,omitempty"` | ||
Values interface{} `yaml:"values,omitempty" json:"values,omitempty"` | ||
} | ||
|
||
// Type interface | ||
type Type struct { | ||
Name string `yaml:"name,omitempty" json:"name,omitempty"` | ||
Version string `yaml:"version,omitempty" json:"version,omitempty"` | ||
TotalVersions int `yaml:"totalVersions,omitempty" json:"totalVersions,omitempty"` | ||
DeploymentTypes []string `yaml:"deployment_types,omitempty" json:"deployment_types,omitempty"` | ||
CreatedBy string `yaml:"createdBy,omitempty" json:"createdBy,omitempty"` | ||
UpdatedBy string `yaml:"updatedBy,omitempty" json:"updatedBy,omitempty"` | ||
CreatedAt string `yaml:"createdAt,omitempty" json:"createdAt,omitempty"` | ||
UpdatedAt string `yaml:"updatedAt,omitempty" json:"updatedAt,omitempty"` | ||
Config interface{} `yaml:"config,omitempty" json:"config,omitempty"` | ||
Deployment interface{} `yaml:"deployment_config,omitempty" json:"deployment_config,omitempty"` | ||
Scaling interface{} `yaml:"scaling_config,omitempty" json:"scaling_config,omitempty"` | ||
Discovery interface{} `yaml:"discovery_config,omitempty" json:"discovery_config,omitempty"` | ||
DeploymentPlatformMapping interface{} `yaml:"behaviour,omitempty" json:"behaviour,omitempty"` | ||
type Data struct { | ||
EnvName string `yaml:"env_name,omitempty" json:"env_name,omitempty"` | ||
ServiceName string `yaml:"service_name,omitempty" json:"service_name,omitempty"` | ||
Operations []Operation `yaml:"operations,omitempty" json:"operations,omitempty"` | ||
} | ||
|
||
// Exposed Config interface | ||
type ExposedConfig struct { | ||
Config string `yaml:"config,omitempty" json:"config,omitempty"` | ||
Mandatory bool `yaml:"mandatory,omitempty" json:"mandatory,omitempty"` | ||
DataType string `yaml:"data_type,omitempty" json:"data_type,omitempty"` | ||
} | ||
|
||
// ListTypeResponse interface | ||
type ListTypeResponse struct { | ||
Response []Type `yaml:"resp,omitempty" json:"resp,omitempty"` | ||
} | ||
|
||
// DetailComponentTypeResponse interface | ||
type ComponentDetailsResponse struct { | ||
Response ComponentDetails `yaml:"resp,omitempty" json:"resp,omitempty"` | ||
} | ||
|
||
// ComponentDetails interface | ||
type ComponentDetails struct { | ||
Details Type `yaml:"details,omitempty" json:"details,omitempty"` | ||
ExposedConfigs []ExposedConfig `yaml:"exposed_config,omitempty" json:"exposed_config,omitempty"` | ||
} | ||
|
||
// ListTypeResponse interface | ||
type DetailComponentResponse struct { | ||
Response Component `yaml:"resp,omitempty" json:"resp,omitempty"` | ||
type OperateComponentRequest struct { | ||
Data Data `yaml:"data,omitempty" json:"data,omitempty"` | ||
} |
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,58 @@ | ||
package componenttype | ||
|
||
// Component interface | ||
type Component struct { | ||
Name string `yaml:"name,omitempty" json:"name,omitempty"` | ||
Type string `yaml:"type,omitempty" json:"type,omitempty"` | ||
Version string `yaml:"version,omitempty" json:"version,omitempty"` | ||
Config interface{} `yaml:"config,omitempty" json:"config,omitempty"` | ||
Deployment interface{} `yaml:"deployment_config,omitempty" json:"deployment_config,omitempty"` | ||
Scaling interface{} `yaml:"scaling_config,omitempty" json:"scaling_config,omitempty"` | ||
Discovery interface{} `yaml:"discovery_config,omitempty" json:"discovery_config,omitempty"` | ||
DeploymentPlatformMapping interface{} `yaml:"behaviour,omitempty" json:"behaviour,omitempty"` | ||
} | ||
|
||
// Type interface | ||
type Type struct { | ||
Name string `yaml:"name,omitempty" json:"name,omitempty"` | ||
Version string `yaml:"version,omitempty" json:"version,omitempty"` | ||
TotalVersions int `yaml:"totalVersions,omitempty" json:"totalVersions,omitempty"` | ||
DeploymentTypes []string `yaml:"deployment_types,omitempty" json:"deployment_types,omitempty"` | ||
CreatedBy string `yaml:"createdBy,omitempty" json:"createdBy,omitempty"` | ||
UpdatedBy string `yaml:"updatedBy,omitempty" json:"updatedBy,omitempty"` | ||
CreatedAt string `yaml:"createdAt,omitempty" json:"createdAt,omitempty"` | ||
UpdatedAt string `yaml:"updatedAt,omitempty" json:"updatedAt,omitempty"` | ||
Config interface{} `yaml:"config,omitempty" json:"config,omitempty"` | ||
Deployment interface{} `yaml:"deployment_config,omitempty" json:"deployment_config,omitempty"` | ||
Scaling interface{} `yaml:"scaling_config,omitempty" json:"scaling_config,omitempty"` | ||
Discovery interface{} `yaml:"discovery_config,omitempty" json:"discovery_config,omitempty"` | ||
DeploymentPlatformMapping interface{} `yaml:"behaviour,omitempty" json:"behaviour,omitempty"` | ||
} | ||
|
||
// Exposed Config interface | ||
type ExposedConfig struct { | ||
Config string `yaml:"config,omitempty" json:"config,omitempty"` | ||
Mandatory bool `yaml:"mandatory,omitempty" json:"mandatory,omitempty"` | ||
DataType string `yaml:"data_type,omitempty" json:"data_type,omitempty"` | ||
} | ||
|
||
// ListTypeResponse interface | ||
type ListTypeResponse struct { | ||
Response []Type `yaml:"resp,omitempty" json:"resp,omitempty"` | ||
} | ||
|
||
// DetailComponentTypeResponse interface | ||
type ComponentDetailsResponse struct { | ||
Response ComponentDetails `yaml:"resp,omitempty" json:"resp,omitempty"` | ||
} | ||
|
||
// ComponentDetails interface | ||
type ComponentDetails struct { | ||
Details Type `yaml:"details,omitempty" json:"details,omitempty"` | ||
ExposedConfigs []ExposedConfig `yaml:"exposed_config,omitempty" json:"exposed_config,omitempty"` | ||
} | ||
|
||
// ListTypeResponse interface | ||
type DetailComponentResponse struct { | ||
Response Component `yaml:"resp,omitempty" json:"resp,omitempty"` | ||
} |
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,11 @@ | ||
package operation | ||
|
||
type Operation struct { | ||
Name string `yaml:"name,omitempty" json:"name,omitempty"` | ||
Description string `yaml:"description,omitempty" json:"description,omitempty"` | ||
InputSchema interface{} `yaml:"inputSchema,omitempty" json:"inputSchema,omitempty"` | ||
} | ||
|
||
type ListOperation struct { | ||
Response []Operation `yaml:"resp,omitempty" json:"resp,omitempty"` | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package backend | ||
|
||
import ( | ||
"path" | ||
|
||
"github.com/dream11/odin/api/component" | ||
) | ||
|
||
type Component struct{} | ||
|
||
func (c *Component) OperateComponent(componentName string, data component.OperateComponentRequest) { | ||
client := newStreamingApiClient() | ||
client.Headers["Command-Verb"] = "operate" | ||
response := client.streamWithRetry(path.Join("component", componentName, "operate"), "PUT", data) | ||
response.Process(true) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package backend | ||
|
||
import ( | ||
"encoding/json" | ||
"path" | ||
|
||
operationapi "github.com/dream11/odin/api/operation" | ||
) | ||
|
||
type Operation struct{} | ||
|
||
func (o *Operation) ListOperations(componentTypeName string) ([]operationapi.Operation, error) { | ||
client := newApiClient() | ||
response := client.actionWithRetry(path.Join("component", componentTypeName, "operate"), "GET", nil) | ||
response.Process(true) // process response and exit if error | ||
var listResponse operationapi.ListOperation | ||
err := json.Unmarshal(response.Body, &listResponse) | ||
return listResponse.Response, err | ||
} |
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.