-
Notifications
You must be signed in to change notification settings - Fork 46
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
Jan 12, 2024
1 parent
acfa856
commit a2f1687
Showing
66 changed files
with
5,436 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package v2021_07_01_preview | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
import ( | ||
"github.com/Azure/go-autorest/autorest" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-07-01-preview/privateendpointconnections" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-07-01-preview/privatelinkresources" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-07-01-preview/privatelinkscopedresources" | ||
"github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-07-01-preview/privatelinkscopesapis" | ||
) | ||
|
||
type Client struct { | ||
PrivateEndpointConnections *privateendpointconnections.PrivateEndpointConnectionsClient | ||
PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient | ||
PrivateLinkScopedResources *privatelinkscopedresources.PrivateLinkScopedResourcesClient | ||
PrivateLinkScopesAPIs *privatelinkscopesapis.PrivateLinkScopesAPIsClient | ||
} | ||
|
||
func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client { | ||
|
||
privateEndpointConnectionsClient := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(endpoint) | ||
configureAuthFunc(&privateEndpointConnectionsClient.Client) | ||
|
||
privateLinkResourcesClient := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(endpoint) | ||
configureAuthFunc(&privateLinkResourcesClient.Client) | ||
|
||
privateLinkScopedResourcesClient := privatelinkscopedresources.NewPrivateLinkScopedResourcesClientWithBaseURI(endpoint) | ||
configureAuthFunc(&privateLinkScopedResourcesClient.Client) | ||
|
||
privateLinkScopesAPIsClient := privatelinkscopesapis.NewPrivateLinkScopesAPIsClientWithBaseURI(endpoint) | ||
configureAuthFunc(&privateLinkScopesAPIsClient.Client) | ||
|
||
return Client{ | ||
PrivateEndpointConnections: &privateEndpointConnectionsClient, | ||
PrivateLinkResources: &privateLinkResourcesClient, | ||
PrivateLinkScopedResources: &privateLinkScopedResourcesClient, | ||
PrivateLinkScopesAPIs: &privateLinkScopesAPIsClient, | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
resource-manager/insights/2021-07-01-preview/privateendpointconnections/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,81 @@ | ||
|
||
## `github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-07-01-preview/privateendpointconnections` Documentation | ||
|
||
The `privateendpointconnections` SDK allows for interaction with the Azure Resource Manager Service `insights` (API Version `2021-07-01-preview`). | ||
|
||
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/insights/2021-07-01-preview/privateendpointconnections" | ||
``` | ||
|
||
|
||
### Client Initialization | ||
|
||
```go | ||
client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") | ||
client.Client.Authorizer = authorizer | ||
``` | ||
|
||
|
||
### Example Usage: `PrivateEndpointConnectionsClient.CreateOrUpdate` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateLinkScopeValue", "privateEndpointConnectionValue") | ||
|
||
payload := privateendpointconnections.PrivateEndpointConnection{ | ||
// ... | ||
} | ||
|
||
|
||
if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PrivateEndpointConnectionsClient.Delete` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateLinkScopeValue", "privateEndpointConnectionValue") | ||
|
||
if err := client.DeleteThenPoll(ctx, id); err != nil { | ||
// handle the error | ||
} | ||
``` | ||
|
||
|
||
### Example Usage: `PrivateEndpointConnectionsClient.Get` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateLinkScopeValue", "privateEndpointConnectionValue") | ||
|
||
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: `PrivateEndpointConnectionsClient.ListByPrivateLinkScope` | ||
|
||
```go | ||
ctx := context.TODO() | ||
id := privateendpointconnections.NewPrivateLinkScopeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "privateLinkScopeValue") | ||
|
||
read, err := client.ListByPrivateLinkScope(ctx, id) | ||
if err != nil { | ||
// handle the error | ||
} | ||
if model := read.Model; model != nil { | ||
// do something with the model/response object | ||
} | ||
``` |
18 changes: 18 additions & 0 deletions
18
resource-manager/insights/2021-07-01-preview/privateendpointconnections/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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package privateendpointconnections | ||
|
||
import "github.com/Azure/go-autorest/autorest" | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type PrivateEndpointConnectionsClient struct { | ||
Client autorest.Client | ||
baseUri string | ||
} | ||
|
||
func NewPrivateEndpointConnectionsClientWithBaseURI(endpoint string) PrivateEndpointConnectionsClient { | ||
return PrivateEndpointConnectionsClient{ | ||
Client: autorest.NewClientWithUserAgent(userAgent()), | ||
baseUri: endpoint, | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
resource-manager/insights/2021-07-01-preview/privateendpointconnections/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,71 @@ | ||
package privateendpointconnections | ||
|
||
import "strings" | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See NOTICE.txt in the project root for license information. | ||
|
||
type PrivateEndpointConnectionProvisioningState string | ||
|
||
const ( | ||
PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" | ||
PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" | ||
PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" | ||
PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" | ||
) | ||
|
||
func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { | ||
return []string{ | ||
string(PrivateEndpointConnectionProvisioningStateCreating), | ||
string(PrivateEndpointConnectionProvisioningStateDeleting), | ||
string(PrivateEndpointConnectionProvisioningStateFailed), | ||
string(PrivateEndpointConnectionProvisioningStateSucceeded), | ||
} | ||
} | ||
|
||
func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { | ||
vals := map[string]PrivateEndpointConnectionProvisioningState{ | ||
"creating": PrivateEndpointConnectionProvisioningStateCreating, | ||
"deleting": PrivateEndpointConnectionProvisioningStateDeleting, | ||
"failed": PrivateEndpointConnectionProvisioningStateFailed, | ||
"succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := PrivateEndpointConnectionProvisioningState(input) | ||
return &out, nil | ||
} | ||
|
||
type PrivateEndpointServiceConnectionStatus string | ||
|
||
const ( | ||
PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" | ||
PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" | ||
PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" | ||
) | ||
|
||
func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { | ||
return []string{ | ||
string(PrivateEndpointServiceConnectionStatusApproved), | ||
string(PrivateEndpointServiceConnectionStatusPending), | ||
string(PrivateEndpointServiceConnectionStatusRejected), | ||
} | ||
} | ||
|
||
func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { | ||
vals := map[string]PrivateEndpointServiceConnectionStatus{ | ||
"approved": PrivateEndpointServiceConnectionStatusApproved, | ||
"pending": PrivateEndpointServiceConnectionStatusPending, | ||
"rejected": PrivateEndpointServiceConnectionStatusRejected, | ||
} | ||
if v, ok := vals[strings.ToLower(input)]; ok { | ||
return &v, nil | ||
} | ||
|
||
// otherwise presume it's an undefined value and best-effort it | ||
out := PrivateEndpointServiceConnectionStatus(input) | ||
return &out, nil | ||
} |
134 changes: 134 additions & 0 deletions
134
...er/insights/2021-07-01-preview/privateendpointconnections/id_privateendpointconnection.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 privateendpointconnections | ||
|
||
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 = PrivateEndpointConnectionId{} | ||
|
||
// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection | ||
type PrivateEndpointConnectionId struct { | ||
SubscriptionId string | ||
ResourceGroupName string | ||
PrivateLinkScopeName string | ||
PrivateEndpointConnectionName string | ||
} | ||
|
||
// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct | ||
func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, privateLinkScopeName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { | ||
return PrivateEndpointConnectionId{ | ||
SubscriptionId: subscriptionId, | ||
ResourceGroupName: resourceGroupName, | ||
PrivateLinkScopeName: privateLinkScopeName, | ||
PrivateEndpointConnectionName: privateEndpointConnectionName, | ||
} | ||
} | ||
|
||
// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId | ||
func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) | ||
parsed, err := parser.Parse(input, false) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := PrivateEndpointConnectionId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId | ||
// note: this method should only be used for API response data and not user input | ||
func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { | ||
parser := resourceids.NewParserFromResourceIdType(PrivateEndpointConnectionId{}) | ||
parsed, err := parser.Parse(input, true) | ||
if err != nil { | ||
return nil, fmt.Errorf("parsing %q: %+v", input, err) | ||
} | ||
|
||
id := PrivateEndpointConnectionId{} | ||
if err := id.FromParseResult(*parsed); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &id, nil | ||
} | ||
|
||
func (id *PrivateEndpointConnectionId) 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.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) | ||
} | ||
|
||
if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { | ||
return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID | ||
func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { | ||
errors = append(errors, err) | ||
} | ||
|
||
return | ||
} | ||
|
||
// ID returns the formatted Private Endpoint Connection ID | ||
func (id PrivateEndpointConnectionId) ID() string { | ||
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Insights/privateLinkScopes/%s/privateEndpointConnections/%s" | ||
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.PrivateLinkScopeName, id.PrivateEndpointConnectionName) | ||
} | ||
|
||
// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID | ||
func (id PrivateEndpointConnectionId) 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("staticMicrosoftInsights", "Microsoft.Insights", "Microsoft.Insights"), | ||
resourceids.StaticSegment("staticPrivateLinkScopes", "privateLinkScopes", "privateLinkScopes"), | ||
resourceids.UserSpecifiedSegment("privateLinkScopeName", "privateLinkScopeValue"), | ||
resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), | ||
resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionValue"), | ||
} | ||
} | ||
|
||
// String returns a human-readable description of this Private Endpoint Connection ID | ||
func (id PrivateEndpointConnectionId) String() string { | ||
components := []string{ | ||
fmt.Sprintf("Subscription: %q", id.SubscriptionId), | ||
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), | ||
fmt.Sprintf("Private Link Scope Name: %q", id.PrivateLinkScopeName), | ||
fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), | ||
} | ||
return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) | ||
} |
Oops, something went wrong.