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 #12785 from terraform-providers/f/signalr-embedded…
…-sdk SignalR: refactoring to use an Embedded SDK
- Loading branch information
Showing
75 changed files
with
3,694 additions
and
3,995 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 was deleted.
Oops, something went wrong.
112 changes: 0 additions & 112 deletions
112
azurerm/internal/services/signalr/parse/service_test.go
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package signalr | ||
|
||
import "github.com/Azure/go-autorest/autorest" | ||
|
||
type SignalRClient struct { | ||
Client autorest.Client | ||
baseUri string | ||
} | ||
|
||
func NewSignalRClientWithBaseURI(endpoint string) SignalRClient { | ||
return SignalRClient{ | ||
Client: autorest.NewClientWithUserAgent(userAgent()), | ||
baseUri: endpoint, | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
azurerm/internal/services/signalr/sdk/signalr/constants.go
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,70 @@ | ||
package signalr | ||
|
||
type ACLAction string | ||
|
||
const ( | ||
ACLActionAllow ACLAction = "Allow" | ||
ACLActionDeny ACLAction = "Deny" | ||
) | ||
|
||
type FeatureFlags string | ||
|
||
const ( | ||
FeatureFlagsEnableConnectivityLogs FeatureFlags = "EnableConnectivityLogs" | ||
FeatureFlagsEnableMessagingLogs FeatureFlags = "EnableMessagingLogs" | ||
FeatureFlagsServiceMode FeatureFlags = "ServiceMode" | ||
) | ||
|
||
type KeyType string | ||
|
||
const ( | ||
KeyTypePrimary KeyType = "Primary" | ||
KeyTypeSecondary KeyType = "Secondary" | ||
) | ||
|
||
type PrivateLinkServiceConnectionStatus string | ||
|
||
const ( | ||
PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" | ||
PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" | ||
PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" | ||
PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" | ||
) | ||
|
||
type ProvisioningState string | ||
|
||
const ( | ||
ProvisioningStateCanceled ProvisioningState = "Canceled" | ||
ProvisioningStateCreating ProvisioningState = "Creating" | ||
ProvisioningStateDeleting ProvisioningState = "Deleting" | ||
ProvisioningStateFailed ProvisioningState = "Failed" | ||
ProvisioningStateMoving ProvisioningState = "Moving" | ||
ProvisioningStateRunning ProvisioningState = "Running" | ||
ProvisioningStateSucceeded ProvisioningState = "Succeeded" | ||
ProvisioningStateUnknown ProvisioningState = "Unknown" | ||
ProvisioningStateUpdating ProvisioningState = "Updating" | ||
) | ||
|
||
type ServiceKind string | ||
|
||
const ( | ||
ServiceKindRawWebSockets ServiceKind = "RawWebSockets" | ||
ServiceKindSignalR ServiceKind = "SignalR" | ||
) | ||
|
||
type SignalRRequestType string | ||
|
||
const ( | ||
SignalRRequestTypeClientConnection SignalRRequestType = "ClientConnection" | ||
SignalRRequestTypeRESTAPI SignalRRequestType = "RESTAPI" | ||
SignalRRequestTypeServerConnection SignalRRequestType = "ServerConnection" | ||
) | ||
|
||
type SignalRSkuTier string | ||
|
||
const ( | ||
SignalRSkuTierBasic SignalRSkuTier = "Basic" | ||
SignalRSkuTierFree SignalRSkuTier = "Free" | ||
SignalRSkuTierPremium SignalRSkuTier = "Premium" | ||
SignalRSkuTierStandard SignalRSkuTier = "Standard" | ||
) |
95 changes: 95 additions & 0 deletions
95
azurerm/internal/services/signalr/sdk/signalr/id_location.go
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,95 @@ | ||
package signalr | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" | ||
) | ||
|
||
type LocationId struct { | ||
SubscriptionId string | ||
Name string | ||
} | ||
|
||
func NewLocationID(subscriptionId, name string) LocationId { | ||
return LocationId{ | ||
SubscriptionId: subscriptionId, | ||
Name: name, | ||
} | ||
} | ||
|
||
func (id LocationId) String() string { | ||
segments := []string{ | ||
fmt.Sprintf("Name %q", id.Name), | ||
} | ||
segmentsStr := strings.Join(segments, " / ") | ||
return fmt.Sprintf("%s: (%s)", "Location", segmentsStr) | ||
} | ||
|
||
func (id LocationId) ID() string { | ||
fmtString := "/subscriptions/%s/providers/Microsoft.SignalRService/locations/%s" | ||
return fmt.Sprintf(fmtString, id.SubscriptionId, id.Name) | ||
} | ||
|
||
// ParseLocationID parses a Location ID into an LocationId struct | ||
func ParseLocationID(input string) (*LocationId, error) { | ||
id, err := resourceids.ParseAzureResourceID(input) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
resourceId := LocationId{ | ||
SubscriptionId: id.SubscriptionID, | ||
} | ||
|
||
if resourceId.SubscriptionId == "" { | ||
return nil, fmt.Errorf("ID was missing the 'subscriptions' element") | ||
} | ||
|
||
if resourceId.Name, err = id.PopSegment("locations"); err != nil { | ||
return nil, err | ||
} | ||
|
||
if err := id.ValidateNoEmptySegments(input); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &resourceId, nil | ||
} | ||
|
||
// ParseLocationIDInsensitively parses an Location ID into an LocationId struct, insensitively | ||
// This should only be used to parse an ID for rewriting to a consistent casing, | ||
// the ParseLocationID method should be used instead for validation etc. | ||
func ParseLocationIDInsensitively(input string) (*LocationId, error) { | ||
id, err := resourceids.ParseAzureResourceID(input) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
resourceId := LocationId{ | ||
SubscriptionId: id.SubscriptionID, | ||
} | ||
|
||
if resourceId.SubscriptionId == "" { | ||
return nil, fmt.Errorf("ID was missing the 'subscriptions' element") | ||
} | ||
|
||
// find the correct casing for the 'locations' segment | ||
locationsKey := "locations" | ||
for key := range id.Path { | ||
if strings.EqualFold(key, locationsKey) { | ||
locationsKey = key | ||
break | ||
} | ||
} | ||
if resourceId.Name, err = id.PopSegment(locationsKey); err != nil { | ||
return nil, err | ||
} | ||
|
||
if err := id.ValidateNoEmptySegments(input); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &resourceId, nil | ||
} |
Oops, something went wrong.