Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package v2022_02_05

import (
"github.com/Azure/go-autorest/autorest"
"github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/delete"
"github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/get"
"github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/patch"
"github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/post"
"github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/put"
)

type Client struct {
DELETE *delete.DELETEClient
GET *get.GETClient
PATCH *patch.PATCHClient
POST *post.POSTClient
PUT *put.PUTClient
}

func NewClientWithBaseURI(endpoint string, configureAuthFunc func(c *autorest.Client)) Client {

dELETEClient := delete.NewDELETEClientWithBaseURI(endpoint)
configureAuthFunc(&dELETEClient.Client)

gETClient := get.NewGETClientWithBaseURI(endpoint)
configureAuthFunc(&gETClient.Client)

pATCHClient := patch.NewPATCHClientWithBaseURI(endpoint)
configureAuthFunc(&pATCHClient.Client)

pOSTClient := post.NewPOSTClientWithBaseURI(endpoint)
configureAuthFunc(&pOSTClient.Client)

pUTClient := put.NewPUTClientWithBaseURI(endpoint)
configureAuthFunc(&pUTClient.Client)

return Client{
DELETE: &dELETEClient,
GET: &gETClient,
PATCH: &pATCHClient,
POST: &pOSTClient,
PUT: &pUTClient,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

## `github.com/hashicorp/go-azure-sdk/resource-manager/deviceprovisioningservices/2022-02-05/delete` Documentation

The `delete` SDK allows for interaction with the Azure Resource Manager Service `deviceprovisioningservices` (API Version `2022-02-05`).

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/deviceprovisioningservices/2022-02-05/delete"
```


### Client Initialization

```go
client := delete.NewDELETEClientWithBaseURI("https://management.azure.com")
client.Client.Authorizer = authorizer
```


### Example Usage: `DELETEClient.DpsCertificateDelete`

```go
ctx := context.TODO()
id := delete.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "provisioningServiceValue", "certificateValue")

read, err := client.DpsCertificateDelete(ctx, id, delete.DefaultDpsCertificateDeleteOperationOptions())
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
}
```


### Example Usage: `DELETEClient.IotDpsResourceDelete`

```go
ctx := context.TODO()
id := delete.NewProvisioningServiceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "provisioningServiceValue")

if err := client.IotDpsResourceDeleteThenPoll(ctx, id); err != nil {
// handle the error
}
```


### Example Usage: `DELETEClient.IotDpsResourceDeletePrivateEndpointConnection`

```go
ctx := context.TODO()
id := delete.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "resourceValue", "privateEndpointConnectionValue")

