Skip to content

Commit

Permalink
v0.3.1
Browse files Browse the repository at this point in the history
* Added multiple content api commands

* Updating tests

* Adding content commands and updating build/release pipeline to include macOS signing
  • Loading branch information
wizedkyle authored Apr 11, 2021
1 parent 487236a commit c9be153
Show file tree
Hide file tree
Showing 19 changed files with 927 additions and 25 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/config.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
source = ["./sumocli"]
bundle_id = "com.thepublicclouds.sumocli"

apple_id {
username = "@env:AC_USERNAME"
password = "@env:AC_PASSWORD"
}

sign {
application_identity = "08C9A4B04024CDEF2C5D93593710C60591FB4614"
}

dmg {
output_path = "sumocli.dmg"
volume_name = "sumocli"
}

zip {
output_path = "sumocli-macos-arm64.zip"
}
44 changes: 35 additions & 9 deletions .github/workflows/sumocli-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ jobs:
-X 'github.com/wizedkyle/sumocli/internal/build.Build=$build' `
-X 'github.com/wizedkyle/sumocli/internal/build.Date=$time'" `
./cmd/sumocli
env:
GOOS: darwin
GOARCH: amd64
- name: Zip Releases
run: |
zip -r sumocli-macos-amd64.zip sumocli
Expand Down Expand Up @@ -181,18 +184,41 @@ jobs:
- name: Download Dependencies
run: go mod download
- name: Build Sumocli
shell: pwsh
shell: bash
run: |
$build = $Env:GITHUB_RUN_NUMBER
$time = Get-Date
go build GOOS=darwin GOARCH=arm64 -ldflags `
"-X 'github.com/wizedkyle/sumocli/internal/build.Version=${{ needs.create_semver.outputs.semvertag }}' `
-X 'github.com/wizedkyle/sumocli/internal/build.Build=$build' `
-X 'github.com/wizedkyle/sumocli/internal/build.Date=$time'" `
time=$(date)
go build -ldflags \
"-X 'github.com/wizedkyle/sumocli/internal/build.Version=${{ needs.create_semver.outputs.semvertag }}' \
-X 'github.com/wizedkyle/sumocli/internal/build.Build=$GITHUB_RUN_NUMBER' \
-X 'github.com/wizedkyle/sumocli/internal/build.Date=$time'" \
./cmd/sumocli
- name: Zip Releases
env:
GOOS: darwin
GOARCH: arm64
- name: Install gon
shell: bash
run: |
zip -r sumocli-macos-arm64.zip sumocli
brew tap mitchellh/gon
brew install mitchellh/gon/gon
- name: Sign and Notarize Binary
shell: bash
run: |
# Install signing certificate
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
security create-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P $P12_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# Sign macOS build
gon .github/workflows/config.hcl
env:
APPLE_DEV_CERT: ${{ secrets.APPLE_DEV_CERT }}
APPLE_DEV_CERT_PASSWORD: ${{ secrets.APPLE_DEV_CERT_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
- name: Upload macOS Release Asset
uses: actions/upload-release-asset@v1
env:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dist/
sumocli.exe
sumocli.exedist/
294 changes: 294 additions & 0 deletions api/content.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
package api

type DashboardSyncDefinition struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
DetailLevel int `json:"detailLevel"`
Properties string `json:"properties"`
Panels []reportPanelSyncDefinition `json:"panels"`
Filters []filtersSyncDefinition `json:"filters"`
}

type FolderSyncDefinition struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Children []contentSyncDefinition `json:"children"`
}

type GetContentResponse struct {
CreatedAt string `json:"createdAt"`
CreatedBy string `json:"createdBy"`
ModifiedAt string `json:"modifiedAt"`
ModifiedBy string `json:"modifiedBy"`
Id string `json:"id"`
Name string `json:"name"`
ItemType string `json:"itemType"`
ParentId string `json:"parentId"`
Permissions []string `json:"permissions"`
}

type GetPathResponse struct {
Path string `json:"path"`
}

