-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use structure output for provision (#2887)
* use structure output for provision * use ux component * test * recordings update * more recordings * final fix * fix test * cl
- Loading branch information
Showing
15 changed files
with
2,579 additions
and
2,533 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
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,34 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package ux | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/azure/azure-dev/cli/azd/pkg/output" | ||
"github.com/fatih/color" | ||
) | ||
|
||
type EnvironmentDetails struct { | ||
Subscription string | ||
Location string | ||
} | ||
|
||
func (t *EnvironmentDetails) ToString(currentIndentation string) string { | ||
var location string | ||
if t.Location != "" { | ||
location = fmt.Sprintf("\nLocation: %s", color.BlueString(t.Location)) | ||
} | ||
return fmt.Sprintf( | ||
"Subscription: %s%s\n", | ||
color.BlueString(t.Subscription), | ||
location, | ||
) | ||
} | ||
|
||
func (t *EnvironmentDetails) MarshalJSON() ([]byte, error) { | ||
// reusing the same envelope from console messages | ||
return json.Marshal(output.EventForMessage(fmt.Sprintf("\n%s\n%s\n", t.Subscription, t.Location))) | ||
} |
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 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package ux | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/azure/azure-dev/cli/azd/test/snapshot" | ||
) | ||
|
||
func TestEnvironmentDetails(t *testing.T) { | ||
pp := &EnvironmentDetails{ | ||
Subscription: "Foo (bar)", | ||
Location: "Somewhere cool", | ||
} | ||
|
||
output := pp.ToString(" ") | ||
snapshot.SnapshotT(t, output) | ||
} |
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,3 @@ | ||
Subscription: Foo (bar) | ||
Location: Somewhere cool | ||
|
1,612 changes: 542 additions & 1,070 deletions
1,612
cli/azd/test/functional/testdata/recordings/Test_CLI_InfraBicepParam.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
693 changes: 404 additions & 289 deletions
693
cli/azd/test/functional/testdata/recordings/Test_CLI_InfraCreateAndDelete.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
814 changes: 491 additions & 323 deletions
814
cli/azd/test/functional/testdata/recordings/Test_CLI_InfraCreateAndDeleteUpperCase.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
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
1,043 changes: 560 additions & 483 deletions
1,043
cli/azd/test/functional/testdata/recordings/Test_CLI_Up_Down_ContainerApp.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
663 changes: 391 additions & 272 deletions
663
cli/azd/test/functional/testdata/recordings/Test_StorageBlobClient.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.