-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
f548458
commit a2faf47
Showing
14 changed files
with
1,021 additions
and
544 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
21 changes: 3 additions & 18 deletions
21
azurerm/internal/services/machinelearning/client/client.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 |
---|---|---|
@@ -1,35 +1,20 @@ | ||
package machinelearning | ||
package client | ||
|
||
import ( | ||
"github.com/Azure/azure-sdk-for-go/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common" | ||
) | ||
|
||
type Client struct { | ||
WorkspacesClient *machinelearningservices.WorkspacesClient | ||
VirtualMachineSizesClient *machinelearningservices.VirtualMachineSizesClient | ||
MachineLearningComputeClient *machinelearningservices.MachineLearningComputeClient | ||
UsagesClient *machinelearningservices.UsagesClient | ||
WorkspacesClient *machinelearningservices.WorkspacesClient | ||
} | ||
|
||
func NewClient(o *common.ClientOptions) *Client { | ||
|
||
WorkspacesClient := machinelearningservices.NewWorkspacesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) | ||
o.ConfigureClient(&WorkspacesClient.Client, o.ResourceManagerAuthorizer) | ||
|
||
VirtualMachineSizesClient := machinelearningservices.NewVirtualMachineSizesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) | ||
o.ConfigureClient(&VirtualMachineSizesClient.Client, o.ResourceManagerAuthorizer) | ||
|
||
MachineLearningComputeClient := machinelearningservices.NewMachineLearningComputeClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) | ||
o.ConfigureClient(&MachineLearningComputeClient.Client, o.ResourceManagerAuthorizer) | ||
|
||
UsagesClient := machinelearningservices.NewUsagesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) | ||
o.ConfigureClient(&UsagesClient.Client, o.ResourceManagerAuthorizer) | ||
|
||
return &Client{ | ||
WorkspacesClient: &WorkspacesClient, | ||
VirtualMachineSizesClient: &VirtualMachineSizesClient, | ||
MachineLearningComputeClient: &MachineLearningComputeClient, | ||
UsagesClient: &UsagesClient, | ||
WorkspacesClient: &WorkspacesClient, | ||
} | ||
} |
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
57 changes: 57 additions & 0 deletions
57
azurerm/internal/services/machinelearning/parse/workspace.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,57 @@ | ||
package parse | ||
|
||
import ( | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" | ||
accountParser "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storage/parsers" | ||
) | ||
|
||
type WorkspaceId struct { | ||
Name string | ||
ResourceGroup string | ||
} | ||
|
||
func WorkspaceID(input string) (*WorkspaceId, error) { | ||
id, err := azure.ParseAzureResourceID(input) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
workspace := WorkspaceId{ | ||
ResourceGroup: id.ResourceGroup, | ||
} | ||
|
||
if workspace.Name, err = id.PopSegment("workspaces"); err != nil { | ||
return nil, err | ||
} | ||
|
||
if err := id.ValidateNoEmptySegments(input); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &workspace, nil | ||
} | ||
|
||
// TODO -- use parse function "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storage/parsers".ParseAccountID | ||
// when issue https://github.com/Azure/azure-rest-api-specs/issues/8323 is addressed | ||
func AccountIDCaseDiffSuppress(input string) (*accountParser.AccountID, error) { | ||
id, err := azure.ParseAzureResourceID(input) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
account := accountParser.AccountID{ | ||
ResourceGroup: id.ResourceGroup, | ||
} | ||
|
||
if account.Name, err = id.PopSegment("storageAccounts"); err != nil { | ||
if account.Name, err = id.PopSegment("storageaccounts"); err != nil { | ||
return nil, err | ||
} | ||
} | ||
|
||
if err := id.ValidateNoEmptySegments(input); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &account, nil | ||
} |
Oops, something went wrong.