[Release] sdk/resourcemanager/containerinstance/armcontainerinstance/2.5.0-beta.1 generation from spec commit: 366aaa13cdd218b9adac716680e49473673410c8 (#23642)
This commit is contained in:
Родитель
5e66e56f28
Коммит
2ede004eff
|
@ -1,5 +1,32 @@
|
|||
# Release History
|
||||
|
||||
## 2.5.0-beta.1 (2024-10-23)
|
||||
### Features Added
|
||||
|
||||
- New function `*ClientFactory.NewContainerGroupProfileClient() *ContainerGroupProfileClient`
|
||||
- New function `*ClientFactory.NewContainerGroupProfilesClient() *ContainerGroupProfilesClient`
|
||||
- New function `NewContainerGroupProfileClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContainerGroupProfileClient, error)`
|
||||
- New function `*ContainerGroupProfileClient.GetByRevisionNumber(context.Context, string, string, string, *ContainerGroupProfileClientGetByRevisionNumberOptions) (ContainerGroupProfileClientGetByRevisionNumberResponse, error)`
|
||||
- New function `*ContainerGroupProfileClient.NewListAllRevisionsPager(string, string, *ContainerGroupProfileClientListAllRevisionsOptions) *runtime.Pager[ContainerGroupProfileClientListAllRevisionsResponse]`
|
||||
- New function `NewContainerGroupProfilesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContainerGroupProfilesClient, error)`
|
||||
- New function `*ContainerGroupProfilesClient.CreateOrUpdate(context.Context, string, string, ContainerGroupProfile, *ContainerGroupProfilesClientCreateOrUpdateOptions) (ContainerGroupProfilesClientCreateOrUpdateResponse, error)`
|
||||
- New function `*ContainerGroupProfilesClient.Delete(context.Context, string, string, *ContainerGroupProfilesClientDeleteOptions) (ContainerGroupProfilesClientDeleteResponse, error)`
|
||||
- New function `*ContainerGroupProfilesClient.Get(context.Context, string, string, *ContainerGroupProfilesClientGetOptions) (ContainerGroupProfilesClientGetResponse, error)`
|
||||
- New function `*ContainerGroupProfilesClient.NewListByResourceGroupPager(string, *ContainerGroupProfilesClientListByResourceGroupOptions) *runtime.Pager[ContainerGroupProfilesClientListByResourceGroupResponse]`
|
||||
- New function `*ContainerGroupProfilesClient.NewListPager(*ContainerGroupProfilesClientListOptions) *runtime.Pager[ContainerGroupProfilesClientListResponse]`
|
||||
- New function `*ContainerGroupProfilesClient.Patch(context.Context, string, string, ContainerGroupProfilePatch, *ContainerGroupProfilesClientPatchOptions) (ContainerGroupProfilesClientPatchResponse, error)`
|
||||
- New struct `ConfigMap`
|
||||
- New struct `ContainerGroupProfile`
|
||||
- New struct `ContainerGroupProfileListResult`
|
||||
- New struct `ContainerGroupProfilePatch`
|
||||
- New struct `ContainerGroupProfileProperties`
|
||||
- New struct `ContainerGroupProfilePropertiesProperties`
|
||||
- New struct `ContainerGroupProfileReferenceDefinition`
|
||||
- New struct `StandbyPoolProfileDefinition`
|
||||
- New field `ContainerGroupProfile`, `IsCreatedFromStandbyPool`, `StandbyPoolProfile` in struct `ContainerGroupPropertiesProperties`
|
||||
- New field `ConfigMap` in struct `ContainerProperties`
|
||||
|
||||
|
||||
## 2.4.0 (2023-11-24)
|
||||
### Features Added
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ clientFactory, err := armcontainerinstance.NewClientFactory(<subscription ID>, c
|
|||
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.NewContainersClient()
|
||||
client := clientFactory.NewContainerGroupProfileClient()
|
||||
```
|
||||
|
||||
## Fakes
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
``` yaml
|
||||
azure-arm: true
|
||||
require:
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/readme.md
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/readme.go.md
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/readme.md
|
||||
- https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/readme.go.md
|
||||
license-header: MICROSOFT_MIT_NO_VERSION
|
||||
module-version: 2.4.0
|
||||
tag: package-2023-05
|
||||
module-version: 2.5.0-beta.1
|
||||
tag: package-preview-2024-05
|
||||
```
|
|
@ -17,53 +17,76 @@ import (
|
|||
// Don't use this type directly, use NewClientFactory instead.
|
||||
type ClientFactory struct {
|
||||
subscriptionID string
|
||||
credential azcore.TokenCredential
|
||||
options *arm.ClientOptions
|
||||
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 - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms
|
||||
// part of the URI for every service call.
|
||||
// - 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) {
|
||||
_, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
internal, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ClientFactory{
|
||||
subscriptionID: subscriptionID, credential: credential,
|
||||
options: options.Clone(),
|
||||
subscriptionID: subscriptionID,
|
||||
internal: internal,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewContainerGroupProfileClient creates a new instance of ContainerGroupProfileClient.
|
||||
func (c *ClientFactory) NewContainerGroupProfileClient() *ContainerGroupProfileClient {
|
||||
return &ContainerGroupProfileClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewContainerGroupProfilesClient creates a new instance of ContainerGroupProfilesClient.
|
||||
func (c *ClientFactory) NewContainerGroupProfilesClient() *ContainerGroupProfilesClient {
|
||||
return &ContainerGroupProfilesClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewContainerGroupsClient creates a new instance of ContainerGroupsClient.
|
||||
func (c *ClientFactory) NewContainerGroupsClient() *ContainerGroupsClient {
|
||||
subClient, _ := NewContainerGroupsClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
return &ContainerGroupsClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewContainersClient creates a new instance of ContainersClient.
|
||||
func (c *ClientFactory) NewContainersClient() *ContainersClient {
|
||||
subClient, _ := NewContainersClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
return &ContainersClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewLocationClient creates a new instance of LocationClient.
|
||||
func (c *ClientFactory) NewLocationClient() *LocationClient {
|
||||
subClient, _ := NewLocationClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
return &LocationClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewOperationsClient creates a new instance of OperationsClient.
|
||||
func (c *ClientFactory) NewOperationsClient() *OperationsClient {
|
||||
subClient, _ := NewOperationsClient(c.credential, c.options)
|
||||
return subClient
|
||||
return &OperationsClient{
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
||||
// NewSubnetServiceAssociationLinkClient creates a new instance of SubnetServiceAssociationLinkClient.
|
||||
func (c *ClientFactory) NewSubnetServiceAssociationLinkClient() *SubnetServiceAssociationLinkClient {
|
||||
subClient, _ := NewSubnetServiceAssociationLinkClient(c.subscriptionID, c.credential, c.options)
|
||||
return subClient
|
||||
return &SubnetServiceAssociationLinkClient{
|
||||
subscriptionID: c.subscriptionID,
|
||||
internal: c.internal,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ package armcontainerinstance
|
|||
|
||||
const (
|
||||
moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance"
|
||||
moduleVersion = "v2.4.0"
|
||||
moduleVersion = "v2.5.0-beta.1"
|
||||
)
|
||||
|
||||
// ContainerGroupIPAddressType - Specifies if the IP is exposed to the public internet or private VNET.
|
||||
|
|
|
@ -0,0 +1,184 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// 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) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armcontainerinstance
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
// ContainerGroupProfileClient contains the methods for the ContainerGroupProfile group.
|
||||
// Don't use this type directly, use NewContainerGroupProfileClient() instead.
|
||||
type ContainerGroupProfileClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewContainerGroupProfileClient creates a new instance of ContainerGroupProfileClient 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 NewContainerGroupProfileClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerGroupProfileClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &ContainerGroupProfileClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// GetByRevisionNumber - Gets the properties of the specified revision of the container group profile in the given subscription
|
||||
// and resource group. The operation returns the properties of container group profile including
|
||||
// containers, image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupProfileName - The name of the container group profile.
|
||||
// - revisionNumber - The revision number of the container group profile.
|
||||
// - options - ContainerGroupProfileClientGetByRevisionNumberOptions contains the optional parameters for the ContainerGroupProfileClient.GetByRevisionNumber
|
||||
// method.
|
||||
func (client *ContainerGroupProfileClient) GetByRevisionNumber(ctx context.Context, resourceGroupName string, containerGroupProfileName string, revisionNumber string, options *ContainerGroupProfileClientGetByRevisionNumberOptions) (ContainerGroupProfileClientGetByRevisionNumberResponse, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupProfileClient.GetByRevisionNumber"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.getByRevisionNumberCreateRequest(ctx, resourceGroupName, containerGroupProfileName, revisionNumber, options)
|
||||
if err != nil {
|
||||
return ContainerGroupProfileClientGetByRevisionNumberResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ContainerGroupProfileClientGetByRevisionNumberResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ContainerGroupProfileClientGetByRevisionNumberResponse{}, err
|
||||
}
|
||||
resp, err := client.getByRevisionNumberHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getByRevisionNumberCreateRequest creates the GetByRevisionNumber request.
|
||||
func (client *ContainerGroupProfileClient) getByRevisionNumberCreateRequest(ctx context.Context, resourceGroupName string, containerGroupProfileName string, revisionNumber string, options *ContainerGroupProfileClientGetByRevisionNumberOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}/revisions/{revisionNumber}"
|
||||
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 containerGroupProfileName == "" {
|
||||
return nil, errors.New("parameter containerGroupProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{containerGroupProfileName}", url.PathEscape(containerGroupProfileName))
|
||||
if revisionNumber == "" {
|
||||
return nil, errors.New("parameter revisionNumber cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{revisionNumber}", url.PathEscape(revisionNumber))
|
||||
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-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getByRevisionNumberHandleResponse handles the GetByRevisionNumber response.
|
||||
func (client *ContainerGroupProfileClient) getByRevisionNumberHandleResponse(resp *http.Response) (ContainerGroupProfileClientGetByRevisionNumberResponse, error) {
|
||||
result := ContainerGroupProfileClientGetByRevisionNumberResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ContainerGroupProfile); err != nil {
|
||||
return ContainerGroupProfileClientGetByRevisionNumberResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListAllRevisionsPager - Get a list of all the revisions of the specified container group profile in the given subscription
|
||||
// and resource group. This operation returns properties of each revision of the specified container
|
||||
// group profile including containers, image registry credentials, restart policy, IP address type, OS type volumes, revision
|
||||
// number, etc.
|
||||
//
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupProfileName - The name of the container group profile.
|
||||
// - options - ContainerGroupProfileClientListAllRevisionsOptions contains the optional parameters for the ContainerGroupProfileClient.NewListAllRevisionsPager
|
||||
// method.
|
||||
func (client *ContainerGroupProfileClient) NewListAllRevisionsPager(resourceGroupName string, containerGroupProfileName string, options *ContainerGroupProfileClientListAllRevisionsOptions) *runtime.Pager[ContainerGroupProfileClientListAllRevisionsResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[ContainerGroupProfileClientListAllRevisionsResponse]{
|
||||
More: func(page ContainerGroupProfileClientListAllRevisionsResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *ContainerGroupProfileClientListAllRevisionsResponse) (ContainerGroupProfileClientListAllRevisionsResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainerGroupProfileClient.NewListAllRevisionsPager")
|
||||
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.listAllRevisionsCreateRequest(ctx, resourceGroupName, containerGroupProfileName, options)
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return ContainerGroupProfileClientListAllRevisionsResponse{}, err
|
||||
}
|
||||
return client.listAllRevisionsHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listAllRevisionsCreateRequest creates the ListAllRevisions request.
|
||||
func (client *ContainerGroupProfileClient) listAllRevisionsCreateRequest(ctx context.Context, resourceGroupName string, containerGroupProfileName string, options *ContainerGroupProfileClientListAllRevisionsOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}/revisions"
|
||||
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 containerGroupProfileName == "" {
|
||||
return nil, errors.New("parameter containerGroupProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{containerGroupProfileName}", url.PathEscape(containerGroupProfileName))
|
||||
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-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listAllRevisionsHandleResponse handles the ListAllRevisions response.
|
||||
func (client *ContainerGroupProfileClient) listAllRevisionsHandleResponse(resp *http.Response) (ContainerGroupProfileClientListAllRevisionsResponse, error) {
|
||||
result := ContainerGroupProfileClientListAllRevisionsResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ContainerGroupProfileListResult); err != nil {
|
||||
return ContainerGroupProfileClientListAllRevisionsResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
|
@ -0,0 +1,192 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// 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) AutoRest Code Generator.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
// DO NOT EDIT.
|
||||
|
||||
package armcontainerinstance_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
|
||||
)
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileListAllRevisions.json
|
||||
func ExampleContainerGroupProfileClient_NewListAllRevisionsPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armcontainerinstance.NewClientFactory("<subscription-id>", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
pager := clientFactory.NewContainerGroupProfileClient().NewListAllRevisionsPager("demo", "demo1", 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.ContainerGroupProfileListResult = armcontainerinstance.ContainerGroupProfileListResult{
|
||||
// Value: []*armcontainerinstance.ContainerGroupProfile{
|
||||
// {
|
||||
// Properties: &armcontainerinstance.ContainerGroupProfilePropertiesProperties{
|
||||
// Containers: []*armcontainerinstance.Container{
|
||||
// {
|
||||
// Name: to.Ptr("demo1"),
|
||||
// Properties: &armcontainerinstance.ContainerProperties{
|
||||
// Command: []*string{
|
||||
// },
|
||||
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
|
||||
// },
|
||||
// Image: to.Ptr("nginx"),
|
||||
// Ports: []*armcontainerinstance.ContainerPort{
|
||||
// {
|
||||
// Port: to.Ptr[int32](80),
|
||||
// }},
|
||||
// Resources: &armcontainerinstance.ResourceRequirements{
|
||||
// Requests: &armcontainerinstance.ResourceRequests{
|
||||
// CPU: to.Ptr[float64](1),
|
||||
// MemoryInGB: to.Ptr[float64](1.5),
|
||||
// },
|
||||
// },
|
||||
// VolumeMounts: []*armcontainerinstance.VolumeMount{
|
||||
// {
|
||||
// Name: to.Ptr("volume1"),
|
||||
// MountPath: to.Ptr("/mnt/volume1"),
|
||||
// ReadOnly: to.Ptr(false),
|
||||
// }},
|
||||
// },
|
||||
// }},
|
||||
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
|
||||
// {
|
||||
// Server: to.Ptr("azcloudconsoleregistry.azurecr.io"),
|
||||
// Username: to.Ptr("azcloudconsoleregistry"),
|
||||
// }},
|
||||
// IPAddress: &armcontainerinstance.IPAddress{
|
||||
// Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
|
||||
// IP: to.Ptr("10.0.0.1"),
|
||||
// Ports: []*armcontainerinstance.Port{
|
||||
// {
|
||||
// Port: to.Ptr[int32](80),
|
||||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// Revision: to.Ptr[int32](1),
|
||||
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
// {
|
||||
// Name: to.Ptr("volume1"),
|
||||
// AzureFile: &armcontainerinstance.AzureFileVolume{
|
||||
// ReadOnly: to.Ptr(false),
|
||||
// ShareName: to.Ptr("share1"),
|
||||
// StorageAccountName: to.Ptr("storage1"),
|
||||
// },
|
||||
// }},
|
||||
// },
|
||||
// Name: to.Ptr("demo1"),
|
||||
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroupProfiles"),
|
||||
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/demo1"),
|
||||
// Location: to.Ptr("WestUs"),
|
||||
// Zones: []*string{
|
||||
// to.Ptr("1")},
|
||||
// }},
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json
|
||||
func ExampleContainerGroupProfileClient_GetByRevisionNumber() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armcontainerinstance.NewClientFactory("<subscription-id>", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
res, err := clientFactory.NewContainerGroupProfileClient().GetByRevisionNumber(ctx, "demo", "demo1", "1", 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.ContainerGroupProfile = armcontainerinstance.ContainerGroupProfile{
|
||||
// Properties: &armcontainerinstance.ContainerGroupProfilePropertiesProperties{
|
||||
// Containers: []*armcontainerinstance.Container{
|
||||
// {
|
||||
// Name: to.Ptr("demo1"),
|
||||
// Properties: &armcontainerinstance.ContainerProperties{
|
||||
// Command: []*string{
|
||||
// },
|
||||
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
|
||||
// },
|
||||
// Image: to.Ptr("nginx"),
|
||||
// Ports: []*armcontainerinstance.ContainerPort{
|
||||
// {
|
||||
// Port: to.Ptr[int32](80),
|
||||
// }},
|
||||
// Resources: &armcontainerinstance.ResourceRequirements{
|
||||
// Requests: &armcontainerinstance.ResourceRequests{
|
||||
// CPU: to.Ptr[float64](1),
|
||||
// MemoryInGB: to.Ptr[float64](1.5),
|
||||
// },
|
||||
// },
|
||||
// VolumeMounts: []*armcontainerinstance.VolumeMount{
|
||||
// {
|
||||
// Name: to.Ptr("volume1"),
|
||||
// MountPath: to.Ptr("/mnt/volume1"),
|
||||
// ReadOnly: to.Ptr(false),
|
||||
// }},
|
||||
// },
|
||||
// }},
|
||||
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
|
||||
// {
|
||||
// Server: to.Ptr("azcloudconsoleregistry.azurecr.io"),
|
||||
// Username: to.Ptr("azcloudconsoleregistry"),
|
||||
// }},
|
||||
// IPAddress: &armcontainerinstance.IPAddress{
|
||||
// Type: to.Ptr(armcontainerinstance.ContainerGroupIPAddressTypePublic),
|
||||
// IP: to.Ptr("10.0.0.1"),
|
||||
// Ports: []*armcontainerinstance.Port{
|
||||
// {
|
||||
// Port: to.Ptr[int32](80),
|
||||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// Revision: to.Ptr[int32](1),
|
||||
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
// {
|
||||
// Name: to.Ptr("volume1"),
|
||||
// AzureFile: &armcontainerinstance.AzureFileVolume{
|
||||
// ReadOnly: to.Ptr(false),
|
||||
// ShareName: to.Ptr("share1"),
|
||||
// StorageAccountName: to.Ptr("storage1"),
|
||||
// },
|
||||
// }},
|
||||
// },
|
||||
// Name: to.Ptr("demo1"),
|
||||
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroupProfiles"),
|
||||
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/demo1"),
|
||||
// Location: to.Ptr("WestUs"),
|
||||
// Zones: []*string{
|
||||
// to.Ptr("1")},
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,424 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// 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) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
package armcontainerinstance
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
// ContainerGroupProfilesClient contains the methods for the ContainerGroupProfiles group.
|
||||
// Don't use this type directly, use NewContainerGroupProfilesClient() instead.
|
||||
type ContainerGroupProfilesClient struct {
|
||||
internal *arm.Client
|
||||
subscriptionID string
|
||||
}
|
||||
|
||||
// NewContainerGroupProfilesClient creates a new instance of ContainerGroupProfilesClient 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 NewContainerGroupProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerGroupProfilesClient, error) {
|
||||
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client := &ContainerGroupProfilesClient{
|
||||
subscriptionID: subscriptionID,
|
||||
internal: cl,
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// CreateOrUpdate - Create or update container group profiles with specified configurations.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupProfileName - The name of the container group profile.
|
||||
// - containerGroupProfile - The properties of the container group profile to be created or updated.
|
||||
// - options - ContainerGroupProfilesClientCreateOrUpdateOptions contains the optional parameters for the ContainerGroupProfilesClient.CreateOrUpdate
|
||||
// method.
|
||||
func (client *ContainerGroupProfilesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, containerGroupProfileName string, containerGroupProfile ContainerGroupProfile, options *ContainerGroupProfilesClientCreateOrUpdateOptions) (ContainerGroupProfilesClientCreateOrUpdateResponse, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupProfilesClient.CreateOrUpdate"
|
||||
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, containerGroupProfileName, containerGroupProfile, options)
|
||||
if err != nil {
|
||||
return ContainerGroupProfilesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ContainerGroupProfilesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ContainerGroupProfilesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
resp, err := client.createOrUpdateHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
|
||||
func (client *ContainerGroupProfilesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, containerGroupProfileName string, containerGroupProfile ContainerGroupProfile, options *ContainerGroupProfilesClientCreateOrUpdateOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}"
|
||||
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 containerGroupProfileName == "" {
|
||||
return nil, errors.New("parameter containerGroupProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{containerGroupProfileName}", url.PathEscape(containerGroupProfileName))
|
||||
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-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, containerGroupProfile); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// createOrUpdateHandleResponse handles the CreateOrUpdate response.
|
||||
func (client *ContainerGroupProfilesClient) createOrUpdateHandleResponse(resp *http.Response) (ContainerGroupProfilesClientCreateOrUpdateResponse, error) {
|
||||
result := ContainerGroupProfilesClientCreateOrUpdateResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ContainerGroupProfile); err != nil {
|
||||
return ContainerGroupProfilesClientCreateOrUpdateResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Delete - Delete the specified container group profile in the specified subscription and resource group. The operation does
|
||||
// not delete other resources provided by the user, such as volumes.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupProfileName - The name of the container group profile.
|
||||
// - options - ContainerGroupProfilesClientDeleteOptions contains the optional parameters for the ContainerGroupProfilesClient.Delete
|
||||
// method.
|
||||
func (client *ContainerGroupProfilesClient) Delete(ctx context.Context, resourceGroupName string, containerGroupProfileName string, options *ContainerGroupProfilesClientDeleteOptions) (ContainerGroupProfilesClientDeleteResponse, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupProfilesClient.Delete"
|
||||
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, containerGroupProfileName, options)
|
||||
if err != nil {
|
||||
return ContainerGroupProfilesClientDeleteResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ContainerGroupProfilesClientDeleteResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ContainerGroupProfilesClientDeleteResponse{}, err
|
||||
}
|
||||
return ContainerGroupProfilesClientDeleteResponse{}, nil
|
||||
}
|
||||
|
||||
// deleteCreateRequest creates the Delete request.
|
||||
func (client *ContainerGroupProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, containerGroupProfileName string, options *ContainerGroupProfilesClientDeleteOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}"
|
||||
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 containerGroupProfileName == "" {
|
||||
return nil, errors.New("parameter containerGroupProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{containerGroupProfileName}", url.PathEscape(containerGroupProfileName))
|
||||
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-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Get - Gets the properties of the specified container group profile in the specified subscription and resource group. The
|
||||
// operation returns the properties of container group profile including containers,
|
||||
// image registry credentials, restart policy, IP address type, OS type, volumes, current revision number, etc.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupProfileName - The name of the container group profile.
|
||||
// - options - ContainerGroupProfilesClientGetOptions contains the optional parameters for the ContainerGroupProfilesClient.Get
|
||||
// method.
|
||||
func (client *ContainerGroupProfilesClient) Get(ctx context.Context, resourceGroupName string, containerGroupProfileName string, options *ContainerGroupProfilesClientGetOptions) (ContainerGroupProfilesClientGetResponse, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupProfilesClient.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, containerGroupProfileName, options)
|
||||
if err != nil {
|
||||
return ContainerGroupProfilesClientGetResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ContainerGroupProfilesClientGetResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ContainerGroupProfilesClientGetResponse{}, err
|
||||
}
|
||||
resp, err := client.getHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// getCreateRequest creates the Get request.
|
||||
func (client *ContainerGroupProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, containerGroupProfileName string, options *ContainerGroupProfilesClientGetOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}"
|
||||
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 containerGroupProfileName == "" {
|
||||
return nil, errors.New("parameter containerGroupProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{containerGroupProfileName}", url.PathEscape(containerGroupProfileName))
|
||||
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-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// getHandleResponse handles the Get response.
|
||||
func (client *ContainerGroupProfilesClient) getHandleResponse(resp *http.Response) (ContainerGroupProfilesClientGetResponse, error) {
|
||||
result := ContainerGroupProfilesClientGetResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ContainerGroupProfile); err != nil {
|
||||
return ContainerGroupProfilesClientGetResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListPager - Get a list of container group profiles in the specified subscription. This operation returns properties
|
||||
// of each container group profile including containers, image registry credentials, restart
|
||||
// policy, IP address type, OS type,volumes,current revision number, etc.
|
||||
//
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - options - ContainerGroupProfilesClientListOptions contains the optional parameters for the ContainerGroupProfilesClient.NewListPager
|
||||
// method.
|
||||
func (client *ContainerGroupProfilesClient) NewListPager(options *ContainerGroupProfilesClientListOptions) *runtime.Pager[ContainerGroupProfilesClientListResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[ContainerGroupProfilesClientListResponse]{
|
||||
More: func(page ContainerGroupProfilesClientListResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *ContainerGroupProfilesClientListResponse) (ContainerGroupProfilesClientListResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainerGroupProfilesClient.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 ContainerGroupProfilesClientListResponse{}, err
|
||||
}
|
||||
return client.listHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listCreateRequest creates the List request.
|
||||
func (client *ContainerGroupProfilesClient) listCreateRequest(ctx context.Context, options *ContainerGroupProfilesClientListOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroupProfiles"
|
||||
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-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listHandleResponse handles the List response.
|
||||
func (client *ContainerGroupProfilesClient) listHandleResponse(resp *http.Response) (ContainerGroupProfilesClientListResponse, error) {
|
||||
result := ContainerGroupProfilesClientListResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ContainerGroupProfileListResult); err != nil {
|
||||
return ContainerGroupProfilesClientListResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NewListByResourceGroupPager - Get a list of container group profiles in a specified subscription and resource group. This
|
||||
// operation returns properties of each container group profile including containers, image registry
|
||||
// credentials, restart policy, IP address type, OS type volumes, current revision number, etc.
|
||||
//
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - options - ContainerGroupProfilesClientListByResourceGroupOptions contains the optional parameters for the ContainerGroupProfilesClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *ContainerGroupProfilesClient) NewListByResourceGroupPager(resourceGroupName string, options *ContainerGroupProfilesClientListByResourceGroupOptions) *runtime.Pager[ContainerGroupProfilesClientListByResourceGroupResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[ContainerGroupProfilesClientListByResourceGroupResponse]{
|
||||
More: func(page ContainerGroupProfilesClientListByResourceGroupResponse) bool {
|
||||
return page.NextLink != nil && len(*page.NextLink) > 0
|
||||
},
|
||||
Fetcher: func(ctx context.Context, page *ContainerGroupProfilesClientListByResourceGroupResponse) (ContainerGroupProfilesClientListByResourceGroupResponse, error) {
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainerGroupProfilesClient.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 ContainerGroupProfilesClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return client.listByResourceGroupHandleResponse(resp)
|
||||
},
|
||||
Tracer: client.internal.Tracer(),
|
||||
})
|
||||
}
|
||||
|
||||
// listByResourceGroupCreateRequest creates the ListByResourceGroup request.
|
||||
func (client *ContainerGroupProfilesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ContainerGroupProfilesClientListByResourceGroupOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles"
|
||||
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-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// listByResourceGroupHandleResponse handles the ListByResourceGroup response.
|
||||
func (client *ContainerGroupProfilesClient) listByResourceGroupHandleResponse(resp *http.Response) (ContainerGroupProfilesClientListByResourceGroupResponse, error) {
|
||||
result := ContainerGroupProfilesClientListByResourceGroupResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ContainerGroupProfileListResult); err != nil {
|
||||
return ContainerGroupProfilesClientListByResourceGroupResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Patch - Patches container group profile with specified properties.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupProfileName - The name of the container group profile.
|
||||
// - properties - The container group profile properties that need to be updated.
|
||||
// - options - ContainerGroupProfilesClientPatchOptions contains the optional parameters for the ContainerGroupProfilesClient.Patch
|
||||
// method.
|
||||
func (client *ContainerGroupProfilesClient) Patch(ctx context.Context, resourceGroupName string, containerGroupProfileName string, properties ContainerGroupProfilePatch, options *ContainerGroupProfilesClientPatchOptions) (ContainerGroupProfilesClientPatchResponse, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupProfilesClient.Patch"
|
||||
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
|
||||
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
|
||||
defer func() { endSpan(err) }()
|
||||
req, err := client.patchCreateRequest(ctx, resourceGroupName, containerGroupProfileName, properties, options)
|
||||
if err != nil {
|
||||
return ContainerGroupProfilesClientPatchResponse{}, err
|
||||
}
|
||||
httpResp, err := client.internal.Pipeline().Do(req)
|
||||
if err != nil {
|
||||
return ContainerGroupProfilesClientPatchResponse{}, err
|
||||
}
|
||||
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
|
||||
err = runtime.NewResponseError(httpResp)
|
||||
return ContainerGroupProfilesClientPatchResponse{}, err
|
||||
}
|
||||
resp, err := client.patchHandleResponse(httpResp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// patchCreateRequest creates the Patch request.
|
||||
func (client *ContainerGroupProfilesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, containerGroupProfileName string, properties ContainerGroupProfilePatch, options *ContainerGroupProfilesClientPatchOptions) (*policy.Request, error) {
|
||||
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}"
|
||||
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 containerGroupProfileName == "" {
|
||||
return nil, errors.New("parameter containerGroupProfileName cannot be empty")
|
||||
}
|
||||
urlPath = strings.ReplaceAll(urlPath, "{containerGroupProfileName}", url.PathEscape(containerGroupProfileName))
|
||||
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-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, properties); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// patchHandleResponse handles the Patch response.
|
||||
func (client *ContainerGroupProfilesClient) patchHandleResponse(resp *http.Response) (ContainerGroupProfilesClientPatchResponse, error) {
|
||||
result := ContainerGroupProfilesClientPatchResponse{}
|
||||
if err := runtime.UnmarshalAsJSON(resp, &result.ContainerGroupProfile); err != nil {
|
||||
return ContainerGroupProfilesClientPatchResponse{}, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -28,8 +28,7 @@ type ContainerGroupsClient struct {
|
|||
}
|
||||
|
||||
// NewContainerGroupsClient creates a new instance of ContainerGroupsClient with the specified values.
|
||||
// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms
|
||||
// part of the URI for every service call.
|
||||
// - 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 NewContainerGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainerGroupsClient, error) {
|
||||
|
@ -47,8 +46,8 @@ func NewContainerGroupsClient(subscriptionID string, credential azcore.TokenCred
|
|||
// BeginCreateOrUpdate - Create or update container groups with specified configurations.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - containerGroup - The properties of the container group to be created or updated.
|
||||
// - options - ContainerGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerGroupsClient.BeginCreateOrUpdate
|
||||
|
@ -73,7 +72,7 @@ func (client *ContainerGroupsClient) BeginCreateOrUpdate(ctx context.Context, re
|
|||
// CreateOrUpdate - Create or update container groups with specified configurations.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// Generated from API version 2024-05-01-preview
|
||||
func (client *ContainerGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup ContainerGroup, options *ContainerGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupsClient.BeginCreateOrUpdate"
|
||||
|
@ -115,7 +114,7 @@ func (client *ContainerGroupsClient) createOrUpdateCreateRequest(ctx context.Con
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, containerGroup); err != nil {
|
||||
|
@ -128,8 +127,8 @@ func (client *ContainerGroupsClient) createOrUpdateCreateRequest(ctx context.Con
|
|||
// not delete other resources provided by the user, such as volumes.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - options - ContainerGroupsClientBeginDeleteOptions contains the optional parameters for the ContainerGroupsClient.BeginDelete
|
||||
// method.
|
||||
|
@ -154,7 +153,7 @@ func (client *ContainerGroupsClient) BeginDelete(ctx context.Context, resourceGr
|
|||
// delete other resources provided by the user, such as volumes.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// Generated from API version 2024-05-01-preview
|
||||
func (client *ContainerGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, containerGroupName string, options *ContainerGroupsClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupsClient.BeginDelete"
|
||||
|
@ -196,7 +195,7 @@ func (client *ContainerGroupsClient) deleteCreateRequest(ctx context.Context, re
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -207,8 +206,8 @@ func (client *ContainerGroupsClient) deleteCreateRequest(ctx context.Context, re
|
|||
// credentials, restart policy, IP address type, OS type, state, and volumes.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - options - ContainerGroupsClientGetOptions contains the optional parameters for the ContainerGroupsClient.Get method.
|
||||
func (client *ContainerGroupsClient) Get(ctx context.Context, resourceGroupName string, containerGroupName string, options *ContainerGroupsClientGetOptions) (ContainerGroupsClientGetResponse, error) {
|
||||
|
@ -253,7 +252,7 @@ func (client *ContainerGroupsClient) getCreateRequest(ctx context.Context, resou
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -272,8 +271,8 @@ func (client *ContainerGroupsClient) getHandleResponse(resp *http.Response) (Con
|
|||
// control of network setting and configuration. For container groups, this will always be an empty list.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - options - ContainerGroupsClientGetOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the
|
||||
// ContainerGroupsClient.GetOutboundNetworkDependenciesEndpoints method.
|
||||
|
@ -319,7 +318,7 @@ func (client *ContainerGroupsClient) getOutboundNetworkDependenciesEndpointsCrea
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -338,7 +337,7 @@ func (client *ContainerGroupsClient) getOutboundNetworkDependenciesEndpointsHand
|
|||
// container group including containers, image registry credentials, restart policy, IP address
|
||||
// type, OS type, state, and volumes.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - options - ContainerGroupsClientListOptions contains the optional parameters for the ContainerGroupsClient.NewListPager
|
||||
// method.
|
||||
func (client *ContainerGroupsClient) NewListPager(options *ContainerGroupsClientListOptions) *runtime.Pager[ContainerGroupsClientListResponse] {
|
||||
|
@ -376,7 +375,7 @@ func (client *ContainerGroupsClient) listCreateRequest(ctx context.Context, opti
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -395,8 +394,8 @@ func (client *ContainerGroupsClient) listHandleResponse(resp *http.Response) (Co
|
|||
// returns properties of each container group including containers, image registry credentials, restart
|
||||
// policy, IP address type, OS type, state, and volumes.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - options - ContainerGroupsClientListByResourceGroupOptions contains the optional parameters for the ContainerGroupsClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
func (client *ContainerGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *ContainerGroupsClientListByResourceGroupOptions) *runtime.Pager[ContainerGroupsClientListByResourceGroupResponse] {
|
||||
|
@ -438,7 +437,7 @@ func (client *ContainerGroupsClient) listByResourceGroupCreateRequest(ctx contex
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -457,8 +456,8 @@ func (client *ContainerGroupsClient) listByResourceGroupHandleResponse(resp *htt
|
|||
// downloaded.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - options - ContainerGroupsClientBeginRestartOptions contains the optional parameters for the ContainerGroupsClient.BeginRestart
|
||||
// method.
|
||||
|
@ -482,7 +481,7 @@ func (client *ContainerGroupsClient) BeginRestart(ctx context.Context, resourceG
|
|||
// Restart - Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// Generated from API version 2024-05-01-preview
|
||||
func (client *ContainerGroupsClient) restart(ctx context.Context, resourceGroupName string, containerGroupName string, options *ContainerGroupsClientBeginRestartOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupsClient.BeginRestart"
|
||||
|
@ -524,7 +523,7 @@ func (client *ContainerGroupsClient) restartCreateRequest(ctx context.Context, r
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -533,8 +532,8 @@ func (client *ContainerGroupsClient) restartCreateRequest(ctx context.Context, r
|
|||
// BeginStart - Starts all containers in a container group. Compute resources will be allocated and billing will start.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - options - ContainerGroupsClientBeginStartOptions contains the optional parameters for the ContainerGroupsClient.BeginStart
|
||||
// method.
|
||||
|
@ -558,7 +557,7 @@ func (client *ContainerGroupsClient) BeginStart(ctx context.Context, resourceGro
|
|||
// Start - Starts all containers in a container group. Compute resources will be allocated and billing will start.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// Generated from API version 2024-05-01-preview
|
||||
func (client *ContainerGroupsClient) start(ctx context.Context, resourceGroupName string, containerGroupName string, options *ContainerGroupsClientBeginStartOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "ContainerGroupsClient.BeginStart"
|
||||
|
@ -600,7 +599,7 @@ func (client *ContainerGroupsClient) startCreateRequest(ctx context.Context, res
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -609,8 +608,8 @@ func (client *ContainerGroupsClient) startCreateRequest(ctx context.Context, res
|
|||
// Stop - Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - options - ContainerGroupsClientStopOptions contains the optional parameters for the ContainerGroupsClient.Stop method.
|
||||
func (client *ContainerGroupsClient) Stop(ctx context.Context, resourceGroupName string, containerGroupName string, options *ContainerGroupsClientStopOptions) (ContainerGroupsClientStopResponse, error) {
|
||||
|
@ -654,7 +653,7 @@ func (client *ContainerGroupsClient) stopCreateRequest(ctx context.Context, reso
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -663,8 +662,8 @@ func (client *ContainerGroupsClient) stopCreateRequest(ctx context.Context, reso
|
|||
// Update - Updates container group tags with specified values.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - resource - The container group resource with just the tags to be updated.
|
||||
// - options - ContainerGroupsClientUpdateOptions contains the optional parameters for the ContainerGroupsClient.Update method.
|
||||
|
@ -710,7 +709,7 @@ func (client *ContainerGroupsClient) updateCreateRequest(ctx context.Context, re
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, resource); err != nil {
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
|
||||
)
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsList.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsList.json
|
||||
func ExampleContainerGroupsClient_NewListPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -95,6 +95,7 @@ func ExampleContainerGroupsClient_NewListPager() {
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
|
@ -118,7 +119,7 @@ func ExampleContainerGroupsClient_NewListPager() {
|
|||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsListByResourceGroup.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsListByResourceGroup.json
|
||||
func ExampleContainerGroupsClient_NewListByResourceGroupPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -185,6 +186,7 @@ func ExampleContainerGroupsClient_NewListByResourceGroupPager() {
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
|
@ -208,7 +210,7 @@ func ExampleContainerGroupsClient_NewListByResourceGroupPager() {
|
|||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGetPriority.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGetPriority.json
|
||||
func ExampleContainerGroupsClient_Get_containerGroupsGetWithPriority() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -291,6 +293,7 @@ func ExampleContainerGroupsClient_Get_containerGroupsGetWithPriority() {
|
|||
// },
|
||||
// State: to.Ptr("Succeeded"),
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// Priority: to.Ptr(armcontainerinstance.ContainerGroupPrioritySpot),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
|
@ -304,7 +307,7 @@ func ExampleContainerGroupsClient_Get_containerGroupsGetWithPriority() {
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGet_Failed.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Failed.json
|
||||
func ExampleContainerGroupsClient_Get_containerGroupsGetFailed() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -402,6 +405,7 @@ func ExampleContainerGroupsClient_Get_containerGroupsGetFailed() {
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
|
@ -421,7 +425,7 @@ func ExampleContainerGroupsClient_Get_containerGroupsGetFailed() {
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsGet_Succeeded.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Succeeded.json
|
||||
func ExampleContainerGroupsClient_Get_containerGroupsGetSucceeded() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -482,6 +486,7 @@ func ExampleContainerGroupsClient_Get_containerGroupsGetSucceeded() {
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
|
@ -503,7 +508,7 @@ func ExampleContainerGroupsClient_Get_containerGroupsGetSucceeded() {
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupCreateConfidential.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateConfidential.json
|
||||
func ExampleContainerGroupsClient_BeginCreateOrUpdate_confidentialContainerGroup() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -619,6 +624,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_confidentialContainerGroup
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUConfidential),
|
||||
|
@ -630,7 +636,104 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_confidentialContainerGroup
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupExtensions.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateOrUpdateStandbyPool.json
|
||||
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupCreateOrUpdateWithStandbyPool() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to obtain a credential: %v", err)
|
||||
}
|
||||
ctx := context.Background()
|
||||
clientFactory, err := armcontainerinstance.NewClientFactory("<subscription-id>", cred, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create client: %v", err)
|
||||
}
|
||||
poller, err := clientFactory.NewContainerGroupsClient().BeginCreateOrUpdate(ctx, "demo", "demo1", armcontainerinstance.ContainerGroup{
|
||||
Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
|
||||
ContainerGroupProfile: &armcontainerinstance.ContainerGroupProfileReferenceDefinition{
|
||||
ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp"),
|
||||
Revision: to.Ptr[int32](1),
|
||||
},
|
||||
Containers: []*armcontainerinstance.Container{
|
||||
{
|
||||
Name: to.Ptr("demo1"),
|
||||
Properties: &armcontainerinstance.ContainerProperties{
|
||||
ConfigMap: &armcontainerinstance.ConfigMap{
|
||||
KeyValuePairs: map[string]*string{
|
||||
"Newkey": to.Ptr("value"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}},
|
||||
StandbyPoolProfile: &armcontainerinstance.StandbyPoolProfileDefinition{
|
||||
ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool"),
|
||||
},
|
||||
},
|
||||
Location: to.Ptr("west us"),
|
||||
}, 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.ContainerGroup = armcontainerinstance.ContainerGroup{
|
||||
// Properties: &armcontainerinstance.ContainerGroupPropertiesProperties{
|
||||
// ContainerGroupProfile: &armcontainerinstance.ContainerGroupProfileReferenceDefinition{
|
||||
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp"),
|
||||
// Revision: to.Ptr[int32](1),
|
||||
// },
|
||||
// Containers: []*armcontainerinstance.Container{
|
||||
// {
|
||||
// Name: to.Ptr("demo1"),
|
||||
// Properties: &armcontainerinstance.ContainerProperties{
|
||||
// Command: []*string{
|
||||
// },
|
||||
// ConfigMap: &armcontainerinstance.ConfigMap{
|
||||
// KeyValuePairs: map[string]*string{
|
||||
// "Newkey": to.Ptr("value"),
|
||||
// },
|
||||
// },
|
||||
// EnvironmentVariables: []*armcontainerinstance.EnvironmentVariable{
|
||||
// },
|
||||
// Image: to.Ptr("nginx"),
|
||||
// Ports: []*armcontainerinstance.ContainerPort{
|
||||
// {
|
||||
// Port: to.Ptr[int32](80),
|
||||
// }},
|
||||
// Resources: &armcontainerinstance.ResourceRequirements{
|
||||
// Requests: &armcontainerinstance.ResourceRequests{
|
||||
// CPU: to.Ptr[float64](1),
|
||||
// MemoryInGB: to.Ptr[float64](1.5),
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// }},
|
||||
// ImageRegistryCredentials: []*armcontainerinstance.ImageRegistryCredential{
|
||||
// },
|
||||
// InitContainers: []*armcontainerinstance.InitContainerDefinition{
|
||||
// },
|
||||
// InstanceView: &armcontainerinstance.ContainerGroupPropertiesInstanceView{
|
||||
// Events: []*armcontainerinstance.Event{
|
||||
// },
|
||||
// State: to.Ptr("Running"),
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(true),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
|
||||
// },
|
||||
// Name: to.Ptr("demo1"),
|
||||
// Type: to.Ptr("Microsoft.ContainerInstance/containerGroups"),
|
||||
// ID: to.Ptr("/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroups/demo1"),
|
||||
// Location: to.Ptr("eastus2"),
|
||||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupExtensions.json
|
||||
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupCreateWithExtensions() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -743,6 +846,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupCreateWithEx
|
|||
// },
|
||||
// State: to.Ptr("Pending"),
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
|
||||
|
@ -777,7 +881,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupCreateWithEx
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupEncryptionProperties.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupEncryptionProperties.json
|
||||
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupWithEncryptionProperties() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -900,6 +1004,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupWithEncrypti
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// SKU: to.Ptr(armcontainerinstance.ContainerGroupSKUStandard),
|
||||
|
@ -911,7 +1016,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupWithEncrypti
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsCreateOrUpdate.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreateOrUpdate.json
|
||||
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateOrUpdate() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -1103,6 +1208,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateOrUpd
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
|
@ -1133,7 +1239,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateOrUpd
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsCreatePriority.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreatePriority.json
|
||||
func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateWithPriority() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -1210,6 +1316,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateWithP
|
|||
// },
|
||||
// State: to.Ptr("Succeeded"),
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// Priority: to.Ptr(armcontainerinstance.ContainerGroupPrioritySpot),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
|
@ -1223,7 +1330,7 @@ func ExampleContainerGroupsClient_BeginCreateOrUpdate_containerGroupsCreateWithP
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsUpdate.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsUpdate.json
|
||||
func ExampleContainerGroupsClient_Update() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -1298,6 +1405,7 @@ func ExampleContainerGroupsClient_Update() {
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
|
@ -1330,7 +1438,7 @@ func ExampleContainerGroupsClient_Update() {
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsDelete.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsDelete.json
|
||||
func ExampleContainerGroupsClient_BeginDelete() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -1395,6 +1503,7 @@ func ExampleContainerGroupsClient_BeginDelete() {
|
|||
// Protocol: to.Ptr(armcontainerinstance.ContainerGroupNetworkProtocolTCP),
|
||||
// }},
|
||||
// },
|
||||
// IsCreatedFromStandbyPool: to.Ptr(false),
|
||||
// OSType: to.Ptr(armcontainerinstance.OperatingSystemTypesLinux),
|
||||
// ProvisioningState: to.Ptr("Succeeded"),
|
||||
// Volumes: []*armcontainerinstance.Volume{
|
||||
|
@ -1416,7 +1525,7 @@ func ExampleContainerGroupsClient_BeginDelete() {
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsRestart.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsRestart.json
|
||||
func ExampleContainerGroupsClient_BeginRestart() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -1437,7 +1546,7 @@ func ExampleContainerGroupsClient_BeginRestart() {
|
|||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStop.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStop.json
|
||||
func ExampleContainerGroupsClient_Stop() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -1454,7 +1563,7 @@ func ExampleContainerGroupsClient_Stop() {
|
|||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupsStart.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStart.json
|
||||
func ExampleContainerGroupsClient_BeginStart() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -29,8 +29,7 @@ type ContainersClient struct {
|
|||
}
|
||||
|
||||
// NewContainersClient creates a new instance of ContainersClient with the specified values.
|
||||
// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms
|
||||
// part of the URI for every service call.
|
||||
// - 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 NewContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainersClient, error) {
|
||||
|
@ -48,8 +47,8 @@ func NewContainersClient(subscriptionID string, credential azcore.TokenCredentia
|
|||
// Attach - Attach to the output stream of a specific container instance in a specified resource group and container group.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - containerName - The name of the container instance.
|
||||
// - options - ContainersClientAttachOptions contains the optional parameters for the ContainersClient.Attach method.
|
||||
|
@ -99,7 +98,7 @@ func (client *ContainersClient) attachCreateRequest(ctx context.Context, resourc
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -117,8 +116,8 @@ func (client *ContainersClient) attachHandleResponse(resp *http.Response) (Conta
|
|||
// ExecuteCommand - Executes a command for a specific container instance in a specified resource group and container group.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - containerName - The name of the container instance.
|
||||
// - containerExecRequest - The request for the exec command.
|
||||
|
@ -170,7 +169,7 @@ func (client *ContainersClient) executeCommandCreateRequest(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
if err := runtime.MarshalAsJSON(req, containerExecRequest); err != nil {
|
||||
|
@ -191,8 +190,8 @@ func (client *ContainersClient) executeCommandHandleResponse(resp *http.Response
|
|||
// ListLogs - Get the logs for a specified container instance in a specified resource group and container group.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - containerGroupName - The name of the container group.
|
||||
// - containerName - The name of the container instance.
|
||||
// - options - ContainersClientListLogsOptions contains the optional parameters for the ContainersClient.ListLogs method.
|
||||
|
@ -242,7 +241,7 @@ func (client *ContainersClient) listLogsCreateRequest(ctx context.Context, resou
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
if options != nil && options.Tail != nil {
|
||||
reqQP.Set("tail", strconv.FormatInt(int64(*options.Tail), 10))
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
|
||||
)
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerListLogs.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerListLogs.json
|
||||
func ExampleContainersClient_ListLogs() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -43,7 +43,7 @@ func ExampleContainersClient_ListLogs() {
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerExec.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerExec.json
|
||||
func ExampleContainersClient_ExecuteCommand() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -73,7 +73,7 @@ func ExampleContainersClient_ExecuteCommand() {
|
|||
// }
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerAttach.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerAttach.json
|
||||
func ExampleContainersClient_Attach() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -0,0 +1,156 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// 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) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
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/containerinstance/armcontainerinstance/v2"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// ContainerGroupProfileServer is a fake server for instances of the armcontainerinstance.ContainerGroupProfileClient type.
|
||||
type ContainerGroupProfileServer struct {
|
||||
// GetByRevisionNumber is the fake for method ContainerGroupProfileClient.GetByRevisionNumber
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
GetByRevisionNumber func(ctx context.Context, resourceGroupName string, containerGroupProfileName string, revisionNumber string, options *armcontainerinstance.ContainerGroupProfileClientGetByRevisionNumberOptions) (resp azfake.Responder[armcontainerinstance.ContainerGroupProfileClientGetByRevisionNumberResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListAllRevisionsPager is the fake for method ContainerGroupProfileClient.NewListAllRevisionsPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListAllRevisionsPager func(resourceGroupName string, containerGroupProfileName string, options *armcontainerinstance.ContainerGroupProfileClientListAllRevisionsOptions) (resp azfake.PagerResponder[armcontainerinstance.ContainerGroupProfileClientListAllRevisionsResponse])
|
||||
}
|
||||
|
||||
// NewContainerGroupProfileServerTransport creates a new instance of ContainerGroupProfileServerTransport with the provided implementation.
|
||||
// The returned ContainerGroupProfileServerTransport instance is connected to an instance of armcontainerinstance.ContainerGroupProfileClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewContainerGroupProfileServerTransport(srv *ContainerGroupProfileServer) *ContainerGroupProfileServerTransport {
|
||||
return &ContainerGroupProfileServerTransport{
|
||||
srv: srv,
|
||||
newListAllRevisionsPager: newTracker[azfake.PagerResponder[armcontainerinstance.ContainerGroupProfileClientListAllRevisionsResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// ContainerGroupProfileServerTransport connects instances of armcontainerinstance.ContainerGroupProfileClient to instances of ContainerGroupProfileServer.
|
||||
// Don't use this type directly, use NewContainerGroupProfileServerTransport instead.
|
||||
type ContainerGroupProfileServerTransport struct {
|
||||
srv *ContainerGroupProfileServer
|
||||
newListAllRevisionsPager *tracker[azfake.PagerResponder[armcontainerinstance.ContainerGroupProfileClientListAllRevisionsResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for ContainerGroupProfileServerTransport.
|
||||
func (c *ContainerGroupProfileServerTransport) 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")}
|
||||
}
|
||||
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "ContainerGroupProfileClient.GetByRevisionNumber":
|
||||
resp, err = c.dispatchGetByRevisionNumber(req)
|
||||
case "ContainerGroupProfileClient.NewListAllRevisionsPager":
|
||||
resp, err = c.dispatchNewListAllRevisionsPager(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ContainerGroupProfileServerTransport) dispatchGetByRevisionNumber(req *http.Request) (*http.Response, error) {
|
||||
if c.srv.GetByRevisionNumber == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method GetByRevisionNumber not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerInstance/containerGroupProfiles/(?P<containerGroupProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revisions/(?P<revisionNumber>[!#&$-;=?-\[\]_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
|
||||
}
|
||||
containerGroupProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerGroupProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
revisionNumberParam, err := url.PathUnescape(matches[regex.SubexpIndex("revisionNumber")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := c.srv.GetByRevisionNumber(req.Context(), resourceGroupNameParam, containerGroupProfileNameParam, revisionNumberParam, 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).ContainerGroupProfile, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ContainerGroupProfileServerTransport) dispatchNewListAllRevisionsPager(req *http.Request) (*http.Response, error) {
|
||||
if c.srv.NewListAllRevisionsPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListAllRevisionsPager not implemented")}
|
||||
}
|
||||
newListAllRevisionsPager := c.newListAllRevisionsPager.get(req)
|
||||
if newListAllRevisionsPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerInstance/containerGroupProfiles/(?P<containerGroupProfileName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revisions`
|
||||
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
|
||||
}
|
||||
containerGroupProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerGroupProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := c.srv.NewListAllRevisionsPager(resourceGroupNameParam, containerGroupProfileNameParam, nil)
|
||||
newListAllRevisionsPager = &resp
|
||||
c.newListAllRevisionsPager.add(req, newListAllRevisionsPager)
|
||||
server.PagerResponderInjectNextLinks(newListAllRevisionsPager, req, func(page *armcontainerinstance.ContainerGroupProfileClientListAllRevisionsResponse, createLink func() string) {
|
||||
page.NextLink = to.Ptr(createLink())
|
||||
})
|
||||
}
|
||||
resp, err := server.PagerResponderNext(newListAllRevisionsPager, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !contains([]int{http.StatusOK}, resp.StatusCode) {
|
||||
c.newListAllRevisionsPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListAllRevisionsPager) {
|
||||
c.newListAllRevisionsPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -0,0 +1,314 @@
|
|||
//go:build go1.18
|
||||
// +build go1.18
|
||||
|
||||
// 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) AutoRest Code Generator. DO NOT EDIT.
|
||||
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
|
||||
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/containerinstance/armcontainerinstance/v2"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// ContainerGroupProfilesServer is a fake server for instances of the armcontainerinstance.ContainerGroupProfilesClient type.
|
||||
type ContainerGroupProfilesServer struct {
|
||||
// CreateOrUpdate is the fake for method ContainerGroupProfilesClient.CreateOrUpdate
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
|
||||
CreateOrUpdate func(ctx context.Context, resourceGroupName string, containerGroupProfileName string, containerGroupProfile armcontainerinstance.ContainerGroupProfile, options *armcontainerinstance.ContainerGroupProfilesClientCreateOrUpdateOptions) (resp azfake.Responder[armcontainerinstance.ContainerGroupProfilesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Delete is the fake for method ContainerGroupProfilesClient.Delete
|
||||
// HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent
|
||||
Delete func(ctx context.Context, resourceGroupName string, containerGroupProfileName string, options *armcontainerinstance.ContainerGroupProfilesClientDeleteOptions) (resp azfake.Responder[armcontainerinstance.ContainerGroupProfilesClientDeleteResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// Get is the fake for method ContainerGroupProfilesClient.Get
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Get func(ctx context.Context, resourceGroupName string, containerGroupProfileName string, options *armcontainerinstance.ContainerGroupProfilesClientGetOptions) (resp azfake.Responder[armcontainerinstance.ContainerGroupProfilesClientGetResponse], errResp azfake.ErrorResponder)
|
||||
|
||||
// NewListPager is the fake for method ContainerGroupProfilesClient.NewListPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListPager func(options *armcontainerinstance.ContainerGroupProfilesClientListOptions) (resp azfake.PagerResponder[armcontainerinstance.ContainerGroupProfilesClientListResponse])
|
||||
|
||||
// NewListByResourceGroupPager is the fake for method ContainerGroupProfilesClient.NewListByResourceGroupPager
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
NewListByResourceGroupPager func(resourceGroupName string, options *armcontainerinstance.ContainerGroupProfilesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontainerinstance.ContainerGroupProfilesClientListByResourceGroupResponse])
|
||||
|
||||
// Patch is the fake for method ContainerGroupProfilesClient.Patch
|
||||
// HTTP status codes to indicate success: http.StatusOK
|
||||
Patch func(ctx context.Context, resourceGroupName string, containerGroupProfileName string, properties armcontainerinstance.ContainerGroupProfilePatch, options *armcontainerinstance.ContainerGroupProfilesClientPatchOptions) (resp azfake.Responder[armcontainerinstance.ContainerGroupProfilesClientPatchResponse], errResp azfake.ErrorResponder)
|
||||
}
|
||||
|
||||
// NewContainerGroupProfilesServerTransport creates a new instance of ContainerGroupProfilesServerTransport with the provided implementation.
|
||||
// The returned ContainerGroupProfilesServerTransport instance is connected to an instance of armcontainerinstance.ContainerGroupProfilesClient via the
|
||||
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
|
||||
func NewContainerGroupProfilesServerTransport(srv *ContainerGroupProfilesServer) *ContainerGroupProfilesServerTransport {
|
||||
return &ContainerGroupProfilesServerTransport{
|
||||
srv: srv,
|
||||
newListPager: newTracker[azfake.PagerResponder[armcontainerinstance.ContainerGroupProfilesClientListResponse]](),
|
||||
newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontainerinstance.ContainerGroupProfilesClientListByResourceGroupResponse]](),
|
||||
}
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesServerTransport connects instances of armcontainerinstance.ContainerGroupProfilesClient to instances of ContainerGroupProfilesServer.
|
||||
// Don't use this type directly, use NewContainerGroupProfilesServerTransport instead.
|
||||
type ContainerGroupProfilesServerTransport struct {
|
||||
srv *ContainerGroupProfilesServer
|
||||
newListPager *tracker[azfake.PagerResponder[armcontainerinstance.ContainerGroupProfilesClientListResponse]]
|
||||
newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontainerinstance.ContainerGroupProfilesClientListByResourceGroupResponse]]
|
||||
}
|
||||
|
||||
// Do implements the policy.Transporter interface for ContainerGroupProfilesServerTransport.
|
||||
func (c *ContainerGroupProfilesServerTransport) 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")}
|
||||
}
|
||||
|
||||
var resp *http.Response
|
||||
var err error
|
||||
|
||||
switch method {
|
||||
case "ContainerGroupProfilesClient.CreateOrUpdate":
|
||||
resp, err = c.dispatchCreateOrUpdate(req)
|
||||
case "ContainerGroupProfilesClient.Delete":
|
||||
resp, err = c.dispatchDelete(req)
|
||||
case "ContainerGroupProfilesClient.Get":
|
||||
resp, err = c.dispatchGet(req)
|
||||
case "ContainerGroupProfilesClient.NewListPager":
|
||||
resp, err = c.dispatchNewListPager(req)
|
||||
case "ContainerGroupProfilesClient.NewListByResourceGroupPager":
|
||||
resp, err = c.dispatchNewListByResourceGroupPager(req)
|
||||
case "ContainerGroupProfilesClient.Patch":
|
||||
resp, err = c.dispatchPatch(req)
|
||||
default:
|
||||
err = fmt.Errorf("unhandled API %s", method)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ContainerGroupProfilesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) {
|
||||
if c.srv.CreateOrUpdate == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerInstance/containerGroupProfiles/(?P<containerGroupProfileName>[!#&$-;=?-\[\]_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[armcontainerinstance.ContainerGroupProfile](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
containerGroupProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerGroupProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := c.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, containerGroupProfileNameParam, body, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ContainerGroupProfile, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ContainerGroupProfilesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) {
|
||||
if c.srv.Delete == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerInstance/containerGroupProfiles/(?P<containerGroupProfileName>[!#&$-;=?-\[\]_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
|
||||
}
|
||||
containerGroupProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerGroupProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, containerGroupProfileNameParam, nil)
|
||||
if respErr := server.GetError(errRespr, req); respErr != nil {
|
||||
return nil, respErr
|
||||
}
|
||||
respContent := server.GetResponseContent(respr)
|
||||
if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) {
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)}
|
||||
}
|
||||
resp, err := server.NewResponse(respContent, req, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ContainerGroupProfilesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
|
||||
if c.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\.ContainerInstance/containerGroupProfiles/(?P<containerGroupProfileName>[!#&$-;=?-\[\]_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
|
||||
}
|
||||
containerGroupProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerGroupProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, containerGroupProfileNameParam, 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).ContainerGroupProfile, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ContainerGroupProfilesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) {
|
||||
if c.srv.NewListPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")}
|
||||
}
|
||||
newListPager := c.newListPager.get(req)
|
||||
if newListPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerInstance/containerGroupProfiles`
|
||||
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 := c.srv.NewListPager(nil)
|
||||
newListPager = &resp
|
||||
c.newListPager.add(req, newListPager)
|
||||
server.PagerResponderInjectNextLinks(newListPager, req, func(page *armcontainerinstance.ContainerGroupProfilesClientListResponse, 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) {
|
||||
c.newListPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListPager) {
|
||||
c.newListPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ContainerGroupProfilesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) {
|
||||
if c.srv.NewListByResourceGroupPager == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")}
|
||||
}
|
||||
newListByResourceGroupPager := c.newListByResourceGroupPager.get(req)
|
||||
if newListByResourceGroupPager == nil {
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerInstance/containerGroupProfiles`
|
||||
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 := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil)
|
||||
newListByResourceGroupPager = &resp
|
||||
c.newListByResourceGroupPager.add(req, newListByResourceGroupPager)
|
||||
server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontainerinstance.ContainerGroupProfilesClientListByResourceGroupResponse, 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) {
|
||||
c.newListByResourceGroupPager.remove(req)
|
||||
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
|
||||
}
|
||||
if !server.PagerResponderMore(newListByResourceGroupPager) {
|
||||
c.newListByResourceGroupPager.remove(req)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ContainerGroupProfilesServerTransport) dispatchPatch(req *http.Request) (*http.Response, error) {
|
||||
if c.srv.Patch == nil {
|
||||
return nil, &nonRetriableError{errors.New("fake for method Patch not implemented")}
|
||||
}
|
||||
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerInstance/containerGroupProfiles/(?P<containerGroupProfileName>[!#&$-;=?-\[\]_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[armcontainerinstance.ContainerGroupProfilePatch](req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
containerGroupProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerGroupProfileName")])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respr, errRespr := c.srv.Patch(req.Context(), resourceGroupNameParam, containerGroupProfileNameParam, 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).ContainerGroupProfile, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
|
@ -19,6 +19,8 @@ import (
|
|||
|
||||
// ServerFactory is a fake server for instances of the armcontainerinstance.ClientFactory type.
|
||||
type ServerFactory struct {
|
||||
ContainerGroupProfileServer ContainerGroupProfileServer
|
||||
ContainerGroupProfilesServer ContainerGroupProfilesServer
|
||||
ContainerGroupsServer ContainerGroupsServer
|
||||
ContainersServer ContainersServer
|
||||
LocationServer LocationServer
|
||||
|
@ -40,6 +42,8 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport {
|
|||
type ServerFactoryTransport struct {
|
||||
srv *ServerFactory
|
||||
trMu sync.Mutex
|
||||
trContainerGroupProfileServer *ContainerGroupProfileServerTransport
|
||||
trContainerGroupProfilesServer *ContainerGroupProfilesServerTransport
|
||||
trContainerGroupsServer *ContainerGroupsServerTransport
|
||||
trContainersServer *ContainersServerTransport
|
||||
trLocationServer *LocationServerTransport
|
||||
|
@ -60,6 +64,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) {
|
|||
var err error
|
||||
|
||||
switch client {
|
||||
case "ContainerGroupProfileClient":
|
||||
initServer(s, &s.trContainerGroupProfileServer, func() *ContainerGroupProfileServerTransport {
|
||||
return NewContainerGroupProfileServerTransport(&s.srv.ContainerGroupProfileServer)
|
||||
})
|
||||
resp, err = s.trContainerGroupProfileServer.Do(req)
|
||||
case "ContainerGroupProfilesClient":
|
||||
initServer(s, &s.trContainerGroupProfilesServer, func() *ContainerGroupProfilesServerTransport {
|
||||
return NewContainerGroupProfilesServerTransport(&s.srv.ContainerGroupProfilesServer)
|
||||
})
|
||||
resp, err = s.trContainerGroupProfilesServer.Do(req)
|
||||
case "ContainerGroupsClient":
|
||||
initServer(s, &s.trContainerGroupsServer, func() *ContainerGroupsServerTransport {
|
||||
return NewContainerGroupsServerTransport(&s.srv.ContainerGroupsServer)
|
||||
|
|
|
@ -19,12 +19,16 @@ import (
|
|||
)
|
||||
|
||||
// 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+)*"*$`)
|
||||
var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`)
|
||||
|
||||
const (
|
||||
utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"`
|
||||
utcDateTime = "2006-01-02T15:04:05.999999999"
|
||||
dateTimeJSON = `"` + time.RFC3339Nano + `"`
|
||||
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
|
||||
|
@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
|
||||
layout := utcDateTimeJSON
|
||||
if tzOffsetRegex.Match(data) {
|
||||
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 {
|
||||
layout := utcDateTime
|
||||
if tzOffsetRegex.Match(data) {
|
||||
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))
|
||||
}
|
||||
|
@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error {
|
|||
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
|
||||
|
@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
|
|||
}
|
||||
|
||||
func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error {
|
||||
if data == nil || strings.EqualFold(string(data), "null") {
|
||||
if data == nil || string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
var aux dateTimeRFC3339
|
||||
|
|
|
@ -28,8 +28,7 @@ type LocationClient struct {
|
|||
}
|
||||
|
||||
// NewLocationClient creates a new instance of LocationClient with the specified values.
|
||||
// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms
|
||||
// part of the URI for every service call.
|
||||
// - 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 NewLocationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationClient, error) {
|
||||
|
@ -46,8 +45,8 @@ func NewLocationClient(subscriptionID string, credential azcore.TokenCredential,
|
|||
|
||||
// NewListCachedImagesPager - Get the list of cached images on specific OS type for a subscription in a region.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - location - The identifier for the physical azure location.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - location - The name of the Azure region.
|
||||
// - options - LocationClientListCachedImagesOptions contains the optional parameters for the LocationClient.NewListCachedImagesPager
|
||||
// method.
|
||||
func (client *LocationClient) NewListCachedImagesPager(location string, options *LocationClientListCachedImagesOptions) *runtime.Pager[LocationClientListCachedImagesResponse] {
|
||||
|
@ -89,7 +88,7 @@ func (client *LocationClient) listCachedImagesCreateRequest(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -106,8 +105,8 @@ func (client *LocationClient) listCachedImagesHandleResponse(resp *http.Response
|
|||
|
||||
// NewListCapabilitiesPager - Get the list of CPU/memory/GPU capabilities of a region.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - location - The identifier for the physical azure location.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - location - The name of the Azure region.
|
||||
// - options - LocationClientListCapabilitiesOptions contains the optional parameters for the LocationClient.NewListCapabilitiesPager
|
||||
// method.
|
||||
func (client *LocationClient) NewListCapabilitiesPager(location string, options *LocationClientListCapabilitiesOptions) *runtime.Pager[LocationClientListCapabilitiesResponse] {
|
||||
|
@ -149,7 +148,7 @@ func (client *LocationClient) listCapabilitiesCreateRequest(ctx context.Context,
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
@ -166,8 +165,8 @@ func (client *LocationClient) listCapabilitiesHandleResponse(resp *http.Response
|
|||
|
||||
// NewListUsagePager - Get the usage for a subscription
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - location - The identifier for the physical azure location.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - location - The name of the Azure region.
|
||||
// - options - LocationClientListUsageOptions contains the optional parameters for the LocationClient.NewListUsagePager method.
|
||||
func (client *LocationClient) NewListUsagePager(location string, options *LocationClientListUsageOptions) *runtime.Pager[LocationClientListUsageResponse] {
|
||||
return runtime.NewPager(runtime.PagingHandler[LocationClientListUsageResponse]{
|
||||
|
@ -209,7 +208,7 @@ func (client *LocationClient) listUsageCreateRequest(ctx context.Context, locati
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
|
||||
)
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/ContainerGroupUsage.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupUsage.json
|
||||
func ExampleLocationClient_NewListUsagePager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -54,7 +54,7 @@ func ExampleLocationClient_NewListUsagePager() {
|
|||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/CachedImagesList.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CachedImagesList.json
|
||||
func ExampleLocationClient_NewListCachedImagesPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
@ -94,7 +94,7 @@ func ExampleLocationClient_NewListCachedImagesPager() {
|
|||
}
|
||||
}
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/CapabilitiesList.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CapabilitiesList.json
|
||||
func ExampleLocationClient_NewListCapabilitiesPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -91,6 +91,12 @@ type ConfidentialComputeProperties struct {
|
|||
CcePolicy *string
|
||||
}
|
||||
|
||||
// ConfigMap - The container config map.
|
||||
type ConfigMap struct {
|
||||
// The key value pairs dictionary in the config map.
|
||||
KeyValuePairs map[string]*string
|
||||
}
|
||||
|
||||
// Container - A container instance.
|
||||
type Container struct {
|
||||
// REQUIRED; The user-provided name of the container instance.
|
||||
|
@ -203,26 +209,53 @@ type ContainerGroupListResult struct {
|
|||
Value []*ContainerGroup
|
||||
}
|
||||
|
||||
// ContainerGroupProperties - The container group properties
|
||||
type ContainerGroupProperties struct {
|
||||
// REQUIRED; The container group properties
|
||||
Properties *ContainerGroupPropertiesProperties
|
||||
// ContainerGroupProfile - A container group profile.
|
||||
type ContainerGroupProfile struct {
|
||||
// REQUIRED; The container group profile properties
|
||||
Properties *ContainerGroupProfilePropertiesProperties
|
||||
|
||||
// The identity of the container group, if configured.
|
||||
Identity *ContainerGroupIdentity
|
||||
// The resource location.
|
||||
Location *string
|
||||
|
||||
// The resource tags.
|
||||
Tags map[string]*string
|
||||
|
||||
// The zones for the container group.
|
||||
Zones []*string
|
||||
|
||||
// READ-ONLY; The resource id.
|
||||
ID *string
|
||||
|
||||
// READ-ONLY; The resource name.
|
||||
Name *string
|
||||
|
||||
// READ-ONLY; The resource type.
|
||||
Type *string
|
||||
}
|
||||
|
||||
// ContainerGroupPropertiesInstanceView - The instance view of the container group. Only valid in response.
|
||||
type ContainerGroupPropertiesInstanceView struct {
|
||||
// READ-ONLY; The events of this container group.
|
||||
Events []*Event
|
||||
// ContainerGroupProfileListResult - The container group profile list response that contains the container group profile properties.
|
||||
type ContainerGroupProfileListResult struct {
|
||||
// The URI to fetch the next page of container group profiles.
|
||||
NextLink *string
|
||||
|
||||
// READ-ONLY; The state of the container group. Only valid in response.
|
||||
State *string
|
||||
// The list of container group profiles.
|
||||
Value []*ContainerGroupProfile
|
||||
}
|
||||
|
||||
// ContainerGroupPropertiesProperties - The container group properties
|
||||
type ContainerGroupPropertiesProperties struct {
|
||||
// ContainerGroupProfilePatch - Properties of container group profile that need to be patched
|
||||
type ContainerGroupProfilePatch struct {
|
||||
// Resource tags.
|
||||
Tags map[string]*string
|
||||
}
|
||||
|
||||
// ContainerGroupProfileProperties - The container group profile properties
|
||||
type ContainerGroupProfileProperties struct {
|
||||
// REQUIRED; The container group profile properties
|
||||
Properties *ContainerGroupProfilePropertiesProperties
|
||||
}
|
||||
|
||||
// ContainerGroupProfilePropertiesProperties - The container group profile properties
|
||||
type ContainerGroupProfilePropertiesProperties struct {
|
||||
// REQUIRED; The containers within the container group.
|
||||
Containers []*Container
|
||||
|
||||
|
@ -232,9 +265,6 @@ type ContainerGroupPropertiesProperties struct {
|
|||
// The properties for confidential container group
|
||||
ConfidentialComputeProperties *ConfidentialComputeProperties
|
||||
|
||||
// The DNS config information for a container group.
|
||||
DNSConfig *DNSConfiguration
|
||||
|
||||
// The diagnostic information for a container group.
|
||||
Diagnostics *ContainerGroupDiagnostics
|
||||
|
||||
|
@ -265,6 +295,91 @@ type ContainerGroupPropertiesProperties struct {
|
|||
// The SKU for a container group.
|
||||
SKU *ContainerGroupSKU
|
||||
|
||||
// The list of volumes that can be mounted by containers in this container group.
|
||||
Volumes []*Volume
|
||||
|
||||
// READ-ONLY; The container group profile current revision number. This only appears in the response.
|
||||
Revision *int32
|
||||
}
|
||||
|
||||
// ContainerGroupProfileReferenceDefinition - The container group profile reference.
|
||||
type ContainerGroupProfileReferenceDefinition struct {
|
||||
// The container group profile reference id.This will be an ARM resource id in the form:
|
||||
// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroupProfiles/{containerGroupProfileName}'.
|
||||
ID *string
|
||||
|
||||
// The container group profile reference revision.
|
||||
Revision *int32
|
||||
}
|
||||
|
||||
// ContainerGroupProperties - The container group properties
|
||||
type ContainerGroupProperties struct {
|
||||
// REQUIRED; The container group properties
|
||||
Properties *ContainerGroupPropertiesProperties
|
||||
|
||||
// The identity of the container group, if configured.
|
||||
Identity *ContainerGroupIdentity
|
||||
}
|
||||
|
||||
// ContainerGroupPropertiesInstanceView - The instance view of the container group. Only valid in response.
|
||||
type ContainerGroupPropertiesInstanceView struct {
|
||||
// READ-ONLY; The events of this container group.
|
||||
Events []*Event
|
||||
|
||||
// READ-ONLY; The state of the container group. Only valid in response.
|
||||
State *string
|
||||
}
|
||||
|
||||
// ContainerGroupPropertiesProperties - The container group properties
|
||||
type ContainerGroupPropertiesProperties struct {
|
||||
// REQUIRED; The containers within the container group.
|
||||
Containers []*Container
|
||||
|
||||
// The properties for confidential container group
|
||||
ConfidentialComputeProperties *ConfidentialComputeProperties
|
||||
|
||||
// The reference container group profile properties.
|
||||
ContainerGroupProfile *ContainerGroupProfileReferenceDefinition
|
||||
|
||||
// The DNS config information for a container group.
|
||||
DNSConfig *DNSConfiguration
|
||||
|
||||
// The diagnostic information for a container group.
|
||||
Diagnostics *ContainerGroupDiagnostics
|
||||
|
||||
// The encryption properties for a container group.
|
||||
EncryptionProperties *EncryptionProperties
|
||||
|
||||
// extensions used by virtual kubelet
|
||||
Extensions []*DeploymentExtensionSpec
|
||||
|
||||
// The IP address type of the container group.
|
||||
IPAddress *IPAddress
|
||||
|
||||
// The image registry credentials by which the container group is created from.
|
||||
ImageRegistryCredentials []*ImageRegistryCredential
|
||||
|
||||
// The init containers for a container group.
|
||||
InitContainers []*InitContainerDefinition
|
||||
|
||||
// The operating system type required by the containers in the container group.
|
||||
OSType *OperatingSystemTypes
|
||||
|
||||
// The priority of the container group.
|
||||
Priority *ContainerGroupPriority
|
||||
|
||||
// Restart policy for all containers within the container group.
|
||||
// * Always Always restart
|
||||
// * OnFailure Restart on failure
|
||||
// * Never Never restart
|
||||
RestartPolicy *ContainerGroupRestartPolicy
|
||||
|
||||
// The SKU for a container group.
|
||||
SKU *ContainerGroupSKU
|
||||
|
||||
// The reference standby pool profile properties.
|
||||
StandbyPoolProfile *StandbyPoolProfileDefinition
|
||||
|
||||
// The subnet resource IDs for a container group.
|
||||
SubnetIDs []*ContainerGroupSubnetID
|
||||
|
||||
|
@ -274,6 +389,9 @@ type ContainerGroupPropertiesProperties struct {
|
|||
// READ-ONLY; The instance view of the container group. Only valid in response.
|
||||
InstanceView *ContainerGroupPropertiesInstanceView
|
||||
|
||||
// READ-ONLY; The flag indicating whether the container group is created by standby pool.
|
||||
IsCreatedFromStandbyPool *bool
|
||||
|
||||
// READ-ONLY; The provisioning state of the container group. This only appears in the response.
|
||||
ProvisioningState *string
|
||||
}
|
||||
|
@ -337,18 +455,18 @@ type ContainerProbe struct {
|
|||
|
||||
// ContainerProperties - The container instance properties.
|
||||
type ContainerProperties struct {
|
||||
// REQUIRED; The name of the image used to create the container instance.
|
||||
Image *string
|
||||
|
||||
// REQUIRED; The resource requirements of the container instance.
|
||||
Resources *ResourceRequirements
|
||||
|
||||
// The commands to execute within the container instance in exec form.
|
||||
Command []*string
|
||||
|
||||
// The config map.
|
||||
ConfigMap *ConfigMap
|
||||
|
||||
// The environment variables to set in the container instance.
|
||||
EnvironmentVariables []*EnvironmentVariable
|
||||
|
||||
// The name of the image used to create the container instance.
|
||||
Image *string
|
||||
|
||||
// The liveness probe.
|
||||
LivenessProbe *ContainerProbe
|
||||
|
||||
|
@ -358,6 +476,9 @@ type ContainerProperties struct {
|
|||
// The readiness probe.
|
||||
ReadinessProbe *ContainerProbe
|
||||
|
||||
// The resource requirements of the container instance.
|
||||
Resources *ResourceRequirements
|
||||
|
||||
// The container security properties.
|
||||
SecurityContext *SecurityContextDefinition
|
||||
|
||||
|
@ -763,6 +884,17 @@ type SecurityContextDefinition struct {
|
|||
SeccompProfile *string
|
||||
}
|
||||
|
||||
// StandbyPoolProfileDefinition - The standby pool profile reference.
|
||||
type StandbyPoolProfileDefinition struct {
|
||||
// The flag to determine whether ACI should fail the create request if the container group can not be obtained from standby
|
||||
// pool.
|
||||
FailContainerGroupCreateOnReuseFailure *bool
|
||||
|
||||
// The standby pool profile reference id.This will be an ARM resource id in the form:
|
||||
// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyPoolName}'.
|
||||
ID *string
|
||||
}
|
||||
|
||||
// Usage - A single usage result
|
||||
type Usage struct {
|
||||
// READ-ONLY; The current usage of the resource
|
||||
|
|
|
@ -256,6 +256,33 @@ func (c *ConfidentialComputeProperties) UnmarshalJSON(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type ConfigMap.
|
||||
func (c ConfigMap) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "keyValuePairs", c.KeyValuePairs)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigMap.
|
||||
func (c *ConfigMap) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "keyValuePairs":
|
||||
err = unpopulate(val, "KeyValuePairs", &c.KeyValuePairs)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type Container.
|
||||
func (c Container) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
|
@ -590,6 +617,252 @@ func (c *ContainerGroupListResult) UnmarshalJSON(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfile.
|
||||
func (c ContainerGroupProfile) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "id", c.ID)
|
||||
populate(objectMap, "location", c.Location)
|
||||
populate(objectMap, "name", c.Name)
|
||||
populate(objectMap, "properties", c.Properties)
|
||||
populate(objectMap, "tags", c.Tags)
|
||||
populate(objectMap, "type", c.Type)
|
||||
populate(objectMap, "zones", c.Zones)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfile.
|
||||
func (c *ContainerGroupProfile) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "id":
|
||||
err = unpopulate(val, "ID", &c.ID)
|
||||
delete(rawMsg, key)
|
||||
case "location":
|
||||
err = unpopulate(val, "Location", &c.Location)
|
||||
delete(rawMsg, key)
|
||||
case "name":
|
||||
err = unpopulate(val, "Name", &c.Name)
|
||||
delete(rawMsg, key)
|
||||
case "properties":
|
||||
err = unpopulate(val, "Properties", &c.Properties)
|
||||
delete(rawMsg, key)
|
||||
case "tags":
|
||||
err = unpopulate(val, "Tags", &c.Tags)
|
||||
delete(rawMsg, key)
|
||||
case "type":
|
||||
err = unpopulate(val, "Type", &c.Type)
|
||||
delete(rawMsg, key)
|
||||
case "zones":
|
||||
err = unpopulate(val, "Zones", &c.Zones)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfileListResult.
|
||||
func (c ContainerGroupProfileListResult) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "nextLink", c.NextLink)
|
||||
populate(objectMap, "value", c.Value)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfileListResult.
|
||||
func (c *ContainerGroupProfileListResult) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "nextLink":
|
||||
err = unpopulate(val, "NextLink", &c.NextLink)
|
||||
delete(rawMsg, key)
|
||||
case "value":
|
||||
err = unpopulate(val, "Value", &c.Value)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfilePatch.
|
||||
func (c ContainerGroupProfilePatch) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "tags", c.Tags)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfilePatch.
|
||||
func (c *ContainerGroupProfilePatch) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "tags":
|
||||
err = unpopulate(val, "Tags", &c.Tags)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfileProperties.
|
||||
func (c ContainerGroupProfileProperties) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "properties", c.Properties)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfileProperties.
|
||||
func (c *ContainerGroupProfileProperties) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "properties":
|
||||
err = unpopulate(val, "Properties", &c.Properties)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfilePropertiesProperties.
|
||||
func (c ContainerGroupProfilePropertiesProperties) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "confidentialComputeProperties", c.ConfidentialComputeProperties)
|
||||
populate(objectMap, "containers", c.Containers)
|
||||
populate(objectMap, "diagnostics", c.Diagnostics)
|
||||
populate(objectMap, "encryptionProperties", c.EncryptionProperties)
|
||||
populate(objectMap, "extensions", c.Extensions)
|
||||
populate(objectMap, "ipAddress", c.IPAddress)
|
||||
populate(objectMap, "imageRegistryCredentials", c.ImageRegistryCredentials)
|
||||
populate(objectMap, "initContainers", c.InitContainers)
|
||||
populate(objectMap, "osType", c.OSType)
|
||||
populate(objectMap, "priority", c.Priority)
|
||||
populate(objectMap, "restartPolicy", c.RestartPolicy)
|
||||
populate(objectMap, "revision", c.Revision)
|
||||
populate(objectMap, "sku", c.SKU)
|
||||
populate(objectMap, "volumes", c.Volumes)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfilePropertiesProperties.
|
||||
func (c *ContainerGroupProfilePropertiesProperties) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "confidentialComputeProperties":
|
||||
err = unpopulate(val, "ConfidentialComputeProperties", &c.ConfidentialComputeProperties)
|
||||
delete(rawMsg, key)
|
||||
case "containers":
|
||||
err = unpopulate(val, "Containers", &c.Containers)
|
||||
delete(rawMsg, key)
|
||||
case "diagnostics":
|
||||
err = unpopulate(val, "Diagnostics", &c.Diagnostics)
|
||||
delete(rawMsg, key)
|
||||
case "encryptionProperties":
|
||||
err = unpopulate(val, "EncryptionProperties", &c.EncryptionProperties)
|
||||
delete(rawMsg, key)
|
||||
case "extensions":
|
||||
err = unpopulate(val, "Extensions", &c.Extensions)
|
||||
delete(rawMsg, key)
|
||||
case "ipAddress":
|
||||
err = unpopulate(val, "IPAddress", &c.IPAddress)
|
||||
delete(rawMsg, key)
|
||||
case "imageRegistryCredentials":
|
||||
err = unpopulate(val, "ImageRegistryCredentials", &c.ImageRegistryCredentials)
|
||||
delete(rawMsg, key)
|
||||
case "initContainers":
|
||||
err = unpopulate(val, "InitContainers", &c.InitContainers)
|
||||
delete(rawMsg, key)
|
||||
case "osType":
|
||||
err = unpopulate(val, "OSType", &c.OSType)
|
||||
delete(rawMsg, key)
|
||||
case "priority":
|
||||
err = unpopulate(val, "Priority", &c.Priority)
|
||||
delete(rawMsg, key)
|
||||
case "restartPolicy":
|
||||
err = unpopulate(val, "RestartPolicy", &c.RestartPolicy)
|
||||
delete(rawMsg, key)
|
||||
case "revision":
|
||||
err = unpopulate(val, "Revision", &c.Revision)
|
||||
delete(rawMsg, key)
|
||||
case "sku":
|
||||
err = unpopulate(val, "SKU", &c.SKU)
|
||||
delete(rawMsg, key)
|
||||
case "volumes":
|
||||
err = unpopulate(val, "Volumes", &c.Volumes)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProfileReferenceDefinition.
|
||||
func (c ContainerGroupProfileReferenceDefinition) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "id", c.ID)
|
||||
populate(objectMap, "revision", c.Revision)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerGroupProfileReferenceDefinition.
|
||||
func (c *ContainerGroupProfileReferenceDefinition) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "id":
|
||||
err = unpopulate(val, "ID", &c.ID)
|
||||
delete(rawMsg, key)
|
||||
case "revision":
|
||||
err = unpopulate(val, "Revision", &c.Revision)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", c, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type ContainerGroupProperties.
|
||||
func (c ContainerGroupProperties) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
|
@ -656,6 +929,7 @@ func (c *ContainerGroupPropertiesInstanceView) UnmarshalJSON(data []byte) error
|
|||
func (c ContainerGroupPropertiesProperties) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "confidentialComputeProperties", c.ConfidentialComputeProperties)
|
||||
populate(objectMap, "containerGroupProfile", c.ContainerGroupProfile)
|
||||
populate(objectMap, "containers", c.Containers)
|
||||
populate(objectMap, "dnsConfig", c.DNSConfig)
|
||||
populate(objectMap, "diagnostics", c.Diagnostics)
|
||||
|
@ -665,11 +939,13 @@ func (c ContainerGroupPropertiesProperties) MarshalJSON() ([]byte, error) {
|
|||
populate(objectMap, "imageRegistryCredentials", c.ImageRegistryCredentials)
|
||||
populate(objectMap, "initContainers", c.InitContainers)
|
||||
populate(objectMap, "instanceView", c.InstanceView)
|
||||
populate(objectMap, "isCreatedFromStandbyPool", c.IsCreatedFromStandbyPool)
|
||||
populate(objectMap, "osType", c.OSType)
|
||||
populate(objectMap, "priority", c.Priority)
|
||||
populate(objectMap, "provisioningState", c.ProvisioningState)
|
||||
populate(objectMap, "restartPolicy", c.RestartPolicy)
|
||||
populate(objectMap, "sku", c.SKU)
|
||||
populate(objectMap, "standbyPoolProfile", c.StandbyPoolProfile)
|
||||
populate(objectMap, "subnetIds", c.SubnetIDs)
|
||||
populate(objectMap, "volumes", c.Volumes)
|
||||
return json.Marshal(objectMap)
|
||||
|
@ -687,6 +963,9 @@ func (c *ContainerGroupPropertiesProperties) UnmarshalJSON(data []byte) error {
|
|||
case "confidentialComputeProperties":
|
||||
err = unpopulate(val, "ConfidentialComputeProperties", &c.ConfidentialComputeProperties)
|
||||
delete(rawMsg, key)
|
||||
case "containerGroupProfile":
|
||||
err = unpopulate(val, "ContainerGroupProfile", &c.ContainerGroupProfile)
|
||||
delete(rawMsg, key)
|
||||
case "containers":
|
||||
err = unpopulate(val, "Containers", &c.Containers)
|
||||
delete(rawMsg, key)
|
||||
|
@ -714,6 +993,9 @@ func (c *ContainerGroupPropertiesProperties) UnmarshalJSON(data []byte) error {
|
|||
case "instanceView":
|
||||
err = unpopulate(val, "InstanceView", &c.InstanceView)
|
||||
delete(rawMsg, key)
|
||||
case "isCreatedFromStandbyPool":
|
||||
err = unpopulate(val, "IsCreatedFromStandbyPool", &c.IsCreatedFromStandbyPool)
|
||||
delete(rawMsg, key)
|
||||
case "osType":
|
||||
err = unpopulate(val, "OSType", &c.OSType)
|
||||
delete(rawMsg, key)
|
||||
|
@ -729,6 +1011,9 @@ func (c *ContainerGroupPropertiesProperties) UnmarshalJSON(data []byte) error {
|
|||
case "sku":
|
||||
err = unpopulate(val, "SKU", &c.SKU)
|
||||
delete(rawMsg, key)
|
||||
case "standbyPoolProfile":
|
||||
err = unpopulate(val, "StandbyPoolProfile", &c.StandbyPoolProfile)
|
||||
delete(rawMsg, key)
|
||||
case "subnetIds":
|
||||
err = unpopulate(val, "SubnetIDs", &c.SubnetIDs)
|
||||
delete(rawMsg, key)
|
||||
|
@ -899,6 +1184,7 @@ func (c *ContainerProbe) UnmarshalJSON(data []byte) error {
|
|||
func (c ContainerProperties) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "command", c.Command)
|
||||
populate(objectMap, "configMap", c.ConfigMap)
|
||||
populate(objectMap, "environmentVariables", c.EnvironmentVariables)
|
||||
populate(objectMap, "image", c.Image)
|
||||
populate(objectMap, "instanceView", c.InstanceView)
|
||||
|
@ -923,6 +1209,9 @@ func (c *ContainerProperties) UnmarshalJSON(data []byte) error {
|
|||
case "command":
|
||||
err = unpopulate(val, "Command", &c.Command)
|
||||
delete(rawMsg, key)
|
||||
case "configMap":
|
||||
err = unpopulate(val, "ConfigMap", &c.ConfigMap)
|
||||
delete(rawMsg, key)
|
||||
case "environmentVariables":
|
||||
err = unpopulate(val, "EnvironmentVariables", &c.EnvironmentVariables)
|
||||
delete(rawMsg, key)
|
||||
|
@ -2006,6 +2295,37 @@ func (s *SecurityContextDefinition) UnmarshalJSON(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type StandbyPoolProfileDefinition.
|
||||
func (s StandbyPoolProfileDefinition) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
populate(objectMap, "failContainerGroupCreateOnReuseFailure", s.FailContainerGroupCreateOnReuseFailure)
|
||||
populate(objectMap, "id", s.ID)
|
||||
return json.Marshal(objectMap)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements the json.Unmarshaller interface for type StandbyPoolProfileDefinition.
|
||||
func (s *StandbyPoolProfileDefinition) UnmarshalJSON(data []byte) error {
|
||||
var rawMsg map[string]json.RawMessage
|
||||
if err := json.Unmarshal(data, &rawMsg); err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
||||
}
|
||||
for key, val := range rawMsg {
|
||||
var err error
|
||||
switch key {
|
||||
case "failContainerGroupCreateOnReuseFailure":
|
||||
err = unpopulate(val, "FailContainerGroupCreateOnReuseFailure", &s.FailContainerGroupCreateOnReuseFailure)
|
||||
delete(rawMsg, key)
|
||||
case "id":
|
||||
err = unpopulate(val, "ID", &s.ID)
|
||||
delete(rawMsg, key)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshalling type %T: %v", s, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements the json.Marshaller interface for type Usage.
|
||||
func (u Usage) MarshalJSON() ([]byte, error) {
|
||||
objectMap := make(map[string]any)
|
||||
|
@ -2237,7 +2557,7 @@ func populateAny(m map[string]any, k string, v any) {
|
|||
}
|
||||
|
||||
func unpopulate(data json.RawMessage, fn string, v any) error {
|
||||
if data == nil {
|
||||
if data == nil || string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
if err := json.Unmarshal(data, v); err != nil {
|
||||
|
|
|
@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO
|
|||
|
||||
// NewListPager - List the operations for Azure Container Instance service.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - 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]{
|
||||
|
@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options *
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
|
||||
)
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/OperationsList.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/OperationsList.json
|
||||
func ExampleOperationsClient_NewListPager() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -8,6 +8,52 @@
|
|||
|
||||
package armcontainerinstance
|
||||
|
||||
// ContainerGroupProfileClientGetByRevisionNumberOptions contains the optional parameters for the ContainerGroupProfileClient.GetByRevisionNumber
|
||||
// method.
|
||||
type ContainerGroupProfileClientGetByRevisionNumberOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ContainerGroupProfileClientListAllRevisionsOptions contains the optional parameters for the ContainerGroupProfileClient.NewListAllRevisionsPager
|
||||
// method.
|
||||
type ContainerGroupProfileClientListAllRevisionsOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientCreateOrUpdateOptions contains the optional parameters for the ContainerGroupProfilesClient.CreateOrUpdate
|
||||
// method.
|
||||
type ContainerGroupProfilesClientCreateOrUpdateOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientDeleteOptions contains the optional parameters for the ContainerGroupProfilesClient.Delete
|
||||
// method.
|
||||
type ContainerGroupProfilesClientDeleteOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientGetOptions contains the optional parameters for the ContainerGroupProfilesClient.Get method.
|
||||
type ContainerGroupProfilesClientGetOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientListByResourceGroupOptions contains the optional parameters for the ContainerGroupProfilesClient.NewListByResourceGroupPager
|
||||
// method.
|
||||
type ContainerGroupProfilesClientListByResourceGroupOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientListOptions contains the optional parameters for the ContainerGroupProfilesClient.NewListPager
|
||||
// method.
|
||||
type ContainerGroupProfilesClientListOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientPatchOptions contains the optional parameters for the ContainerGroupProfilesClient.Patch method.
|
||||
type ContainerGroupProfilesClientPatchOptions struct {
|
||||
// placeholder for future optional parameters
|
||||
}
|
||||
|
||||
// ContainerGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainerGroupsClient.BeginCreateOrUpdate
|
||||
// method.
|
||||
type ContainerGroupsClientBeginCreateOrUpdateOptions struct {
|
||||
|
|
|
@ -8,6 +8,53 @@
|
|||
|
||||
package armcontainerinstance
|
||||
|
||||
// ContainerGroupProfileClientGetByRevisionNumberResponse contains the response from method ContainerGroupProfileClient.GetByRevisionNumber.
|
||||
type ContainerGroupProfileClientGetByRevisionNumberResponse struct {
|
||||
// A container group profile.
|
||||
ContainerGroupProfile
|
||||
}
|
||||
|
||||
// ContainerGroupProfileClientListAllRevisionsResponse contains the response from method ContainerGroupProfileClient.NewListAllRevisionsPager.
|
||||
type ContainerGroupProfileClientListAllRevisionsResponse struct {
|
||||
// The container group profile list response that contains the container group profile properties.
|
||||
ContainerGroupProfileListResult
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientCreateOrUpdateResponse contains the response from method ContainerGroupProfilesClient.CreateOrUpdate.
|
||||
type ContainerGroupProfilesClientCreateOrUpdateResponse struct {
|
||||
// A container group profile.
|
||||
ContainerGroupProfile
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientDeleteResponse contains the response from method ContainerGroupProfilesClient.Delete.
|
||||
type ContainerGroupProfilesClientDeleteResponse struct {
|
||||
// placeholder for future response values
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientGetResponse contains the response from method ContainerGroupProfilesClient.Get.
|
||||
type ContainerGroupProfilesClientGetResponse struct {
|
||||
// A container group profile.
|
||||
ContainerGroupProfile
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientListByResourceGroupResponse contains the response from method ContainerGroupProfilesClient.NewListByResourceGroupPager.
|
||||
type ContainerGroupProfilesClientListByResourceGroupResponse struct {
|
||||
// The container group profile list response that contains the container group profile properties.
|
||||
ContainerGroupProfileListResult
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientListResponse contains the response from method ContainerGroupProfilesClient.NewListPager.
|
||||
type ContainerGroupProfilesClientListResponse struct {
|
||||
// The container group profile list response that contains the container group profile properties.
|
||||
ContainerGroupProfileListResult
|
||||
}
|
||||
|
||||
// ContainerGroupProfilesClientPatchResponse contains the response from method ContainerGroupProfilesClient.Patch.
|
||||
type ContainerGroupProfilesClientPatchResponse struct {
|
||||
// A container group profile.
|
||||
ContainerGroupProfile
|
||||
}
|
||||
|
||||
// ContainerGroupsClientCreateOrUpdateResponse contains the response from method ContainerGroupsClient.BeginCreateOrUpdate.
|
||||
type ContainerGroupsClientCreateOrUpdateResponse struct {
|
||||
// A container group.
|
|
@ -28,8 +28,7 @@ type SubnetServiceAssociationLinkClient struct {
|
|||
}
|
||||
|
||||
// NewSubnetServiceAssociationLinkClient creates a new instance of SubnetServiceAssociationLinkClient with the specified values.
|
||||
// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms
|
||||
// part of the URI for every service call.
|
||||
// - 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 NewSubnetServiceAssociationLinkClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubnetServiceAssociationLinkClient, error) {
|
||||
|
@ -48,8 +47,8 @@ func NewSubnetServiceAssociationLinkClient(subscriptionID string, credential azc
|
|||
// by the user.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// - resourceGroupName - The name of the resource group.
|
||||
// Generated from API version 2024-05-01-preview
|
||||
// - resourceGroupName - The name of the resource group. The name is case insensitive.
|
||||
// - virtualNetworkName - The name of the virtual network.
|
||||
// - subnetName - The name of the subnet.
|
||||
// - options - SubnetServiceAssociationLinkClientBeginDeleteOptions contains the optional parameters for the SubnetServiceAssociationLinkClient.BeginDelete
|
||||
|
@ -75,7 +74,7 @@ func (client *SubnetServiceAssociationLinkClient) BeginDelete(ctx context.Contex
|
|||
// by the user.
|
||||
// If the operation fails it returns an *azcore.ResponseError type.
|
||||
//
|
||||
// Generated from API version 2023-05-01
|
||||
// Generated from API version 2024-05-01-preview
|
||||
func (client *SubnetServiceAssociationLinkClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, options *SubnetServiceAssociationLinkClientBeginDeleteOptions) (*http.Response, error) {
|
||||
var err error
|
||||
const operationName = "SubnetServiceAssociationLinkClient.BeginDelete"
|
||||
|
@ -121,7 +120,7 @@ func (client *SubnetServiceAssociationLinkClient) deleteCreateRequest(ctx contex
|
|||
return nil, err
|
||||
}
|
||||
reqQP := req.Raw().URL.Query()
|
||||
reqQP.Set("api-version", "2023-05-01")
|
||||
reqQP.Set("api-version", "2024-05-01-preview")
|
||||
req.Raw().URL.RawQuery = reqQP.Encode()
|
||||
req.Raw().Header["Accept"] = []string{"application/json"}
|
||||
return req, nil
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerinstance/armcontainerinstance/v2"
|
||||
)
|
||||
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e60df62e9e0d88462e6abba81a76d94eab000f0d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2023-05-01/examples/SubnetServiceAssociationLinkDelete.json
|
||||
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/366aaa13cdd218b9adac716680e49473673410c8/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/SubnetServiceAssociationLinkDelete.json
|
||||
func ExampleSubnetServiceAssociationLinkClient_BeginDelete() {
|
||||
cred, err := azidentity.NewDefaultAzureCredential(nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -19,12 +19,16 @@ import (
|
|||
)
|
||||
|
||||
// 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+)*"*$`)
|
||||
var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`)
|
||||
|
||||
const (
|
||||
utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"`
|
||||
utcDateTime = "2006-01-02T15:04:05.999999999"
|
||||
dateTimeJSON = `"` + time.RFC3339Nano + `"`
|
||||
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
|
||||
|
@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
|
||||
layout := utcDateTimeJSON
|
||||
if tzOffsetRegex.Match(data) {
|
||||
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 {
|
||||
layout := utcDateTime
|
||||
if tzOffsetRegex.Match(data) {
|
||||
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))
|
||||
}
|
||||
|
@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error {
|
|||
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
|
||||
|
@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
|
|||
}
|
||||
|
||||
func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error {
|
||||
if data == nil || strings.EqualFold(string(data), "null") {
|
||||
if data == nil || string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
var aux dateTimeRFC3339
|
||||
|
|
Загрузка…
Ссылка в новой задаче