if err := client.IotDpsResourceDeletePrivateEndpointConnectionThenPoll(ctx, id); err != nil {
// handle the error
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package delete

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 DELETEClient struct {
Client autorest.Client
baseUri string
}

func NewDELETEClientWithBaseURI(endpoint string) DELETEClient {
return DELETEClient{
Client: autorest.NewClientWithUserAgent(userAgent()),
baseUri: endpoint,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package delete

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 CertificatePurpose string

const (
CertificatePurposeClientAuthentication CertificatePurpose = "clientAuthentication"
CertificatePurposeServerAuthentication CertificatePurpose = "serverAuthentication"
)

func PossibleValuesForCertificatePurpose() []string {
return []string{
string(CertificatePurposeClientAuthentication),
string(CertificatePurposeServerAuthentication),
}
}

func parseCertificatePurpose(input string) (*CertificatePurpose, error) {
vals := map[string]CertificatePurpose{
"clientauthentication": CertificatePurposeClientAuthentication,
"serverauthentication": CertificatePurposeServerAuthentication,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := CertificatePurpose(input)
return &out, nil
}

type PrivateLinkServiceConnectionStatus string

const (
PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved"
PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected"
PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending"
PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected"
)

func PossibleValuesForPrivateLinkServiceConnectionStatus() []string {
return []string{
string(PrivateLinkServiceConnectionStatusApproved),
string(PrivateLinkServiceConnectionStatusDisconnected),
string(PrivateLinkServiceConnectionStatusPending),
string(PrivateLinkServiceConnectionStatusRejected),
}
}

func parsePrivateLinkServiceConnectionStatus(input string) (*PrivateLinkServiceConnectionStatus, error) {
vals := map[string]PrivateLinkServiceConnectionStatus{
"approved": PrivateLinkServiceConnectionStatusApproved,
"disconnected": PrivateLinkServiceConnectionStatusDisconnected,
"pending": PrivateLinkServiceConnectionStatusPending,
"rejected": PrivateLinkServiceConnectionStatusRejected,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}

// otherwise presume it's an undefined value and best-effort it
out := PrivateLinkServiceConnectionStatus(input)
return &out, nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package delete

import (
"fmt"
"strings"

"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
)

var _ resourceids.ResourceId = CertificateId{}

// CertificateId is a struct representing the Resource ID for a Certificate
type CertificateId struct {
SubscriptionId string
ResourceGroupName string
ProvisioningServiceName string
CertificateName string
}

// NewCertificateID returns a new CertificateId struct
func NewCertificateID(subscriptionId string, resourceGroupName string, provisioningServiceName string, certificateName string) CertificateId {
return CertificateId{
SubscriptionId: subscriptionId,
ResourceGroupName: resourceGroupName,
ProvisioningServiceName: provisioningServiceName,
CertificateName: certificateName,
}
}

// ParseCertificateID parses 'input' into a CertificateId
func ParseCertificateID(input string) (*CertificateId, error) {
parser := resourceids.NewParserFromResourceIdType(CertificateId{})
parsed, err := parser.Parse(input, false)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

var ok bool
id := CertificateId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
}

if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok {
return nil, fmt.Errorf("the segment 'provisioningServiceName' was not found in the resource id %q", input)
}

if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok {
return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input)
}

return &id, nil
}

// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId
// note: this method should only be used for API response data and not user input
func ParseCertificateIDInsensitively(input string) (*CertificateId, error) {
parser := resourceids.NewParserFromResourceIdType(CertificateId{})
parsed, err := parser.Parse(input, true)
if err != nil {
return nil, fmt.Errorf("parsing %q: %+v", input, err)
}

var ok bool
id := CertificateId{}

if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok {
return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input)
}

if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok {
return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input)
}

if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok {
return nil, fmt.Errorf("the segment 'provisioningServiceName' was not found in the resource id %q", input)
}

if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok {
return nil, fmt.Errorf("the segment 'certificateName' was not found in the resource id %q", input)
}

return &id, nil
}

// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID
func ValidateCertificateID(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 := ParseCertificateID(v); err != nil {
errors = append(errors, err)
}

return
}

// ID returns the formatted Certificate ID
func (id CertificateId) ID() string {
fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Devices/provisioningServices/%s/certificates/%s"
return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProvisioningServiceName, id.CertificateName)
}

// Segments returns a slice of Resource ID Segments which comprise this Certificate ID
func (id CertificateId) 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("staticMicrosoftDevices", "Microsoft.Devices", "Microsoft.Devices"),
resourceids.StaticSegment("staticProvisioningServices", "provisioningServices", "provisioningServices"),
resourceids.UserSpecifiedSegment("provisioningServiceName", "provisioningServiceValue"),
resourceids.StaticSegment("staticCertificates", "certificates", "certificates"),
resourceids.UserSpecifiedSegment("certificateName", "certificateValue"),
}
}

// String returns a human-readable description of this Certificate ID
func (id CertificateId) String() string {
components := []string{
fmt.Sprintf("Subscription: %q", id.SubscriptionId),
fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName),
fmt.Sprintf("Provisioning Service Name: %q", id.ProvisioningServiceName),
fmt.Sprintf("Certificate Name: %q", id.CertificateName),
}
return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n"))
}
Loading