type MetricsSavedSearchSyncDefinition struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
TimeRange timeRangeDefinition `json:"timeRange"`
LogQuery string `json:"logQuery"`
MetricsQueries []metricsQueriesDefinition `json:"metricsQueries"`
DesiredQuantizationInSecs int `json:"desiredQuantizationInSecs"`
Properties string `json:"properties"`
}

type MetricsSearchSyncDefinition struct {
Type string `json:"type"`
Name string `json:"name"`
TimeRange timeRangeDefinition `json:"timeRange"`
Description string `json:"description"`
Queries []queries `json:"queries"`
VisualSettings string `json:"visualSettings"`
}

type LookupTableSyncDefinition struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Fields []fields `json:"fields"`
PrimaryKeys []string `json:"primaryKeys"`
TTL int `json:"ttl"`
SizeLimitAction string `json:"sizeLimitAction"`
}

type MewboardSyncDefinition struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
Title string `json:"title"`
RootPanel rootPanelDefinition `json:"rootPanel"`
Theme string `json:"theme"`
TopologyLabelMap topologyLabelMap `json:"topologyLabelMap"`
RefreshInterval int `json:"refreshInterval"`
TimeRange timeRangeDefinition `json:"timeRange"`
Layout layout `json:"layout"`
Panels panelsDefinition `json:"panels"`
Variables variablesDefinition `json:"variables"`
ColoringRules coloringRulesDefinition `json:"coloringRules"`
}

type ResponseType struct {
Type string `json:"type"`
}

type SavedSearchWithScheduleSyncDefinition struct {
Type string `json:"type"`
Name string `json:"name"`
Search search `json:"search"`
SearchSchedule searchSchedule `json:"searchSchedule"`
Description string `json:"description"`
}

type StartExportResponse struct {
Id string `json:"id"`
}

type ExportStatusResponse struct {
Status string `json:"status"`
StatusMessage string `json:"statusMessage,omitempty"`
Error exportError `json:"error,omitempty"`
}

type autoComplete struct {
AutoCompleteType string `json:"autoCompleteType"`
AutoCompleteKey string `json:"autoCompleteKey"`
AutoCompleteValues []autoCompleteValues `json:"autoCompleteValues"`
LookupFileName string `json:"lookupFileName"`
LookupLabelColumn string `json:"lookupLabelColumn"`
LookupValueColumn string `json:"lookupValueColumn"`
}

type autoCompleteValues struct {
Label string `json:"label"`
Value string `json:"value"`
}

type autoParsingInfo struct {
Mode string `json:"mode"`
}

type coloringRulesDefinition struct {
Scope string `json:"scope"`
SingleSeriesAggregateFunction string `json:"singleSeriesAggregateFunction"`
MultipleSeriesAggregateFunction string `json:"multipleSeriesAggregateFunction"`
ColorThresholds colorThresholds `json:"colorThresholds"`
}

type colorThresholds struct {
Color string `json:"color"`
Min int `json:"min"`
Max int `json:"max"`
}

type contentSyncDefinition struct {
Type string `json:"type"`
Name string `json:"name"`
}

type exportError struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Detail string `json:"detail,omitempty"`
}

type fields struct {
FieldName string `json:"fieldName"`
FieldType string `json:"fieldType"`
}

type filtersSyncDefinition struct {
FieldName string `json:"fieldName"`
Label string `json:"label"`
DefaultValue string `json:"defaultValue"`
FilterType string `json:"filterType"`
Properties string `json:"properties"`
PanelIds []string `json:"panelIds"`
}

type layout struct {
LayoutType string `json:"layouType"`
LayoutStructures []layoutStructure `json:"layoutStructures"`
}

type layoutStructure struct {
Key string `json:"key"`
Structure string `json:"structure"`
}

type metricsQueriesDefinition struct {
Query string `json:"query"`
RowId string `json:"rowId"`
}

type panelsDefinition struct {
Id string `json:"id"`
Key string `json:"key"`
Title string `json:"title"`
visualSettings string `json:"visualSettings"`
KeepVisualSettingsConsistentWithParent bool `json:"keepVisualSettingsConsistentWithParent"`
PanelType string `json:"panelType"`
}

