-
Notifications
You must be signed in to change notification settings - Fork 52
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
hc-github-team-tf-azure
committed
Mar 1, 2024
1 parent
ddac485
commit ce625d1
Showing
223 changed files
with
15,546 additions
and
0 deletions.
There are no files selected for viewing
111 changes: 111 additions & 0 deletions
111
resource-manager/batch/2024-02-01/application/README.md
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,111 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/batch/2024-02-01/application` Documentation | ||
|
||
The `application` SDK allows for interaction with the Azure Resource Manager Service `batch` (API Version `2024-02-01`). | ||
|
||
This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). | ||
|
||
### Import Path | ||
|
||
```go | ||
import "github.com/hashicorp/go-azure-sdk/resource-manager/batch/2024-02-01/application" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := application.NewApplicationClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `ApplicationClient.Create` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") | ||
|
||
payload := application.Application{ | ||
// ... | ||
} | ||
|
||
|
||
read, err := client.Create(ctx, id, payload) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `ApplicationClient.Delete` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") | ||
|
||
read, err := client.Delete(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `ApplicationClient.Get` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") | ||
|
||
read, err := client.Get(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `ApplicationClient.List` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := application.NewBatchAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue") | ||
|
||
// alternatively `client.List(ctx, id, application.DefaultListOperationOptions())` can be used to do batched pagination | ||
items, err := client.ListComplete(ctx, id, application.DefaultListOperationOptions()) | ||
if err != nil { | ||
// handle the error | ||
} | ||
for _, item := range items { | ||
// do something | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `ApplicationClient.Update` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := application.NewApplicationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "batchAccountValue", "applicationValue") | ||
|
||
payload := application.Application{ | ||
// ... | ||
} | ||
|
||
|
||
read, err := client.Update(ctx, id, payload) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` |
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,26 @@ | ||
package application | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" | ||
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type ApplicationClient struct { | ||
Client *resourcemanager.Client | ||
} | ||
|
||
func NewApplicationClientWithBaseURI(sdkApi sdkEnv.Api) (*ApplicationClient, error) { | ||
client, err := resourcemanager.NewResourceManagerClient(sdkApi, "application", defaultApiVersion) | ||
if err != nil { | ||
return nil, fmt.Errorf("instantiating ApplicationClient: %+v", err) | ||
} | ||
|
||
return &ApplicationClient{ | ||
Client: client, | ||
}, nil | ||
} |
134 changes: 134 additions & 0 deletions
134
resource-manager/batch/2024-02-01/application/id_application.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,134 @@ | ||
package application | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" | ||
) | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
var _ resourceids.ResourceId = &ApplicationId{} | ||
|
||
// ApplicationId is a struct representing the Resource ID for a Application | ||
type ApplicationId struct { | ||
SubscriptionId string | ||
ResourceGroupName string | ||
BatchAccountName string | ||
ApplicationName string | ||
} | ||
|
||
// NewApplicationID returns a new ApplicationId struct | ||
func NewApplicationID(subscriptionId string, resourceGroupName string, batchAccountName string, applicationName string) ApplicationId { | ||
return ApplicationId{ | ||
SubscriptionId: subscriptionId, | ||
ResourceGroupName: resourceGroupName, | ||
BatchAccountName: batchAccountName, | ||
ApplicationName: applicationName, | ||
} | ||
} | ||
|
||
// ParseApplicationID parses 'input' into a ApplicationId | ||
func ParseApplicationID(input string) (*ApplicationId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&ApplicationId{}) | ||
parsed, err := parser.Parse(input, false) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := ApplicationId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
// ParseApplicationIDInsensitively parses 'input' case-insensitively into a ApplicationId | ||
// note: this method should only be used for API response data and not user input | ||
func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(&ApplicationId{}) | ||
parsed, err := parser.Parse(input, true) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := ApplicationId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { | ||
var ok bool | ||
|
||
if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) | ||
} | ||
|
||
if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) | ||
} | ||
|
||
if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) | ||
} | ||
|
||
if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ValidateApplicationID checks that 'input' can be parsed as a Application ID | ||
func ValidateApplicationID(input interface{}, key string) (warnings []string, errors []error) { | ||
v, ok := input.(string) | ||
if !ok { | ||
errors = append(errors, fmt.Errorf("expected %q to be a string", key)) | ||
return | ||
} | ||
|
||
if _, err := ParseApplicationID(v); err != nil { | ||
errors = append(errors, err) | ||
} | ||
|
||
return | ||
} | ||
|
||
// ID returns the formatted Application ID | ||
func (id ApplicationId) ID() string { | ||
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Batch/batchAccounts/%s/applications/%s" | ||
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.BatchAccountName, id.ApplicationName) | ||
} | ||
|
||
// Segments returns a slice of Resource ID Segments which comprise this Application ID | ||
func (id ApplicationId) Segments() []resourceids.Segment { | ||
return []resourceids.Segment{ | ||
resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), | ||
resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), | ||
resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), | ||
resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), | ||
resourceids.StaticSegment("staticProviders", "providers", "providers"), | ||
resourceids.ResourceProviderSegment("staticMicrosoftBatch", "Microsoft.Batch", "Microsoft.Batch"), | ||
resourceids.StaticSegment("staticBatchAccounts", "batchAccounts", "batchAccounts"), | ||
resourceids.UserSpecifiedSegment("batchAccountName", "batchAccountValue"), | ||
resourceids.StaticSegment("staticApplications", "applications", "applications"), | ||
resourceids.UserSpecifiedSegment("applicationName", "applicationValue"), | ||
} | ||
} | ||
|
||
// String returns a human-readable description of this Application ID | ||
func (id ApplicationId) String() string { | ||
components := []string{ | ||
fmt.Sprintf("Subscription: %q", id.SubscriptionId), | ||
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), | ||
fmt.Sprintf("Batch Account Name: %q", id.BatchAccountName), | ||
fmt.Sprintf("Application Name: %q", id.ApplicationName), | ||
} | ||
return fmt.Sprintf("Application (%s)", strings.Join(components, "\n")) | ||
} |
Oops, something went wrong.