Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions integration/model_azure_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ type AzureIntegration struct {
// Flag determining whether SignalFx should also import metrics from Azure Monitor (when value is true) or only metadata (when value is false).
ImportAzureMonitor *bool `json:"importAzureMonitor,omitempty"`
// Azure ID of the Azure tenant. To learn how to get this ID, see the topic (https://docs.signalfx.com/en/latest/getting-started/send-data.html#connect-to-microsoft-azure)[Connect to Microsoft Azure] in the product documentation.
TenantId string `json:"tenantId,omitempty"`
NamedToken string `json:"namedToken,omitempty"`
TenantId string `json:"tenantId,omitempty"`
NamedToken string `json:"namedToken,omitempty"`
UseBatchApi *bool `json:"useBatchApi,omitempty"`
}

func (gcp *AzureIntegration) MarshalJSON() ([]byte, error) {
Expand Down
24 changes: 24 additions & 0 deletions integration/model_azure_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,30 @@ func TestUnmarshalAzureIntegrationWithImportAzureMonitorEmpty(t *testing.T) {
assert.Equal(t, (*bool)(nil), azure.ImportAzureMonitor, "ImportAzureMonitor does not match")
}

func TestUnmarshalAzureIntegrationWithUseBatchApiDisabled(t *testing.T) {
azure := AzureIntegration{}
err := json.Unmarshal([]byte(`{"useBatchApi":false}`), &azure)

assert.NoError(t, err, "Unexpected error unmarshalling integration")
assert.Equal(t, false, *azure.UseBatchApi, "UseBatchApi does not match")
}

func TestUnmarshalAzureIntegrationWithUseBatchApiEnabled(t *testing.T) {
azure := AzureIntegration{}
err := json.Unmarshal([]byte(`{"useBatchApi":true}`), &azure)

assert.NoError(t, err, "Unexpected error unmarshalling integration")
assert.Equal(t, true, *azure.UseBatchApi, "UseBatchApi does not match")
}

func TestUnmarshalAzureIntegrationWithUseBatchApiEmpty(t *testing.T) {
azure := AzureIntegration{}
err := json.Unmarshal([]byte(`{}`), &azure)

assert.NoError(t, err, "Unexpected error unmarshalling integration")
assert.Equal(t, (*bool)(nil), azure.UseBatchApi, "UseBatchApi does not match")
}

func newBoolPtr(val bool) *bool {
return &val
}