type queries struct {
QueryString string `json:"queryString"`
QueryType string `json:"queryType"`
QueryKey string `json:"queryKey"`
}

type queryParameters struct {
Name string `json:"name"`
Label string `json:"label"`
Description string `json:"description"`
DataType string `json:"dataType"`
Value string `json:"value"`
AutoComplete autoComplete `json:"autoComplete"`
}

type rootPanelDefinition struct {
Id string `json:"id"`
Key string `json:"key"`
Title string `json:"title"`
VisualSettings string `json:"visualSettings"`
KeepVisualSettingsConsistentWithParent bool `json:"keepVisualSettingsConsistentWithParent"`
PanelType string `json:"panelType"`
Layout layout `json:"layout"`
Panels []panelsDefinition `json:"panels"`
Variables []variablesDefinition `json:"variables"`
ColoringRules []coloringRulesDefinition `json:"coloringRules"`
}

type reportPanelSyncDefinition struct {
Name string `json:"name"`
ViewerType string `json:"viewerType"`
DetailLevel int `json:"detailLevel"`
QueryString string `json:"queryString"`
MetricsQueries []metricsQueriesDefinition `json:"metricsQueries"`
TimeRange timeRangeDefinition `json:"timeRange"`
X int `json:"x"`
Y int `json:"Y"`
Width int `json:"width"`
Height int `json:"height"`
Properties string `json:"properties"`
Id string `json:"id"`
DesiredQuantizationInSecs int `json:"desiredQuantizationInSecs"`
QueryParameters []queryParameters `json:"queryParameters"`
AutoParsingInfo autoParsingInfo `json:"autoParsingInfo"`
}

type search struct {
QueryText string `json:"queryText"`
DefaultTimeRange string `json:"defaultTimeRange"`
ByReceiptTime bool `json:"byReceiptTime"`
ViewName string `json:"viewName"`
ViewStartTime string `json:"viewStartTime"`
QueryParameters []queryParameters `json:"queryParameters"`
ParsingMode string `json:"parsingMode"`
}

type searchSchedule struct {
CronExpression string `json:"cronExpression"`
DisplayableTimeRange string `json:"displayableTimeRange"`
ParseableTimeRange timeRangeDefinition `json:"parseableTimeRange"`
TimeZone string `json:"timeZone"`
Threshold searchScheduleThreshold `json:"threshold"`
Notification searchScheduleNotification `json:"notification"`
ScheduleType string `json:"scheduleType"`
MuteErrorEmails bool `json:"muteErrorEmails"`
Parameters []searchScheduleParamters `json:"parameters"`
}

type searchScheduleNotification struct {
TaskType string `json:"taskType"`
}

type searchScheduleParamters struct {
Name string `json:"name"`
Value string `json:"value"`
}

type searchScheduleThreshold struct {
ThresholdType string `json:"thresholdType"`
Operator string `json:"operator"`
Count int `json:"count"`
}

type timeRangeDefinition struct {
Type string `json:"type"`
From timeRangeFromDefinition `json:"from"`
}

type timeRangeFromDefinition struct {
Type string `json:"type"`
RelativeTime string `json:"relativeTime"`
}

type topologyLabelMap struct {
Service []string `json:"service"`
}

type variablesDefinition struct {
Id string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
DefaultValue string `json:"defaultValue"`
SourceDefinition variablesSourceDefinition `json:"sourceDefinition"`
AllowMultiSelect bool `json:"allowMultiSelect"`
IncludeAllOption bool `json:"includeAllOption"`
HideFromUI bool `json:"hideFromUI"`
}

type variablesSourceDefinition struct {
VariableSourceType string `json:"variableSourceType"`
}
9 changes: 9 additions & 0 deletions api/lookup-tables.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package api

type GetLookupTableResponse struct {
CreatedAt string `json:"createdAt"`
CreatedBy string `json:"createdBy"`
ModifiedAt string `json:"modifiedAt"`
ModifiedBy string `json:"modifiedBy"`
Description string `json:"description"`
}
Loading

0 comments on commit c9be153

Please sign in to comment.