-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e03db3
commit 5855aa7
Showing
14 changed files
with
173 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/inexio/thola/core/request" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
readCMD.AddCommand(readAvailableComponentsCMD) | ||
} | ||
|
||
var readAvailableComponentsCMD = &cobra.Command{ | ||
Use: "available-components", | ||
Short: "Returns the available components for the device", | ||
Long: "Returns the available components for the device.", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
request := request.ReadAvailableComponentsRequest{ | ||
ReadRequest: getReadRequest(), | ||
} | ||
handleRequest(&request) | ||
}, | ||
} |
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
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,20 @@ | ||
package request | ||
|
||
// ReadAvailableComponentsRequest | ||
// | ||
// ReadAvailableComponentsRequest is a the request struct for the read available-components request. | ||
// | ||
// swagger:model | ||
type ReadAvailableComponentsRequest struct { | ||
ReadRequest | ||
} | ||
|
||
// ReadAvailableComponentsResponse | ||
// | ||
// ReadAvailableComponentsResponse is a the response struct for the read available-components response. | ||
// | ||
// swagger:model | ||
type ReadAvailableComponentsResponse struct { | ||
AvailableComponents []string `yaml:"availableComponents" json:"availableComponents" xml:"availableComponents"` | ||
ReadResponse | ||
} |
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 @@ | ||
// +build !client | ||
|
||
package request | ||
|
||
import ( | ||
"context" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func (r *ReadAvailableComponentsRequest) process(ctx context.Context) (Response, error) { | ||
com, err := GetCommunicator(ctx, r.BaseRequest) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "failed to get communicator") | ||
} | ||
|
||
return &ReadAvailableComponentsResponse{ | ||
AvailableComponents: com.GetAvailableComponents(), | ||
}, nil | ||
} |
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