[Release] sdk/resourcemanager/iotoperations/armiotoperations/0.1.0 (#23654)
* [Release] sdk/resourcemanager/iotoperations/armiotoperations/1.0.0 generation from spec commit: 1ba188e3c1a7246ce6a7067adacd04d576fcfa24 * refine readme * change version * update examples
This commit is contained in:
Родитель
88fddb42a8
Коммит
ee9358aeac
|
@ -0,0 +1,8 @@
|
|||
# Release History
|
||||
|
||||
## 0.1.0 (2024-10-24)
|
||||
### Other Changes
|
||||
|
||||
The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html).
|
||||
|
||||
To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt).
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,92 @@
|
|||
# Azure IoTOperations Module for Go
|
||||
|
||||
[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations)
|
||||
|
||||
The `armiotoperations` module provides operations for working with Azure IoTOperations.
|
||||
|
||||
[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/iotoperations/armiotoperations)
|
||||
|
||||
# Getting started
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- an [Azure subscription](https://azure.microsoft.com/free/)
|
||||
- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).)
|
||||
|
||||
## Install the package
|
||||
|
||||
This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management.
|
||||
|
||||
Install the Azure IoTOperations module:
|
||||
|
||||
```sh
|
||||
go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations
|
||||
```
|
||||
|
||||
## Authorization
|
||||
|
||||
When creating a client, you will need to provide a credential for authenticating with Azure IoTOperations. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.
|
||||
|
||||
```go
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
```
|
||||
|
||||
For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity).
|
||||
|
||||
## Client Factory
|
||||
|
||||
Azure IoTOperations module consists of one or more clients. We provide a client factory which could be used to create any client in this module.
|
||||
|
||||
```go
|
||||
clientFactory, err := armiotoperations.NewClientFactory(<subscription ID>, cred, nil)
|
||||
```
|
||||
|
||||
You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore).
|
||||
|
||||
```go
|
||||
options := arm.ClientOptions {
|
||||
ClientOptions: azcore.ClientOptions {
|
||||
Cloud: cloud.AzureChina,
|
||||
},
|
||||
}
|
||||
clientFactory, err := armiotoperations.NewClientFactory(<subscription ID>, cred, &options)
|
||||
```
|
||||
|
||||
## Clients
|
||||
|
||||
A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.
|
||||
|
||||
```go
|
||||
client := clientFactory.NewBrokerAuthenticationClient()
|
||||
```
|
||||
|
||||
## Fakes
|
||||
|
||||
The fake package contains types used for constructing in-memory fake servers used in unit tests.
|
||||
This allows writing tests to cover various success/error conditions without the need for connecting to a live service.
|
||||
|
||||
Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.
|
||||
|
||||
## Provide Feedback
|
||||
|
||||
If you encounter bugs or have suggestions, please
|
||||
[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `IoTOperations` label.
|
||||
|
||||
# Contributing
|
||||
|
||||
This project welcomes contributions and suggestions. Most contributions require
|
||||
you to agree to a Contributor License Agreement (CLA) declaring that you have
|
||||
the right to, and actually do, grant us the rights to use your contribution.
|
||||
For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).
|
||||
|
||||
When you submit a pull request, a CLA-bot will automatically determine whether
|
||||
you need to provide a CLA and decorate the PR appropriately (e.g., label,
|
||||
comment). Simply follow the instructions provided by the bot. You will only
|
||||
need to do this once across all repos using our CLA.
|
||||
|
||||
This project has adopted the
|
||||
[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information, see the
|
||||
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any
|
||||
additional questions or comments.
|
|
@ -0,0 +1,340 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BrokerClient contains the methods for the Broker group.
|
||||
// Don't use this type directly, use NewBrokerClient() instead.
|
||||
type BrokerClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewBrokerClient creates a new instance of BrokerClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewBrokerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BrokerClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &BrokerClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// BeginCreateOrUpdate - Create a BrokerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - resource - Resource create parameters.
|
||||
// - options - BrokerClientBeginCreateOrUpdateOptions contains the optional parameters for the BrokerClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
func (client *BrokerClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, resource BrokerResource, options *BrokerClientBeginCreateOrUpdateOptions) (*runtime.Poller[BrokerClientCreateOrUpdateResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.createOrUpdate(ctx, resourceGroupName, instanceName, brokerName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BrokerClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BrokerClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create a BrokerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *BrokerClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, resource BrokerResource, options *BrokerClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "BrokerClient.BeginCreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instanceName, brokerName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *BrokerClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, resource BrokerResource, _ *BrokerClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// BeginDelete - Delete a BrokerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - options - BrokerClientBeginDeleteOptions contains the optional parameters for the BrokerClient.BeginDelete method.
|
||||
func (client *BrokerClient) BeginDelete(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, options *BrokerClientBeginDeleteOptions) (*runtime.Poller[BrokerClientDeleteResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.deleteOperation(ctx, resourceGroupName, instanceName, brokerName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BrokerClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BrokerClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete - Delete a BrokerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *BrokerClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, options *BrokerClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "BrokerClient.BeginDelete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, instanceName, brokerName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *BrokerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, _ *BrokerClientBeginDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get a BrokerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - options - BrokerClientGetOptions contains the optional parameters for the BrokerClient.Get method.
|
||||
func (client *BrokerClient) Get(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, options *BrokerClientGetOptions) (BrokerClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "BrokerClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, instanceName, brokerName, options)
|
||||
if err != nil {
|
||||
return BrokerClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BrokerClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BrokerClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *BrokerClient) getCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, _ *BrokerClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *BrokerClient) getHandleResponse(resp *http.Response) (BrokerClientGetResponse, error) {
|
||||
result := BrokerClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BrokerResource); err != nil {
|
||||
return BrokerClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - List BrokerResource resources by InstanceResource
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - options - BrokerClientListByResourceGroupOptions contains the optional parameters for the BrokerClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *BrokerClient) NewListByResourceGroupPager(resourceGroupName string, instanceName string, options *BrokerClientListByResourceGroupOptions) *runtime.Pager[BrokerClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[BrokerClientListByResourceGroupResponse]{
|
||||
More: func(page BrokerClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *BrokerClientListByResourceGroupResponse) (BrokerClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BrokerClient.NewListByResourceGroupPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, instanceName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return BrokerClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *BrokerClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, _ *BrokerClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *BrokerClient) listByResourceGroupHandleResponse(resp *http.Response) (BrokerClientListByResourceGroupResponse, error) {
|
||||
result := BrokerClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BrokerResourceListResult); err != nil {
|
||||
return BrokerClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,362 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BrokerAuthenticationClient contains the methods for the BrokerAuthentication group.
|
||||
// Don't use this type directly, use NewBrokerAuthenticationClient() instead.
|
||||
type BrokerAuthenticationClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewBrokerAuthenticationClient creates a new instance of BrokerAuthenticationClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewBrokerAuthenticationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BrokerAuthenticationClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &BrokerAuthenticationClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// BeginCreateOrUpdate - Create a BrokerAuthenticationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - authenticationName - Name of Instance broker authentication resource
|
||||
// - resource - Resource create parameters.
|
||||
// - options - BrokerAuthenticationClientBeginCreateOrUpdateOptions contains the optional parameters for the BrokerAuthenticationClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
func (client *BrokerAuthenticationClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, resource BrokerAuthenticationResource, options *BrokerAuthenticationClientBeginCreateOrUpdateOptions) (*runtime.Poller[BrokerAuthenticationClientCreateOrUpdateResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.createOrUpdate(ctx, resourceGroupName, instanceName, brokerName, authenticationName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BrokerAuthenticationClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BrokerAuthenticationClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create a BrokerAuthenticationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *BrokerAuthenticationClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, resource BrokerAuthenticationResource, options *BrokerAuthenticationClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "BrokerAuthenticationClient.BeginCreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instanceName, brokerName, authenticationName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *BrokerAuthenticationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, resource BrokerAuthenticationResource, _ *BrokerAuthenticationClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if authenticationName == "" {
|
||||
return nil, errors.New("parameter authenticationName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{authenticationName}", url.PathEscape(authenticationName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// BeginDelete - Delete a BrokerAuthenticationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - authenticationName - Name of Instance broker authentication resource
|
||||
// - options - BrokerAuthenticationClientBeginDeleteOptions contains the optional parameters for the BrokerAuthenticationClient.BeginDelete
|
||||
// method.
|
||||
func (client *BrokerAuthenticationClient) BeginDelete(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, options *BrokerAuthenticationClientBeginDeleteOptions) (*runtime.Poller[BrokerAuthenticationClientDeleteResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.deleteOperation(ctx, resourceGroupName, instanceName, brokerName, authenticationName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BrokerAuthenticationClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BrokerAuthenticationClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete - Delete a BrokerAuthenticationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *BrokerAuthenticationClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, options *BrokerAuthenticationClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "BrokerAuthenticationClient.BeginDelete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, instanceName, brokerName, authenticationName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *BrokerAuthenticationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, _ *BrokerAuthenticationClientBeginDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if authenticationName == "" {
|
||||
return nil, errors.New("parameter authenticationName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{authenticationName}", url.PathEscape(authenticationName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get a BrokerAuthenticationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - authenticationName - Name of Instance broker authentication resource
|
||||
// - options - BrokerAuthenticationClientGetOptions contains the optional parameters for the BrokerAuthenticationClient.Get
|
||||
// method.
|
||||
func (client *BrokerAuthenticationClient) Get(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, options *BrokerAuthenticationClientGetOptions) (BrokerAuthenticationClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "BrokerAuthenticationClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, instanceName, brokerName, authenticationName, options)
|
||||
if err != nil {
|
||||
return BrokerAuthenticationClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BrokerAuthenticationClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BrokerAuthenticationClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *BrokerAuthenticationClient) getCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, _ *BrokerAuthenticationClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if authenticationName == "" {
|
||||
return nil, errors.New("parameter authenticationName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{authenticationName}", url.PathEscape(authenticationName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *BrokerAuthenticationClient) getHandleResponse(resp *http.Response) (BrokerAuthenticationClientGetResponse, error) {
|
||||
result := BrokerAuthenticationClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BrokerAuthenticationResource); err != nil {
|
||||
return BrokerAuthenticationClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - List BrokerAuthenticationResource resources by BrokerResource
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - options - BrokerAuthenticationClientListByResourceGroupOptions contains the optional parameters for the BrokerAuthenticationClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *BrokerAuthenticationClient) NewListByResourceGroupPager(resourceGroupName string, instanceName string, brokerName string, options *BrokerAuthenticationClientListByResourceGroupOptions) *runtime.Pager[BrokerAuthenticationClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[BrokerAuthenticationClientListByResourceGroupResponse]{
|
||||
More: func(page BrokerAuthenticationClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *BrokerAuthenticationClientListByResourceGroupResponse) (BrokerAuthenticationClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BrokerAuthenticationClient.NewListByResourceGroupPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, instanceName, brokerName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return BrokerAuthenticationClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *BrokerAuthenticationClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, _ *BrokerAuthenticationClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *BrokerAuthenticationClient) listByResourceGroupHandleResponse(resp *http.Response) (BrokerAuthenticationClientListByResourceGroupResponse, error) {
|
||||
result := BrokerAuthenticationClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BrokerAuthenticationResourceListResult); err != nil {
|
||||
return BrokerAuthenticationClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,440 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"log"
|
||||
)
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthentication_CreateOrUpdate_Complex.json
|
||||
func ExampleBrokerAuthenticationClient_BeginCreateOrUpdate_brokerAuthenticationCreateOrUpdateComplex() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerAuthenticationClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerAuthenticationResource{
|
||||
Properties: &armiotoperations.BrokerAuthenticationProperties{
|
||||
AuthenticationMethods: []*armiotoperations.BrokerAuthenticatorMethods{
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerAuthenticationMethodServiceAccountToken),
|
||||
ServiceAccountTokenSettings: &armiotoperations.BrokerAuthenticatorMethodSat{
|
||||
Audiences: []*string{
|
||||
to.Ptr("aio-internal"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerAuthenticationMethodX509),
|
||||
X509Settings: &armiotoperations.BrokerAuthenticatorMethodX509{
|
||||
TrustedClientCaCert: to.Ptr("my-ca"),
|
||||
AuthorizationAttributes: map[string]*armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
"root": {
|
||||
Subject: to.Ptr("CN = Contoso Root CA Cert, OU = Engineering, C = US"),
|
||||
Attributes: map[string]*string{
|
||||
"organization": to.Ptr("contoso"),
|
||||
},
|
||||
},
|
||||
"intermediate": {
|
||||
Subject: to.Ptr("CN = Contoso Intermediate CA"),
|
||||
Attributes: map[string]*string{
|
||||
"city": to.Ptr("seattle"),
|
||||
"foo": to.Ptr("bar"),
|
||||
},
|
||||
},
|
||||
"smart-fan": {
|
||||
Subject: to.Ptr("CN = smart-fan"),
|
||||
Attributes: map[string]*string{
|
||||
"building": to.Ptr("17"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerAuthenticationClientCreateOrUpdateResponse{
|
||||
// BrokerAuthenticationResource: &armiotoperations.BrokerAuthenticationResource{
|
||||
// Properties: &armiotoperations.BrokerAuthenticationProperties{
|
||||
// AuthenticationMethods: []*armiotoperations.BrokerAuthenticatorMethods{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerAuthenticationMethodServiceAccountToken),
|
||||
// ServiceAccountTokenSettings: &armiotoperations.BrokerAuthenticatorMethodSat{
|
||||
// Audiences: []*string{
|
||||
// to.Ptr("aio-internal"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerAuthenticationMethodX509),
|
||||
// X509Settings: &armiotoperations.BrokerAuthenticatorMethodX509{
|
||||
// TrustedClientCaCert: to.Ptr("my-ca"),
|
||||
// AuthorizationAttributes: map[string]*armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// "root": &armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// Subject: to.Ptr("CN = Contoso Root CA Cert, OU = Engineering, C = US"),
|
||||
// Attributes: map[string]*string{
|
||||
// "organization": to.Ptr("contoso"),
|
||||
// },
|
||||
// },
|
||||
// "intermediate": &armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// Subject: to.Ptr("CN = Contoso Intermediate CA"),
|
||||
// Attributes: map[string]*string{
|
||||
// "city": to.Ptr("seattle"),
|
||||
// "foo": to.Ptr("bar"),
|
||||
// },
|
||||
// },
|
||||
// "smart-fan": &armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// Subject: to.Ptr("CN = smart-fan"),
|
||||
// Attributes: map[string]*string{
|
||||
// "building": to.Ptr("17"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authentications/resource-name123"),
|
||||
// Name: to.Ptr("lwucizfvtsdpx"),
|
||||
// Type: to.Ptr("kvtilkgcxanlfozrd"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthentication_CreateOrUpdate_MaximumSet_Gen.json
|
||||
func ExampleBrokerAuthenticationClient_BeginCreateOrUpdate_brokerAuthenticationCreateOrUpdate() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerAuthenticationClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerAuthenticationResource{
|
||||
Properties: &armiotoperations.BrokerAuthenticationProperties{
|
||||
AuthenticationMethods: []*armiotoperations.BrokerAuthenticatorMethods{
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerAuthenticationMethodCustom),
|
||||
CustomSettings: &armiotoperations.BrokerAuthenticatorMethodCustom{
|
||||
Auth: &armiotoperations.BrokerAuthenticatorCustomAuth{
|
||||
X509: &armiotoperations.X509ManualCertificate{
|
||||
SecretRef: to.Ptr("secret-name"),
|
||||
},
|
||||
},
|
||||
CaCertConfigMap: to.Ptr("pdecudefqyolvncbus"),
|
||||
Endpoint: to.Ptr("https://www.example.com"),
|
||||
Headers: map[string]*string{
|
||||
"key8518": to.Ptr("bwityjy"),
|
||||
},
|
||||
},
|
||||
ServiceAccountTokenSettings: &armiotoperations.BrokerAuthenticatorMethodSat{
|
||||
Audiences: []*string{
|
||||
to.Ptr("jqyhyqatuydg"),
|
||||
},
|
||||
},
|
||||
X509Settings: &armiotoperations.BrokerAuthenticatorMethodX509{
|
||||
AuthorizationAttributes: map[string]*armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
"key3384": {
|
||||
Attributes: map[string]*string{
|
||||
"key186": to.Ptr("ucpajramsz"),
|
||||
},
|
||||
Subject: to.Ptr("jpgwctfeixitptfgfnqhua"),
|
||||
},
|
||||
},
|
||||
TrustedClientCaCert: to.Ptr("vlctsqddl"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerAuthenticationClientCreateOrUpdateResponse{
|
||||
// BrokerAuthenticationResource: &armiotoperations.BrokerAuthenticationResource{
|
||||
// Properties: &armiotoperations.BrokerAuthenticationProperties{
|
||||
// AuthenticationMethods: []*armiotoperations.BrokerAuthenticatorMethods{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerAuthenticationMethodCustom),
|
||||
// CustomSettings: &armiotoperations.BrokerAuthenticatorMethodCustom{
|
||||
// Auth: &armiotoperations.BrokerAuthenticatorCustomAuth{
|
||||
// X509: &armiotoperations.X509ManualCertificate{
|
||||
// SecretRef: to.Ptr("secret-name"),
|
||||
// },
|
||||
// },
|
||||
// CaCertConfigMap: to.Ptr("pdecudefqyolvncbus"),
|
||||
// Endpoint: to.Ptr("https://www.example.com"),
|
||||
// Headers: map[string]*string{
|
||||
// "key8518": to.Ptr("bwityjy"),
|
||||
// },
|
||||
// },
|
||||
// ServiceAccountTokenSettings: &armiotoperations.BrokerAuthenticatorMethodSat{
|
||||
// Audiences: []*string{
|
||||
// to.Ptr("jqyhyqatuydg"),
|
||||
// },
|
||||
// },
|
||||
// X509Settings: &armiotoperations.BrokerAuthenticatorMethodX509{
|
||||
// AuthorizationAttributes: map[string]*armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// "key3384": &armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// Attributes: map[string]*string{
|
||||
// "key186": to.Ptr("ucpajramsz"),
|
||||
// },
|
||||
// Subject: to.Ptr("jpgwctfeixitptfgfnqhua"),
|
||||
// },
|
||||
// },
|
||||
// TrustedClientCaCert: to.Ptr("vlctsqddl"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authentications/resource-name123"),
|
||||
// Name: to.Ptr("lwucizfvtsdpx"),
|
||||
// Type: to.Ptr("kvtilkgcxanlfozrd"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthentication_Delete_MaximumSet_Gen.json
|
||||
func ExampleBrokerAuthenticationClient_BeginDelete() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerAuthenticationClient().BeginDelete(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
_, err = poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthentication_Get_MaximumSet_Gen.json
|
||||
func ExampleBrokerAuthenticationClient_Get() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
res, err := clientFactory.NewBrokerAuthenticationClient().Get(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerAuthenticationClientGetResponse{
|
||||
// BrokerAuthenticationResource: &armiotoperations.BrokerAuthenticationResource{
|
||||
// Properties: &armiotoperations.BrokerAuthenticationProperties{
|
||||
// AuthenticationMethods: []*armiotoperations.BrokerAuthenticatorMethods{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerAuthenticationMethodCustom),
|
||||
// CustomSettings: &armiotoperations.BrokerAuthenticatorMethodCustom{
|
||||
// Auth: &armiotoperations.BrokerAuthenticatorCustomAuth{
|
||||
// X509: &armiotoperations.X509ManualCertificate{
|
||||
// SecretRef: to.Ptr("secret-name"),
|
||||
// },
|
||||
// },
|
||||
// CaCertConfigMap: to.Ptr("pdecudefqyolvncbus"),
|
||||
// Endpoint: to.Ptr("https://www.example.com"),
|
||||
// Headers: map[string]*string{
|
||||
// "key8518": to.Ptr("bwityjy"),
|
||||
// },
|
||||
// },
|
||||
// ServiceAccountTokenSettings: &armiotoperations.BrokerAuthenticatorMethodSat{
|
||||
// Audiences: []*string{
|
||||
// to.Ptr("jqyhyqatuydg"),
|
||||
// },
|
||||
// },
|
||||
// X509Settings: &armiotoperations.BrokerAuthenticatorMethodX509{
|
||||
// AuthorizationAttributes: map[string]*armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// "key3384": &armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// Attributes: map[string]*string{
|
||||
// "key186": to.Ptr("ucpajramsz"),
|
||||
// },
|
||||
// Subject: to.Ptr("jpgwctfeixitptfgfnqhua"),
|
||||
// },
|
||||
// },
|
||||
// TrustedClientCaCert: to.Ptr("vlctsqddl"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authentications/resource-name123"),
|
||||
// Name: to.Ptr("lwucizfvtsdpx"),
|
||||
// Type: to.Ptr("kvtilkgcxanlfozrd"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthentication_ListByResourceGroup_MaximumSet_Gen.json
|
||||
func ExampleBrokerAuthenticationClient_NewListByResourceGroupPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
pager := clientFactory.NewBrokerAuthenticationClient().NewListByResourceGroupPager("rgiotoperations", "resource-name123", "resource-name123", nil)
|
||||
for pager.More() {
|
||||
page, err := pager.NextPage(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to advance page: %v", err)
|
||||
}
|
||||
for _, v := range page.Value {
|
||||
// You could use page here. We use blank identifier for just demo purposes.
|
||||
_ = v
|
||||
}
|
||||
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// page = armiotoperations.BrokerAuthenticationClientListByResourceGroupResponse{
|
||||
// BrokerAuthenticationResourceListResult: armiotoperations.BrokerAuthenticationResourceListResult{
|
||||
// Value: []*armiotoperations.BrokerAuthenticationResource{
|
||||
// {
|
||||
// Properties: &armiotoperations.BrokerAuthenticationProperties{
|
||||
// AuthenticationMethods: []*armiotoperations.BrokerAuthenticatorMethods{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerAuthenticationMethodCustom),
|
||||
// CustomSettings: &armiotoperations.BrokerAuthenticatorMethodCustom{
|
||||
// Auth: &armiotoperations.BrokerAuthenticatorCustomAuth{
|
||||
// X509: &armiotoperations.X509ManualCertificate{
|
||||
// SecretRef: to.Ptr("secret-name"),
|
||||
// },
|
||||
// },
|
||||
// CaCertConfigMap: to.Ptr("pdecudefqyolvncbus"),
|
||||
// Endpoint: to.Ptr("https://www.example.com"),
|
||||
// Headers: map[string]*string{
|
||||
// "key8518": to.Ptr("bwityjy"),
|
||||
// },
|
||||
// },
|
||||
// ServiceAccountTokenSettings: &armiotoperations.BrokerAuthenticatorMethodSat{
|
||||
// Audiences: []*string{
|
||||
// to.Ptr("jqyhyqatuydg"),
|
||||
// },
|
||||
// },
|
||||
// X509Settings: &armiotoperations.BrokerAuthenticatorMethodX509{
|
||||
// AuthorizationAttributes: map[string]*armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// "key3384": &armiotoperations.BrokerAuthenticatorMethodX509Attributes{
|
||||
// Attributes: map[string]*string{
|
||||
// "key186": to.Ptr("ucpajramsz"),
|
||||
// },
|
||||
// Subject: to.Ptr("jpgwctfeixitptfgfnqhua"),
|
||||
// },
|
||||
// },
|
||||
// TrustedClientCaCert: to.Ptr("vlctsqddl"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authentications/resource-name123"),
|
||||
// Name: to.Ptr("lwucizfvtsdpx"),
|
||||
// Type: to.Ptr("kvtilkgcxanlfozrd"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// NextLink: to.Ptr("https://microsoft.com/a"),
|
||||
// },
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,361 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BrokerAuthorizationClient contains the methods for the BrokerAuthorization group.
|
||||
// Don't use this type directly, use NewBrokerAuthorizationClient() instead.
|
||||
type BrokerAuthorizationClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewBrokerAuthorizationClient creates a new instance of BrokerAuthorizationClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewBrokerAuthorizationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BrokerAuthorizationClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &BrokerAuthorizationClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// BeginCreateOrUpdate - Create a BrokerAuthorizationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - authorizationName - Name of Instance broker authorization resource
|
||||
// - resource - Resource create parameters.
|
||||
// - options - BrokerAuthorizationClientBeginCreateOrUpdateOptions contains the optional parameters for the BrokerAuthorizationClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
func (client *BrokerAuthorizationClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, resource BrokerAuthorizationResource, options *BrokerAuthorizationClientBeginCreateOrUpdateOptions) (*runtime.Poller[BrokerAuthorizationClientCreateOrUpdateResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.createOrUpdate(ctx, resourceGroupName, instanceName, brokerName, authorizationName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BrokerAuthorizationClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BrokerAuthorizationClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create a BrokerAuthorizationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *BrokerAuthorizationClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, resource BrokerAuthorizationResource, options *BrokerAuthorizationClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "BrokerAuthorizationClient.BeginCreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instanceName, brokerName, authorizationName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *BrokerAuthorizationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, resource BrokerAuthorizationResource, _ *BrokerAuthorizationClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if authorizationName == "" {
|
||||
return nil, errors.New("parameter authorizationName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// BeginDelete - Delete a BrokerAuthorizationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - authorizationName - Name of Instance broker authorization resource
|
||||
// - options - BrokerAuthorizationClientBeginDeleteOptions contains the optional parameters for the BrokerAuthorizationClient.BeginDelete
|
||||
// method.
|
||||
func (client *BrokerAuthorizationClient) BeginDelete(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, options *BrokerAuthorizationClientBeginDeleteOptions) (*runtime.Poller[BrokerAuthorizationClientDeleteResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.deleteOperation(ctx, resourceGroupName, instanceName, brokerName, authorizationName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BrokerAuthorizationClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BrokerAuthorizationClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete - Delete a BrokerAuthorizationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *BrokerAuthorizationClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, options *BrokerAuthorizationClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "BrokerAuthorizationClient.BeginDelete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, instanceName, brokerName, authorizationName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *BrokerAuthorizationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, _ *BrokerAuthorizationClientBeginDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if authorizationName == "" {
|
||||
return nil, errors.New("parameter authorizationName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get a BrokerAuthorizationResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - authorizationName - Name of Instance broker authorization resource
|
||||
// - options - BrokerAuthorizationClientGetOptions contains the optional parameters for the BrokerAuthorizationClient.Get method.
|
||||
func (client *BrokerAuthorizationClient) Get(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, options *BrokerAuthorizationClientGetOptions) (BrokerAuthorizationClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "BrokerAuthorizationClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, instanceName, brokerName, authorizationName, options)
|
||||
if err != nil {
|
||||
return BrokerAuthorizationClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BrokerAuthorizationClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BrokerAuthorizationClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *BrokerAuthorizationClient) getCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, _ *BrokerAuthorizationClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if authorizationName == "" {
|
||||
return nil, errors.New("parameter authorizationName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{authorizationName}", url.PathEscape(authorizationName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *BrokerAuthorizationClient) getHandleResponse(resp *http.Response) (BrokerAuthorizationClientGetResponse, error) {
|
||||
result := BrokerAuthorizationClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BrokerAuthorizationResource); err != nil {
|
||||
return BrokerAuthorizationClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - List BrokerAuthorizationResource resources by BrokerResource
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - options - BrokerAuthorizationClientListByResourceGroupOptions contains the optional parameters for the BrokerAuthorizationClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *BrokerAuthorizationClient) NewListByResourceGroupPager(resourceGroupName string, instanceName string, brokerName string, options *BrokerAuthorizationClientListByResourceGroupOptions) *runtime.Pager[BrokerAuthorizationClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[BrokerAuthorizationClientListByResourceGroupResponse]{
|
||||
More: func(page BrokerAuthorizationClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *BrokerAuthorizationClientListByResourceGroupResponse) (BrokerAuthorizationClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BrokerAuthorizationClient.NewListByResourceGroupPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, instanceName, brokerName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return BrokerAuthorizationClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *BrokerAuthorizationClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, _ *BrokerAuthorizationClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *BrokerAuthorizationClient) listByResourceGroupHandleResponse(resp *http.Response) (BrokerAuthorizationClientListByResourceGroupResponse, error) {
|
||||
result := BrokerAuthorizationClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BrokerAuthorizationResourceListResult); err != nil {
|
||||
return BrokerAuthorizationClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,641 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"log"
|
||||
)
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_Complex.json
|
||||
func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCreateOrUpdateComplex() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerAuthorizationClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerAuthorizationResource{
|
||||
Properties: &armiotoperations.BrokerAuthorizationProperties{
|
||||
AuthorizationPolicies: &armiotoperations.AuthorizationConfig{
|
||||
Cache: to.Ptr(armiotoperations.OperationalModeEnabled),
|
||||
Rules: []*armiotoperations.AuthorizationRule{
|
||||
{
|
||||
Principals: &armiotoperations.PrincipalDefinition{
|
||||
Usernames: []*string{
|
||||
to.Ptr("temperature-sensor"),
|
||||
to.Ptr("humidity-sensor"),
|
||||
},
|
||||
Attributes: []map[string]*string{
|
||||
{
|
||||
"building": to.Ptr("17"),
|
||||
"organization": to.Ptr("contoso"),
|
||||
},
|
||||
},
|
||||
},
|
||||
BrokerResources: []*armiotoperations.BrokerResourceRule{
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsConnect),
|
||||
ClientIDs: []*string{
|
||||
to.Ptr("{principal.attributes.building}*"),
|
||||
},
|
||||
},
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsPublish),
|
||||
Topics: []*string{
|
||||
to.Ptr("sensors/{principal.attributes.building}/{principal.clientId}/telemetry/*"),
|
||||
},
|
||||
},
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsSubscribe),
|
||||
Topics: []*string{
|
||||
to.Ptr("commands/{principal.attributes.organization}"),
|
||||
},
|
||||
},
|
||||
},
|
||||
StateStoreResources: []*armiotoperations.StateStoreResourceRule{
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsRead),
|
||||
KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesPattern),
|
||||
Keys: []*string{
|
||||
to.Ptr("myreadkey"),
|
||||
to.Ptr("myotherkey?"),
|
||||
to.Ptr("mynumerickeysuffix[0-9]"),
|
||||
to.Ptr("clients:{principal.clientId}:*"),
|
||||
},
|
||||
},
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsReadWrite),
|
||||
KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesBinary),
|
||||
Keys: []*string{
|
||||
to.Ptr("MTE2IDEwMSAxMTUgMTE2"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerAuthorizationClientCreateOrUpdateResponse{
|
||||
// BrokerAuthorizationResource: &armiotoperations.BrokerAuthorizationResource{
|
||||
// Properties: &armiotoperations.BrokerAuthorizationProperties{
|
||||
// AuthorizationPolicies: &armiotoperations.AuthorizationConfig{
|
||||
// Cache: to.Ptr(armiotoperations.OperationalModeEnabled),
|
||||
// Rules: []*armiotoperations.AuthorizationRule{
|
||||
// {
|
||||
// Principals: &armiotoperations.PrincipalDefinition{
|
||||
// Usernames: []*string{
|
||||
// to.Ptr("temperature-sensor"),
|
||||
// to.Ptr("humidity-sensor"),
|
||||
// },
|
||||
// Attributes: []map[string]*string{
|
||||
// map[string]*string{
|
||||
// "building": to.Ptr("17"),
|
||||
// "organization": to.Ptr("contoso"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// BrokerResources: []*armiotoperations.BrokerResourceRule{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsConnect),
|
||||
// ClientIDs: []*string{
|
||||
// to.Ptr("{principal.attributes.building}*"),
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsPublish),
|
||||
// Topics: []*string{
|
||||
// to.Ptr("sensors/{principal.attributes.building}/{principal.clientId}/telemetry/*"),
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsSubscribe),
|
||||
// Topics: []*string{
|
||||
// to.Ptr("commands/{principal.attributes.organization}"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// StateStoreResources: []*armiotoperations.StateStoreResourceRule{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsRead),
|
||||
// KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesPattern),
|
||||
// Keys: []*string{
|
||||
// to.Ptr("myreadkey"),
|
||||
// to.Ptr("myotherkey?"),
|
||||
// to.Ptr("mynumerickeysuffix[0-9]"),
|
||||
// to.Ptr("clients:{principal.clientId}:*"),
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsReadWrite),
|
||||
// KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesBinary),
|
||||
// Keys: []*string{
|
||||
// to.Ptr("MTE2IDEwMSAxMTUgMTE2"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authorizations/resource-name123"),
|
||||
// Name: to.Ptr("anqrqsvrjmlvzkrbuav"),
|
||||
// Type: to.Ptr("yjlsfarshqoxojvgmy"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_MaximumSet_Gen.json
|
||||
func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCreateOrUpdate() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerAuthorizationClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerAuthorizationResource{
|
||||
Properties: &armiotoperations.BrokerAuthorizationProperties{
|
||||
AuthorizationPolicies: &armiotoperations.AuthorizationConfig{
|
||||
Cache: to.Ptr(armiotoperations.OperationalModeEnabled),
|
||||
Rules: []*armiotoperations.AuthorizationRule{
|
||||
{
|
||||
BrokerResources: []*armiotoperations.BrokerResourceRule{
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsConnect),
|
||||
ClientIDs: []*string{
|
||||
to.Ptr("nlc"),
|
||||
},
|
||||
Topics: []*string{
|
||||
to.Ptr("wvuca"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Principals: &armiotoperations.PrincipalDefinition{
|
||||
Attributes: []map[string]*string{
|
||||
{
|
||||
"key5526": to.Ptr("nydhzdhbldygqcn"),
|
||||
},
|
||||
},
|
||||
ClientIDs: []*string{
|
||||
to.Ptr("smopeaeddsygz"),
|
||||
},
|
||||
Usernames: []*string{
|
||||
to.Ptr("iozngyqndrteikszkbasinzdjtm"),
|
||||
},
|
||||
},
|
||||
StateStoreResources: []*armiotoperations.StateStoreResourceRule{
|
||||
{
|
||||
KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesPattern),
|
||||
Keys: []*string{
|
||||
to.Ptr("tkounsqtwvzyaklxjqoerpu"),
|
||||
},
|
||||
Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsRead),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerAuthorizationClientCreateOrUpdateResponse{
|
||||
// BrokerAuthorizationResource: &armiotoperations.BrokerAuthorizationResource{
|
||||
// Properties: &armiotoperations.BrokerAuthorizationProperties{
|
||||
// AuthorizationPolicies: &armiotoperations.AuthorizationConfig{
|
||||
// Cache: to.Ptr(armiotoperations.OperationalModeEnabled),
|
||||
// Rules: []*armiotoperations.AuthorizationRule{
|
||||
// {
|
||||
// BrokerResources: []*armiotoperations.BrokerResourceRule{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsConnect),
|
||||
// ClientIDs: []*string{
|
||||
// to.Ptr("nlc"),
|
||||
// },
|
||||
// Topics: []*string{
|
||||
// to.Ptr("wvuca"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// Principals: &armiotoperations.PrincipalDefinition{
|
||||
// Attributes: []map[string]*string{
|
||||
// map[string]*string{
|
||||
// "key5526": to.Ptr("nydhzdhbldygqcn"),
|
||||
// },
|
||||
// },
|
||||
// ClientIDs: []*string{
|
||||
// to.Ptr("smopeaeddsygz"),
|
||||
// },
|
||||
// Usernames: []*string{
|
||||
// to.Ptr("iozngyqndrteikszkbasinzdjtm"),
|
||||
// },
|
||||
// },
|
||||
// StateStoreResources: []*armiotoperations.StateStoreResourceRule{
|
||||
// {
|
||||
// KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesPattern),
|
||||
// Keys: []*string{
|
||||
// to.Ptr("tkounsqtwvzyaklxjqoerpu"),
|
||||
// },
|
||||
// Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsRead),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authorizations/resource-name123"),
|
||||
// Name: to.Ptr("anqrqsvrjmlvzkrbuav"),
|
||||
// Type: to.Ptr("yjlsfarshqoxojvgmy"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_Simple.json
|
||||
func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCreateOrUpdateSimple() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerAuthorizationClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerAuthorizationResource{
|
||||
Properties: &armiotoperations.BrokerAuthorizationProperties{
|
||||
AuthorizationPolicies: &armiotoperations.AuthorizationConfig{
|
||||
Cache: to.Ptr(armiotoperations.OperationalModeEnabled),
|
||||
Rules: []*armiotoperations.AuthorizationRule{
|
||||
{
|
||||
Principals: &armiotoperations.PrincipalDefinition{
|
||||
ClientIDs: []*string{
|
||||
to.Ptr("my-client-id"),
|
||||
},
|
||||
Attributes: []map[string]*string{
|
||||
{
|
||||
"floor": to.Ptr("floor1"),
|
||||
"site": to.Ptr("site1"),
|
||||
},
|
||||
},
|
||||
},
|
||||
BrokerResources: []*armiotoperations.BrokerResourceRule{
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsConnect),
|
||||
},
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsSubscribe),
|
||||
Topics: []*string{
|
||||
to.Ptr("topic"),
|
||||
to.Ptr("topic/with/wildcard/#"),
|
||||
},
|
||||
},
|
||||
},
|
||||
StateStoreResources: []*armiotoperations.StateStoreResourceRule{
|
||||
{
|
||||
Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsReadWrite),
|
||||
KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesPattern),
|
||||
Keys: []*string{
|
||||
to.Ptr("*"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerAuthorizationClientCreateOrUpdateResponse{
|
||||
// BrokerAuthorizationResource: &armiotoperations.BrokerAuthorizationResource{
|
||||
// Properties: &armiotoperations.BrokerAuthorizationProperties{
|
||||
// AuthorizationPolicies: &armiotoperations.AuthorizationConfig{
|
||||
// Cache: to.Ptr(armiotoperations.OperationalModeEnabled),
|
||||
// Rules: []*armiotoperations.AuthorizationRule{
|
||||
// {
|
||||
// Principals: &armiotoperations.PrincipalDefinition{
|
||||
// ClientIDs: []*string{
|
||||
// to.Ptr("my-client-id"),
|
||||
// },
|
||||
// Attributes: []map[string]*string{
|
||||
// map[string]*string{
|
||||
// "floor": to.Ptr("floor1"),
|
||||
// "site": to.Ptr("site1"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// BrokerResources: []*armiotoperations.BrokerResourceRule{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsConnect),
|
||||
// },
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsSubscribe),
|
||||
// Topics: []*string{
|
||||
// to.Ptr("topic"),
|
||||
// to.Ptr("topic/with/wildcard/#"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// StateStoreResources: []*armiotoperations.StateStoreResourceRule{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsReadWrite),
|
||||
// KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesPattern),
|
||||
// Keys: []*string{
|
||||
// to.Ptr("*"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authorizations/resource-name123"),
|
||||
// Name: to.Ptr("anqrqsvrjmlvzkrbuav"),
|
||||
// Type: to.Ptr("yjlsfarshqoxojvgmy"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthorization_Delete_MaximumSet_Gen.json
|
||||
func ExampleBrokerAuthorizationClient_BeginDelete() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerAuthorizationClient().BeginDelete(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
_, err = poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthorization_Get_MaximumSet_Gen.json
|
||||
func ExampleBrokerAuthorizationClient_Get() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
res, err := clientFactory.NewBrokerAuthorizationClient().Get(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerAuthorizationClientGetResponse{
|
||||
// BrokerAuthorizationResource: &armiotoperations.BrokerAuthorizationResource{
|
||||
// Properties: &armiotoperations.BrokerAuthorizationProperties{
|
||||
// AuthorizationPolicies: &armiotoperations.AuthorizationConfig{
|
||||
// Cache: to.Ptr(armiotoperations.OperationalModeEnabled),
|
||||
// Rules: []*armiotoperations.AuthorizationRule{
|
||||
// {
|
||||
// BrokerResources: []*armiotoperations.BrokerResourceRule{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsConnect),
|
||||
// ClientIDs: []*string{
|
||||
// to.Ptr("nlc"),
|
||||
// },
|
||||
// Topics: []*string{
|
||||
// to.Ptr("wvuca"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// Principals: &armiotoperations.PrincipalDefinition{
|
||||
// Attributes: []map[string]*string{
|
||||
// map[string]*string{
|
||||
// "key5526": to.Ptr("nydhzdhbldygqcn"),
|
||||
// },
|
||||
// },
|
||||
// ClientIDs: []*string{
|
||||
// to.Ptr("smopeaeddsygz"),
|
||||
// },
|
||||
// Usernames: []*string{
|
||||
// to.Ptr("iozngyqndrteikszkbasinzdjtm"),
|
||||
// },
|
||||
// },
|
||||
// StateStoreResources: []*armiotoperations.StateStoreResourceRule{
|
||||
// {
|
||||
// KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesPattern),
|
||||
// Keys: []*string{
|
||||
// to.Ptr("tkounsqtwvzyaklxjqoerpu"),
|
||||
// },
|
||||
// Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsRead),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authorizations/resource-name123"),
|
||||
// Name: to.Ptr("anqrqsvrjmlvzkrbuav"),
|
||||
// Type: to.Ptr("yjlsfarshqoxojvgmy"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerAuthorization_ListByResourceGroup_MaximumSet_Gen.json
|
||||
func ExampleBrokerAuthorizationClient_NewListByResourceGroupPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
pager := clientFactory.NewBrokerAuthorizationClient().NewListByResourceGroupPager("rgiotoperations", "resource-name123", "resource-name123", nil)
|
||||
for pager.More() {
|
||||
page, err := pager.NextPage(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to advance page: %v", err)
|
||||
}
|
||||
for _, v := range page.Value {
|
||||
// You could use page here. We use blank identifier for just demo purposes.
|
||||
_ = v
|
||||
}
|
||||
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// page = armiotoperations.BrokerAuthorizationClientListByResourceGroupResponse{
|
||||
// BrokerAuthorizationResourceListResult: armiotoperations.BrokerAuthorizationResourceListResult{
|
||||
// Value: []*armiotoperations.BrokerAuthorizationResource{
|
||||
// {
|
||||
// Properties: &armiotoperations.BrokerAuthorizationProperties{
|
||||
// AuthorizationPolicies: &armiotoperations.AuthorizationConfig{
|
||||
// Cache: to.Ptr(armiotoperations.OperationalModeEnabled),
|
||||
// Rules: []*armiotoperations.AuthorizationRule{
|
||||
// {
|
||||
// BrokerResources: []*armiotoperations.BrokerResourceRule{
|
||||
// {
|
||||
// Method: to.Ptr(armiotoperations.BrokerResourceDefinitionMethodsConnect),
|
||||
// ClientIDs: []*string{
|
||||
// to.Ptr("nlc"),
|
||||
// },
|
||||
// Topics: []*string{
|
||||
// to.Ptr("wvuca"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// Principals: &armiotoperations.PrincipalDefinition{
|
||||
// Attributes: []map[string]*string{
|
||||
// map[string]*string{
|
||||
// "key5526": to.Ptr("nydhzdhbldygqcn"),
|
||||
// },
|
||||
// },
|
||||
// ClientIDs: []*string{
|
||||
// to.Ptr("smopeaeddsygz"),
|
||||
// },
|
||||
// Usernames: []*string{
|
||||
// to.Ptr("iozngyqndrteikszkbasinzdjtm"),
|
||||
// },
|
||||
// },
|
||||
// StateStoreResources: []*armiotoperations.StateStoreResourceRule{
|
||||
// {
|
||||
// KeyType: to.Ptr(armiotoperations.StateStoreResourceKeyTypesPattern),
|
||||
// Keys: []*string{
|
||||
// to.Ptr("tkounsqtwvzyaklxjqoerpu"),
|
||||
// },
|
||||
// Method: to.Ptr(armiotoperations.StateStoreResourceDefinitionMethodsRead),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/authorizations/resource-name123"),
|
||||
// Name: to.Ptr("anqrqsvrjmlvzkrbuav"),
|
||||
// Type: to.Ptr("yjlsfarshqoxojvgmy"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// NextLink: to.Ptr("https://microsoft.com/a"),
|
||||
// },
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,361 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BrokerListenerClient contains the methods for the BrokerListener group.
|
||||
// Don't use this type directly, use NewBrokerListenerClient() instead.
|
||||
type BrokerListenerClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewBrokerListenerClient creates a new instance of BrokerListenerClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewBrokerListenerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BrokerListenerClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &BrokerListenerClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// BeginCreateOrUpdate - Create a BrokerListenerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - listenerName - Name of Instance broker listener resource
|
||||
// - resource - Resource create parameters.
|
||||
// - options - BrokerListenerClientBeginCreateOrUpdateOptions contains the optional parameters for the BrokerListenerClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
func (client *BrokerListenerClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, resource BrokerListenerResource, options *BrokerListenerClientBeginCreateOrUpdateOptions) (*runtime.Poller[BrokerListenerClientCreateOrUpdateResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.createOrUpdate(ctx, resourceGroupName, instanceName, brokerName, listenerName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BrokerListenerClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BrokerListenerClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create a BrokerListenerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *BrokerListenerClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, resource BrokerListenerResource, options *BrokerListenerClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "BrokerListenerClient.BeginCreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instanceName, brokerName, listenerName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *BrokerListenerClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, resource BrokerListenerResource, _ *BrokerListenerClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if listenerName == "" {
|
||||
return nil, errors.New("parameter listenerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{listenerName}", url.PathEscape(listenerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// BeginDelete - Delete a BrokerListenerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - listenerName - Name of Instance broker listener resource
|
||||
// - options - BrokerListenerClientBeginDeleteOptions contains the optional parameters for the BrokerListenerClient.BeginDelete
|
||||
// method.
|
||||
func (client *BrokerListenerClient) BeginDelete(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, options *BrokerListenerClientBeginDeleteOptions) (*runtime.Poller[BrokerListenerClientDeleteResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.deleteOperation(ctx, resourceGroupName, instanceName, brokerName, listenerName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BrokerListenerClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BrokerListenerClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete - Delete a BrokerListenerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *BrokerListenerClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, options *BrokerListenerClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "BrokerListenerClient.BeginDelete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, instanceName, brokerName, listenerName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *BrokerListenerClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, _ *BrokerListenerClientBeginDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if listenerName == "" {
|
||||
return nil, errors.New("parameter listenerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{listenerName}", url.PathEscape(listenerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get a BrokerListenerResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - listenerName - Name of Instance broker listener resource
|
||||
// - options - BrokerListenerClientGetOptions contains the optional parameters for the BrokerListenerClient.Get method.
|
||||
func (client *BrokerListenerClient) Get(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, options *BrokerListenerClientGetOptions) (BrokerListenerClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "BrokerListenerClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, instanceName, brokerName, listenerName, options)
|
||||
if err != nil {
|
||||
return BrokerListenerClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return BrokerListenerClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return BrokerListenerClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *BrokerListenerClient) getCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, _ *BrokerListenerClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
if listenerName == "" {
|
||||
return nil, errors.New("parameter listenerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{listenerName}", url.PathEscape(listenerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *BrokerListenerClient) getHandleResponse(resp *http.Response) (BrokerListenerClientGetResponse, error) {
|
||||
result := BrokerListenerClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BrokerListenerResource); err != nil {
|
||||
return BrokerListenerClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - List BrokerListenerResource resources by BrokerResource
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - brokerName - Name of broker.
|
||||
// - options - BrokerListenerClientListByResourceGroupOptions contains the optional parameters for the BrokerListenerClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *BrokerListenerClient) NewListByResourceGroupPager(resourceGroupName string, instanceName string, brokerName string, options *BrokerListenerClientListByResourceGroupOptions) *runtime.Pager[BrokerListenerClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[BrokerListenerClientListByResourceGroupResponse]{
|
||||
More: func(page BrokerListenerClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *BrokerListenerClientListByResourceGroupResponse) (BrokerListenerClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BrokerListenerClient.NewListByResourceGroupPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, instanceName, brokerName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return BrokerListenerClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *BrokerListenerClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, _ *BrokerListenerClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if brokerName == "" {
|
||||
return nil, errors.New("parameter brokerName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{brokerName}", url.PathEscape(brokerName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *BrokerListenerClient) listByResourceGroupHandleResponse(resp *http.Response) (BrokerListenerClientListByResourceGroupResponse, error) {
|
||||
result := BrokerListenerClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.BrokerListenerResourceListResult); err != nil {
|
||||
return BrokerListenerClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,530 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"log"
|
||||
)
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Complex.json
|
||||
func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdateComplex() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerListenerClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerListenerResource{
|
||||
Properties: &armiotoperations.BrokerListenerProperties{
|
||||
ServiceType: to.Ptr(armiotoperations.ServiceTypeLoadBalancer),
|
||||
Ports: []*armiotoperations.ListenerPort{
|
||||
{
|
||||
Port: to.Ptr[int32](8080),
|
||||
AuthenticationRef: to.Ptr("example-authentication"),
|
||||
Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets),
|
||||
},
|
||||
{
|
||||
Port: to.Ptr[int32](8443),
|
||||
AuthenticationRef: to.Ptr("example-authentication"),
|
||||
Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets),
|
||||
TLS: &armiotoperations.TLSCertMethod{
|
||||
Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
|
||||
CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
|
||||
IssuerRef: &armiotoperations.CertManagerIssuerRef{
|
||||
Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
|
||||
Name: to.Ptr("example-issuer"),
|
||||
Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Port: to.Ptr[int32](1883),
|
||||
AuthenticationRef: to.Ptr("example-authentication"),
|
||||
},
|
||||
{
|
||||
Port: to.Ptr[int32](8883),
|
||||
AuthenticationRef: to.Ptr("example-authentication"),
|
||||
TLS: &armiotoperations.TLSCertMethod{
|
||||
Mode: to.Ptr(armiotoperations.TLSCertMethodModeManual),
|
||||
Manual: &armiotoperations.X509ManualCertificate{
|
||||
SecretRef: to.Ptr("example-secret"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerListenerClientCreateOrUpdateResponse{
|
||||
// BrokerListenerResource: &armiotoperations.BrokerListenerResource{
|
||||
// Properties: &armiotoperations.BrokerListenerProperties{
|
||||
// ServiceName: to.Ptr("tpfiszlapdpxktx"),
|
||||
// ServiceType: to.Ptr(armiotoperations.ServiceTypeLoadBalancer),
|
||||
// Ports: []*armiotoperations.ListenerPort{
|
||||
// {
|
||||
// Port: to.Ptr[int32](8080),
|
||||
// AuthenticationRef: to.Ptr("example-authentication"),
|
||||
// Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets),
|
||||
// },
|
||||
// {
|
||||
// Port: to.Ptr[int32](8443),
|
||||
// AuthenticationRef: to.Ptr("example-authentication"),
|
||||
// Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets),
|
||||
// TLS: &armiotoperations.TLSCertMethod{
|
||||
// Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
|
||||
// CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
|
||||
// IssuerRef: &armiotoperations.CertManagerIssuerRef{
|
||||
// Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
|
||||
// Name: to.Ptr("example-issuer"),
|
||||
// Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// Port: to.Ptr[int32](1883),
|
||||
// AuthenticationRef: to.Ptr("example-authentication"),
|
||||
// },
|
||||
// {
|
||||
// Port: to.Ptr[int32](8883),
|
||||
// AuthenticationRef: to.Ptr("example-authentication"),
|
||||
// TLS: &armiotoperations.TLSCertMethod{
|
||||
// Mode: to.Ptr(armiotoperations.TLSCertMethodModeManual),
|
||||
// Manual: &armiotoperations.X509ManualCertificate{
|
||||
// SecretRef: to.Ptr("example-secret"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123"),
|
||||
// Name: to.Ptr("hoqjaachratt"),
|
||||
// Type: to.Ptr("hizbknwegcdaeh"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json
|
||||
func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdate() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerListenerClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerListenerResource{
|
||||
Properties: &armiotoperations.BrokerListenerProperties{
|
||||
ServiceName: to.Ptr("tpfiszlapdpxktx"),
|
||||
Ports: []*armiotoperations.ListenerPort{
|
||||
{
|
||||
AuthenticationRef: to.Ptr("tjvdroaqqy"),
|
||||
AuthorizationRef: to.Ptr("inxhvxnwswyrvt"),
|
||||
NodePort: to.Ptr[int32](7281),
|
||||
Port: to.Ptr[int32](1268),
|
||||
Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeMqtt),
|
||||
TLS: &armiotoperations.TLSCertMethod{
|
||||
Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
|
||||
CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
|
||||
Duration: to.Ptr("qmpeffoksron"),
|
||||
SecretName: to.Ptr("oagi"),
|
||||
RenewBefore: to.Ptr("hutno"),
|
||||
IssuerRef: &armiotoperations.CertManagerIssuerRef{
|
||||
Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
|
||||
Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
|
||||
Name: to.Ptr("ocwoqpgucvjrsuudtjhb"),
|
||||
},
|
||||
PrivateKey: &armiotoperations.CertManagerPrivateKey{
|
||||
Algorithm: to.Ptr(armiotoperations.PrivateKeyAlgorithmEc256),
|
||||
RotationPolicy: to.Ptr(armiotoperations.PrivateKeyRotationPolicyAlways),
|
||||
},
|
||||
San: &armiotoperations.SanForCert{
|
||||
DNS: []*string{
|
||||
to.Ptr("xhvmhrrhgfsapocjeebqtnzarlj"),
|
||||
},
|
||||
IP: []*string{
|
||||
to.Ptr("zbgugfzcgsmegevzktsnibyuyp"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Manual: &armiotoperations.X509ManualCertificate{
|
||||
SecretRef: to.Ptr("secret-name"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ServiceType: to.Ptr(armiotoperations.ServiceTypeClusterIP),
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerListenerClientCreateOrUpdateResponse{
|
||||
// BrokerListenerResource: &armiotoperations.BrokerListenerResource{
|
||||
// Properties: &armiotoperations.BrokerListenerProperties{
|
||||
// ServiceName: to.Ptr("tpfiszlapdpxktx"),
|
||||
// Ports: []*armiotoperations.ListenerPort{
|
||||
// {
|
||||
// AuthenticationRef: to.Ptr("tjvdroaqqy"),
|
||||
// AuthorizationRef: to.Ptr("inxhvxnwswyrvt"),
|
||||
// NodePort: to.Ptr[int32](7281),
|
||||
// Port: to.Ptr[int32](1268),
|
||||
// Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeMqtt),
|
||||
// TLS: &armiotoperations.TLSCertMethod{
|
||||
// Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
|
||||
// CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
|
||||
// Duration: to.Ptr("qmpeffoksron"),
|
||||
// SecretName: to.Ptr("oagi"),
|
||||
// RenewBefore: to.Ptr("hutno"),
|
||||
// IssuerRef: &armiotoperations.CertManagerIssuerRef{
|
||||
// Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
|
||||
// Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
|
||||
// Name: to.Ptr("ocwoqpgucvjrsuudtjhb"),
|
||||
// },
|
||||
// PrivateKey: &armiotoperations.CertManagerPrivateKey{
|
||||
// Algorithm: to.Ptr(armiotoperations.PrivateKeyAlgorithmEc256),
|
||||
// RotationPolicy: to.Ptr(armiotoperations.PrivateKeyRotationPolicyAlways),
|
||||
// },
|
||||
// San: &armiotoperations.SanForCert{
|
||||
// DNS: []*string{
|
||||
// to.Ptr("xhvmhrrhgfsapocjeebqtnzarlj"),
|
||||
// },
|
||||
// IP: []*string{
|
||||
// to.Ptr("zbgugfzcgsmegevzktsnibyuyp"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// Manual: &armiotoperations.X509ManualCertificate{
|
||||
// SecretRef: to.Ptr("secret-name"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ServiceType: to.Ptr(armiotoperations.ServiceTypeClusterIP),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123"),
|
||||
// Name: to.Ptr("hoqjaachratt"),
|
||||
// Type: to.Ptr("hizbknwegcdaeh"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Simple.json
|
||||
func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdateSimple() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerListenerClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerListenerResource{
|
||||
Properties: &armiotoperations.BrokerListenerProperties{
|
||||
Ports: []*armiotoperations.ListenerPort{
|
||||
{
|
||||
Port: to.Ptr[int32](1883),
|
||||
},
|
||||
},
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerListenerClientCreateOrUpdateResponse{
|
||||
// BrokerListenerResource: &armiotoperations.BrokerListenerResource{
|
||||
// Properties: &armiotoperations.BrokerListenerProperties{
|
||||
// ServiceName: to.Ptr("tpfiszlapdpxktx"),
|
||||
// ServiceType: to.Ptr(armiotoperations.ServiceTypeLoadBalancer),
|
||||
// Ports: []*armiotoperations.ListenerPort{
|
||||
// {
|
||||
// Port: to.Ptr[int32](1883),
|
||||
// },
|
||||
// },
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123"),
|
||||
// Name: to.Ptr("hoqjaachratt"),
|
||||
// Type: to.Ptr("hizbknwegcdaeh"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerListener_Delete_MaximumSet_Gen.json
|
||||
func ExampleBrokerListenerClient_BeginDelete() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewBrokerListenerClient().BeginDelete(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
_, err = poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerListener_Get_MaximumSet_Gen.json
|
||||
func ExampleBrokerListenerClient_Get() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
res, err := clientFactory.NewBrokerListenerClient().Get(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.BrokerListenerClientGetResponse{
|
||||
// BrokerListenerResource: &armiotoperations.BrokerListenerResource{
|
||||
// Properties: &armiotoperations.BrokerListenerProperties{
|
||||
// ServiceName: to.Ptr("tpfiszlapdpxktx"),
|
||||
// Ports: []*armiotoperations.ListenerPort{
|
||||
// {
|
||||
// AuthenticationRef: to.Ptr("tjvdroaqqy"),
|
||||
// AuthorizationRef: to.Ptr("inxhvxnwswyrvt"),
|
||||
// NodePort: to.Ptr[int32](7281),
|
||||
// Port: to.Ptr[int32](1268),
|
||||
// Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeMqtt),
|
||||
// TLS: &armiotoperations.TLSCertMethod{
|
||||
// Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
|
||||
// CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
|
||||
// Duration: to.Ptr("qmpeffoksron"),
|
||||
// SecretName: to.Ptr("oagi"),
|
||||
// RenewBefore: to.Ptr("hutno"),
|
||||
// IssuerRef: &armiotoperations.CertManagerIssuerRef{
|
||||
// Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
|
||||
// Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
|
||||
// Name: to.Ptr("ocwoqpgucvjrsuudtjhb"),
|
||||
// },
|
||||
// PrivateKey: &armiotoperations.CertManagerPrivateKey{
|
||||
// Algorithm: to.Ptr(armiotoperations.PrivateKeyAlgorithmEc256),
|
||||
// RotationPolicy: to.Ptr(armiotoperations.PrivateKeyRotationPolicyAlways),
|
||||
// },
|
||||
// San: &armiotoperations.SanForCert{
|
||||
// DNS: []*string{
|
||||
// to.Ptr("xhvmhrrhgfsapocjeebqtnzarlj"),
|
||||
// },
|
||||
// IP: []*string{
|
||||
// to.Ptr("zbgugfzcgsmegevzktsnibyuyp"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// Manual: &armiotoperations.X509ManualCertificate{
|
||||
// SecretRef: to.Ptr("secret-name"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ServiceType: to.Ptr(armiotoperations.ServiceTypeClusterIP),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123"),
|
||||
// Name: to.Ptr("hoqjaachratt"),
|
||||
// Type: to.Ptr("hizbknwegcdaeh"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/BrokerListener_ListByResourceGroup_MaximumSet_Gen.json
|
||||
func ExampleBrokerListenerClient_NewListByResourceGroupPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
pager := clientFactory.NewBrokerListenerClient().NewListByResourceGroupPager("rgiotoperations", "resource-name123", "resource-name123", nil)
|
||||
for pager.More() {
|
||||
page, err := pager.NextPage(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to advance page: %v", err)
|
||||
}
|
||||
for _, v := range page.Value {
|
||||
// You could use page here. We use blank identifier for just demo purposes.
|
||||
_ = v
|
||||
}
|
||||
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// page = armiotoperations.BrokerListenerClientListByResourceGroupResponse{
|
||||
// BrokerListenerResourceListResult: armiotoperations.BrokerListenerResourceListResult{
|
||||
// Value: []*armiotoperations.BrokerListenerResource{
|
||||
// {
|
||||
// Properties: &armiotoperations.BrokerListenerProperties{
|
||||
// ServiceName: to.Ptr("tpfiszlapdpxktx"),
|
||||
// Ports: []*armiotoperations.ListenerPort{
|
||||
// {
|
||||
// AuthenticationRef: to.Ptr("tjvdroaqqy"),
|
||||
// AuthorizationRef: to.Ptr("inxhvxnwswyrvt"),
|
||||
// NodePort: to.Ptr[int32](7281),
|
||||
// Port: to.Ptr[int32](1268),
|
||||
// Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeMqtt),
|
||||
// TLS: &armiotoperations.TLSCertMethod{
|
||||
// Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
|
||||
// CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
|
||||
// Duration: to.Ptr("qmpeffoksron"),
|
||||
// SecretName: to.Ptr("oagi"),
|
||||
// RenewBefore: to.Ptr("hutno"),
|
||||
// IssuerRef: &armiotoperations.CertManagerIssuerRef{
|
||||
// Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
|
||||
// Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
|
||||
// Name: to.Ptr("ocwoqpgucvjrsuudtjhb"),
|
||||
// },
|
||||
// PrivateKey: &armiotoperations.CertManagerPrivateKey{
|
||||
// Algorithm: to.Ptr(armiotoperations.PrivateKeyAlgorithmEc256),
|
||||
// RotationPolicy: to.Ptr(armiotoperations.PrivateKeyRotationPolicyAlways),
|
||||
// },
|
||||
// San: &armiotoperations.SanForCert{
|
||||
// DNS: []*string{
|
||||
// to.Ptr("xhvmhrrhgfsapocjeebqtnzarlj"),
|
||||
// },
|
||||
// IP: []*string{
|
||||
// to.Ptr("zbgugfzcgsmegevzktsnibyuyp"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// Manual: &armiotoperations.X509ManualCertificate{
|
||||
// SecretRef: to.Ptr("secret-name"),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ServiceType: to.Ptr(armiotoperations.ServiceTypeClusterIP),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123"),
|
||||
// Name: to.Ptr("hoqjaachratt"),
|
||||
// Type: to.Ptr("hizbknwegcdaeh"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// NextLink: to.Ptr("https://microsoft.com/a"),
|
||||
// },
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- feature/*
|
||||
- hotfix/*
|
||||
- release/*
|
||||
paths:
|
||||
include:
|
||||
- sdk/resourcemanager/iotoperations/armiotoperations/
|
||||
|
||||
pr:
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
- feature/*
|
||||
- hotfix/*
|
||||
- release/*
|
||||
paths:
|
||||
include:
|
||||
- sdk/resourcemanager/iotoperations/armiotoperations/
|
||||
|
||||
extends:
|
||||
template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml
|
||||
parameters:
|
||||
IncludeRelease: true
|
||||
ServiceDirectory: 'resourcemanager/iotoperations/armiotoperations'
|
|
@ -0,0 +1,104 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
)
|
||||
|
||||
// ClientFactory is a client factory used to create any client in this module.
|
||||
// Don't use this type directly, use NewClientFactory instead.
|
||||
type ClientFactory struct {
|
||||
subscriptionID string
|
||||
internal *arm.Client
|
||||
}
|
||||
|
||||
// NewClientFactory creates a new instance of ClientFactory with the specified values.
|
||||
// The parameter values will be propagated to any client created from this factory.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) {
|
||||
internal, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ClientFactory{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: internal,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewBrokerAuthenticationClient creates a new instance of BrokerAuthenticationClient.
|
||||
func (c *ClientFactory) NewBrokerAuthenticationClient() *BrokerAuthenticationClient {
|
||||
return &BrokerAuthenticationClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewBrokerAuthorizationClient creates a new instance of BrokerAuthorizationClient.
|
||||
func (c *ClientFactory) NewBrokerAuthorizationClient() *BrokerAuthorizationClient {
|
||||
return &BrokerAuthorizationClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewBrokerClient creates a new instance of BrokerClient.
|
||||
func (c *ClientFactory) NewBrokerClient() *BrokerClient {
|
||||
return &BrokerClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewBrokerListenerClient creates a new instance of BrokerListenerClient.
|
||||
func (c *ClientFactory) NewBrokerListenerClient() *BrokerListenerClient {
|
||||
return &BrokerListenerClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDataflowClient creates a new instance of DataflowClient.
|
||||
func (c *ClientFactory) NewDataflowClient() *DataflowClient {
|
||||
return &DataflowClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDataflowEndpointClient creates a new instance of DataflowEndpointClient.
|
||||
func (c *ClientFactory) NewDataflowEndpointClient() *DataflowEndpointClient {
|
||||
return &DataflowEndpointClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewDataflowProfileClient creates a new instance of DataflowProfileClient.
|
||||
func (c *ClientFactory) NewDataflowProfileClient() *DataflowProfileClient {
|
||||
return &DataflowProfileClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewInstanceClient creates a new instance of InstanceClient.
|
||||
func (c *ClientFactory) NewInstanceClient() *InstanceClient {
|
||||
return &InstanceClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewOperationsClient creates a new instance of OperationsClient.
|
||||
func (c *ClientFactory) NewOperationsClient() *OperationsClient {
|
||||
return &OperationsClient{
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,822 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
const (
|
||||
moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
moduleVersion = "v0.1.0"
|
||||
)
|
||||
|
||||
// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
|
||||
type ActionType string
|
||||
|
||||
const (
|
||||
// ActionTypeInternal - Actions are for internal-only APIs.
|
||||
ActionTypeInternal ActionType = "Internal"
|
||||
)
|
||||
|
||||
// PossibleActionTypeValues returns the possible values for the ActionType const type.
|
||||
func PossibleActionTypeValues() []ActionType {
|
||||
return []ActionType{
|
||||
ActionTypeInternal,
|
||||
}
|
||||
}
|
||||
|
||||
// BrokerAuthenticationMethod - Broker Authentication Mode
|
||||
type BrokerAuthenticationMethod string
|
||||
|
||||
const (
|
||||
// BrokerAuthenticationMethodCustom - Custom authentication configuration.
|
||||
BrokerAuthenticationMethodCustom BrokerAuthenticationMethod = "Custom"
|
||||
// BrokerAuthenticationMethodServiceAccountToken - ServiceAccountToken authentication configuration.
|
||||
BrokerAuthenticationMethodServiceAccountToken BrokerAuthenticationMethod = "ServiceAccountToken"
|
||||
// BrokerAuthenticationMethodX509 - X.509 authentication configuration.
|
||||
BrokerAuthenticationMethodX509 BrokerAuthenticationMethod = "X509"
|
||||
)
|
||||
|
||||
// PossibleBrokerAuthenticationMethodValues returns the possible values for the BrokerAuthenticationMethod const type.
|
||||
func PossibleBrokerAuthenticationMethodValues() []BrokerAuthenticationMethod {
|
||||
return []BrokerAuthenticationMethod{
|
||||
BrokerAuthenticationMethodCustom,
|
||||
BrokerAuthenticationMethodServiceAccountToken,
|
||||
BrokerAuthenticationMethodX509,
|
||||
}
|
||||
}
|
||||
|
||||
// BrokerMemoryProfile - The memory profile settings of the Broker
|
||||
type BrokerMemoryProfile string
|
||||
|
||||
const (
|
||||
// BrokerMemoryProfileHigh - High memory profile.
|
||||
BrokerMemoryProfileHigh BrokerMemoryProfile = "High"
|
||||
// BrokerMemoryProfileLow - Low memory profile.
|
||||
BrokerMemoryProfileLow BrokerMemoryProfile = "Low"
|
||||
// BrokerMemoryProfileMedium - Medium memory profile.
|
||||
BrokerMemoryProfileMedium BrokerMemoryProfile = "Medium"
|
||||
// BrokerMemoryProfileTiny - Tiny memory profile.
|
||||
BrokerMemoryProfileTiny BrokerMemoryProfile = "Tiny"
|
||||
)
|
||||
|
||||
// PossibleBrokerMemoryProfileValues returns the possible values for the BrokerMemoryProfile const type.
|
||||
func PossibleBrokerMemoryProfileValues() []BrokerMemoryProfile {
|
||||
return []BrokerMemoryProfile{
|
||||
BrokerMemoryProfileHigh,
|
||||
BrokerMemoryProfileLow,
|
||||
BrokerMemoryProfileMedium,
|
||||
BrokerMemoryProfileTiny,
|
||||
}
|
||||
}
|
||||
|
||||
// BrokerProtocolType - Broker Protocol types
|
||||
type BrokerProtocolType string
|
||||
|
||||
const (
|
||||
// BrokerProtocolTypeMqtt - protocol broker
|
||||
BrokerProtocolTypeMqtt BrokerProtocolType = "Mqtt"
|
||||
// BrokerProtocolTypeWebSockets - protocol websocket
|
||||
BrokerProtocolTypeWebSockets BrokerProtocolType = "WebSockets"
|
||||
)
|
||||
|
||||
// PossibleBrokerProtocolTypeValues returns the possible values for the BrokerProtocolType const type.
|
||||
func PossibleBrokerProtocolTypeValues() []BrokerProtocolType {
|
||||
return []BrokerProtocolType{
|
||||
BrokerProtocolTypeMqtt,
|
||||
BrokerProtocolTypeWebSockets,
|
||||
}
|
||||
}
|
||||
|
||||
// BrokerResourceDefinitionMethods - BrokerResourceDefinitionMethods methods allowed
|
||||
type BrokerResourceDefinitionMethods string
|
||||
|
||||
const (
|
||||
// BrokerResourceDefinitionMethodsConnect - Allowed Connecting to Broker
|
||||
BrokerResourceDefinitionMethodsConnect BrokerResourceDefinitionMethods = "Connect"
|
||||
// BrokerResourceDefinitionMethodsPublish - Allowed Publishing to Broker
|
||||
BrokerResourceDefinitionMethodsPublish BrokerResourceDefinitionMethods = "Publish"
|
||||
// BrokerResourceDefinitionMethodsSubscribe - Allowed Subscribing to Broker
|
||||
BrokerResourceDefinitionMethodsSubscribe BrokerResourceDefinitionMethods = "Subscribe"
|
||||
)
|
||||
|
||||
// PossibleBrokerResourceDefinitionMethodsValues returns the possible values for the BrokerResourceDefinitionMethods const type.
|
||||
func PossibleBrokerResourceDefinitionMethodsValues() []BrokerResourceDefinitionMethods {
|
||||
return []BrokerResourceDefinitionMethods{
|
||||
BrokerResourceDefinitionMethodsConnect,
|
||||
BrokerResourceDefinitionMethodsPublish,
|
||||
BrokerResourceDefinitionMethodsSubscribe,
|
||||
}
|
||||
}
|
||||
|
||||
// CertManagerIssuerKind - CertManagerIssuerKind properties
|
||||
type CertManagerIssuerKind string
|
||||
|
||||
const (
|
||||
// CertManagerIssuerKindClusterIssuer - ClusterIssuer kind.
|
||||
CertManagerIssuerKindClusterIssuer CertManagerIssuerKind = "ClusterIssuer"
|
||||
// CertManagerIssuerKindIssuer - Issuer kind.
|
||||
CertManagerIssuerKindIssuer CertManagerIssuerKind = "Issuer"
|
||||
)
|
||||
|
||||
// PossibleCertManagerIssuerKindValues returns the possible values for the CertManagerIssuerKind const type.
|
||||
func PossibleCertManagerIssuerKindValues() []CertManagerIssuerKind {
|
||||
return []CertManagerIssuerKind{
|
||||
CertManagerIssuerKindClusterIssuer,
|
||||
CertManagerIssuerKindIssuer,
|
||||
}
|
||||
}
|
||||
|
||||
// CloudEventAttributeType - How to map events to the cloud.
|
||||
type CloudEventAttributeType string
|
||||
|
||||
const (
|
||||
// CloudEventAttributeTypeCreateOrRemap - CreateOrRemap type
|
||||
CloudEventAttributeTypeCreateOrRemap CloudEventAttributeType = "CreateOrRemap"
|
||||
// CloudEventAttributeTypePropagate - Propagate type
|
||||
CloudEventAttributeTypePropagate CloudEventAttributeType = "Propagate"
|
||||
)
|
||||
|
||||
// PossibleCloudEventAttributeTypeValues returns the possible values for the CloudEventAttributeType const type.
|
||||
func PossibleCloudEventAttributeTypeValues() []CloudEventAttributeType {
|
||||
return []CloudEventAttributeType{
|
||||
CloudEventAttributeTypeCreateOrRemap,
|
||||
CloudEventAttributeTypePropagate,
|
||||
}
|
||||
}
|
||||
|
||||
// CreatedByType - The kind of entity that created the resource.
|
||||
type CreatedByType string
|
||||
|
||||
const (
|
||||
// CreatedByTypeApplication - The entity was created by an application.
|
||||
CreatedByTypeApplication CreatedByType = "Application"
|
||||
// CreatedByTypeKey - The entity was created by a key.
|
||||
CreatedByTypeKey CreatedByType = "Key"
|
||||
// CreatedByTypeManagedIdentity - The entity was created by a managed identity.
|
||||
CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity"
|
||||
// CreatedByTypeUser - The entity was created by a user.
|
||||
CreatedByTypeUser CreatedByType = "User"
|
||||
)
|
||||
|
||||
// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.
|
||||
func PossibleCreatedByTypeValues() []CreatedByType {
|
||||
return []CreatedByType{
|
||||
CreatedByTypeApplication,
|
||||
CreatedByTypeKey,
|
||||
CreatedByTypeManagedIdentity,
|
||||
CreatedByTypeUser,
|
||||
}
|
||||
}
|
||||
|
||||
// DataExplorerAuthMethod - DataflowEndpoint Data Explorer Authentication Method properties
|
||||
type DataExplorerAuthMethod string
|
||||
|
||||
const (
|
||||
// DataExplorerAuthMethodSystemAssignedManagedIdentity - SystemAssignedManagedIdentity type
|
||||
DataExplorerAuthMethodSystemAssignedManagedIdentity DataExplorerAuthMethod = "SystemAssignedManagedIdentity"
|
||||
// DataExplorerAuthMethodUserAssignedManagedIdentity - UserAssignedManagedIdentity type
|
||||
DataExplorerAuthMethodUserAssignedManagedIdentity DataExplorerAuthMethod = "UserAssignedManagedIdentity"
|
||||
)
|
||||
|
||||
// PossibleDataExplorerAuthMethodValues returns the possible values for the DataExplorerAuthMethod const type.
|
||||
func PossibleDataExplorerAuthMethodValues() []DataExplorerAuthMethod {
|
||||
return []DataExplorerAuthMethod{
|
||||
DataExplorerAuthMethodSystemAssignedManagedIdentity,
|
||||
DataExplorerAuthMethodUserAssignedManagedIdentity,
|
||||
}
|
||||
}
|
||||
|
||||
// DataLakeStorageAuthMethod - DataflowEndpoint Data Lake Storage Authentication Method properties
|
||||
type DataLakeStorageAuthMethod string
|
||||
|
||||
const (
|
||||
// DataLakeStorageAuthMethodAccessToken - AccessToken Option
|
||||
DataLakeStorageAuthMethodAccessToken DataLakeStorageAuthMethod = "AccessToken"
|
||||
// DataLakeStorageAuthMethodSystemAssignedManagedIdentity - SystemAssignedManagedIdentity type
|
||||
DataLakeStorageAuthMethodSystemAssignedManagedIdentity DataLakeStorageAuthMethod = "SystemAssignedManagedIdentity"
|
||||
// DataLakeStorageAuthMethodUserAssignedManagedIdentity - UserAssignedManagedIdentity type
|
||||
DataLakeStorageAuthMethodUserAssignedManagedIdentity DataLakeStorageAuthMethod = "UserAssignedManagedIdentity"
|
||||
)
|
||||
|
||||
// PossibleDataLakeStorageAuthMethodValues returns the possible values for the DataLakeStorageAuthMethod const type.
|
||||
func PossibleDataLakeStorageAuthMethodValues() []DataLakeStorageAuthMethod {
|
||||
return []DataLakeStorageAuthMethod{
|
||||
DataLakeStorageAuthMethodAccessToken,
|
||||
DataLakeStorageAuthMethodSystemAssignedManagedIdentity,
|
||||
DataLakeStorageAuthMethodUserAssignedManagedIdentity,
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowEndpointAuthenticationSaslType - DataflowEndpoint Authentication Sasl Type properties
|
||||
type DataflowEndpointAuthenticationSaslType string
|
||||
|
||||
const (
|
||||
// DataflowEndpointAuthenticationSaslTypePlain - PLAIN Type
|
||||
DataflowEndpointAuthenticationSaslTypePlain DataflowEndpointAuthenticationSaslType = "Plain"
|
||||
// DataflowEndpointAuthenticationSaslTypeScramSHA256 - SCRAM_SHA_256 Type
|
||||
DataflowEndpointAuthenticationSaslTypeScramSHA256 DataflowEndpointAuthenticationSaslType = "ScramSha256"
|
||||
// DataflowEndpointAuthenticationSaslTypeScramSHA512 - SCRAM_SHA_512 Type
|
||||
DataflowEndpointAuthenticationSaslTypeScramSHA512 DataflowEndpointAuthenticationSaslType = "ScramSha512"
|
||||
)
|
||||
|
||||
// PossibleDataflowEndpointAuthenticationSaslTypeValues returns the possible values for the DataflowEndpointAuthenticationSaslType const type.
|
||||
func PossibleDataflowEndpointAuthenticationSaslTypeValues() []DataflowEndpointAuthenticationSaslType {
|
||||
return []DataflowEndpointAuthenticationSaslType{
|
||||
DataflowEndpointAuthenticationSaslTypePlain,
|
||||
DataflowEndpointAuthenticationSaslTypeScramSHA256,
|
||||
DataflowEndpointAuthenticationSaslTypeScramSHA512,
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowEndpointFabricPathType - DataflowEndpoint Fabric Path Type properties
|
||||
type DataflowEndpointFabricPathType string
|
||||
|
||||
const (
|
||||
// DataflowEndpointFabricPathTypeFiles - FILES Type
|
||||
DataflowEndpointFabricPathTypeFiles DataflowEndpointFabricPathType = "Files"
|
||||
// DataflowEndpointFabricPathTypeTables - TABLES Type
|
||||
DataflowEndpointFabricPathTypeTables DataflowEndpointFabricPathType = "Tables"
|
||||
)
|
||||
|
||||
// PossibleDataflowEndpointFabricPathTypeValues returns the possible values for the DataflowEndpointFabricPathType const type.
|
||||
func PossibleDataflowEndpointFabricPathTypeValues() []DataflowEndpointFabricPathType {
|
||||
return []DataflowEndpointFabricPathType{
|
||||
DataflowEndpointFabricPathTypeFiles,
|
||||
DataflowEndpointFabricPathTypeTables,
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowEndpointKafkaAcks - DataflowEndpoint Kafka Acks properties
|
||||
type DataflowEndpointKafkaAcks string
|
||||
|
||||
const (
|
||||
// DataflowEndpointKafkaAcksAll - ALL Option
|
||||
DataflowEndpointKafkaAcksAll DataflowEndpointKafkaAcks = "All"
|
||||
// DataflowEndpointKafkaAcksOne - ONE Option
|
||||
DataflowEndpointKafkaAcksOne DataflowEndpointKafkaAcks = "One"
|
||||
// DataflowEndpointKafkaAcksZero - ZERO Option
|
||||
DataflowEndpointKafkaAcksZero DataflowEndpointKafkaAcks = "Zero"
|
||||
)
|
||||
|
||||
// PossibleDataflowEndpointKafkaAcksValues returns the possible values for the DataflowEndpointKafkaAcks const type.
|
||||
func PossibleDataflowEndpointKafkaAcksValues() []DataflowEndpointKafkaAcks {
|
||||
return []DataflowEndpointKafkaAcks{
|
||||
DataflowEndpointKafkaAcksAll,
|
||||
DataflowEndpointKafkaAcksOne,
|
||||
DataflowEndpointKafkaAcksZero,
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowEndpointKafkaCompression - Kafka endpoint Compression properties
|
||||
type DataflowEndpointKafkaCompression string
|
||||
|
||||
const (
|
||||
// DataflowEndpointKafkaCompressionGzip - Gzip Option
|
||||
DataflowEndpointKafkaCompressionGzip DataflowEndpointKafkaCompression = "Gzip"
|
||||
// DataflowEndpointKafkaCompressionLz4 - LZ4 Option
|
||||
DataflowEndpointKafkaCompressionLz4 DataflowEndpointKafkaCompression = "Lz4"
|
||||
// DataflowEndpointKafkaCompressionNone - NONE Option
|
||||
DataflowEndpointKafkaCompressionNone DataflowEndpointKafkaCompression = "None"
|
||||
// DataflowEndpointKafkaCompressionSnappy - SNAPPY Option
|
||||
DataflowEndpointKafkaCompressionSnappy DataflowEndpointKafkaCompression = "Snappy"
|
||||
)
|
||||
|
||||
// PossibleDataflowEndpointKafkaCompressionValues returns the possible values for the DataflowEndpointKafkaCompression const type.
|
||||
func PossibleDataflowEndpointKafkaCompressionValues() []DataflowEndpointKafkaCompression {
|
||||
return []DataflowEndpointKafkaCompression{
|
||||
DataflowEndpointKafkaCompressionGzip,
|
||||
DataflowEndpointKafkaCompressionLz4,
|
||||
DataflowEndpointKafkaCompressionNone,
|
||||
DataflowEndpointKafkaCompressionSnappy,
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowEndpointKafkaPartitionStrategy - DataflowEndpoint Kafka Partition Strategy properties
|
||||
type DataflowEndpointKafkaPartitionStrategy string
|
||||
|
||||
const (
|
||||
// DataflowEndpointKafkaPartitionStrategyDefault - Default: Assigns messages to random partitions, using a round-robin algorithm.
|
||||
DataflowEndpointKafkaPartitionStrategyDefault DataflowEndpointKafkaPartitionStrategy = "Default"
|
||||
// DataflowEndpointKafkaPartitionStrategyProperty - PROPERTY Option
|
||||
DataflowEndpointKafkaPartitionStrategyProperty DataflowEndpointKafkaPartitionStrategy = "Property"
|
||||
// DataflowEndpointKafkaPartitionStrategyStatic - Static: Assigns messages to a fixed partition number that's derived from
|
||||
// the instance ID of the dataflow.
|
||||
DataflowEndpointKafkaPartitionStrategyStatic DataflowEndpointKafkaPartitionStrategy = "Static"
|
||||
// DataflowEndpointKafkaPartitionStrategyTopic - TOPIC Option
|
||||
DataflowEndpointKafkaPartitionStrategyTopic DataflowEndpointKafkaPartitionStrategy = "Topic"
|
||||
)
|
||||
|
||||
// PossibleDataflowEndpointKafkaPartitionStrategyValues returns the possible values for the DataflowEndpointKafkaPartitionStrategy const type.
|
||||
func PossibleDataflowEndpointKafkaPartitionStrategyValues() []DataflowEndpointKafkaPartitionStrategy {
|
||||
return []DataflowEndpointKafkaPartitionStrategy{
|
||||
DataflowEndpointKafkaPartitionStrategyDefault,
|
||||
DataflowEndpointKafkaPartitionStrategyProperty,
|
||||
DataflowEndpointKafkaPartitionStrategyStatic,
|
||||
DataflowEndpointKafkaPartitionStrategyTopic,
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowMappingType - Dataflow type mapping properties
|
||||
type DataflowMappingType string
|
||||
|
||||
const (
|
||||
// DataflowMappingTypeBuiltInFunction - Built in function type
|
||||
DataflowMappingTypeBuiltInFunction DataflowMappingType = "BuiltInFunction"
|
||||
// DataflowMappingTypeCompute - Compute type
|
||||
DataflowMappingTypeCompute DataflowMappingType = "Compute"
|
||||
// DataflowMappingTypeNewProperties - New Properties type
|
||||
DataflowMappingTypeNewProperties DataflowMappingType = "NewProperties"
|
||||
// DataflowMappingTypePassThrough - Pass-through type
|
||||
DataflowMappingTypePassThrough DataflowMappingType = "PassThrough"
|
||||
// DataflowMappingTypeRename - Rename type
|
||||
DataflowMappingTypeRename DataflowMappingType = "Rename"
|
||||
)
|
||||
|
||||
// PossibleDataflowMappingTypeValues returns the possible values for the DataflowMappingType const type.
|
||||
func PossibleDataflowMappingTypeValues() []DataflowMappingType {
|
||||
return []DataflowMappingType{
|
||||
DataflowMappingTypeBuiltInFunction,
|
||||
DataflowMappingTypeCompute,
|
||||
DataflowMappingTypeNewProperties,
|
||||
DataflowMappingTypePassThrough,
|
||||
DataflowMappingTypeRename,
|
||||
}
|
||||
}
|
||||
|
||||
// EndpointType - DataflowEndpoint Type properties
|
||||
type EndpointType string
|
||||
|
||||
const (
|
||||
// EndpointTypeDataExplorer - Azure Data Explorer Type
|
||||
EndpointTypeDataExplorer EndpointType = "DataExplorer"
|
||||
// EndpointTypeDataLakeStorage - Azure Data Lake Type
|
||||
EndpointTypeDataLakeStorage EndpointType = "DataLakeStorage"
|
||||
// EndpointTypeFabricOneLake - Microsoft Fabric Type
|
||||
EndpointTypeFabricOneLake EndpointType = "FabricOneLake"
|
||||
// EndpointTypeKafka - Kafka Type
|
||||
EndpointTypeKafka EndpointType = "Kafka"
|
||||
// EndpointTypeLocalStorage - Local Storage Type
|
||||
EndpointTypeLocalStorage EndpointType = "LocalStorage"
|
||||
// EndpointTypeMqtt - Broker Type
|
||||
EndpointTypeMqtt EndpointType = "Mqtt"
|
||||
)
|
||||
|
||||
// PossibleEndpointTypeValues returns the possible values for the EndpointType const type.
|
||||
func PossibleEndpointTypeValues() []EndpointType {
|
||||
return []EndpointType{
|
||||
EndpointTypeDataExplorer,
|
||||
EndpointTypeDataLakeStorage,
|
||||
EndpointTypeFabricOneLake,
|
||||
EndpointTypeKafka,
|
||||
EndpointTypeLocalStorage,
|
||||
EndpointTypeMqtt,
|
||||
}
|
||||
}
|
||||
|
||||
// ExtendedLocationType - The enum defining type of ExtendedLocation accepted.
|
||||
type ExtendedLocationType string
|
||||
|
||||
const (
|
||||
// ExtendedLocationTypeCustomLocation - CustomLocation type
|
||||
ExtendedLocationTypeCustomLocation ExtendedLocationType = "CustomLocation"
|
||||
)
|
||||
|
||||
// PossibleExtendedLocationTypeValues returns the possible values for the ExtendedLocationType const type.
|
||||
func PossibleExtendedLocationTypeValues() []ExtendedLocationType {
|
||||
return []ExtendedLocationType{
|
||||
ExtendedLocationTypeCustomLocation,
|
||||
}
|
||||
}
|
||||
|
||||
// FabricOneLakeAuthMethod - DataflowEndpoint Fabric One Lake Authentication Method properties
|
||||
type FabricOneLakeAuthMethod string
|
||||
|
||||
const (
|
||||
// FabricOneLakeAuthMethodSystemAssignedManagedIdentity - SystemAssignedManagedIdentity type
|
||||
FabricOneLakeAuthMethodSystemAssignedManagedIdentity FabricOneLakeAuthMethod = "SystemAssignedManagedIdentity"
|
||||
// FabricOneLakeAuthMethodUserAssignedManagedIdentity - UserAssignedManagedIdentity type
|
||||
FabricOneLakeAuthMethodUserAssignedManagedIdentity FabricOneLakeAuthMethod = "UserAssignedManagedIdentity"
|
||||
)
|
||||
|
||||
// PossibleFabricOneLakeAuthMethodValues returns the possible values for the FabricOneLakeAuthMethod const type.
|
||||
func PossibleFabricOneLakeAuthMethodValues() []FabricOneLakeAuthMethod {
|
||||
return []FabricOneLakeAuthMethod{
|
||||
FabricOneLakeAuthMethodSystemAssignedManagedIdentity,
|
||||
FabricOneLakeAuthMethodUserAssignedManagedIdentity,
|
||||
}
|
||||
}
|
||||
|
||||
// FilterType - Filter Type properties
|
||||
type FilterType string
|
||||
|
||||
const (
|
||||
// FilterTypeFilter - Filter type
|
||||
FilterTypeFilter FilterType = "Filter"
|
||||
)
|
||||
|
||||
// PossibleFilterTypeValues returns the possible values for the FilterType const type.
|
||||
func PossibleFilterTypeValues() []FilterType {
|
||||
return []FilterType{
|
||||
FilterTypeFilter,
|
||||
}
|
||||
}
|
||||
|
||||
// KafkaAuthMethod - DataflowEndpoint Kafka Authentication Method properties
|
||||
type KafkaAuthMethod string
|
||||
|
||||
const (
|
||||
// KafkaAuthMethodAnonymous - Anonymous Option
|
||||
KafkaAuthMethodAnonymous KafkaAuthMethod = "Anonymous"
|
||||
// KafkaAuthMethodSasl - Sasl Option
|
||||
KafkaAuthMethodSasl KafkaAuthMethod = "Sasl"
|
||||
// KafkaAuthMethodSystemAssignedManagedIdentity - SystemAssignedManagedIdentity type
|
||||
KafkaAuthMethodSystemAssignedManagedIdentity KafkaAuthMethod = "SystemAssignedManagedIdentity"
|
||||
// KafkaAuthMethodUserAssignedManagedIdentity - UserAssignedManagedIdentity type
|
||||
KafkaAuthMethodUserAssignedManagedIdentity KafkaAuthMethod = "UserAssignedManagedIdentity"
|
||||
// KafkaAuthMethodX509Certificate - x509Certificate Option
|
||||
KafkaAuthMethodX509Certificate KafkaAuthMethod = "X509Certificate"
|
||||
)
|
||||
|
||||
// PossibleKafkaAuthMethodValues returns the possible values for the KafkaAuthMethod const type.
|
||||
func PossibleKafkaAuthMethodValues() []KafkaAuthMethod {
|
||||
return []KafkaAuthMethod{
|
||||
KafkaAuthMethodAnonymous,
|
||||
KafkaAuthMethodSasl,
|
||||
KafkaAuthMethodSystemAssignedManagedIdentity,
|
||||
KafkaAuthMethodUserAssignedManagedIdentity,
|
||||
KafkaAuthMethodX509Certificate,
|
||||
}
|
||||
}
|
||||
|
||||
// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
|
||||
type ManagedServiceIdentityType string
|
||||
|
||||
const (
|
||||
// ManagedServiceIdentityTypeNone - No managed identity.
|
||||
ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None"
|
||||
// ManagedServiceIdentityTypeSystemAndUserAssigned - System and user assigned managed identity.
|
||||
ManagedServiceIdentityTypeSystemAndUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned"
|
||||
// ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity.
|
||||
ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned"
|
||||
// ManagedServiceIdentityTypeUserAssigned - User assigned managed identity.
|
||||
ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned"
|
||||
)
|
||||
|
||||
// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type.
|
||||
func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType {
|
||||
return []ManagedServiceIdentityType{
|
||||
ManagedServiceIdentityTypeNone,
|
||||
ManagedServiceIdentityTypeSystemAndUserAssigned,
|
||||
ManagedServiceIdentityTypeSystemAssigned,
|
||||
ManagedServiceIdentityTypeUserAssigned,
|
||||
}
|
||||
}
|
||||
|
||||
// MqttAuthMethod - DataflowEndpoint Mqtt Authentication Method properties
|
||||
type MqttAuthMethod string
|
||||
|
||||
const (
|
||||
// MqttAuthMethodAnonymous - Anonymous Option
|
||||
MqttAuthMethodAnonymous MqttAuthMethod = "Anonymous"
|
||||
// MqttAuthMethodServiceAccountToken - ServiceAccountToken Option
|
||||
MqttAuthMethodServiceAccountToken MqttAuthMethod = "ServiceAccountToken"
|
||||
// MqttAuthMethodSystemAssignedManagedIdentity - SystemAssignedManagedIdentity type
|
||||
MqttAuthMethodSystemAssignedManagedIdentity MqttAuthMethod = "SystemAssignedManagedIdentity"
|
||||
// MqttAuthMethodUserAssignedManagedIdentity - UserAssignedManagedIdentity type
|
||||
MqttAuthMethodUserAssignedManagedIdentity MqttAuthMethod = "UserAssignedManagedIdentity"
|
||||
// MqttAuthMethodX509Certificate - x509Certificate Option
|
||||
MqttAuthMethodX509Certificate MqttAuthMethod = "X509Certificate"
|
||||
)
|
||||
|
||||
// PossibleMqttAuthMethodValues returns the possible values for the MqttAuthMethod const type.
|
||||
func PossibleMqttAuthMethodValues() []MqttAuthMethod {
|
||||
return []MqttAuthMethod{
|
||||
MqttAuthMethodAnonymous,
|
||||
MqttAuthMethodServiceAccountToken,
|
||||
MqttAuthMethodSystemAssignedManagedIdentity,
|
||||
MqttAuthMethodUserAssignedManagedIdentity,
|
||||
MqttAuthMethodX509Certificate,
|
||||
}
|
||||
}
|
||||
|
||||
// MqttRetainType - Broker Retain types
|
||||
type MqttRetainType string
|
||||
|
||||
const (
|
||||
// MqttRetainTypeKeep - Retain the messages.
|
||||
MqttRetainTypeKeep MqttRetainType = "Keep"
|
||||
// MqttRetainTypeNever - Never retain messages.
|
||||
MqttRetainTypeNever MqttRetainType = "Never"
|
||||
)
|
||||
|
||||
// PossibleMqttRetainTypeValues returns the possible values for the MqttRetainType const type.
|
||||
func PossibleMqttRetainTypeValues() []MqttRetainType {
|
||||
return []MqttRetainType{
|
||||
MqttRetainTypeKeep,
|
||||
MqttRetainTypeNever,
|
||||
}
|
||||
}
|
||||
|
||||
// OperationType - Dataflow Operation Type properties
|
||||
type OperationType string
|
||||
|
||||
const (
|
||||
// OperationTypeBuiltInTransformation - Dataflow BuiltIn Transformation Operation
|
||||
OperationTypeBuiltInTransformation OperationType = "BuiltInTransformation"
|
||||
// OperationTypeDestination - Dataflow Destination Operation
|
||||
OperationTypeDestination OperationType = "Destination"
|
||||
// OperationTypeSource - Dataflow Source Operation
|
||||
OperationTypeSource OperationType = "Source"
|
||||
)
|
||||
|
||||
// PossibleOperationTypeValues returns the possible values for the OperationType const type.
|
||||
func PossibleOperationTypeValues() []OperationType {
|
||||
return []OperationType{
|
||||
OperationTypeBuiltInTransformation,
|
||||
OperationTypeDestination,
|
||||
OperationTypeSource,
|
||||
}
|
||||
}
|
||||
|
||||
// OperationalMode - Mode properties
|
||||
type OperationalMode string
|
||||
|
||||
const (
|
||||
// OperationalModeDisabled - Disabled is equivalent to False.
|
||||
OperationalModeDisabled OperationalMode = "Disabled"
|
||||
// OperationalModeEnabled - Enabled is equivalent to True
|
||||
OperationalModeEnabled OperationalMode = "Enabled"
|
||||
)
|
||||
|
||||
// PossibleOperationalModeValues returns the possible values for the OperationalMode const type.
|
||||
func PossibleOperationalModeValues() []OperationalMode {
|
||||
return []OperationalMode{
|
||||
OperationalModeDisabled,
|
||||
OperationalModeEnabled,
|
||||
}
|
||||
}
|
||||
|
||||
// OperatorValues - Valid operators are In, NotIn, Exists and DoesNotExist.
|
||||
type OperatorValues string
|
||||
|
||||
const (
|
||||
// OperatorValuesDoesNotExist - DoesNotExist operator.
|
||||
OperatorValuesDoesNotExist OperatorValues = "DoesNotExist"
|
||||
// OperatorValuesExists - Exists operator.
|
||||
OperatorValuesExists OperatorValues = "Exists"
|
||||
// OperatorValuesIn - In operator.
|
||||
OperatorValuesIn OperatorValues = "In"
|
||||
// OperatorValuesNotIn - NotIn operator.
|
||||
OperatorValuesNotIn OperatorValues = "NotIn"
|
||||
)
|
||||
|
||||
// PossibleOperatorValuesValues returns the possible values for the OperatorValues const type.
|
||||
func PossibleOperatorValuesValues() []OperatorValues {
|
||||
return []OperatorValues{
|
||||
OperatorValuesDoesNotExist,
|
||||
OperatorValuesExists,
|
||||
OperatorValuesIn,
|
||||
OperatorValuesNotIn,
|
||||
}
|
||||
}
|
||||
|
||||
// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
|
||||
// value is "user,system"
|
||||
type Origin string
|
||||
|
||||
const (
|
||||
// OriginSystem - Indicates the operation is initiated by a system.
|
||||
OriginSystem Origin = "system"
|
||||
// OriginUser - Indicates the operation is initiated by a user.
|
||||
OriginUser Origin = "user"
|
||||
// OriginUserSystem - Indicates the operation is initiated by a user or system.
|
||||
OriginUserSystem Origin = "user,system"
|
||||
)
|
||||
|
||||
// PossibleOriginValues returns the possible values for the Origin const type.
|
||||
func PossibleOriginValues() []Origin {
|
||||
return []Origin{
|
||||
OriginSystem,
|
||||
OriginUser,
|
||||
OriginUserSystem,
|
||||
}
|
||||
}
|
||||
|
||||
// PrivateKeyAlgorithm - Private key algorithm types.
|
||||
type PrivateKeyAlgorithm string
|
||||
|
||||
const (
|
||||
// PrivateKeyAlgorithmEc256 - Algorithm - ec256.
|
||||
PrivateKeyAlgorithmEc256 PrivateKeyAlgorithm = "Ec256"
|
||||
// PrivateKeyAlgorithmEc384 - Algorithm - ec384.
|
||||
PrivateKeyAlgorithmEc384 PrivateKeyAlgorithm = "Ec384"
|
||||
// PrivateKeyAlgorithmEc521 - Algorithm - ec521.
|
||||
PrivateKeyAlgorithmEc521 PrivateKeyAlgorithm = "Ec521"
|
||||
// PrivateKeyAlgorithmEd25519 - Algorithm - ed25519.
|
||||
PrivateKeyAlgorithmEd25519 PrivateKeyAlgorithm = "Ed25519"
|
||||
// PrivateKeyAlgorithmRsa2048 - Algorithm - rsa2048.
|
||||
PrivateKeyAlgorithmRsa2048 PrivateKeyAlgorithm = "Rsa2048"
|
||||
// PrivateKeyAlgorithmRsa4096 - Algorithm - rsa4096.
|
||||
PrivateKeyAlgorithmRsa4096 PrivateKeyAlgorithm = "Rsa4096"
|
||||
// PrivateKeyAlgorithmRsa8192 - Algorithm - rsa8192.
|
||||
PrivateKeyAlgorithmRsa8192 PrivateKeyAlgorithm = "Rsa8192"
|
||||
)
|
||||
|
||||
// PossiblePrivateKeyAlgorithmValues returns the possible values for the PrivateKeyAlgorithm const type.
|
||||
func PossiblePrivateKeyAlgorithmValues() []PrivateKeyAlgorithm {
|
||||
return []PrivateKeyAlgorithm{
|
||||
PrivateKeyAlgorithmEc256,
|
||||
PrivateKeyAlgorithmEc384,
|
||||
PrivateKeyAlgorithmEc521,
|
||||
PrivateKeyAlgorithmEd25519,
|
||||
PrivateKeyAlgorithmRsa2048,
|
||||
PrivateKeyAlgorithmRsa4096,
|
||||
PrivateKeyAlgorithmRsa8192,
|
||||
}
|
||||
}
|
||||
|
||||
// PrivateKeyRotationPolicy - Private key rotation policy.
|
||||
type PrivateKeyRotationPolicy string
|
||||
|
||||
const (
|
||||
// PrivateKeyRotationPolicyAlways - Rotation Policy - Always.
|
||||
PrivateKeyRotationPolicyAlways PrivateKeyRotationPolicy = "Always"
|
||||
// PrivateKeyRotationPolicyNever - Rotation Policy - Never.
|
||||
PrivateKeyRotationPolicyNever PrivateKeyRotationPolicy = "Never"
|
||||
)
|
||||
|
||||
// PossiblePrivateKeyRotationPolicyValues returns the possible values for the PrivateKeyRotationPolicy const type.
|
||||
func PossiblePrivateKeyRotationPolicyValues() []PrivateKeyRotationPolicy {
|
||||
return []PrivateKeyRotationPolicy{
|
||||
PrivateKeyRotationPolicyAlways,
|
||||
PrivateKeyRotationPolicyNever,
|
||||
}
|
||||
}
|
||||
|
||||
// ProvisioningState - The enum defining status of resource.
|
||||
type ProvisioningState string
|
||||
|
||||
const (
|
||||
// ProvisioningStateAccepted - Resource has been Accepted.
|
||||
ProvisioningStateAccepted ProvisioningState = "Accepted"
|
||||
// ProvisioningStateCanceled - Resource creation was canceled.
|
||||
ProvisioningStateCanceled ProvisioningState = "Canceled"
|
||||
// ProvisioningStateDeleting - Resource is Deleting.
|
||||
ProvisioningStateDeleting ProvisioningState = "Deleting"
|
||||
// ProvisioningStateFailed - Resource creation failed.
|
||||
ProvisioningStateFailed ProvisioningState = "Failed"
|
||||
// ProvisioningStateProvisioning - Resource is getting provisioned.
|
||||
ProvisioningStateProvisioning ProvisioningState = "Provisioning"
|
||||
// ProvisioningStateSucceeded - Resource has been created.
|
||||
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
|
||||
// ProvisioningStateUpdating - Resource is Updating.
|
||||
ProvisioningStateUpdating ProvisioningState = "Updating"
|
||||
)
|
||||
|
||||
// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.
|
||||
func PossibleProvisioningStateValues() []ProvisioningState {
|
||||
return []ProvisioningState{
|
||||
ProvisioningStateAccepted,
|
||||
ProvisioningStateCanceled,
|
||||
ProvisioningStateDeleting,
|
||||
ProvisioningStateFailed,
|
||||
ProvisioningStateProvisioning,
|
||||
ProvisioningStateSucceeded,
|
||||
ProvisioningStateUpdating,
|
||||
}
|
||||
}
|
||||
|
||||
// ServiceType - Kubernetes Service Types supported by Listener
|
||||
type ServiceType string
|
||||
|
||||
const (
|
||||
// ServiceTypeClusterIP - Cluster IP Service.
|
||||
ServiceTypeClusterIP ServiceType = "ClusterIp"
|
||||
// ServiceTypeLoadBalancer - Load Balancer Service.
|
||||
ServiceTypeLoadBalancer ServiceType = "LoadBalancer"
|
||||
// ServiceTypeNodePort - Node Port Service.
|
||||
ServiceTypeNodePort ServiceType = "NodePort"
|
||||
)
|
||||
|
||||
// PossibleServiceTypeValues returns the possible values for the ServiceType const type.
|
||||
func PossibleServiceTypeValues() []ServiceType {
|
||||
return []ServiceType{
|
||||
ServiceTypeClusterIP,
|
||||
ServiceTypeLoadBalancer,
|
||||
ServiceTypeNodePort,
|
||||
}
|
||||
}
|
||||
|
||||
// SourceSerializationFormat - Serialization Format properties
|
||||
type SourceSerializationFormat string
|
||||
|
||||
const (
|
||||
// SourceSerializationFormatJSON - JSON Format
|
||||
SourceSerializationFormatJSON SourceSerializationFormat = "Json"
|
||||
)
|
||||
|
||||
// PossibleSourceSerializationFormatValues returns the possible values for the SourceSerializationFormat const type.
|
||||
func PossibleSourceSerializationFormatValues() []SourceSerializationFormat {
|
||||
return []SourceSerializationFormat{
|
||||
SourceSerializationFormatJSON,
|
||||
}
|
||||
}
|
||||
|
||||
// StateStoreResourceDefinitionMethods - StateStoreResourceDefinitionMethods methods allowed
|
||||
type StateStoreResourceDefinitionMethods string
|
||||
|
||||
const (
|
||||
// StateStoreResourceDefinitionMethodsRead - Get/KeyNotify from Store
|
||||
StateStoreResourceDefinitionMethodsRead StateStoreResourceDefinitionMethods = "Read"
|
||||
// StateStoreResourceDefinitionMethodsReadWrite - Allowed all operations on Store - Get/KeyNotify/Set/Delete
|
||||
StateStoreResourceDefinitionMethodsReadWrite StateStoreResourceDefinitionMethods = "ReadWrite"
|
||||
// StateStoreResourceDefinitionMethodsWrite - Set/Delete in Store
|
||||
StateStoreResourceDefinitionMethodsWrite StateStoreResourceDefinitionMethods = "Write"
|
||||
)
|
||||
|
||||
// PossibleStateStoreResourceDefinitionMethodsValues returns the possible values for the StateStoreResourceDefinitionMethods const type.
|
||||
func PossibleStateStoreResourceDefinitionMethodsValues() []StateStoreResourceDefinitionMethods {
|
||||
return []StateStoreResourceDefinitionMethods{
|
||||
StateStoreResourceDefinitionMethodsRead,
|
||||
StateStoreResourceDefinitionMethodsReadWrite,
|
||||
StateStoreResourceDefinitionMethodsWrite,
|
||||
}
|
||||
}
|
||||
|
||||
// StateStoreResourceKeyTypes - StateStoreResourceKeyTypes properties
|
||||
type StateStoreResourceKeyTypes string
|
||||
|
||||
const (
|
||||
// StateStoreResourceKeyTypesBinary - Key type - binary
|
||||
StateStoreResourceKeyTypesBinary StateStoreResourceKeyTypes = "Binary"
|
||||
// StateStoreResourceKeyTypesPattern - Key type - pattern
|
||||
StateStoreResourceKeyTypesPattern StateStoreResourceKeyTypes = "Pattern"
|
||||
// StateStoreResourceKeyTypesString - Key type - string
|
||||
StateStoreResourceKeyTypesString StateStoreResourceKeyTypes = "String"
|
||||
)
|
||||
|
||||
// PossibleStateStoreResourceKeyTypesValues returns the possible values for the StateStoreResourceKeyTypes const type.
|
||||
func PossibleStateStoreResourceKeyTypesValues() []StateStoreResourceKeyTypes {
|
||||
return []StateStoreResourceKeyTypes{
|
||||
StateStoreResourceKeyTypesBinary,
|
||||
StateStoreResourceKeyTypesPattern,
|
||||
StateStoreResourceKeyTypesString,
|
||||
}
|
||||
}
|
||||
|
||||
// SubscriberMessageDropStrategy - The enum defining strategies for dropping messages from the subscriber queue.
|
||||
type SubscriberMessageDropStrategy string
|
||||
|
||||
const (
|
||||
// SubscriberMessageDropStrategyDropOldest - The oldest message is dropped.
|
||||
SubscriberMessageDropStrategyDropOldest SubscriberMessageDropStrategy = "DropOldest"
|
||||
// SubscriberMessageDropStrategyNone - Messages are never dropped.
|
||||
SubscriberMessageDropStrategyNone SubscriberMessageDropStrategy = "None"
|
||||
)
|
||||
|
||||
// PossibleSubscriberMessageDropStrategyValues returns the possible values for the SubscriberMessageDropStrategy const type.
|
||||
func PossibleSubscriberMessageDropStrategyValues() []SubscriberMessageDropStrategy {
|
||||
return []SubscriberMessageDropStrategy{
|
||||
SubscriberMessageDropStrategyDropOldest,
|
||||
SubscriberMessageDropStrategyNone,
|
||||
}
|
||||
}
|
||||
|
||||
// TLSCertMethodMode - Broker Authentication Mode
|
||||
type TLSCertMethodMode string
|
||||
|
||||
const (
|
||||
// TLSCertMethodModeAutomatic - Automatic TLS server certificate configuration.
|
||||
TLSCertMethodModeAutomatic TLSCertMethodMode = "Automatic"
|
||||
// TLSCertMethodModeManual - Manual TLS server certificate configuration.
|
||||
TLSCertMethodModeManual TLSCertMethodMode = "Manual"
|
||||
)
|
||||
|
||||
// PossibleTLSCertMethodModeValues returns the possible values for the TLSCertMethodMode const type.
|
||||
func PossibleTLSCertMethodModeValues() []TLSCertMethodMode {
|
||||
return []TLSCertMethodMode{
|
||||
TLSCertMethodModeAutomatic,
|
||||
TLSCertMethodModeManual,
|
||||
}
|
||||
}
|
||||
|
||||
// TransformationSerializationFormat - Transformation Format properties
|
||||
type TransformationSerializationFormat string
|
||||
|
||||
const (
|
||||
// TransformationSerializationFormatDelta - Delta Format
|
||||
TransformationSerializationFormatDelta TransformationSerializationFormat = "Delta"
|
||||
// TransformationSerializationFormatJSON - JSON Format
|
||||
TransformationSerializationFormatJSON TransformationSerializationFormat = "Json"
|
||||
// TransformationSerializationFormatParquet - Parquet Format
|
||||
TransformationSerializationFormatParquet TransformationSerializationFormat = "Parquet"
|
||||
)
|
||||
|
||||
// PossibleTransformationSerializationFormatValues returns the possible values for the TransformationSerializationFormat const type.
|
||||
func PossibleTransformationSerializationFormatValues() []TransformationSerializationFormat {
|
||||
return []TransformationSerializationFormat{
|
||||
TransformationSerializationFormatDelta,
|
||||
TransformationSerializationFormatJSON,
|
||||
TransformationSerializationFormatParquet,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,360 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DataflowClient contains the methods for the Dataflow group.
|
||||
// Don't use this type directly, use NewDataflowClient() instead.
|
||||
type DataflowClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewDataflowClient creates a new instance of DataflowClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewDataflowClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataflowClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &DataflowClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// BeginCreateOrUpdate - Create a DataflowResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowProfileName - Name of Instance dataflowProfile resource
|
||||
// - dataflowName - Name of Instance dataflowProfile dataflow resource
|
||||
// - resource - Resource create parameters.
|
||||
// - options - DataflowClientBeginCreateOrUpdateOptions contains the optional parameters for the DataflowClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
func (client *DataflowClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, resource DataflowResource, options *DataflowClientBeginCreateOrUpdateOptions) (*runtime.Poller[DataflowClientCreateOrUpdateResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.createOrUpdate(ctx, resourceGroupName, instanceName, dataflowProfileName, dataflowName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataflowClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DataflowClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create a DataflowResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *DataflowClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, resource DataflowResource, options *DataflowClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "DataflowClient.BeginCreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instanceName, dataflowProfileName, dataflowName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *DataflowClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, resource DataflowResource, _ *DataflowClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowProfileName == "" {
|
||||
return nil, errors.New("parameter dataflowProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowProfileName}", url.PathEscape(dataflowProfileName))
|
||||
if dataflowName == "" {
|
||||
return nil, errors.New("parameter dataflowName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowName}", url.PathEscape(dataflowName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// BeginDelete - Delete a DataflowResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowProfileName - Name of Instance dataflowProfile resource
|
||||
// - dataflowName - Name of Instance dataflowProfile dataflow resource
|
||||
// - options - DataflowClientBeginDeleteOptions contains the optional parameters for the DataflowClient.BeginDelete method.
|
||||
func (client *DataflowClient) BeginDelete(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, options *DataflowClientBeginDeleteOptions) (*runtime.Poller[DataflowClientDeleteResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.deleteOperation(ctx, resourceGroupName, instanceName, dataflowProfileName, dataflowName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataflowClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DataflowClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete - Delete a DataflowResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *DataflowClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, options *DataflowClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "DataflowClient.BeginDelete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, instanceName, dataflowProfileName, dataflowName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *DataflowClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, _ *DataflowClientBeginDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowProfileName == "" {
|
||||
return nil, errors.New("parameter dataflowProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowProfileName}", url.PathEscape(dataflowProfileName))
|
||||
if dataflowName == "" {
|
||||
return nil, errors.New("parameter dataflowName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowName}", url.PathEscape(dataflowName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get a DataflowResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowProfileName - Name of Instance dataflowProfile resource
|
||||
// - dataflowName - Name of Instance dataflowProfile dataflow resource
|
||||
// - options - DataflowClientGetOptions contains the optional parameters for the DataflowClient.Get method.
|
||||
func (client *DataflowClient) Get(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, options *DataflowClientGetOptions) (DataflowClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "DataflowClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, instanceName, dataflowProfileName, dataflowName, options)
|
||||
if err != nil {
|
||||
return DataflowClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return DataflowClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return DataflowClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *DataflowClient) getCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, _ *DataflowClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowProfileName == "" {
|
||||
return nil, errors.New("parameter dataflowProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowProfileName}", url.PathEscape(dataflowProfileName))
|
||||
if dataflowName == "" {
|
||||
return nil, errors.New("parameter dataflowName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowName}", url.PathEscape(dataflowName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *DataflowClient) getHandleResponse(resp *http.Response) (DataflowClientGetResponse, error) {
|
||||
result := DataflowClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.DataflowResource); err != nil {
|
||||
return DataflowClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - List DataflowResource resources by DataflowProfileResource
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowProfileName - Name of Instance dataflowProfile resource
|
||||
// - options - DataflowClientListByResourceGroupOptions contains the optional parameters for the DataflowClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *DataflowClient) NewListByResourceGroupPager(resourceGroupName string, instanceName string, dataflowProfileName string, options *DataflowClientListByResourceGroupOptions) *runtime.Pager[DataflowClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[DataflowClientListByResourceGroupResponse]{
|
||||
More: func(page DataflowClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *DataflowClientListByResourceGroupResponse) (DataflowClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataflowClient.NewListByResourceGroupPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, instanceName, dataflowProfileName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return DataflowClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *DataflowClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, _ *DataflowClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowProfileName == "" {
|
||||
return nil, errors.New("parameter dataflowProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowProfileName}", url.PathEscape(dataflowProfileName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *DataflowClient) listByResourceGroupHandleResponse(resp *http.Response) (DataflowClientListByResourceGroupResponse, error) {
|
||||
result := DataflowClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.DataflowResourceListResult); err != nil {
|
||||
return DataflowClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,341 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DataflowEndpointClient contains the methods for the DataflowEndpoint group.
|
||||
// Don't use this type directly, use NewDataflowEndpointClient() instead.
|
||||
type DataflowEndpointClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewDataflowEndpointClient creates a new instance of DataflowEndpointClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewDataflowEndpointClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataflowEndpointClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &DataflowEndpointClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// BeginCreateOrUpdate - Create a DataflowEndpointResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowEndpointName - Name of Instance dataflowEndpoint resource
|
||||
// - resource - Resource create parameters.
|
||||
// - options - DataflowEndpointClientBeginCreateOrUpdateOptions contains the optional parameters for the DataflowEndpointClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
func (client *DataflowEndpointClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, resource DataflowEndpointResource, options *DataflowEndpointClientBeginCreateOrUpdateOptions) (*runtime.Poller[DataflowEndpointClientCreateOrUpdateResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.createOrUpdate(ctx, resourceGroupName, instanceName, dataflowEndpointName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataflowEndpointClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DataflowEndpointClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create a DataflowEndpointResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *DataflowEndpointClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, resource DataflowEndpointResource, options *DataflowEndpointClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "DataflowEndpointClient.BeginCreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instanceName, dataflowEndpointName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *DataflowEndpointClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, resource DataflowEndpointResource, _ *DataflowEndpointClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowEndpointName == "" {
|
||||
return nil, errors.New("parameter dataflowEndpointName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowEndpointName}", url.PathEscape(dataflowEndpointName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// BeginDelete - Delete a DataflowEndpointResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowEndpointName - Name of Instance dataflowEndpoint resource
|
||||
// - options - DataflowEndpointClientBeginDeleteOptions contains the optional parameters for the DataflowEndpointClient.BeginDelete
|
||||
// method.
|
||||
func (client *DataflowEndpointClient) BeginDelete(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, options *DataflowEndpointClientBeginDeleteOptions) (*runtime.Poller[DataflowEndpointClientDeleteResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.deleteOperation(ctx, resourceGroupName, instanceName, dataflowEndpointName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataflowEndpointClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DataflowEndpointClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete - Delete a DataflowEndpointResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *DataflowEndpointClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, options *DataflowEndpointClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "DataflowEndpointClient.BeginDelete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, instanceName, dataflowEndpointName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *DataflowEndpointClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, _ *DataflowEndpointClientBeginDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowEndpointName == "" {
|
||||
return nil, errors.New("parameter dataflowEndpointName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowEndpointName}", url.PathEscape(dataflowEndpointName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get a DataflowEndpointResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowEndpointName - Name of Instance dataflowEndpoint resource
|
||||
// - options - DataflowEndpointClientGetOptions contains the optional parameters for the DataflowEndpointClient.Get method.
|
||||
func (client *DataflowEndpointClient) Get(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, options *DataflowEndpointClientGetOptions) (DataflowEndpointClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "DataflowEndpointClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, instanceName, dataflowEndpointName, options)
|
||||
if err != nil {
|
||||
return DataflowEndpointClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return DataflowEndpointClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return DataflowEndpointClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *DataflowEndpointClient) getCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, _ *DataflowEndpointClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowEndpointName == "" {
|
||||
return nil, errors.New("parameter dataflowEndpointName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowEndpointName}", url.PathEscape(dataflowEndpointName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *DataflowEndpointClient) getHandleResponse(resp *http.Response) (DataflowEndpointClientGetResponse, error) {
|
||||
result := DataflowEndpointClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.DataflowEndpointResource); err != nil {
|
||||
return DataflowEndpointClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - List DataflowEndpointResource resources by InstanceResource
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - options - DataflowEndpointClientListByResourceGroupOptions contains the optional parameters for the DataflowEndpointClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *DataflowEndpointClient) NewListByResourceGroupPager(resourceGroupName string, instanceName string, options *DataflowEndpointClientListByResourceGroupOptions) *runtime.Pager[DataflowEndpointClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[DataflowEndpointClientListByResourceGroupResponse]{
|
||||
More: func(page DataflowEndpointClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *DataflowEndpointClientListByResourceGroupResponse) (DataflowEndpointClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataflowEndpointClient.NewListByResourceGroupPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, instanceName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return DataflowEndpointClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *DataflowEndpointClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, _ *DataflowEndpointClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *DataflowEndpointClient) listByResourceGroupHandleResponse(resp *http.Response) (DataflowEndpointClientListByResourceGroupResponse, error) {
|
||||
result := DataflowEndpointClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.DataflowEndpointResourceListResult); err != nil {
|
||||
return DataflowEndpointClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,341 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DataflowProfileClient contains the methods for the DataflowProfile group.
|
||||
// Don't use this type directly, use NewDataflowProfileClient() instead.
|
||||
type DataflowProfileClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewDataflowProfileClient creates a new instance of DataflowProfileClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewDataflowProfileClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataflowProfileClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &DataflowProfileClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// BeginCreateOrUpdate - Create a DataflowProfileResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowProfileName - Name of Instance dataflowProfile resource
|
||||
// - resource - Resource create parameters.
|
||||
// - options - DataflowProfileClientBeginCreateOrUpdateOptions contains the optional parameters for the DataflowProfileClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
func (client *DataflowProfileClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, resource DataflowProfileResource, options *DataflowProfileClientBeginCreateOrUpdateOptions) (*runtime.Poller[DataflowProfileClientCreateOrUpdateResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.createOrUpdate(ctx, resourceGroupName, instanceName, dataflowProfileName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataflowProfileClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DataflowProfileClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create a DataflowProfileResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *DataflowProfileClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, resource DataflowProfileResource, options *DataflowProfileClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "DataflowProfileClient.BeginCreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instanceName, dataflowProfileName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *DataflowProfileClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, resource DataflowProfileResource, _ *DataflowProfileClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowProfileName == "" {
|
||||
return nil, errors.New("parameter dataflowProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowProfileName}", url.PathEscape(dataflowProfileName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// BeginDelete - Delete a DataflowProfileResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowProfileName - Name of Instance dataflowProfile resource
|
||||
// - options - DataflowProfileClientBeginDeleteOptions contains the optional parameters for the DataflowProfileClient.BeginDelete
|
||||
// method.
|
||||
func (client *DataflowProfileClient) BeginDelete(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, options *DataflowProfileClientBeginDeleteOptions) (*runtime.Poller[DataflowProfileClientDeleteResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.deleteOperation(ctx, resourceGroupName, instanceName, dataflowProfileName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataflowProfileClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DataflowProfileClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete - Delete a DataflowProfileResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *DataflowProfileClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, options *DataflowProfileClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "DataflowProfileClient.BeginDelete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, instanceName, dataflowProfileName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *DataflowProfileClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, _ *DataflowProfileClientBeginDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowProfileName == "" {
|
||||
return nil, errors.New("parameter dataflowProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowProfileName}", url.PathEscape(dataflowProfileName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get a DataflowProfileResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - dataflowProfileName - Name of Instance dataflowProfile resource
|
||||
// - options - DataflowProfileClientGetOptions contains the optional parameters for the DataflowProfileClient.Get method.
|
||||
func (client *DataflowProfileClient) Get(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, options *DataflowProfileClientGetOptions) (DataflowProfileClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "DataflowProfileClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, instanceName, dataflowProfileName, options)
|
||||
if err != nil {
|
||||
return DataflowProfileClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return DataflowProfileClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return DataflowProfileClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *DataflowProfileClient) getCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, _ *DataflowProfileClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
if dataflowProfileName == "" {
|
||||
return nil, errors.New("parameter dataflowProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{dataflowProfileName}", url.PathEscape(dataflowProfileName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *DataflowProfileClient) getHandleResponse(resp *http.Response) (DataflowProfileClientGetResponse, error) {
|
||||
result := DataflowProfileClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.DataflowProfileResource); err != nil {
|
||||
return DataflowProfileClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - List DataflowProfileResource resources by InstanceResource
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - options - DataflowProfileClientListByResourceGroupOptions contains the optional parameters for the DataflowProfileClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *DataflowProfileClient) NewListByResourceGroupPager(resourceGroupName string, instanceName string, options *DataflowProfileClientListByResourceGroupOptions) *runtime.Pager[DataflowProfileClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[DataflowProfileClientListByResourceGroupResponse]{
|
||||
More: func(page DataflowProfileClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *DataflowProfileClientListByResourceGroupResponse) (DataflowProfileClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataflowProfileClient.NewListByResourceGroupPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, instanceName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return DataflowProfileClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *DataflowProfileClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, _ *DataflowProfileClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *DataflowProfileClient) listByResourceGroupHandleResponse(resp *http.Response) (DataflowProfileClientListByResourceGroupResponse, error) {
|
||||
result := DataflowProfileClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.DataflowProfileResourceListResult); err != nil {
|
||||
return DataflowProfileClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,327 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"log"
|
||||
)
|
||||
|
||||
// Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_MaximumSet_Gen.json
|
||||
func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpdate() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewDataflowProfileClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", armiotoperations.DataflowProfileResource{
|
||||
Properties: &armiotoperations.DataflowProfileProperties{
|
||||
Diagnostics: &armiotoperations.ProfileDiagnostics{
|
||||
Logs: &armiotoperations.DiagnosticsLogs{
|
||||
Level: to.Ptr("rnmwokumdmebpmfxxxzvvjfdywotav"),
|
||||
},
|
||||
Metrics: &armiotoperations.Metrics{
|
||||
PrometheusPort: to.Ptr[int32](7581),
|
||||
},
|
||||
},
|
||||
InstanceCount: to.Ptr[int32](14),
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.DataflowProfileClientCreateOrUpdateResponse{
|
||||
// DataflowProfileResource: &armiotoperations.DataflowProfileResource{
|
||||
// Properties: &armiotoperations.DataflowProfileProperties{
|
||||
// Diagnostics: &armiotoperations.ProfileDiagnostics{
|
||||
// Logs: &armiotoperations.DiagnosticsLogs{
|
||||
// Level: to.Ptr("rnmwokumdmebpmfxxxzvvjfdywotav"),
|
||||
// },
|
||||
// Metrics: &armiotoperations.Metrics{
|
||||
// PrometheusPort: to.Ptr[int32](7581),
|
||||
// },
|
||||
// },
|
||||
// InstanceCount: to.Ptr[int32](14),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123"),
|
||||
// Name: to.Ptr("bwhcjsnnfnrmbixamyxjau"),
|
||||
// Type: to.Ptr("ejvancsomtbapgztnerhlvx"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_Minimal.json
|
||||
func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpdateMinimal() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewDataflowProfileClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "aio-dataflowprofile", armiotoperations.DataflowProfileResource{
|
||||
Properties: &armiotoperations.DataflowProfileProperties{
|
||||
InstanceCount: to.Ptr[int32](1),
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.DataflowProfileClientCreateOrUpdateResponse{
|
||||
// DataflowProfileResource: &armiotoperations.DataflowProfileResource{
|
||||
// Properties: &armiotoperations.DataflowProfileProperties{
|
||||
// InstanceCount: to.Ptr[int32](1),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123"),
|
||||
// Name: to.Ptr("bwhcjsnnfnrmbixamyxjau"),
|
||||
// Type: to.Ptr("ejvancsomtbapgztnerhlvx"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_Multi.json
|
||||
func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpdateMulti() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewDataflowProfileClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "aio-dataflowprofile", armiotoperations.DataflowProfileResource{
|
||||
Properties: &armiotoperations.DataflowProfileProperties{
|
||||
InstanceCount: to.Ptr[int32](3),
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.DataflowProfileClientCreateOrUpdateResponse{
|
||||
// DataflowProfileResource: &armiotoperations.DataflowProfileResource{
|
||||
// Properties: &armiotoperations.DataflowProfileProperties{
|
||||
// InstanceCount: to.Ptr[int32](3),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123"),
|
||||
// Name: to.Ptr("bwhcjsnnfnrmbixamyxjau"),
|
||||
// Type: to.Ptr("ejvancsomtbapgztnerhlvx"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/DataflowProfile_Delete_MaximumSet_Gen.json
|
||||
func ExampleDataflowProfileClient_BeginDelete() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewDataflowProfileClient().BeginDelete(ctx, "rgiotoperations", "resource-name123", "resource-name123", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
_, err = poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/DataflowProfile_Get_MaximumSet_Gen.json
|
||||
func ExampleDataflowProfileClient_Get() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
res, err := clientFactory.NewDataflowProfileClient().Get(ctx, "rgiotoperations", "resource-name123", "resource-name123", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.DataflowProfileClientGetResponse{
|
||||
// DataflowProfileResource: &armiotoperations.DataflowProfileResource{
|
||||
// Properties: &armiotoperations.DataflowProfileProperties{
|
||||
// Diagnostics: &armiotoperations.ProfileDiagnostics{
|
||||
// Logs: &armiotoperations.DiagnosticsLogs{
|
||||
// Level: to.Ptr("rnmwokumdmebpmfxxxzvvjfdywotav"),
|
||||
// },
|
||||
// Metrics: &armiotoperations.Metrics{
|
||||
// PrometheusPort: to.Ptr[int32](7581),
|
||||
// },
|
||||
// },
|
||||
// InstanceCount: to.Ptr[int32](14),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123"),
|
||||
// Name: to.Ptr("bwhcjsnnfnrmbixamyxjau"),
|
||||
// Type: to.Ptr("ejvancsomtbapgztnerhlvx"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/DataflowProfile_ListByResourceGroup_MaximumSet_Gen.json
|
||||
func ExampleDataflowProfileClient_NewListByResourceGroupPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
pager := clientFactory.NewDataflowProfileClient().NewListByResourceGroupPager("rgiotoperations", "resource-name123", nil)
|
||||
for pager.More() {
|
||||
page, err := pager.NextPage(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to advance page: %v", err)
|
||||
}
|
||||
for _, v := range page.Value {
|
||||
// You could use page here. We use blank identifier for just demo purposes.
|
||||
_ = v
|
||||
}
|
||||
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// page = armiotoperations.DataflowProfileClientListByResourceGroupResponse{
|
||||
// DataflowProfileResourceListResult: armiotoperations.DataflowProfileResourceListResult{
|
||||
// Value: []*armiotoperations.DataflowProfileResource{
|
||||
// {
|
||||
// Properties: &armiotoperations.DataflowProfileProperties{
|
||||
// Diagnostics: &armiotoperations.ProfileDiagnostics{
|
||||
// Logs: &armiotoperations.DiagnosticsLogs{
|
||||
// Level: to.Ptr("rnmwokumdmebpmfxxxzvvjfdywotav"),
|
||||
// },
|
||||
// Metrics: &armiotoperations.Metrics{
|
||||
// PrometheusPort: to.Ptr[int32](7581),
|
||||
// },
|
||||
// },
|
||||
// InstanceCount: to.Ptr[int32](14),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123"),
|
||||
// Name: to.Ptr("bwhcjsnnfnrmbixamyxjau"),
|
||||
// Type: to.Ptr("ejvancsomtbapgztnerhlvx"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// NextLink: to.Ptr("https://microsoft.com/a"),
|
||||
// },
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,268 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// BrokerServer is a fake server for instances of the armiotoperations.BrokerClient type.
|
||||
type BrokerServer struct {
|
||||
// BeginCreateOrUpdate is the fake for method BrokerClient.BeginCreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, resource armiotoperations.BrokerResource, options *armiotoperations.BrokerClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// BeginDelete is the fake for method BrokerClient.BeginDelete
|
||||
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
|
||||
BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, options *armiotoperations.BrokerClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method BrokerClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, options *armiotoperations.BrokerClientGetOptions) (resp azfake.Responder[armiotoperations.BrokerClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method BrokerClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, instanceName string, options *armiotoperations.BrokerClientListByResourceGroupOptions) (resp azfake.PagerResponder[armiotoperations.BrokerClientListByResourceGroupResponse])
|
||||
}
|
||||
|
||||
// NewBrokerServerTransport creates a new instance of BrokerServerTransport with the provided implementation.
|
||||
// The returned BrokerServerTransport instance is connected to an instance of armiotoperations.BrokerClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewBrokerServerTransport(srv *BrokerServer) *BrokerServerTransport {
|
||||
return &BrokerServerTransport{
|
||||
srv: srv,
|
||||
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armiotoperations.BrokerClientCreateOrUpdateResponse]](),
|
||||
beginDelete: newTracker[azfake.PollerResponder[armiotoperations.BrokerClientDeleteResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armiotoperations.BrokerClientListByResourceGroupResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// BrokerServerTransport connects instances of armiotoperations.BrokerClient to instances of BrokerServer.
|
||||
// Don't use this type directly, use NewBrokerServerTransport instead.
|
||||
type BrokerServerTransport struct {
|
||||
srv *BrokerServer
|
||||
beginCreateOrUpdate *tracker[azfake.PollerResponder[armiotoperations.BrokerClientCreateOrUpdateResponse]]
|
||||
beginDelete *tracker[azfake.PollerResponder[armiotoperations.BrokerClientDeleteResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armiotoperations.BrokerClientListByResourceGroupResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for BrokerServerTransport.
|
||||
func (b *BrokerServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return b.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (b *BrokerServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "BrokerClient.BeginCreateOrUpdate":
|
||||
resp, err = b.dispatchBeginCreateOrUpdate(req)
|
||||
case "BrokerClient.BeginDelete":
|
||||
resp, err = b.dispatchBeginDelete(req)
|
||||
case "BrokerClient.Get":
|
||||
resp, err = b.dispatchGet(req)
|
||||
case "BrokerClient.NewListByResourceGroupPager":
|
||||
resp, err = b.dispatchNewListByResourceGroupPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (b *BrokerServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.BeginCreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
|
||||
}
|
||||
beginCreateOrUpdate := b.beginCreateOrUpdate.get(req)
|
||||
if beginCreateOrUpdate == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.BrokerResource](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginCreateOrUpdate = &respr
|
||||
b.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
|
||||
b.beginCreateOrUpdate.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginCreateOrUpdate) {
|
||||
b.beginCreateOrUpdate.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.BeginDelete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
|
||||
}
|
||||
beginDelete := b.beginDelete.get(req)
|
||||
if beginDelete == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.BeginDelete(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginDelete = &respr
|
||||
b.beginDelete.add(req, beginDelete)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginDelete, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
|
||||
b.beginDelete.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginDelete) {
|
||||
b.beginDelete.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.Get == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BrokerResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := b.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 3 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := b.srv.NewListByResourceGroupPager(resourceGroupNameParam, instanceNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
b.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armiotoperations.BrokerClientListByResourceGroupResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
b.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
b.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,284 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// BrokerAuthenticationServer is a fake server for instances of the armiotoperations.BrokerAuthenticationClient type.
|
||||
type BrokerAuthenticationServer struct {
|
||||
// BeginCreateOrUpdate is the fake for method BrokerAuthenticationClient.BeginCreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, resource armiotoperations.BrokerAuthenticationResource, options *armiotoperations.BrokerAuthenticationClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// BeginDelete is the fake for method BrokerAuthenticationClient.BeginDelete
|
||||
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
|
||||
BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, options *armiotoperations.BrokerAuthenticationClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method BrokerAuthenticationClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, options *armiotoperations.BrokerAuthenticationClientGetOptions) (resp azfake.Responder[armiotoperations.BrokerAuthenticationClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method BrokerAuthenticationClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, instanceName string, brokerName string, options *armiotoperations.BrokerAuthenticationClientListByResourceGroupOptions) (resp azfake.PagerResponder[armiotoperations.BrokerAuthenticationClientListByResourceGroupResponse])
|
||||
}
|
||||
|
||||
// NewBrokerAuthenticationServerTransport creates a new instance of BrokerAuthenticationServerTransport with the provided implementation.
|
||||
// The returned BrokerAuthenticationServerTransport instance is connected to an instance of armiotoperations.BrokerAuthenticationClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewBrokerAuthenticationServerTransport(srv *BrokerAuthenticationServer) *BrokerAuthenticationServerTransport {
|
||||
return &BrokerAuthenticationServerTransport{
|
||||
srv: srv,
|
||||
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientCreateOrUpdateResponse]](),
|
||||
beginDelete: newTracker[azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientDeleteResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armiotoperations.BrokerAuthenticationClientListByResourceGroupResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// BrokerAuthenticationServerTransport connects instances of armiotoperations.BrokerAuthenticationClient to instances of BrokerAuthenticationServer.
|
||||
// Don't use this type directly, use NewBrokerAuthenticationServerTransport instead.
|
||||
type BrokerAuthenticationServerTransport struct {
|
||||
srv *BrokerAuthenticationServer
|
||||
beginCreateOrUpdate *tracker[azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientCreateOrUpdateResponse]]
|
||||
beginDelete *tracker[azfake.PollerResponder[armiotoperations.BrokerAuthenticationClientDeleteResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armiotoperations.BrokerAuthenticationClientListByResourceGroupResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for BrokerAuthenticationServerTransport.
|
||||
func (b *BrokerAuthenticationServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return b.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (b *BrokerAuthenticationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "BrokerAuthenticationClient.BeginCreateOrUpdate":
|
||||
resp, err = b.dispatchBeginCreateOrUpdate(req)
|
||||
case "BrokerAuthenticationClient.BeginDelete":
|
||||
resp, err = b.dispatchBeginDelete(req)
|
||||
case "BrokerAuthenticationClient.Get":
|
||||
resp, err = b.dispatchGet(req)
|
||||
case "BrokerAuthenticationClient.NewListByResourceGroupPager":
|
||||
resp, err = b.dispatchNewListByResourceGroupPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (b *BrokerAuthenticationServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.BeginCreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
|
||||
}
|
||||
beginCreateOrUpdate := b.beginCreateOrUpdate.get(req)
|
||||
if beginCreateOrUpdate == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authentications/(?P<authenticationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.BrokerAuthenticationResource](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authenticationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authenticationName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, authenticationNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginCreateOrUpdate = &respr
|
||||
b.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
|
||||
b.beginCreateOrUpdate.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginCreateOrUpdate) {
|
||||
b.beginCreateOrUpdate.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerAuthenticationServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.BeginDelete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
|
||||
}
|
||||
beginDelete := b.beginDelete.get(req)
|
||||
if beginDelete == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authentications/(?P<authenticationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authenticationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authenticationName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.BeginDelete(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, authenticationNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginDelete = &respr
|
||||
b.beginDelete.add(req, beginDelete)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginDelete, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
|
||||
b.beginDelete.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginDelete) {
|
||||
b.beginDelete.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerAuthenticationServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.Get == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authentications/(?P<authenticationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authenticationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authenticationName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, authenticationNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BrokerAuthenticationResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerAuthenticationServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := b.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authentications`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := b.srv.NewListByResourceGroupPager(resourceGroupNameParam, instanceNameParam, brokerNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
b.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armiotoperations.BrokerAuthenticationClientListByResourceGroupResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
b.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
b.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,284 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// BrokerAuthorizationServer is a fake server for instances of the armiotoperations.BrokerAuthorizationClient type.
|
||||
type BrokerAuthorizationServer struct {
|
||||
// BeginCreateOrUpdate is the fake for method BrokerAuthorizationClient.BeginCreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, resource armiotoperations.BrokerAuthorizationResource, options *armiotoperations.BrokerAuthorizationClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// BeginDelete is the fake for method BrokerAuthorizationClient.BeginDelete
|
||||
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
|
||||
BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, options *armiotoperations.BrokerAuthorizationClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method BrokerAuthorizationClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, options *armiotoperations.BrokerAuthorizationClientGetOptions) (resp azfake.Responder[armiotoperations.BrokerAuthorizationClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method BrokerAuthorizationClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, instanceName string, brokerName string, options *armiotoperations.BrokerAuthorizationClientListByResourceGroupOptions) (resp azfake.PagerResponder[armiotoperations.BrokerAuthorizationClientListByResourceGroupResponse])
|
||||
}
|
||||
|
||||
// NewBrokerAuthorizationServerTransport creates a new instance of BrokerAuthorizationServerTransport with the provided implementation.
|
||||
// The returned BrokerAuthorizationServerTransport instance is connected to an instance of armiotoperations.BrokerAuthorizationClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewBrokerAuthorizationServerTransport(srv *BrokerAuthorizationServer) *BrokerAuthorizationServerTransport {
|
||||
return &BrokerAuthorizationServerTransport{
|
||||
srv: srv,
|
||||
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientCreateOrUpdateResponse]](),
|
||||
beginDelete: newTracker[azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientDeleteResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armiotoperations.BrokerAuthorizationClientListByResourceGroupResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// BrokerAuthorizationServerTransport connects instances of armiotoperations.BrokerAuthorizationClient to instances of BrokerAuthorizationServer.
|
||||
// Don't use this type directly, use NewBrokerAuthorizationServerTransport instead.
|
||||
type BrokerAuthorizationServerTransport struct {
|
||||
srv *BrokerAuthorizationServer
|
||||
beginCreateOrUpdate *tracker[azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientCreateOrUpdateResponse]]
|
||||
beginDelete *tracker[azfake.PollerResponder[armiotoperations.BrokerAuthorizationClientDeleteResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armiotoperations.BrokerAuthorizationClientListByResourceGroupResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for BrokerAuthorizationServerTransport.
|
||||
func (b *BrokerAuthorizationServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return b.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (b *BrokerAuthorizationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "BrokerAuthorizationClient.BeginCreateOrUpdate":
|
||||
resp, err = b.dispatchBeginCreateOrUpdate(req)
|
||||
case "BrokerAuthorizationClient.BeginDelete":
|
||||
resp, err = b.dispatchBeginDelete(req)
|
||||
case "BrokerAuthorizationClient.Get":
|
||||
resp, err = b.dispatchGet(req)
|
||||
case "BrokerAuthorizationClient.NewListByResourceGroupPager":
|
||||
resp, err = b.dispatchNewListByResourceGroupPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (b *BrokerAuthorizationServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.BeginCreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
|
||||
}
|
||||
beginCreateOrUpdate := b.beginCreateOrUpdate.get(req)
|
||||
if beginCreateOrUpdate == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authorizations/(?P<authorizationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.BrokerAuthorizationResource](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authorizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authorizationName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, authorizationNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginCreateOrUpdate = &respr
|
||||
b.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
|
||||
b.beginCreateOrUpdate.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginCreateOrUpdate) {
|
||||
b.beginCreateOrUpdate.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerAuthorizationServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.BeginDelete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
|
||||
}
|
||||
beginDelete := b.beginDelete.get(req)
|
||||
if beginDelete == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authorizations/(?P<authorizationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authorizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authorizationName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.BeginDelete(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, authorizationNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginDelete = &respr
|
||||
b.beginDelete.add(req, beginDelete)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginDelete, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
|
||||
b.beginDelete.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginDelete) {
|
||||
b.beginDelete.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerAuthorizationServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.Get == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authorizations/(?P<authorizationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authorizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authorizationName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, authorizationNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BrokerAuthorizationResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerAuthorizationServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := b.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authorizations`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := b.srv.NewListByResourceGroupPager(resourceGroupNameParam, instanceNameParam, brokerNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
b.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armiotoperations.BrokerAuthorizationClientListByResourceGroupResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
b.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
b.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,284 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// BrokerListenerServer is a fake server for instances of the armiotoperations.BrokerListenerClient type.
|
||||
type BrokerListenerServer struct {
|
||||
// BeginCreateOrUpdate is the fake for method BrokerListenerClient.BeginCreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, resource armiotoperations.BrokerListenerResource, options *armiotoperations.BrokerListenerClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.BrokerListenerClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// BeginDelete is the fake for method BrokerListenerClient.BeginDelete
|
||||
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
|
||||
BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, options *armiotoperations.BrokerListenerClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.BrokerListenerClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method BrokerListenerClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, options *armiotoperations.BrokerListenerClientGetOptions) (resp azfake.Responder[armiotoperations.BrokerListenerClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method BrokerListenerClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, instanceName string, brokerName string, options *armiotoperations.BrokerListenerClientListByResourceGroupOptions) (resp azfake.PagerResponder[armiotoperations.BrokerListenerClientListByResourceGroupResponse])
|
||||
}
|
||||
|
||||
// NewBrokerListenerServerTransport creates a new instance of BrokerListenerServerTransport with the provided implementation.
|
||||
// The returned BrokerListenerServerTransport instance is connected to an instance of armiotoperations.BrokerListenerClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewBrokerListenerServerTransport(srv *BrokerListenerServer) *BrokerListenerServerTransport {
|
||||
return &BrokerListenerServerTransport{
|
||||
srv: srv,
|
||||
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armiotoperations.BrokerListenerClientCreateOrUpdateResponse]](),
|
||||
beginDelete: newTracker[azfake.PollerResponder[armiotoperations.BrokerListenerClientDeleteResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armiotoperations.BrokerListenerClientListByResourceGroupResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// BrokerListenerServerTransport connects instances of armiotoperations.BrokerListenerClient to instances of BrokerListenerServer.
|
||||
// Don't use this type directly, use NewBrokerListenerServerTransport instead.
|
||||
type BrokerListenerServerTransport struct {
|
||||
srv *BrokerListenerServer
|
||||
beginCreateOrUpdate *tracker[azfake.PollerResponder[armiotoperations.BrokerListenerClientCreateOrUpdateResponse]]
|
||||
beginDelete *tracker[azfake.PollerResponder[armiotoperations.BrokerListenerClientDeleteResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armiotoperations.BrokerListenerClientListByResourceGroupResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for BrokerListenerServerTransport.
|
||||
func (b *BrokerListenerServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return b.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (b *BrokerListenerServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "BrokerListenerClient.BeginCreateOrUpdate":
|
||||
resp, err = b.dispatchBeginCreateOrUpdate(req)
|
||||
case "BrokerListenerClient.BeginDelete":
|
||||
resp, err = b.dispatchBeginDelete(req)
|
||||
case "BrokerListenerClient.Get":
|
||||
resp, err = b.dispatchGet(req)
|
||||
case "BrokerListenerClient.NewListByResourceGroupPager":
|
||||
resp, err = b.dispatchNewListByResourceGroupPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (b *BrokerListenerServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.BeginCreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
|
||||
}
|
||||
beginCreateOrUpdate := b.beginCreateOrUpdate.get(req)
|
||||
if beginCreateOrUpdate == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listeners/(?P<listenerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.BrokerListenerResource](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
listenerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("listenerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, listenerNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginCreateOrUpdate = &respr
|
||||
b.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
|
||||
b.beginCreateOrUpdate.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginCreateOrUpdate) {
|
||||
b.beginCreateOrUpdate.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerListenerServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.BeginDelete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
|
||||
}
|
||||
beginDelete := b.beginDelete.get(req)
|
||||
if beginDelete == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listeners/(?P<listenerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
listenerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("listenerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.BeginDelete(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, listenerNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginDelete = &respr
|
||||
b.beginDelete.add(req, beginDelete)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginDelete, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
|
||||
b.beginDelete.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginDelete) {
|
||||
b.beginDelete.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerListenerServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.Get == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listeners/(?P<listenerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
listenerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("listenerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, instanceNameParam, brokerNameParam, listenerNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BrokerListenerResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (b *BrokerListenerServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if b.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := b.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P<brokerName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listeners`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
brokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("brokerName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := b.srv.NewListByResourceGroupPager(resourceGroupNameParam, instanceNameParam, brokerNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
b.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armiotoperations.BrokerListenerClientListByResourceGroupResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
b.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
b.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,284 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// DataflowServer is a fake server for instances of the armiotoperations.DataflowClient type.
|
||||
type DataflowServer struct {
|
||||
// BeginCreateOrUpdate is the fake for method DataflowClient.BeginCreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, resource armiotoperations.DataflowResource, options *armiotoperations.DataflowClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// BeginDelete is the fake for method DataflowClient.BeginDelete
|
||||
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
|
||||
BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, options *armiotoperations.DataflowClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method DataflowClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, options *armiotoperations.DataflowClientGetOptions) (resp azfake.Responder[armiotoperations.DataflowClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method DataflowClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, instanceName string, dataflowProfileName string, options *armiotoperations.DataflowClientListByResourceGroupOptions) (resp azfake.PagerResponder[armiotoperations.DataflowClientListByResourceGroupResponse])
|
||||
}
|
||||
|
||||
// NewDataflowServerTransport creates a new instance of DataflowServerTransport with the provided implementation.
|
||||
// The returned DataflowServerTransport instance is connected to an instance of armiotoperations.DataflowClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewDataflowServerTransport(srv *DataflowServer) *DataflowServerTransport {
|
||||
return &DataflowServerTransport{
|
||||
srv: srv,
|
||||
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armiotoperations.DataflowClientCreateOrUpdateResponse]](),
|
||||
beginDelete: newTracker[azfake.PollerResponder[armiotoperations.DataflowClientDeleteResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armiotoperations.DataflowClientListByResourceGroupResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowServerTransport connects instances of armiotoperations.DataflowClient to instances of DataflowServer.
|
||||
// Don't use this type directly, use NewDataflowServerTransport instead.
|
||||
type DataflowServerTransport struct {
|
||||
srv *DataflowServer
|
||||
beginCreateOrUpdate *tracker[azfake.PollerResponder[armiotoperations.DataflowClientCreateOrUpdateResponse]]
|
||||
beginDelete *tracker[azfake.PollerResponder[armiotoperations.DataflowClientDeleteResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armiotoperations.DataflowClientListByResourceGroupResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for DataflowServerTransport.
|
||||
func (d *DataflowServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return d.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (d *DataflowServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "DataflowClient.BeginCreateOrUpdate":
|
||||
resp, err = d.dispatchBeginCreateOrUpdate(req)
|
||||
case "DataflowClient.BeginDelete":
|
||||
resp, err = d.dispatchBeginDelete(req)
|
||||
case "DataflowClient.Get":
|
||||
resp, err = d.dispatchGet(req)
|
||||
case "DataflowClient.NewListByResourceGroupPager":
|
||||
resp, err = d.dispatchNewListByResourceGroupPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (d *DataflowServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.BeginCreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
|
||||
}
|
||||
beginCreateOrUpdate := d.beginCreateOrUpdate.get(req)
|
||||
if beginCreateOrUpdate == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P<dataflowProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflows/(?P<dataflowName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.DataflowResource](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowProfileNameParam, dataflowNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginCreateOrUpdate = &respr
|
||||
d.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
|
||||
d.beginCreateOrUpdate.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginCreateOrUpdate) {
|
||||
d.beginCreateOrUpdate.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.BeginDelete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
|
||||
}
|
||||
beginDelete := d.beginDelete.get(req)
|
||||
if beginDelete == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P<dataflowProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflows/(?P<dataflowName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowProfileNameParam, dataflowNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginDelete = &respr
|
||||
d.beginDelete.add(req, beginDelete)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginDelete, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
|
||||
d.beginDelete.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginDelete) {
|
||||
d.beginDelete.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.Get == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P<dataflowProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflows/(?P<dataflowName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 5 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowProfileNameParam, dataflowNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataflowResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := d.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P<dataflowProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflows`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, instanceNameParam, dataflowProfileNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
d.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armiotoperations.DataflowClientListByResourceGroupResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
d.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
d.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,268 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// DataflowEndpointServer is a fake server for instances of the armiotoperations.DataflowEndpointClient type.
|
||||
type DataflowEndpointServer struct {
|
||||
// BeginCreateOrUpdate is the fake for method DataflowEndpointClient.BeginCreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, resource armiotoperations.DataflowEndpointResource, options *armiotoperations.DataflowEndpointClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowEndpointClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// BeginDelete is the fake for method DataflowEndpointClient.BeginDelete
|
||||
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
|
||||
BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, options *armiotoperations.DataflowEndpointClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowEndpointClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method DataflowEndpointClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, options *armiotoperations.DataflowEndpointClientGetOptions) (resp azfake.Responder[armiotoperations.DataflowEndpointClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method DataflowEndpointClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, instanceName string, options *armiotoperations.DataflowEndpointClientListByResourceGroupOptions) (resp azfake.PagerResponder[armiotoperations.DataflowEndpointClientListByResourceGroupResponse])
|
||||
}
|
||||
|
||||
// NewDataflowEndpointServerTransport creates a new instance of DataflowEndpointServerTransport with the provided implementation.
|
||||
// The returned DataflowEndpointServerTransport instance is connected to an instance of armiotoperations.DataflowEndpointClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewDataflowEndpointServerTransport(srv *DataflowEndpointServer) *DataflowEndpointServerTransport {
|
||||
return &DataflowEndpointServerTransport{
|
||||
srv: srv,
|
||||
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armiotoperations.DataflowEndpointClientCreateOrUpdateResponse]](),
|
||||
beginDelete: newTracker[azfake.PollerResponder[armiotoperations.DataflowEndpointClientDeleteResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armiotoperations.DataflowEndpointClientListByResourceGroupResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowEndpointServerTransport connects instances of armiotoperations.DataflowEndpointClient to instances of DataflowEndpointServer.
|
||||
// Don't use this type directly, use NewDataflowEndpointServerTransport instead.
|
||||
type DataflowEndpointServerTransport struct {
|
||||
srv *DataflowEndpointServer
|
||||
beginCreateOrUpdate *tracker[azfake.PollerResponder[armiotoperations.DataflowEndpointClientCreateOrUpdateResponse]]
|
||||
beginDelete *tracker[azfake.PollerResponder[armiotoperations.DataflowEndpointClientDeleteResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armiotoperations.DataflowEndpointClientListByResourceGroupResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for DataflowEndpointServerTransport.
|
||||
func (d *DataflowEndpointServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return d.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (d *DataflowEndpointServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "DataflowEndpointClient.BeginCreateOrUpdate":
|
||||
resp, err = d.dispatchBeginCreateOrUpdate(req)
|
||||
case "DataflowEndpointClient.BeginDelete":
|
||||
resp, err = d.dispatchBeginDelete(req)
|
||||
case "DataflowEndpointClient.Get":
|
||||
resp, err = d.dispatchGet(req)
|
||||
case "DataflowEndpointClient.NewListByResourceGroupPager":
|
||||
resp, err = d.dispatchNewListByResourceGroupPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (d *DataflowEndpointServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.BeginCreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
|
||||
}
|
||||
beginCreateOrUpdate := d.beginCreateOrUpdate.get(req)
|
||||
if beginCreateOrUpdate == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowEndpoints/(?P<dataflowEndpointName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.DataflowEndpointResource](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowEndpointName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowEndpointNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginCreateOrUpdate = &respr
|
||||
d.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
|
||||
d.beginCreateOrUpdate.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginCreateOrUpdate) {
|
||||
d.beginCreateOrUpdate.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowEndpointServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.BeginDelete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
|
||||
}
|
||||
beginDelete := d.beginDelete.get(req)
|
||||
if beginDelete == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowEndpoints/(?P<dataflowEndpointName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowEndpointName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowEndpointNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginDelete = &respr
|
||||
d.beginDelete.add(req, beginDelete)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginDelete, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
|
||||
d.beginDelete.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginDelete) {
|
||||
d.beginDelete.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowEndpointServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.Get == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowEndpoints/(?P<dataflowEndpointName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowEndpointName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowEndpointNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataflowEndpointResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowEndpointServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := d.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowEndpoints`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 3 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, instanceNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
d.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armiotoperations.DataflowEndpointClientListByResourceGroupResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
d.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
d.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,268 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// DataflowProfileServer is a fake server for instances of the armiotoperations.DataflowProfileClient type.
|
||||
type DataflowProfileServer struct {
|
||||
// BeginCreateOrUpdate is the fake for method DataflowProfileClient.BeginCreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, resource armiotoperations.DataflowProfileResource, options *armiotoperations.DataflowProfileClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.DataflowProfileClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// BeginDelete is the fake for method DataflowProfileClient.BeginDelete
|
||||
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
|
||||
BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, options *armiotoperations.DataflowProfileClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.DataflowProfileClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method DataflowProfileClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, options *armiotoperations.DataflowProfileClientGetOptions) (resp azfake.Responder[armiotoperations.DataflowProfileClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method DataflowProfileClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, instanceName string, options *armiotoperations.DataflowProfileClientListByResourceGroupOptions) (resp azfake.PagerResponder[armiotoperations.DataflowProfileClientListByResourceGroupResponse])
|
||||
}
|
||||
|
||||
// NewDataflowProfileServerTransport creates a new instance of DataflowProfileServerTransport with the provided implementation.
|
||||
// The returned DataflowProfileServerTransport instance is connected to an instance of armiotoperations.DataflowProfileClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewDataflowProfileServerTransport(srv *DataflowProfileServer) *DataflowProfileServerTransport {
|
||||
return &DataflowProfileServerTransport{
|
||||
srv: srv,
|
||||
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armiotoperations.DataflowProfileClientCreateOrUpdateResponse]](),
|
||||
beginDelete: newTracker[azfake.PollerResponder[armiotoperations.DataflowProfileClientDeleteResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armiotoperations.DataflowProfileClientListByResourceGroupResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// DataflowProfileServerTransport connects instances of armiotoperations.DataflowProfileClient to instances of DataflowProfileServer.
|
||||
// Don't use this type directly, use NewDataflowProfileServerTransport instead.
|
||||
type DataflowProfileServerTransport struct {
|
||||
srv *DataflowProfileServer
|
||||
beginCreateOrUpdate *tracker[azfake.PollerResponder[armiotoperations.DataflowProfileClientCreateOrUpdateResponse]]
|
||||
beginDelete *tracker[azfake.PollerResponder[armiotoperations.DataflowProfileClientDeleteResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armiotoperations.DataflowProfileClientListByResourceGroupResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for DataflowProfileServerTransport.
|
||||
func (d *DataflowProfileServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return d.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (d *DataflowProfileServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "DataflowProfileClient.BeginCreateOrUpdate":
|
||||
resp, err = d.dispatchBeginCreateOrUpdate(req)
|
||||
case "DataflowProfileClient.BeginDelete":
|
||||
resp, err = d.dispatchBeginDelete(req)
|
||||
case "DataflowProfileClient.Get":
|
||||
resp, err = d.dispatchGet(req)
|
||||
case "DataflowProfileClient.NewListByResourceGroupPager":
|
||||
resp, err = d.dispatchNewListByResourceGroupPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (d *DataflowProfileServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.BeginCreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
|
||||
}
|
||||
beginCreateOrUpdate := d.beginCreateOrUpdate.get(req)
|
||||
if beginCreateOrUpdate == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P<dataflowProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.DataflowProfileResource](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowProfileNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginCreateOrUpdate = &respr
|
||||
d.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
|
||||
d.beginCreateOrUpdate.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginCreateOrUpdate) {
|
||||
d.beginCreateOrUpdate.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowProfileServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.BeginDelete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
|
||||
}
|
||||
beginDelete := d.beginDelete.get(req)
|
||||
if beginDelete == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P<dataflowProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowProfileNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginDelete = &respr
|
||||
d.beginDelete.add(req, beginDelete)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginDelete, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
|
||||
d.beginDelete.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginDelete) {
|
||||
d.beginDelete.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowProfileServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.Get == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P<dataflowProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 4 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataflowProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataflowProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, instanceNameParam, dataflowProfileNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataflowProfileResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (d *DataflowProfileServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if d.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := d.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 3 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, instanceNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
d.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armiotoperations.DataflowProfileClientListByResourceGroupResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
d.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
d.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,336 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// InstanceServer is a fake server for instances of the armiotoperations.InstanceClient type.
|
||||
type InstanceServer struct {
|
||||
// BeginCreateOrUpdate is the fake for method InstanceClient.BeginCreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, instanceName string, resource armiotoperations.InstanceResource, options *armiotoperations.InstanceClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armiotoperations.InstanceClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// BeginDelete is the fake for method InstanceClient.BeginDelete
|
||||
// HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent
|
||||
BeginDelete func(ctx context.Context, resourceGroupName string, instanceName string, options *armiotoperations.InstanceClientBeginDeleteOptions) (resp azfake.PollerResponder[armiotoperations.InstanceClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method InstanceClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, instanceName string, options *armiotoperations.InstanceClientGetOptions) (resp azfake.Responder[armiotoperations.InstanceClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method InstanceClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, options *armiotoperations.InstanceClientListByResourceGroupOptions) (resp azfake.PagerResponder[armiotoperations.InstanceClientListByResourceGroupResponse])
|
||||
|
||||
// NewListBySubscriptionPager is the fake for method InstanceClient.NewListBySubscriptionPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListBySubscriptionPager func(options *armiotoperations.InstanceClientListBySubscriptionOptions) (resp azfake.PagerResponder[armiotoperations.InstanceClientListBySubscriptionResponse])
|
||||
|
||||
// Update is the fake for method InstanceClient.Update
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Update func(ctx context.Context, resourceGroupName string, instanceName string, properties armiotoperations.InstancePatchModel, options *armiotoperations.InstanceClientUpdateOptions) (resp azfake.Responder[armiotoperations.InstanceClientUpdateResponse], errResp azfake.ErrorResponder)
|
||||
}
|
||||
|
||||
// NewInstanceServerTransport creates a new instance of InstanceServerTransport with the provided implementation.
|
||||
// The returned InstanceServerTransport instance is connected to an instance of armiotoperations.InstanceClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewInstanceServerTransport(srv *InstanceServer) *InstanceServerTransport {
|
||||
return &InstanceServerTransport{
|
||||
srv: srv,
|
||||
beginCreateOrUpdate: newTracker[azfake.PollerResponder[armiotoperations.InstanceClientCreateOrUpdateResponse]](),
|
||||
beginDelete: newTracker[azfake.PollerResponder[armiotoperations.InstanceClientDeleteResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armiotoperations.InstanceClientListByResourceGroupResponse]](),
|
||||
newListBySubscriptionPager: newTracker[azfake.PagerResponder[armiotoperations.InstanceClientListBySubscriptionResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// InstanceServerTransport connects instances of armiotoperations.InstanceClient to instances of InstanceServer.
|
||||
// Don't use this type directly, use NewInstanceServerTransport instead.
|
||||
type InstanceServerTransport struct {
|
||||
srv *InstanceServer
|
||||
beginCreateOrUpdate *tracker[azfake.PollerResponder[armiotoperations.InstanceClientCreateOrUpdateResponse]]
|
||||
beginDelete *tracker[azfake.PollerResponder[armiotoperations.InstanceClientDeleteResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armiotoperations.InstanceClientListByResourceGroupResponse]]
|
||||
newListBySubscriptionPager *tracker[azfake.PagerResponder[armiotoperations.InstanceClientListBySubscriptionResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for InstanceServerTransport.
|
||||
func (i *InstanceServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return i.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (i *InstanceServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "InstanceClient.BeginCreateOrUpdate":
|
||||
resp, err = i.dispatchBeginCreateOrUpdate(req)
|
||||
case "InstanceClient.BeginDelete":
|
||||
resp, err = i.dispatchBeginDelete(req)
|
||||
case "InstanceClient.Get":
|
||||
resp, err = i.dispatchGet(req)
|
||||
case "InstanceClient.NewListByResourceGroupPager":
|
||||
resp, err = i.dispatchNewListByResourceGroupPager(req)
|
||||
case "InstanceClient.NewListBySubscriptionPager":
|
||||
resp, err = i.dispatchNewListBySubscriptionPager(req)
|
||||
case "InstanceClient.Update":
|
||||
resp, err = i.dispatchUpdate(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (i *InstanceServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if i.srv.BeginCreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")}
|
||||
}
|
||||
beginCreateOrUpdate := i.beginCreateOrUpdate.get(req)
|
||||
if beginCreateOrUpdate == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 3 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.InstanceResource](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := i.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, instanceNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginCreateOrUpdate = &respr
|
||||
i.beginCreateOrUpdate.add(req, beginCreateOrUpdate)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginCreateOrUpdate, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) {
|
||||
i.beginCreateOrUpdate.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginCreateOrUpdate) {
|
||||
i.beginCreateOrUpdate.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (i *InstanceServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) {
|
||||
if i.srv.BeginDelete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")}
|
||||
}
|
||||
beginDelete := i.beginDelete.get(req)
|
||||
if beginDelete == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 3 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := i.srv.BeginDelete(req.Context(), resourceGroupNameParam, instanceNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
beginDelete = &respr
|
||||
i.beginDelete.add(req, beginDelete)
|
||||
}
|
||||
|
||||
resp, err := server.PollerResponderNext(beginDelete, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) {
|
||||
i.beginDelete.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)}
|
||||
}
|
||||
if !server.PollerResponderMore(beginDelete) {
|
||||
i.beginDelete.remove(req)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (i *InstanceServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if i.srv.Get == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 3 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := i.srv.Get(req.Context(), resourceGroupNameParam, instanceNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).InstanceResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (i *InstanceServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if i.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := i.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 2 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := i.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
i.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armiotoperations.InstanceClientListByResourceGroupResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListByResourceGroupPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
i.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
i.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (i *InstanceServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) {
|
||||
if i.srv.NewListBySubscriptionPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")}
|
||||
}
|
||||
newListBySubscriptionPager := i.newListBySubscriptionPager.get(req)
|
||||
if newListBySubscriptionPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 1 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
resp := i.srv.NewListBySubscriptionPager(nil)
|
||||
newListBySubscriptionPager = &resp
|
||||
i.newListBySubscriptionPager.add(req, newListBySubscriptionPager)
|
||||
server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armiotoperations.InstanceClientListBySubscriptionResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListBySubscriptionPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
i.newListBySubscriptionPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListBySubscriptionPager) {
|
||||
i.newListBySubscriptionPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (i *InstanceServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) {
|
||||
if i.srv.Update == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Update not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P<instanceName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
|
||||
regex := regexp.MustCompile(regexStr)
|
||||
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
|
||||
if matches == nil || len(matches) < 3 {
|
||||
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
|
||||
}
|
||||
body, err := server.UnmarshalRequestAsJSON[armiotoperations.InstancePatchModel](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
instanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("instanceName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := i.srv.Update(req.Context(), resourceGroupNameParam, instanceNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).InstanceResource, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"net/http"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type nonRetriableError struct {
|
||||
error
|
||||
}
|
||||
|
||||
func (nonRetriableError) NonRetriable() {
|
||||
// marker method
|
||||
}
|
||||
|
||||
func contains[T comparable](s []T, v T) bool {
|
||||
for _, vv := range s {
|
||||
if vv == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func newTracker[T any]() *tracker[T] {
|
||||
return &tracker[T]{
|
||||
items: map[string]*T{},
|
||||
}
|
||||
}
|
||||
|
||||
type tracker[T any] struct {
|
||||
items map[string]*T
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func (p *tracker[T]) get(req *http.Request) *T {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok {
|
||||
return item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *tracker[T]) add(req *http.Request, item *T) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item
|
||||
}
|
||||
|
||||
func (p *tracker[T]) remove(req *http.Request) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
delete(p.items, server.SanitizePagerPollerPath(req.URL.Path))
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OperationsServer is a fake server for instances of the armiotoperations.OperationsClient type.
|
||||
type OperationsServer struct {
|
||||
// NewListPager is the fake for method OperationsClient.NewListPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListPager func(options *armiotoperations.OperationsClientListOptions) (resp azfake.PagerResponder[armiotoperations.OperationsClientListResponse])
|
||||
}
|
||||
|
||||
// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation.
|
||||
// The returned OperationsServerTransport instance is connected to an instance of armiotoperations.OperationsClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport {
|
||||
return &OperationsServerTransport{
|
||||
srv: srv,
|
||||
newListPager: newTracker[azfake.PagerResponder[armiotoperations.OperationsClientListResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// OperationsServerTransport connects instances of armiotoperations.OperationsClient to instances of OperationsServer.
|
||||
// Don't use this type directly, use NewOperationsServerTransport instead.
|
||||
type OperationsServerTransport struct {
|
||||
srv *OperationsServer
|
||||
newListPager *tracker[azfake.PagerResponder[armiotoperations.OperationsClientListResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for OperationsServerTransport.
|
||||
func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
return o.dispatchToMethodFake(req, method)
|
||||
}
|
||||
|
||||
func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "OperationsClient.NewListPager":
|
||||
resp, err = o.dispatchNewListPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) {
|
||||
if o.srv.NewListPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")}
|
||||
}
|
||||
newListPager := o.newListPager.get(req)
|
||||
if newListPager == nil {
|
||||
resp := o.srv.NewListPager(nil)
|
||||
newListPager = &resp
|
||||
o.newListPager.add(req, newListPager)
|
||||
server.PagerResponderInjectNextLinks(newListPager, req, func(page *armiotoperations.OperationsClientListResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
o.newListPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListPager) {
|
||||
o.newListPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// ServerFactory is a fake server for instances of the armiotoperations.ClientFactory type.
|
||||
type ServerFactory struct {
|
||||
// BrokerAuthenticationServer contains the fakes for client BrokerAuthenticationClient
|
||||
BrokerAuthenticationServer BrokerAuthenticationServer
|
||||
|
||||
// BrokerAuthorizationServer contains the fakes for client BrokerAuthorizationClient
|
||||
BrokerAuthorizationServer BrokerAuthorizationServer
|
||||
|
||||
// BrokerServer contains the fakes for client BrokerClient
|
||||
BrokerServer BrokerServer
|
||||
|
||||
// BrokerListenerServer contains the fakes for client BrokerListenerClient
|
||||
BrokerListenerServer BrokerListenerServer
|
||||
|
||||
// DataflowServer contains the fakes for client DataflowClient
|
||||
DataflowServer DataflowServer
|
||||
|
||||
// DataflowEndpointServer contains the fakes for client DataflowEndpointClient
|
||||
DataflowEndpointServer DataflowEndpointServer
|
||||
|
||||
// DataflowProfileServer contains the fakes for client DataflowProfileClient
|
||||
DataflowProfileServer DataflowProfileServer
|
||||
|
||||
// InstanceServer contains the fakes for client InstanceClient
|
||||
InstanceServer InstanceServer
|
||||
|
||||
// OperationsServer contains the fakes for client OperationsClient
|
||||
OperationsServer OperationsServer
|
||||
}
|
||||
|
||||
// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation.
|
||||
// The returned ServerFactoryTransport instance is connected to an instance of armiotoperations.ClientFactory via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport {
|
||||
return &ServerFactoryTransport{
|
||||
srv: srv,
|
||||
}
|
||||
}
|
||||
|
||||
// ServerFactoryTransport connects instances of armiotoperations.ClientFactory to instances of ServerFactory.
|
||||
// Don't use this type directly, use NewServerFactoryTransport instead.
|
||||
type ServerFactoryTransport struct {
|
||||
srv *ServerFactory
|
||||
trMu sync.Mutex
|
||||
trBrokerAuthenticationServer *BrokerAuthenticationServerTransport
|
||||
trBrokerAuthorizationServer *BrokerAuthorizationServerTransport
|
||||
trBrokerServer *BrokerServerTransport
|
||||
trBrokerListenerServer *BrokerListenerServerTransport
|
||||
trDataflowServer *DataflowServerTransport
|
||||
trDataflowEndpointServer *DataflowEndpointServerTransport
|
||||
trDataflowProfileServer *DataflowProfileServerTransport
|
||||
trInstanceServer *InstanceServerTransport
|
||||
trOperationsServer *OperationsServerTransport
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for ServerFactoryTransport.
|
||||
func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) {
|
||||
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
|
||||
method, ok := rawMethod.(string)
|
||||
if !ok {
|
||||
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
|
||||
}
|
||||
|
||||
client := method[:strings.Index(method, ".")]
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch client {
|
||||
case "BrokerAuthenticationClient":
|
||||
initServer(s, &s.trBrokerAuthenticationServer, func() *BrokerAuthenticationServerTransport {
|
||||
return NewBrokerAuthenticationServerTransport(&s.srv.BrokerAuthenticationServer)
|
||||
})
|
||||
resp, err = s.trBrokerAuthenticationServer.Do(req)
|
||||
case "BrokerAuthorizationClient":
|
||||
initServer(s, &s.trBrokerAuthorizationServer, func() *BrokerAuthorizationServerTransport {
|
||||
return NewBrokerAuthorizationServerTransport(&s.srv.BrokerAuthorizationServer)
|
||||
})
|
||||
resp, err = s.trBrokerAuthorizationServer.Do(req)
|
||||
case "BrokerClient":
|
||||
initServer(s, &s.trBrokerServer, func() *BrokerServerTransport { return NewBrokerServerTransport(&s.srv.BrokerServer) })
|
||||
resp, err = s.trBrokerServer.Do(req)
|
||||
case "BrokerListenerClient":
|
||||
initServer(s, &s.trBrokerListenerServer, func() *BrokerListenerServerTransport {
|
||||
return NewBrokerListenerServerTransport(&s.srv.BrokerListenerServer)
|
||||
})
|
||||
resp, err = s.trBrokerListenerServer.Do(req)
|
||||
case "DataflowClient":
|
||||
initServer(s, &s.trDataflowServer, func() *DataflowServerTransport { return NewDataflowServerTransport(&s.srv.DataflowServer) })
|
||||
resp, err = s.trDataflowServer.Do(req)
|
||||
case "DataflowEndpointClient":
|
||||
initServer(s, &s.trDataflowEndpointServer, func() *DataflowEndpointServerTransport {
|
||||
return NewDataflowEndpointServerTransport(&s.srv.DataflowEndpointServer)
|
||||
})
|
||||
resp, err = s.trDataflowEndpointServer.Do(req)
|
||||
case "DataflowProfileClient":
|
||||
initServer(s, &s.trDataflowProfileServer, func() *DataflowProfileServerTransport {
|
||||
return NewDataflowProfileServerTransport(&s.srv.DataflowProfileServer)
|
||||
})
|
||||
resp, err = s.trDataflowProfileServer.Do(req)
|
||||
case "InstanceClient":
|
||||
initServer(s, &s.trInstanceServer, func() *InstanceServerTransport { return NewInstanceServerTransport(&s.srv.InstanceServer) })
|
||||
resp, err = s.trInstanceServer.Do(req)
|
||||
case "OperationsClient":
|
||||
initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) })
|
||||
resp, err = s.trOperationsServer.Do(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled client %s", client)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) {
|
||||
s.trMu.Lock()
|
||||
if *dst == nil {
|
||||
*dst = src()
|
||||
}
|
||||
s.trMu.Unlock()
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
|
||||
var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`)
|
||||
|
||||
const (
|
||||
utcDateTime = "2006-01-02T15:04:05.999999999"
|
||||
utcDateTimeJSON = `"` + utcDateTime + `"`
|
||||
utcDateTimeNoT = "2006-01-02 15:04:05.999999999"
|
||||
utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"`
|
||||
dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00`
|
||||
dateTimeJSON = `"` + time.RFC3339Nano + `"`
|
||||
dateTimeJSONNoT = `"` + dateTimeNoT + `"`
|
||||
)
|
||||
|
||||
type dateTimeRFC3339 time.Time
|
||||
|
||||
func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalJSON()
|
||||
}
|
||||
|
||||
func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalText()
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
|
||||
tzOffset := tzOffsetRegex.Match(data)
|
||||
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
|
||||
var layout string
|
||||
if tzOffset && hasT {
|
||||
layout = dateTimeJSON
|
||||
} else if tzOffset {
|
||||
layout = dateTimeJSONNoT
|
||||
} else if hasT {
|
||||
layout = utcDateTimeJSON
|
||||
} else {
|
||||
layout = utcDateTimeJSONNoT
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalText(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
return nil
|
||||
}
|
||||
tzOffset := tzOffsetRegex.Match(data)
|
||||
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
|
||||
var layout string
|
||||
if tzOffset && hasT {
|
||||
layout = time.RFC3339Nano
|
||||
} else if tzOffset {
|
||||
layout = dateTimeNoT
|
||||
} else if hasT {
|
||||
layout = utcDateTime
|
||||
} else {
|
||||
layout = utcDateTimeNoT
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) Parse(layout, value string) error {
|
||||
p, err := time.Parse(layout, strings.ToUpper(value))
|
||||
*t = dateTimeRFC3339(p)
|
||||
return err
|
||||
}
|
||||
|
||||
func (t dateTimeRFC3339) String() string {
|
||||
return time.Time(t).Format(time.RFC3339Nano)
|
||||
}
|
||||
|
||||
func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
|
||||
if t == nil {
|
||||
return
|
||||
} else if azcore.IsNullValue(t) {
|
||||
m[k] = nil
|
||||
return
|
||||
} else if reflect.ValueOf(t).IsNil() {
|
||||
return
|
||||
}
|
||||
m[k] = (*dateTimeRFC3339)(t)
|
||||
}
|
||||
|
||||
func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error {
|
||||
if data == nil || string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
var aux dateTimeRFC3339
|
||||
if err := json.Unmarshal(data, &aux); err != nil {
|
||||
return fmt.Errorf("struct field %s: %v", fn, err)
|
||||
}
|
||||
*t = (*time.Time)(&aux)
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations
|
||||
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||
golang.org/x/crypto v0.25.0 // indirect
|
||||
golang.org/x/net v0.27.0 // indirect
|
||||
golang.org/x/sys v0.22.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
)
|
|
@ -0,0 +1,29 @@
|
|||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
|
||||
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
|
||||
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
|
||||
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|
@ -0,0 +1,444 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// InstanceClient contains the methods for the Instance group.
|
||||
// Don't use this type directly, use NewInstanceClient() instead.
|
||||
type InstanceClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewInstanceClient creates a new instance of InstanceClient with the specified values.
|
||||
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InstanceClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &InstanceClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// BeginCreateOrUpdate - Create a InstanceResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - resource - Resource create parameters.
|
||||
// - options - InstanceClientBeginCreateOrUpdateOptions contains the optional parameters for the InstanceClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
func (client *InstanceClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, resource InstanceResource, options *InstanceClientBeginCreateOrUpdateOptions) (*runtime.Poller[InstanceClientCreateOrUpdateResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.createOrUpdate(ctx, resourceGroupName, instanceName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InstanceClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[InstanceClientCreateOrUpdateResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create a InstanceResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *InstanceClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, resource InstanceResource, options *InstanceClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "InstanceClient.BeginCreateOrUpdate"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, instanceName, resource, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *InstanceClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, resource InstanceResource, _ *InstanceClientBeginCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// BeginDelete - Delete a InstanceResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - options - InstanceClientBeginDeleteOptions contains the optional parameters for the InstanceClient.BeginDelete method.
|
||||
func (client *InstanceClient) BeginDelete(ctx context.Context, resourceGroupName string, instanceName string, options *InstanceClientBeginDeleteOptions) (*runtime.Poller[InstanceClientDeleteResponse], error) {
|
||||
if options == nil || options.ResumeToken == "" {
|
||||
resp, err := client.deleteOperation(ctx, resourceGroupName, instanceName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[InstanceClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
return poller, err
|
||||
} else {
|
||||
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[InstanceClientDeleteResponse]{
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Delete - Delete a InstanceResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
func (client *InstanceClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, options *InstanceClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "InstanceClient.BeginDelete"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.deleteCreateRequest(ctx, resourceGroupName, instanceName, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return nil, err
|
||||
}
|
||||
return httpResp, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *InstanceClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, _ *InstanceClientBeginDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Get a InstanceResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - options - InstanceClientGetOptions contains the optional parameters for the InstanceClient.Get method.
|
||||
func (client *InstanceClient) Get(ctx context.Context, resourceGroupName string, instanceName string, options *InstanceClientGetOptions) (InstanceClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "InstanceClient.Get"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getCreateRequest(ctx, resourceGroupName, instanceName, options)
|
||||
if err != nil {
|
||||
return InstanceClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return InstanceClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return InstanceClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *InstanceClient) getCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, _ *InstanceClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *InstanceClient) getHandleResponse(resp *http.Response) (InstanceClientGetResponse, error) {
|
||||
result := InstanceClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.InstanceResource); err != nil {
|
||||
return InstanceClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - List InstanceResource resources by resource group
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - options - InstanceClientListByResourceGroupOptions contains the optional parameters for the InstanceClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *InstanceClient) NewListByResourceGroupPager(resourceGroupName string, options *InstanceClientListByResourceGroupOptions) *runtime.Pager[InstanceClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[InstanceClientListByResourceGroupResponse]{
|
||||
More: func(page InstanceClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *InstanceClientListByResourceGroupResponse) (InstanceClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InstanceClient.NewListByResourceGroupPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return InstanceClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *InstanceClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *InstanceClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *InstanceClient) listByResourceGroupHandleResponse(resp *http.Response) (InstanceClientListByResourceGroupResponse, error) {
|
||||
result := InstanceClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.InstanceResourceListResult); err != nil {
|
||||
return InstanceClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListBySubscriptionPager - List InstanceResource resources by subscription ID
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - options - InstanceClientListBySubscriptionOptions contains the optional parameters for the InstanceClient.NewListBySubscriptionPager
|
||||
// method.
|
||||
func (client *InstanceClient) NewListBySubscriptionPager(options *InstanceClientListBySubscriptionOptions) *runtime.Pager[InstanceClientListBySubscriptionResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[InstanceClientListBySubscriptionResponse]{
|
||||
More: func(page InstanceClientListBySubscriptionResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *InstanceClientListBySubscriptionResponse) (InstanceClientListBySubscriptionResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "InstanceClient.NewListBySubscriptionPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listBySubscriptionCreateRequest(ctx, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return InstanceClientListBySubscriptionResponse{}, err
|
||||
}
|
||||
return client.listBySubscriptionHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listBySubscriptionCreateRequest creates the ListBySubscription request.
|
||||
func (client *InstanceClient) listBySubscriptionCreateRequest(ctx context.Context, _ *InstanceClientListBySubscriptionOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IoTOperations/instances"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listBySubscriptionHandleResponse handles the ListBySubscription response.
|
||||
func (client *InstanceClient) listBySubscriptionHandleResponse(resp *http.Response) (InstanceClientListBySubscriptionResponse, error) {
|
||||
result := InstanceClientListBySubscriptionResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.InstanceResourceListResult); err != nil {
|
||||
return InstanceClientListBySubscriptionResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Update - Update a InstanceResource
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - instanceName - Name of instance.
|
||||
// - properties - The resource properties to be updated.
|
||||
// - options - InstanceClientUpdateOptions contains the optional parameters for the InstanceClient.Update method.
|
||||
func (client *InstanceClient) Update(ctx context.Context, resourceGroupName string, instanceName string, properties InstancePatchModel, options *InstanceClientUpdateOptions) (InstanceClientUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "InstanceClient.Update"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.updateCreateRequest(ctx, resourceGroupName, instanceName, properties, options)
|
||||
if err != nil {
|
||||
return InstanceClientUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return InstanceClientUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return InstanceClientUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.updateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// updateCreateRequest creates the Update request.
|
||||
func (client *InstanceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, instanceName string, properties InstancePatchModel, _ *InstanceClientUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}"
|
||||
if client.subscriptionID == "" {
|
||||
return nil, errors.New("parameter client.subscriptionID cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
|
||||
if resourceGroupName == "" {
|
||||
return nil, errors.New("parameter resourceGroupName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
|
||||
if instanceName == "" {
|
||||
return nil, errors.New("parameter instanceName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{instanceName}", url.PathEscape(instanceName))
|
||||
req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
req.Raw().Header["Content-Type"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, properties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// updateHandleResponse handles the Update response.
|
||||
func (client *InstanceClient) updateHandleResponse(resp *http.Response) (InstanceClientUpdateResponse, error) {
|
||||
result := InstanceClientUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.InstanceResource); err != nil {
|
||||
return InstanceClientUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,366 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"log"
|
||||
)
|
||||
|
||||
// Generated from example definition: 2024-11-01/Instance_CreateOrUpdate_MaximumSet_Gen.json
|
||||
func ExampleInstanceClient_BeginCreateOrUpdate() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewInstanceClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "aio-instance", armiotoperations.InstanceResource{
|
||||
Properties: &armiotoperations.InstanceProperties{
|
||||
SchemaRegistryRef: &armiotoperations.SchemaRegistryRef{
|
||||
ResourceID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.DeviceRegistry/schemaRegistries/resource-name123"),
|
||||
},
|
||||
Description: to.Ptr("kpqtgocs"),
|
||||
},
|
||||
ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
},
|
||||
Identity: &armiotoperations.ManagedServiceIdentity{
|
||||
Type: to.Ptr(armiotoperations.ManagedServiceIdentityTypeNone),
|
||||
UserAssignedIdentities: map[string]*armiotoperations.UserAssignedIdentity{},
|
||||
},
|
||||
Tags: map[string]*string{},
|
||||
Location: to.Ptr("xvewadyhycrjpu"),
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
res, err := poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.InstanceClientCreateOrUpdateResponse{
|
||||
// InstanceResource: &armiotoperations.InstanceResource{
|
||||
// Properties: &armiotoperations.InstanceProperties{
|
||||
// SchemaRegistryRef: &armiotoperations.SchemaRegistryRef{
|
||||
// ResourceID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.DeviceRegistry/schemaRegistries/resource-name123"),
|
||||
// },
|
||||
// Description: to.Ptr("kpqtgocs"),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// Version: to.Ptr("vjjbmunthiphfmekvxgxcxkzdwjti"),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// Identity: &armiotoperations.ManagedServiceIdentity{
|
||||
// Type: to.Ptr(armiotoperations.ManagedServiceIdentityTypeNone),
|
||||
// UserAssignedIdentities: map[string]*armiotoperations.UserAssignedIdentity{
|
||||
// },
|
||||
// PrincipalID: to.Ptr("4a6e4195-75b8-4685-aa0c-0b5704779327"),
|
||||
// TenantID: to.Ptr("ed060aa2-71ff-4d3f-99c4-a9138356fdec"),
|
||||
// },
|
||||
// Tags: map[string]*string{
|
||||
// },
|
||||
// Location: to.Ptr("xvewadyhycrjpu"),
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123"),
|
||||
// Name: to.Ptr("llptmlifnqqwairx"),
|
||||
// Type: to.Ptr("qwrfzxjfxvismlqvigot"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/Instance_Delete_MaximumSet_Gen.json
|
||||
func ExampleInstanceClient_BeginDelete() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewInstanceClient().BeginDelete(ctx, "rgiotoperations", "aio-instance", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
_, err = poller.PollUntilDone(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to pull the result: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/Instance_Get_MaximumSet_Gen.json
|
||||
func ExampleInstanceClient_Get() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
res, err := clientFactory.NewInstanceClient().Get(ctx, "rgiotoperations", "aio-instance", nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.InstanceClientGetResponse{
|
||||
// InstanceResource: &armiotoperations.InstanceResource{
|
||||
// Properties: &armiotoperations.InstanceProperties{
|
||||
// SchemaRegistryRef: &armiotoperations.SchemaRegistryRef{
|
||||
// ResourceID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.DeviceRegistry/schemaRegistries/resource-name123"),
|
||||
// },
|
||||
// Description: to.Ptr("rlfvvnnhcypp"),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// Version: to.Ptr("vjjbmunthiphfmekvxgxcxkzdwjti"),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// Identity: &armiotoperations.ManagedServiceIdentity{
|
||||
// Type: to.Ptr(armiotoperations.ManagedServiceIdentityTypeNone),
|
||||
// UserAssignedIdentities: map[string]*armiotoperations.UserAssignedIdentity{
|
||||
// },
|
||||
// PrincipalID: to.Ptr("4a6e4195-75b8-4685-aa0c-0b5704779327"),
|
||||
// TenantID: to.Ptr("ed060aa2-71ff-4d3f-99c4-a9138356fdec"),
|
||||
// },
|
||||
// Tags: map[string]*string{
|
||||
// },
|
||||
// Location: to.Ptr("xvewadyhycrjpu"),
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123"),
|
||||
// Name: to.Ptr("llptmlifnqqwairx"),
|
||||
// Type: to.Ptr("qwrfzxjfxvismlqvigot"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/Instance_ListByResourceGroup_MaximumSet_Gen.json
|
||||
func ExampleInstanceClient_NewListByResourceGroupPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
pager := clientFactory.NewInstanceClient().NewListByResourceGroupPager("rgiotoperations", nil)
|
||||
for pager.More() {
|
||||
page, err := pager.NextPage(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to advance page: %v", err)
|
||||
}
|
||||
for _, v := range page.Value {
|
||||
// You could use page here. We use blank identifier for just demo purposes.
|
||||
_ = v
|
||||
}
|
||||
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// page = armiotoperations.InstanceClientListByResourceGroupResponse{
|
||||
// InstanceResourceListResult: armiotoperations.InstanceResourceListResult{
|
||||
// Value: []*armiotoperations.InstanceResource{
|
||||
// {
|
||||
// Properties: &armiotoperations.InstanceProperties{
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// Version: to.Ptr("vjjbmunthiphfmekvxgxcxkzdwjti"),
|
||||
// SchemaRegistryRef: &armiotoperations.SchemaRegistryRef{
|
||||
// ResourceID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.DeviceRegistry/schemaRegistries/resource-name123"),
|
||||
// },
|
||||
// Description: to.Ptr("vmujggxdvxk"),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// Identity: &armiotoperations.ManagedServiceIdentity{
|
||||
// PrincipalID: to.Ptr("4a6e4195-75b8-4685-aa0c-0b5704779327"),
|
||||
// TenantID: to.Ptr("ed060aa2-71ff-4d3f-99c4-a9138356fdec"),
|
||||
// Type: to.Ptr(armiotoperations.ManagedServiceIdentityTypeNone),
|
||||
// UserAssignedIdentities: map[string]*armiotoperations.UserAssignedIdentity{
|
||||
// },
|
||||
// },
|
||||
// Tags: map[string]*string{
|
||||
// },
|
||||
// Location: to.Ptr("xvewadyhycrjpu"),
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123"),
|
||||
// Name: to.Ptr("llptmlifnqqwairx"),
|
||||
// Type: to.Ptr("qwrfzxjfxvismlqvigot"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// NextLink: to.Ptr("https://microsoft.com/a"),
|
||||
// },
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/Instance_ListBySubscription_MaximumSet_Gen.json
|
||||
func ExampleInstanceClient_NewListBySubscriptionPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
pager := clientFactory.NewInstanceClient().NewListBySubscriptionPager(nil)
|
||||
for pager.More() {
|
||||
page, err := pager.NextPage(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to advance page: %v", err)
|
||||
}
|
||||
for _, v := range page.Value {
|
||||
// You could use page here. We use blank identifier for just demo purposes.
|
||||
_ = v
|
||||
}
|
||||
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// page = armiotoperations.InstanceClientListBySubscriptionResponse{
|
||||
// InstanceResourceListResult: armiotoperations.InstanceResourceListResult{
|
||||
// Value: []*armiotoperations.InstanceResource{
|
||||
// {
|
||||
// Properties: &armiotoperations.InstanceProperties{
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// Version: to.Ptr("vjjbmunthiphfmekvxgxcxkzdwjti"),
|
||||
// SchemaRegistryRef: &armiotoperations.SchemaRegistryRef{
|
||||
// ResourceID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.DeviceRegistry/schemaRegistries/resource-name123"),
|
||||
// },
|
||||
// Description: to.Ptr("empgqmbhvklcqlyahmdsjemlep"),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// Identity: &armiotoperations.ManagedServiceIdentity{
|
||||
// PrincipalID: to.Ptr("4a6e4195-75b8-4685-aa0c-0b5704779327"),
|
||||
// TenantID: to.Ptr("ed060aa2-71ff-4d3f-99c4-a9138356fdec"),
|
||||
// Type: to.Ptr(armiotoperations.ManagedServiceIdentityTypeNone),
|
||||
// UserAssignedIdentities: map[string]*armiotoperations.UserAssignedIdentity{
|
||||
// },
|
||||
// },
|
||||
// Tags: map[string]*string{
|
||||
// },
|
||||
// Location: to.Ptr("xvewadyhycrjpu"),
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123"),
|
||||
// Name: to.Ptr("llptmlifnqqwairx"),
|
||||
// Type: to.Ptr("qwrfzxjfxvismlqvigot"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// NextLink: to.Ptr("https://microsoft.com/a"),
|
||||
// },
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: 2024-11-01/Instance_Update_MaximumSet_Gen.json
|
||||
func ExampleInstanceClient_Update() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
res, err := clientFactory.NewInstanceClient().Update(ctx, "rgiotoperations", "aio-instance", armiotoperations.InstancePatchModel{
|
||||
Tags: map[string]*string{},
|
||||
Identity: &armiotoperations.ManagedServiceIdentity{
|
||||
Type: to.Ptr(armiotoperations.ManagedServiceIdentityTypeNone),
|
||||
UserAssignedIdentities: map[string]*armiotoperations.UserAssignedIdentity{},
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to finish the request: %v", err)
|
||||
}
|
||||
// You could use response here. We use blank identifier for just demo purposes.
|
||||
_ = res
|
||||
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// res = armiotoperations.InstanceClientUpdateResponse{
|
||||
// InstanceResource: &armiotoperations.InstanceResource{
|
||||
// Properties: &armiotoperations.InstanceProperties{
|
||||
// SchemaRegistryRef: &armiotoperations.SchemaRegistryRef{
|
||||
// ResourceID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.DeviceRegistry/schemaRegistries/resource-name123"),
|
||||
// },
|
||||
// Description: to.Ptr("wwihkapmgjbyrtyaj"),
|
||||
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
|
||||
// Version: to.Ptr("vjjbmunthiphfmekvxgxcxkzdwjti"),
|
||||
// },
|
||||
// ExtendedLocation: &armiotoperations.ExtendedLocation{
|
||||
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
|
||||
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
|
||||
// },
|
||||
// Identity: &armiotoperations.ManagedServiceIdentity{
|
||||
// Type: to.Ptr(armiotoperations.ManagedServiceIdentityTypeNone),
|
||||
// UserAssignedIdentities: map[string]*armiotoperations.UserAssignedIdentity{
|
||||
// },
|
||||
// PrincipalID: to.Ptr("4a6e4195-75b8-4685-aa0c-0b5704779327"),
|
||||
// TenantID: to.Ptr("ed060aa2-71ff-4d3f-99c4-a9138356fdec"),
|
||||
// },
|
||||
// Tags: map[string]*string{
|
||||
// },
|
||||
// Location: to.Ptr("xvewadyhycrjpu"),
|
||||
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123"),
|
||||
// Name: to.Ptr("llptmlifnqqwairx"),
|
||||
// Type: to.Ptr("qwrfzxjfxvismlqvigot"),
|
||||
// SystemData: &armiotoperations.SystemData{
|
||||
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
|
||||
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// LastModifiedBy: to.Ptr("gnicpuszwd"),
|
||||
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
|
||||
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
|
||||
// },
|
||||
// },
|
||||
// }
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,84 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OperationsClient contains the methods for the Operations group.
|
||||
// Don't use this type directly, use NewOperationsClient() instead.
|
||||
type OperationsClient struct {
|
||||
internal *arm.Client
|
||||
}
|
||||
|
||||
// NewOperationsClient creates a new instance of OperationsClient with the specified values.
|
||||
// - credential - used to authorize requests. Usually a credential from azidentity.
|
||||
// - options - pass nil to accept the default values.
|
||||
func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &OperationsClient{
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// NewListPager - List the operations for the provider
|
||||
//
|
||||
// Generated from API version 2024-11-01
|
||||
// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
|
||||
func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{
|
||||
More: func(page OperationsClientListResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager")
|
||||
nextLink := ""
|
||||
if page != nil {
|
||||
nextLink = *page.NextLink
|
||||
}
|
||||
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
|
||||
return client.listCreateRequest(ctx, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return OperationsClientListResponse{}, err
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/providers/Microsoft.IoTOperations/operations"
|
||||
req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2024-11-01")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) {
|
||||
result := OperationsClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil {
|
||||
return OperationsClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotoperations/armiotoperations"
|
||||
"log"
|
||||
)
|
||||
|
||||
// Generated from example definition: 2024-11-01/Operations_List_MaximumSet_Gen.json
|
||||
func ExampleOperationsClient_NewListPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armiotoperations.NewClientFactory("<subscriptionID>", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
pager := clientFactory.NewOperationsClient().NewListPager(nil)
|
||||
for pager.More() {
|
||||
page, err := pager.NextPage(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to advance page: %v", err)
|
||||
}
|
||||
for _, v := range page.Value {
|
||||
// You could use page here. We use blank identifier for just demo purposes.
|
||||
_ = v
|
||||
}
|
||||
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
|
||||
// page = armiotoperations.OperationsClientListResponse{
|
||||
// OperationListResult: armiotoperations.OperationListResult{
|
||||
// Value: []*armiotoperations.Operation{
|
||||
// {
|
||||
// Name: to.Ptr("xzxqfusky"),
|
||||
// IsDataAction: to.Ptr(true),
|
||||
// Display: &armiotoperations.OperationDisplay{
|
||||
// Provider: to.Ptr("lrveskajtuwf"),
|
||||
// Resource: to.Ptr("d"),
|
||||
// Operation: to.Ptr("icuckgobartrrgmirax"),
|
||||
// Description: to.Ptr("dsbfnxzvnoqdm"),
|
||||
// },
|
||||
// Origin: to.Ptr(armiotoperations.OriginUser),
|
||||
// ActionType: to.Ptr(armiotoperations.ActionTypeInternal),
|
||||
// },
|
||||
// },
|
||||
// NextLink: to.Ptr("https://microsoft.com/a"),
|
||||
// },
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,212 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
// BrokerAuthenticationClientBeginCreateOrUpdateOptions contains the optional parameters for the BrokerAuthenticationClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
type BrokerAuthenticationClientBeginCreateOrUpdateOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BrokerAuthenticationClientBeginDeleteOptions contains the optional parameters for the BrokerAuthenticationClient.BeginDelete
|
||||
// method.
|
||||
type BrokerAuthenticationClientBeginDeleteOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BrokerAuthenticationClientGetOptions contains the optional parameters for the BrokerAuthenticationClient.Get method.
|
||||
type BrokerAuthenticationClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BrokerAuthenticationClientListByResourceGroupOptions contains the optional parameters for the BrokerAuthenticationClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type BrokerAuthenticationClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BrokerAuthorizationClientBeginCreateOrUpdateOptions contains the optional parameters for the BrokerAuthorizationClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
type BrokerAuthorizationClientBeginCreateOrUpdateOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BrokerAuthorizationClientBeginDeleteOptions contains the optional parameters for the BrokerAuthorizationClient.BeginDelete
|
||||
// method.
|
||||
type BrokerAuthorizationClientBeginDeleteOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BrokerAuthorizationClientGetOptions contains the optional parameters for the BrokerAuthorizationClient.Get method.
|
||||
type BrokerAuthorizationClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BrokerAuthorizationClientListByResourceGroupOptions contains the optional parameters for the BrokerAuthorizationClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type BrokerAuthorizationClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BrokerClientBeginCreateOrUpdateOptions contains the optional parameters for the BrokerClient.BeginCreateOrUpdate method.
|
||||
type BrokerClientBeginCreateOrUpdateOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BrokerClientBeginDeleteOptions contains the optional parameters for the BrokerClient.BeginDelete method.
|
||||
type BrokerClientBeginDeleteOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BrokerClientGetOptions contains the optional parameters for the BrokerClient.Get method.
|
||||
type BrokerClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BrokerClientListByResourceGroupOptions contains the optional parameters for the BrokerClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type BrokerClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BrokerListenerClientBeginCreateOrUpdateOptions contains the optional parameters for the BrokerListenerClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
type BrokerListenerClientBeginCreateOrUpdateOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BrokerListenerClientBeginDeleteOptions contains the optional parameters for the BrokerListenerClient.BeginDelete method.
|
||||
type BrokerListenerClientBeginDeleteOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// BrokerListenerClientGetOptions contains the optional parameters for the BrokerListenerClient.Get method.
|
||||
type BrokerListenerClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// BrokerListenerClientListByResourceGroupOptions contains the optional parameters for the BrokerListenerClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type BrokerListenerClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// DataflowClientBeginCreateOrUpdateOptions contains the optional parameters for the DataflowClient.BeginCreateOrUpdate method.
|
||||
type DataflowClientBeginCreateOrUpdateOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// DataflowClientBeginDeleteOptions contains the optional parameters for the DataflowClient.BeginDelete method.
|
||||
type DataflowClientBeginDeleteOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// DataflowClientGetOptions contains the optional parameters for the DataflowClient.Get method.
|
||||
type DataflowClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// DataflowClientListByResourceGroupOptions contains the optional parameters for the DataflowClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type DataflowClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// DataflowEndpointClientBeginCreateOrUpdateOptions contains the optional parameters for the DataflowEndpointClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
type DataflowEndpointClientBeginCreateOrUpdateOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// DataflowEndpointClientBeginDeleteOptions contains the optional parameters for the DataflowEndpointClient.BeginDelete method.
|
||||
type DataflowEndpointClientBeginDeleteOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// DataflowEndpointClientGetOptions contains the optional parameters for the DataflowEndpointClient.Get method.
|
||||
type DataflowEndpointClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// DataflowEndpointClientListByResourceGroupOptions contains the optional parameters for the DataflowEndpointClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type DataflowEndpointClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// DataflowProfileClientBeginCreateOrUpdateOptions contains the optional parameters for the DataflowProfileClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
type DataflowProfileClientBeginCreateOrUpdateOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// DataflowProfileClientBeginDeleteOptions contains the optional parameters for the DataflowProfileClient.BeginDelete method.
|
||||
type DataflowProfileClientBeginDeleteOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// DataflowProfileClientGetOptions contains the optional parameters for the DataflowProfileClient.Get method.
|
||||
type DataflowProfileClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// DataflowProfileClientListByResourceGroupOptions contains the optional parameters for the DataflowProfileClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type DataflowProfileClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// InstanceClientBeginCreateOrUpdateOptions contains the optional parameters for the InstanceClient.BeginCreateOrUpdate method.
|
||||
type InstanceClientBeginCreateOrUpdateOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// InstanceClientBeginDeleteOptions contains the optional parameters for the InstanceClient.BeginDelete method.
|
||||
type InstanceClientBeginDeleteOptions struct {
|
||||
// Resumes the long-running operation from the provided token.
|
||||
ResumeToken string
|
||||
}
|
||||
|
||||
// InstanceClientGetOptions contains the optional parameters for the InstanceClient.Get method.
|
||||
type InstanceClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// InstanceClientListByResourceGroupOptions contains the optional parameters for the InstanceClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type InstanceClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// InstanceClientListBySubscriptionOptions contains the optional parameters for the InstanceClient.NewListBySubscriptionPager
|
||||
// method.
|
||||
type InstanceClientListBySubscriptionOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// InstanceClientUpdateOptions contains the optional parameters for the InstanceClient.Update method.
|
||||
type InstanceClientUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
|
||||
type OperationsClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
|
@ -0,0 +1,207 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
// BrokerAuthenticationClientCreateOrUpdateResponse contains the response from method BrokerAuthenticationClient.BeginCreateOrUpdate.
|
||||
type BrokerAuthenticationClientCreateOrUpdateResponse struct {
|
||||
// Instance broker authentication resource
|
||||
BrokerAuthenticationResource
|
||||
}
|
||||
|
||||
// BrokerAuthenticationClientDeleteResponse contains the response from method BrokerAuthenticationClient.BeginDelete.
|
||||
type BrokerAuthenticationClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// BrokerAuthenticationClientGetResponse contains the response from method BrokerAuthenticationClient.Get.
|
||||
type BrokerAuthenticationClientGetResponse struct {
|
||||
// Instance broker authentication resource
|
||||
BrokerAuthenticationResource
|
||||
}
|
||||
|
||||
// BrokerAuthenticationClientListByResourceGroupResponse contains the response from method BrokerAuthenticationClient.NewListByResourceGroupPager.
|
||||
type BrokerAuthenticationClientListByResourceGroupResponse struct {
|
||||
// The response of a BrokerAuthenticationResource list operation.
|
||||
BrokerAuthenticationResourceListResult
|
||||
}
|
||||
|
||||
// BrokerAuthorizationClientCreateOrUpdateResponse contains the response from method BrokerAuthorizationClient.BeginCreateOrUpdate.
|
||||
type BrokerAuthorizationClientCreateOrUpdateResponse struct {
|
||||
// Instance broker authorizations resource
|
||||
BrokerAuthorizationResource
|
||||
}
|
||||
|
||||
// BrokerAuthorizationClientDeleteResponse contains the response from method BrokerAuthorizationClient.BeginDelete.
|
||||
type BrokerAuthorizationClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// BrokerAuthorizationClientGetResponse contains the response from method BrokerAuthorizationClient.Get.
|
||||
type BrokerAuthorizationClientGetResponse struct {
|
||||
// Instance broker authorizations resource
|
||||
BrokerAuthorizationResource
|
||||
}
|
||||
|
||||
// BrokerAuthorizationClientListByResourceGroupResponse contains the response from method BrokerAuthorizationClient.NewListByResourceGroupPager.
|
||||
type BrokerAuthorizationClientListByResourceGroupResponse struct {
|
||||
// The response of a BrokerAuthorizationResource list operation.
|
||||
BrokerAuthorizationResourceListResult
|
||||
}
|
||||
|
||||
// BrokerClientCreateOrUpdateResponse contains the response from method BrokerClient.BeginCreateOrUpdate.
|
||||
type BrokerClientCreateOrUpdateResponse struct {
|
||||
// Instance broker resource
|
||||
BrokerResource
|
||||
}
|
||||
|
||||
// BrokerClientDeleteResponse contains the response from method BrokerClient.BeginDelete.
|
||||
type BrokerClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// BrokerClientGetResponse contains the response from method BrokerClient.Get.
|
||||
type BrokerClientGetResponse struct {
|
||||
// Instance broker resource
|
||||
BrokerResource
|
||||
}
|
||||
|
||||
// BrokerClientListByResourceGroupResponse contains the response from method BrokerClient.NewListByResourceGroupPager.
|
||||
type BrokerClientListByResourceGroupResponse struct {
|
||||
// The response of a BrokerResource list operation.
|
||||
BrokerResourceListResult
|
||||
}
|
||||
|
||||
// BrokerListenerClientCreateOrUpdateResponse contains the response from method BrokerListenerClient.BeginCreateOrUpdate.
|
||||
type BrokerListenerClientCreateOrUpdateResponse struct {
|
||||
// Instance broker resource
|
||||
BrokerListenerResource
|
||||
}
|
||||
|
||||
// BrokerListenerClientDeleteResponse contains the response from method BrokerListenerClient.BeginDelete.
|
||||
type BrokerListenerClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// BrokerListenerClientGetResponse contains the response from method BrokerListenerClient.Get.
|
||||
type BrokerListenerClientGetResponse struct {
|
||||
// Instance broker resource
|
||||
BrokerListenerResource
|
||||
}
|
||||
|
||||
// BrokerListenerClientListByResourceGroupResponse contains the response from method BrokerListenerClient.NewListByResourceGroupPager.
|
||||
type BrokerListenerClientListByResourceGroupResponse struct {
|
||||
// The response of a BrokerListenerResource list operation.
|
||||
BrokerListenerResourceListResult
|
||||
}
|
||||
|
||||
// DataflowClientCreateOrUpdateResponse contains the response from method DataflowClient.BeginCreateOrUpdate.
|
||||
type DataflowClientCreateOrUpdateResponse struct {
|
||||
// Instance dataflowProfile dataflow resource
|
||||
DataflowResource
|
||||
}
|
||||
|
||||
// DataflowClientDeleteResponse contains the response from method DataflowClient.BeginDelete.
|
||||
type DataflowClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// DataflowClientGetResponse contains the response from method DataflowClient.Get.
|
||||
type DataflowClientGetResponse struct {
|
||||
// Instance dataflowProfile dataflow resource
|
||||
DataflowResource
|
||||
}
|
||||
|
||||
// DataflowClientListByResourceGroupResponse contains the response from method DataflowClient.NewListByResourceGroupPager.
|
||||
type DataflowClientListByResourceGroupResponse struct {
|
||||
// The response of a DataflowResource list operation.
|
||||
DataflowResourceListResult
|
||||
}
|
||||
|
||||
// DataflowEndpointClientCreateOrUpdateResponse contains the response from method DataflowEndpointClient.BeginCreateOrUpdate.
|
||||
type DataflowEndpointClientCreateOrUpdateResponse struct {
|
||||
// Instance dataflowEndpoint resource
|
||||
DataflowEndpointResource
|
||||
}
|
||||
|
||||
// DataflowEndpointClientDeleteResponse contains the response from method DataflowEndpointClient.BeginDelete.
|
||||
type DataflowEndpointClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// DataflowEndpointClientGetResponse contains the response from method DataflowEndpointClient.Get.
|
||||
type DataflowEndpointClientGetResponse struct {
|
||||
// Instance dataflowEndpoint resource
|
||||
DataflowEndpointResource
|
||||
}
|
||||
|
||||
// DataflowEndpointClientListByResourceGroupResponse contains the response from method DataflowEndpointClient.NewListByResourceGroupPager.
|
||||
type DataflowEndpointClientListByResourceGroupResponse struct {
|
||||
// The response of a DataflowEndpointResource list operation.
|
||||
DataflowEndpointResourceListResult
|
||||
}
|
||||
|
||||
// DataflowProfileClientCreateOrUpdateResponse contains the response from method DataflowProfileClient.BeginCreateOrUpdate.
|
||||
type DataflowProfileClientCreateOrUpdateResponse struct {
|
||||
// Instance dataflowProfile resource
|
||||
DataflowProfileResource
|
||||
}
|
||||
|
||||
// DataflowProfileClientDeleteResponse contains the response from method DataflowProfileClient.BeginDelete.
|
||||
type DataflowProfileClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// DataflowProfileClientGetResponse contains the response from method DataflowProfileClient.Get.
|
||||
type DataflowProfileClientGetResponse struct {
|
||||
// Instance dataflowProfile resource
|
||||
DataflowProfileResource
|
||||
}
|
||||
|
||||
// DataflowProfileClientListByResourceGroupResponse contains the response from method DataflowProfileClient.NewListByResourceGroupPager.
|
||||
type DataflowProfileClientListByResourceGroupResponse struct {
|
||||
// The response of a DataflowProfileResource list operation.
|
||||
DataflowProfileResourceListResult
|
||||
}
|
||||
|
||||
// InstanceClientCreateOrUpdateResponse contains the response from method InstanceClient.BeginCreateOrUpdate.
|
||||
type InstanceClientCreateOrUpdateResponse struct {
|
||||
// A Instance resource is a logical container for a set of child resources.
|
||||
InstanceResource
|
||||
}
|
||||
|
||||
// InstanceClientDeleteResponse contains the response from method InstanceClient.BeginDelete.
|
||||
type InstanceClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// InstanceClientGetResponse contains the response from method InstanceClient.Get.
|
||||
type InstanceClientGetResponse struct {
|
||||
// A Instance resource is a logical container for a set of child resources.
|
||||
InstanceResource
|
||||
}
|
||||
|
||||
// InstanceClientListByResourceGroupResponse contains the response from method InstanceClient.NewListByResourceGroupPager.
|
||||
type InstanceClientListByResourceGroupResponse struct {
|
||||
// The response of a InstanceResource list operation.
|
||||
InstanceResourceListResult
|
||||
}
|
||||
|
||||
// InstanceClientListBySubscriptionResponse contains the response from method InstanceClient.NewListBySubscriptionPager.
|
||||
type InstanceClientListBySubscriptionResponse struct {
|
||||
// The response of a InstanceResource list operation.
|
||||
InstanceResourceListResult
|
||||
}
|
||||
|
||||
// InstanceClientUpdateResponse contains the response from method InstanceClient.Update.
|
||||
type InstanceClientUpdateResponse struct {
|
||||
// A Instance resource is a logical container for a set of child resources.
|
||||
InstanceResource
|
||||
}
|
||||
|
||||
// OperationsClientListResponse contains the response from method OperationsClient.NewListPager.
|
||||
type OperationsClientListResponse struct {
|
||||
// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.
|
||||
OperationListResult
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
|
||||
|
||||
package armiotoperations
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
|
||||
var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`)
|
||||
|
||||
const (
|
||||
utcDateTime = "2006-01-02T15:04:05.999999999"
|
||||
utcDateTimeJSON = `"` + utcDateTime + `"`
|
||||
utcDateTimeNoT = "2006-01-02 15:04:05.999999999"
|
||||
utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"`
|
||||
dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00`
|
||||
dateTimeJSON = `"` + time.RFC3339Nano + `"`
|
||||
dateTimeJSONNoT = `"` + dateTimeNoT + `"`
|
||||
)
|
||||
|
||||
type dateTimeRFC3339 time.Time
|
||||
|
||||
func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalJSON()
|
||||
}
|
||||
|
||||
func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
|
||||
tt := time.Time(t)
|
||||
return tt.MarshalText()
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
|
||||
tzOffset := tzOffsetRegex.Match(data)
|
||||
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
|
||||
var layout string
|
||||
if tzOffset && hasT {
|
||||
layout = dateTimeJSON
|
||||
} else if tzOffset {
|
||||
layout = dateTimeJSONNoT
|
||||
} else if hasT {
|
||||
layout = utcDateTimeJSON
|
||||
} else {
|
||||
layout = utcDateTimeJSONNoT
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalText(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
return nil
|
||||
}
|
||||
tzOffset := tzOffsetRegex.Match(data)
|
||||
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
|
||||
var layout string
|
||||
if tzOffset && hasT {
|
||||
layout = time.RFC3339Nano
|
||||
} else if tzOffset {
|
||||
layout = dateTimeNoT
|
||||
} else if hasT {
|
||||
layout = utcDateTime
|
||||
} else {
|
||||
layout = utcDateTimeNoT
|
||||
}
|
||||
return t.Parse(layout, string(data))
|
||||
}
|
||||
|
||||
func (t *dateTimeRFC3339) Parse(layout, value string) error {
|
||||
p, err := time.Parse(layout, strings.ToUpper(value))
|
||||
*t = dateTimeRFC3339(p)
|
||||
return err
|
||||
}
|
||||
|
||||
func (t dateTimeRFC3339) String() string {
|
||||
return time.Time(t).Format(time.RFC3339Nano)
|
||||
}
|
||||
|
||||
func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
|
||||
if t == nil {
|
||||
return
|
||||
} else if azcore.IsNullValue(t) {
|
||||
m[k] = nil
|
||||
return
|
||||
} else if reflect.ValueOf(t).IsNil() {
|
||||
return
|
||||
}
|
||||
m[k] = (*dateTimeRFC3339)(t)
|
||||
}
|
||||
|
||||
func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error {
|
||||
if data == nil || string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
var aux dateTimeRFC3339
|
||||
if err := json.Unmarshal(data, &aux); err != nil {
|
||||
return fmt.Errorf("struct field %s: %v", fn, err)
|
||||
}
|
||||
*t = (*time.Time)(&aux)
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
directory: specification/iotoperations/IoTOperations.Management
|
||||
commit: 1ba188e3c1a7246ce6a7067adacd04d576fcfa24
|
||||
repo: Azure/azure-rest-api-specs
|
||||
additionalDirectories:
|
Загрузка…
Ссылка в новой задаче