diff --git a/sdk/resourcemanager/msi/armmsi/CHANGELOG.md b/sdk/resourcemanager/msi/armmsi/CHANGELOG.md index 8111e2b5bdf2..00982eba9674 100644 --- a/sdk/resourcemanager/msi/armmsi/CHANGELOG.md +++ b/sdk/resourcemanager/msi/armmsi/CHANGELOG.md @@ -1,5 +1,23 @@ # Release History +## 1.0.0 (2023-02-24) +### Breaking Changes + +- Function `*UserAssignedIdentitiesClient.NewListAssociatedResourcesPager` has been removed + +### Features Added + +- New type alias `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New function `timeRFC3339.MarshalText() ([]byte, error)` +- New function `*timeRFC3339.Parse(string) error` +- New function `*timeRFC3339.UnmarshalText([]byte) error` +- New struct `SystemData` +- New field `SystemData` in struct `FederatedIdentityCredential` +- New field `SystemData` in struct `Identity` +- New field `SystemData` in struct `IdentityUpdate` +- New field `SystemData` in struct `SystemAssignedIdentity` + + ## 0.7.0 (2022-06-27) ### Features Added diff --git a/sdk/resourcemanager/msi/armmsi/autorest.md b/sdk/resourcemanager/msi/armmsi/autorest.md index c86cf2a6a232..9a46816003cc 100644 --- a/sdk/resourcemanager/msi/armmsi/autorest.md +++ b/sdk/resourcemanager/msi/armmsi/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/182d92fc16cc51247ffd4e863dee28c77c6484d2/specification/msi/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/182d92fc16cc51247ffd4e863dee28c77c6484d2/specification/msi/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.7.0 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/msi/armmsi/build.go b/sdk/resourcemanager/msi/armmsi/build.go index 7cd9c6f56585..e0f6bb372fa8 100644 --- a/sdk/resourcemanager/msi/armmsi/build.go +++ b/sdk/resourcemanager/msi/armmsi/build.go @@ -2,6 +2,6 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/msi/armmsi +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/msi/armmsi package armmsi diff --git a/sdk/resourcemanager/msi/armmsi/constants.go b/sdk/resourcemanager/msi/armmsi/constants.go index 8488c3a310a1..18b59eb71338 100644 --- a/sdk/resourcemanager/msi/armmsi/constants.go +++ b/sdk/resourcemanager/msi/armmsi/constants.go @@ -11,5 +11,25 @@ package armmsi const ( moduleName = "armmsi" - moduleVersion = "v0.7.0" + moduleVersion = "v1.0.0" ) + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} diff --git a/sdk/resourcemanager/msi/armmsi/federatedidentitycredentials_client.go b/sdk/resourcemanager/msi/armmsi/federatedidentitycredentials_client.go index fee93e1621ad..119c68eb981b 100644 --- a/sdk/resourcemanager/msi/armmsi/federatedidentitycredentials_client.go +++ b/sdk/resourcemanager/msi/armmsi/federatedidentitycredentials_client.go @@ -33,9 +33,9 @@ type FederatedIdentityCredentialsClient struct { } // NewFederatedIdentityCredentialsClient creates a new instance of FederatedIdentityCredentialsClient with the specified values. -// subscriptionID - The Id of the Subscription to which the identity belongs. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The Id of the Subscription to which the identity belongs. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewFederatedIdentityCredentialsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FederatedIdentityCredentialsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,13 +58,14 @@ func NewFederatedIdentityCredentialsClient(subscriptionID string, credential azc // CreateOrUpdate - Create or update a federated identity credential under the specified user assigned identity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// federatedIdentityCredentialResourceName - The name of the federated identity credential resource. -// parameters - Parameters to create or update the federated identity credential. -// options - FederatedIdentityCredentialsClientCreateOrUpdateOptions contains the optional parameters for the FederatedIdentityCredentialsClient.CreateOrUpdate -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the identity resource. +// - federatedIdentityCredentialResourceName - The name of the federated identity credential resource. +// - parameters - Parameters to create or update the federated identity credential. +// - options - FederatedIdentityCredentialsClientCreateOrUpdateOptions contains the optional parameters for the FederatedIdentityCredentialsClient.CreateOrUpdate +// method. func (client *FederatedIdentityCredentialsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, federatedIdentityCredentialResourceName string, parameters FederatedIdentityCredential, options *FederatedIdentityCredentialsClientCreateOrUpdateOptions) (FederatedIdentityCredentialsClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, federatedIdentityCredentialResourceName, parameters, options) if err != nil { @@ -104,7 +105,7 @@ func (client *FederatedIdentityCredentialsClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -121,12 +122,13 @@ func (client *FederatedIdentityCredentialsClient) createOrUpdateHandleResponse(r // Delete - Deletes the federated identity credential. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// federatedIdentityCredentialResourceName - The name of the federated identity credential resource. -// options - FederatedIdentityCredentialsClientDeleteOptions contains the optional parameters for the FederatedIdentityCredentialsClient.Delete -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the identity resource. +// - federatedIdentityCredentialResourceName - The name of the federated identity credential resource. +// - options - FederatedIdentityCredentialsClientDeleteOptions contains the optional parameters for the FederatedIdentityCredentialsClient.Delete +// method. func (client *FederatedIdentityCredentialsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, federatedIdentityCredentialResourceName string, options *FederatedIdentityCredentialsClientDeleteOptions) (FederatedIdentityCredentialsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, federatedIdentityCredentialResourceName, options) if err != nil { @@ -166,7 +168,7 @@ func (client *FederatedIdentityCredentialsClient) deleteCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,12 +176,13 @@ func (client *FederatedIdentityCredentialsClient) deleteCreateRequest(ctx contex // Get - Gets the federated identity credential. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// federatedIdentityCredentialResourceName - The name of the federated identity credential resource. -// options - FederatedIdentityCredentialsClientGetOptions contains the optional parameters for the FederatedIdentityCredentialsClient.Get -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the identity resource. +// - federatedIdentityCredentialResourceName - The name of the federated identity credential resource. +// - options - FederatedIdentityCredentialsClientGetOptions contains the optional parameters for the FederatedIdentityCredentialsClient.Get +// method. func (client *FederatedIdentityCredentialsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, federatedIdentityCredentialResourceName string, options *FederatedIdentityCredentialsClientGetOptions) (FederatedIdentityCredentialsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, federatedIdentityCredentialResourceName, options) if err != nil { @@ -219,7 +222,7 @@ func (client *FederatedIdentityCredentialsClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,12 +238,12 @@ func (client *FederatedIdentityCredentialsClient) getHandleResponse(resp *http.R } // NewListPager - Lists all the federated identity credentials under the specified user assigned identity. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// options - FederatedIdentityCredentialsClientListOptions contains the optional parameters for the FederatedIdentityCredentialsClient.List -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the identity resource. +// - options - FederatedIdentityCredentialsClientListOptions contains the optional parameters for the FederatedIdentityCredentialsClient.NewListPager +// method. func (client *FederatedIdentityCredentialsClient) NewListPager(resourceGroupName string, resourceName string, options *FederatedIdentityCredentialsClientListOptions) *runtime.Pager[FederatedIdentityCredentialsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[FederatedIdentityCredentialsClientListResponse]{ More: func(page FederatedIdentityCredentialsClientListResponse) bool { @@ -295,7 +298,7 @@ func (client *FederatedIdentityCredentialsClient) listCreateRequest(ctx context. if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/msi/armmsi/federatedidentitycredentials_client_example_test.go b/sdk/resourcemanager/msi/armmsi/federatedidentitycredentials_client_example_test.go index 0f990709e186..7f201af08586 100644 --- a/sdk/resourcemanager/msi/armmsi/federatedidentitycredentials_client_example_test.go +++ b/sdk/resourcemanager/msi/armmsi/federatedidentitycredentials_client_example_test.go @@ -5,6 +5,7 @@ // 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 armmsi_test @@ -17,104 +18,128 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/FederatedIdentityCredentialList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialList.json func ExampleFederatedIdentityCredentialsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armmsi.NewFederatedIdentityCredentialsClient("subid", cred, nil) + client, err := armmsi.NewFederatedIdentityCredentialsClient("c267c0e7-0a73-4789-9e17-d26aeb0904e5", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListPager("rgName", - "resourceName", - &armmsi.FederatedIdentityCredentialsClientListOptions{Top: nil, - Skiptoken: nil, - }) + pager := client.NewListPager("rgName", "resourceName", &armmsi.FederatedIdentityCredentialsClientListOptions{Top: nil, + Skiptoken: nil, + }) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.FederatedIdentityCredentialsListResult = armmsi.FederatedIdentityCredentialsListResult{ + // Value: []*armmsi.FederatedIdentityCredential{ + // { + // Name: to.Ptr("ficResourceName"), + // Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials"), + // ID: to.Ptr("/subscriptions/c267c0e7-0a73-4789-9e17-d26aeb0904e5/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName/federatedIdentityCredentials/ficResourceName"), + // Properties: &armmsi.FederatedIdentityCredentialProperties{ + // Audiences: []*string{ + // to.Ptr("api://AzureADTokenExchange")}, + // Issuer: to.Ptr("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID"), + // Subject: to.Ptr("system:serviceaccount:ns:svcaccount"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/FederatedIdentityCredentialCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialCreate.json func ExampleFederatedIdentityCredentialsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armmsi.NewFederatedIdentityCredentialsClient("subid", cred, nil) + client, err := armmsi.NewFederatedIdentityCredentialsClient("c267c0e7-0a73-4789-9e17-d26aeb0904e5", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "rgName", - "resourceName", - "ficResourceName", - armmsi.FederatedIdentityCredential{ - Properties: &armmsi.FederatedIdentityCredentialProperties{ - Audiences: []*string{ - to.Ptr("api://AzureADTokenExchange")}, - Issuer: to.Ptr("https://oidc.prod-aks.azure.com/IssuerGUID"), - Subject: to.Ptr("system:serviceaccount:ns:svcaccount"), - }, + res, err := client.CreateOrUpdate(ctx, "rgName", "resourceName", "ficResourceName", armmsi.FederatedIdentityCredential{ + Properties: &armmsi.FederatedIdentityCredentialProperties{ + Audiences: []*string{ + to.Ptr("api://AzureADTokenExchange")}, + Issuer: to.Ptr("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID"), + Subject: to.Ptr("system:serviceaccount:ns:svcaccount"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // 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.FederatedIdentityCredential = armmsi.FederatedIdentityCredential{ + // Name: to.Ptr("ficResourceName"), + // Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials"), + // ID: to.Ptr("/subscriptions/c267c0e7-0a73-4789-9e17-d26aeb0904e5/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName/federatedIdentityCredentials/ficResourceName"), + // Properties: &armmsi.FederatedIdentityCredentialProperties{ + // Audiences: []*string{ + // to.Ptr("api://AzureADTokenExchange")}, + // Issuer: to.Ptr("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID"), + // Subject: to.Ptr("system:serviceaccount:ns:svcaccount"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/FederatedIdentityCredentialGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialGet.json func ExampleFederatedIdentityCredentialsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armmsi.NewFederatedIdentityCredentialsClient("subid", cred, nil) + client, err := armmsi.NewFederatedIdentityCredentialsClient("c267c0e7-0a73-4789-9e17-d26aeb0904e5", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "rgName", - "resourceName", - "ficResourceName", - nil) + res, err := client.Get(ctx, "rgName", "resourceName", "ficResourceName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // 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.FederatedIdentityCredential = armmsi.FederatedIdentityCredential{ + // Name: to.Ptr("ficResourceName"), + // Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials"), + // ID: to.Ptr("/subscriptions/c267c0e7-0a73-4789-9e17-d26aeb0904e5/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName/federatedIdentityCredentials/ficResourceName"), + // Properties: &armmsi.FederatedIdentityCredentialProperties{ + // Audiences: []*string{ + // to.Ptr("api://AzureADTokenExchange")}, + // Issuer: to.Ptr("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID"), + // Subject: to.Ptr("system:serviceaccount:ns:svcaccount"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/FederatedIdentityCredentialDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialDelete.json func ExampleFederatedIdentityCredentialsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - client, err := armmsi.NewFederatedIdentityCredentialsClient("subid", cred, nil) + client, err := armmsi.NewFederatedIdentityCredentialsClient("c267c0e7-0a73-4789-9e17-d26aeb0904e5", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "rgName", - "resourceName", - "ficResourceName", - nil) + _, err = client.Delete(ctx, "rgName", "resourceName", "ficResourceName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/msi/armmsi/go.mod b/sdk/resourcemanager/msi/armmsi/go.mod index 8175419a3ec7..2ebcfd6ee16d 100644 --- a/sdk/resourcemanager/msi/armmsi/go.mod +++ b/sdk/resourcemanager/msi/armmsi/go.mod @@ -4,13 +4,13 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1 ) require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1 // indirect + github.com/golang-jwt/jwt/v4 v4.4.2 // indirect github.com/google/uuid v1.1.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect diff --git a/sdk/resourcemanager/msi/armmsi/go.sum b/sdk/resourcemanager/msi/armmsi/go.sum index 8828b17b1853..67cfef6bdf6e 100644 --- a/sdk/resourcemanager/msi/armmsi/go.sum +++ b/sdk/resourcemanager/msi/armmsi/go.sum @@ -1,21 +1,19 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1 h1:T8quHYlUGyb/oqtSTwqlCr1ilJHrDv+ZtpSfo+hm1BU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1/go.mod h1:gLa1CL2RNE4s7M3yopJ/p0iq5DdY6Yv5ZUt9MTRZOQM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1 h1:oPdPEZFSbl7oSPEAIPMPBMUmiL+mqgzBJwM/9qYcwNg= +github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1/go.mod h1:4qFor3D/HDsvBME35Xy9rwW9DecL+M2sNw1ybjPtwA0= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= +github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= +github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -24,7 +22,6 @@ golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4Wwu golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= diff --git a/sdk/resourcemanager/msi/armmsi/models.go b/sdk/resourcemanager/msi/armmsi/models.go index f16947711a94..191bd843b4cf 100644 --- a/sdk/resourcemanager/msi/armmsi/models.go +++ b/sdk/resourcemanager/msi/armmsi/models.go @@ -9,71 +9,22 @@ package armmsi -// AssociatedResourcesListResult - Azure resources returned by the resource action to get a list of assigned resources. -type AssociatedResourcesListResult struct { - // READ-ONLY; The url to get the next page of results, if any. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; Total number of Azure resources assigned to the identity. - TotalCount *float32 `json:"totalCount,omitempty" azure:"ro"` - - // READ-ONLY; The collection of Azure resources returned by the resource action to get a list of assigned resources. - Value []*AzureResource `json:"value,omitempty" azure:"ro"` -} - -// AzureResource - Describes an Azure resource that is attached to an identity. -type AzureResource struct { - // READ-ONLY; The ID of this resource. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of this resource. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource group this resource belongs to. - ResourceGroup *string `json:"resourceGroup,omitempty" azure:"ro"` - - // READ-ONLY; The name of the subscription this resource belongs to. - SubscriptionDisplayName *string `json:"subscriptionDisplayName,omitempty" azure:"ro"` - - // READ-ONLY; The ID of the subscription this resource belongs to. - SubscriptionID *string `json:"subscriptionId,omitempty" azure:"ro"` - - // READ-ONLY; The type of this resource. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// CloudError - An error response from the ManagedServiceIdentity service. -type CloudError struct { - // A list of additional details about the error. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from the ManagedServiceIdentity service. -type CloudErrorBody struct { - // An identifier for the error. - Code *string `json:"code,omitempty"` - - // A list of additional details about the error. - Details []*CloudErrorBody `json:"details,omitempty"` - - // A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - - // The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` -} +import "time" // FederatedIdentityCredential - Describes a federated identity credential. type FederatedIdentityCredential struct { // The properties associated with the federated identity credential. Properties *FederatedIdentityCredentialProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -108,7 +59,7 @@ type FederatedIdentityCredentialsClientGetOptions struct { // placeholder for future optional parameters } -// FederatedIdentityCredentialsClientListOptions contains the optional parameters for the FederatedIdentityCredentialsClient.List +// FederatedIdentityCredentialsClientListOptions contains the optional parameters for the FederatedIdentityCredentialsClient.NewListPager // method. type FederatedIdentityCredentialsClientListOptions struct { // A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains @@ -136,7 +87,7 @@ type Identity struct { // Resource tags. Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -145,6 +96,9 @@ type Identity struct { // READ-ONLY; The properties associated with the identity. Properties *UserAssignedIdentityProperties `json:"properties,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -157,7 +111,7 @@ type IdentityUpdate struct { // Resource tags Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -166,6 +120,9 @@ type IdentityUpdate struct { // READ-ONLY; The properties associated with the identity. Properties *UserAssignedIdentityProperties `json:"properties,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -203,36 +160,11 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - // SystemAssignedIdentitiesClientGetByScopeOptions contains the optional parameters for the SystemAssignedIdentitiesClient.GetByScope // method. type SystemAssignedIdentitiesClientGetByScopeOptions struct { @@ -247,7 +179,7 @@ type SystemAssignedIdentity struct { // Resource tags Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -256,6 +188,9 @@ type SystemAssignedIdentity struct { // READ-ONLY; The properties associated with the identity. Properties *SystemAssignedIdentityProperties `json:"properties,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -275,23 +210,25 @@ type SystemAssignedIdentityProperties struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } // UserAssignedIdentitiesClientCreateOrUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.CreateOrUpdate @@ -311,30 +248,13 @@ type UserAssignedIdentitiesClientGetOptions struct { // placeholder for future optional parameters } -// UserAssignedIdentitiesClientListAssociatedResourcesOptions contains the optional parameters for the UserAssignedIdentitiesClient.ListAssociatedResources -// method. -type UserAssignedIdentitiesClientListAssociatedResourcesOptions struct { - // OData filter expression to apply to the query. - Filter *string - // OData orderBy expression to apply to the query. - Orderby *string - // Number of records to skip. - Skip *int32 - // A skip token is used to continue retrieving items after an operation returns a partial result. If a previous response contains - // a nextLink element, the value of the nextLink element will include a - // skipToken parameter that specifies a starting point to use for subsequent calls. - Skiptoken *string - // Number of records to return. - Top *int32 -} - -// UserAssignedIdentitiesClientListByResourceGroupOptions contains the optional parameters for the UserAssignedIdentitiesClient.ListByResourceGroup +// UserAssignedIdentitiesClientListByResourceGroupOptions contains the optional parameters for the UserAssignedIdentitiesClient.NewListByResourceGroupPager // method. type UserAssignedIdentitiesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// UserAssignedIdentitiesClientListBySubscriptionOptions contains the optional parameters for the UserAssignedIdentitiesClient.ListBySubscription +// UserAssignedIdentitiesClientListBySubscriptionOptions contains the optional parameters for the UserAssignedIdentitiesClient.NewListBySubscriptionPager // method. type UserAssignedIdentitiesClientListBySubscriptionOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/msi/armmsi/models_serde.go b/sdk/resourcemanager/msi/armmsi/models_serde.go index 55dce07e2102..c220b6fc82ab 100644 --- a/sdk/resourcemanager/msi/armmsi/models_serde.go +++ b/sdk/resourcemanager/msi/armmsi/models_serde.go @@ -16,160 +16,13 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type AssociatedResourcesListResult. -func (a AssociatedResourcesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "totalCount", a.TotalCount) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssociatedResourcesListResult. -func (a *AssociatedResourcesListResult) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "totalCount": - err = unpopulate(val, "TotalCount", &a.TotalCount) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResource. -func (a AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "resourceGroup", a.ResourceGroup) - populate(objectMap, "subscriptionDisplayName", a.SubscriptionDisplayName) - populate(objectMap, "subscriptionId", a.SubscriptionID) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. -func (a *AzureResource) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "resourceGroup": - err = unpopulate(val, "ResourceGroup", &a.ResourceGroup) - delete(rawMsg, key) - case "subscriptionDisplayName": - err = unpopulate(val, "SubscriptionDisplayName", &a.SubscriptionDisplayName) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &a.SubscriptionID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CloudError. -func (c CloudError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", c.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudError. -func (c *CloudError) 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 "error": - err = unpopulate(val, "Error", &c.Error) - 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 CloudErrorBody. -func (c CloudErrorBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", c.Code) - populate(objectMap, "details", c.Details) - populate(objectMap, "message", c.Message) - populate(objectMap, "target", c.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudErrorBody. -func (c *CloudErrorBody) 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 "code": - err = unpopulate(val, "Code", &c.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &c.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &c.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &c.Target) - 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 FederatedIdentityCredential. func (f FederatedIdentityCredential) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", f.ID) populate(objectMap, "name", f.Name) populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) populate(objectMap, "type", f.Type) return json.Marshal(objectMap) } @@ -192,6 +45,9 @@ func (f *FederatedIdentityCredential) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &f.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) @@ -205,7 +61,7 @@ func (f *FederatedIdentityCredential) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FederatedIdentityCredentialProperties. func (f FederatedIdentityCredentialProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "audiences", f.Audiences) populate(objectMap, "issuer", f.Issuer) populate(objectMap, "subject", f.Subject) @@ -240,7 +96,7 @@ func (f *FederatedIdentityCredentialProperties) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type FederatedIdentityCredentialsListResult. func (f FederatedIdentityCredentialsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", f.NextLink) populate(objectMap, "value", f.Value) return json.Marshal(objectMap) @@ -271,11 +127,12 @@ func (f *FederatedIdentityCredentialsListResult) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type Identity. func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", i.ID) populate(objectMap, "location", i.Location) populate(objectMap, "name", i.Name) populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) populate(objectMap, "tags", i.Tags) populate(objectMap, "type", i.Type) return json.Marshal(objectMap) @@ -302,6 +159,9 @@ func (i *Identity) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &i.Tags) delete(rawMsg, key) @@ -318,11 +178,12 @@ func (i *Identity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type IdentityUpdate. func (i IdentityUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", i.ID) populate(objectMap, "location", i.Location) populate(objectMap, "name", i.Name) populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) populate(objectMap, "tags", i.Tags) populate(objectMap, "type", i.Type) return json.Marshal(objectMap) @@ -349,6 +210,9 @@ func (i *IdentityUpdate) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &i.Tags) delete(rawMsg, key) @@ -365,7 +229,7 @@ func (i *IdentityUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "display", o.Display) populate(objectMap, "name", o.Name) return json.Marshal(objectMap) @@ -396,7 +260,7 @@ func (o *Operation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationDisplay. func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", o.Description) populate(objectMap, "operation", o.Operation) populate(objectMap, "provider", o.Provider) @@ -435,7 +299,7 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationListResult. func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) @@ -464,83 +328,14 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type SystemAssignedIdentity. func (s SystemAssignedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "tags", s.Tags) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) @@ -567,6 +362,9 @@ func (s *SystemAssignedIdentity) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) @@ -583,7 +381,7 @@ func (s *SystemAssignedIdentity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemAssignedIdentityProperties. func (s SystemAssignedIdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clientId", s.ClientID) populate(objectMap, "clientSecretUrl", s.ClientSecretURL) populate(objectMap, "principalId", s.PrincipalID) @@ -620,44 +418,48 @@ func (s *SystemAssignedIdentityProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil @@ -665,7 +467,7 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentitiesListResult. func (u UserAssignedIdentitiesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", u.NextLink) populate(objectMap, "value", u.Value) return json.Marshal(objectMap) @@ -696,7 +498,7 @@ func (u *UserAssignedIdentitiesListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentityProperties. func (u UserAssignedIdentityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clientId", u.ClientID) populate(objectMap, "principalId", u.PrincipalID) populate(objectMap, "tenantId", u.TenantID) @@ -729,7 +531,7 @@ func (u *UserAssignedIdentityProperties) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -739,7 +541,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/msi/armmsi/operations_client.go b/sdk/resourcemanager/msi/armmsi/operations_client.go index 2b15c40d8b7d..c67566e3333f 100644 --- a/sdk/resourcemanager/msi/armmsi/operations_client.go +++ b/sdk/resourcemanager/msi/armmsi/operations_client.go @@ -28,8 +28,8 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -50,9 +50,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists available operations for the Microsoft.ManagedIdentity provider -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2023-01-31 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -89,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/msi/armmsi/operations_client_example_test.go b/sdk/resourcemanager/msi/armmsi/operations_client_example_test.go index ef955871b714..fe7a435c31ee 100644 --- a/sdk/resourcemanager/msi/armmsi/operations_client_example_test.go +++ b/sdk/resourcemanager/msi/armmsi/operations_client_example_test.go @@ -5,6 +5,7 @@ // 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 armmsi_test @@ -16,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/MsiOperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/MsiOperationsList.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -29,13 +30,44 @@ func ExampleOperationsClient_NewListPager() { } pager := client.NewListPager(nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.OperationListResult = armmsi.OperationListResult{ + // Value: []*armmsi.Operation{ + // { + // Name: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/read"), + // Display: &armmsi.OperationDisplay{ + // Description: to.Ptr("Gets an existing user assigned identity"), + // Operation: to.Ptr("Get User Assigned Identity"), + // Provider: to.Ptr("Managed Service Identity"), + // Resource: to.Ptr("User Assigned Identities"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/write"), + // Display: &armmsi.OperationDisplay{ + // Description: to.Ptr("Creates a new user assigned identity or updates the tags associated with an existing user assigned identity"), + // Operation: to.Ptr("Create/Update User Assigned Identity"), + // Provider: to.Ptr("Managed Service Identity"), + // Resource: to.Ptr("User Assigned Identities"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities/delete"), + // Display: &armmsi.OperationDisplay{ + // Description: to.Ptr("Deletes an existing user assigned identity"), + // Operation: to.Ptr("Delete User Assigned Identity"), + // Provider: to.Ptr("Managed Service Identity"), + // Resource: to.Ptr("User Assigned Identities"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/msi/armmsi/response_types.go b/sdk/resourcemanager/msi/armmsi/response_types.go index 8ec9b702aeff..601cbfd895a5 100644 --- a/sdk/resourcemanager/msi/armmsi/response_types.go +++ b/sdk/resourcemanager/msi/armmsi/response_types.go @@ -24,12 +24,12 @@ type FederatedIdentityCredentialsClientGetResponse struct { FederatedIdentityCredential } -// FederatedIdentityCredentialsClientListResponse contains the response from method FederatedIdentityCredentialsClient.List. +// FederatedIdentityCredentialsClientListResponse contains the response from method FederatedIdentityCredentialsClient.NewListPager. type FederatedIdentityCredentialsClientListResponse struct { FederatedIdentityCredentialsListResult } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } @@ -54,17 +54,12 @@ type UserAssignedIdentitiesClientGetResponse struct { Identity } -// UserAssignedIdentitiesClientListAssociatedResourcesResponse contains the response from method UserAssignedIdentitiesClient.ListAssociatedResources. -type UserAssignedIdentitiesClientListAssociatedResourcesResponse struct { - AssociatedResourcesListResult -} - -// UserAssignedIdentitiesClientListByResourceGroupResponse contains the response from method UserAssignedIdentitiesClient.ListByResourceGroup. +// UserAssignedIdentitiesClientListByResourceGroupResponse contains the response from method UserAssignedIdentitiesClient.NewListByResourceGroupPager. type UserAssignedIdentitiesClientListByResourceGroupResponse struct { UserAssignedIdentitiesListResult } -// UserAssignedIdentitiesClientListBySubscriptionResponse contains the response from method UserAssignedIdentitiesClient.ListBySubscription. +// UserAssignedIdentitiesClientListBySubscriptionResponse contains the response from method UserAssignedIdentitiesClient.NewListBySubscriptionPager. type UserAssignedIdentitiesClientListBySubscriptionResponse struct { UserAssignedIdentitiesListResult } diff --git a/sdk/resourcemanager/msi/armmsi/systemassignedidentities_client.go b/sdk/resourcemanager/msi/armmsi/systemassignedidentities_client.go index 083e17387e63..38f427487d81 100644 --- a/sdk/resourcemanager/msi/armmsi/systemassignedidentities_client.go +++ b/sdk/resourcemanager/msi/armmsi/systemassignedidentities_client.go @@ -29,8 +29,8 @@ type SystemAssignedIdentitiesClient struct { } // NewSystemAssignedIdentitiesClient creates a new instance of SystemAssignedIdentitiesClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSystemAssignedIdentitiesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SystemAssignedIdentitiesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -52,10 +52,11 @@ func NewSystemAssignedIdentitiesClient(credential azcore.TokenCredential, option // GetByScope - Gets the systemAssignedIdentity available under the specified RP scope. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// scope - The resource provider scope of the resource. Parent resource being extended by Managed Identities. -// options - SystemAssignedIdentitiesClientGetByScopeOptions contains the optional parameters for the SystemAssignedIdentitiesClient.GetByScope -// method. +// +// Generated from API version 2023-01-31 +// - scope - The resource provider scope of the resource. Parent resource being extended by Managed Identities. +// - options - SystemAssignedIdentitiesClientGetByScopeOptions contains the optional parameters for the SystemAssignedIdentitiesClient.GetByScope +// method. func (client *SystemAssignedIdentitiesClient) GetByScope(ctx context.Context, scope string, options *SystemAssignedIdentitiesClientGetByScopeOptions) (SystemAssignedIdentitiesClientGetByScopeResponse, error) { req, err := client.getByScopeCreateRequest(ctx, scope, options) if err != nil { @@ -80,7 +81,7 @@ func (client *SystemAssignedIdentitiesClient) getByScopeCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/msi/armmsi/systemassignedidentities_client_example_test.go b/sdk/resourcemanager/msi/armmsi/systemassignedidentities_client_example_test.go index ecf2b4ceba14..64a80a9ac0ff 100644 --- a/sdk/resourcemanager/msi/armmsi/systemassignedidentities_client_example_test.go +++ b/sdk/resourcemanager/msi/armmsi/systemassignedidentities_client_example_test.go @@ -5,6 +5,7 @@ // 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 armmsi_test @@ -16,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/SystemAssignedIdentityGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/SystemAssignedIdentityGet.json func ExampleSystemAssignedIdentitiesClient_GetByScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -27,12 +28,23 @@ func ExampleSystemAssignedIdentitiesClient_GetByScope() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.GetByScope(ctx, - "scope", - nil) + res, err := client.GetByScope(ctx, "scope", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // 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.SystemAssignedIdentity = armmsi.SystemAssignedIdentity{ + // Name: to.Ptr("resourceName"), + // Type: to.Ptr("ResourceProvider"), + // ID: to.Ptr("/scope"), + // Location: to.Ptr("cus"), + // Properties: &armmsi.SystemAssignedIdentityProperties{ + // ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"), + // ClientSecretURL: to.Ptr("https://serviceRoot/scope/credentials?tid=tenantId&oid=principalId&aid=clientId"), + // PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"), + // TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"), + // }, + // } } diff --git a/sdk/resourcemanager/msi/armmsi/time_rfc3339.go b/sdk/resourcemanager/msi/armmsi/time_rfc3339.go new file mode 100644 index 000000000000..0e1dfc22ec83 --- /dev/null +++ b/sdk/resourcemanager/msi/armmsi/time_rfc3339.go @@ -0,0 +1,87 @@ +//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 armmsi + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// 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+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/msi/armmsi/userassignedidentities_client.go b/sdk/resourcemanager/msi/armmsi/userassignedidentities_client.go index 672d09f156c0..598ee2da393a 100644 --- a/sdk/resourcemanager/msi/armmsi/userassignedidentities_client.go +++ b/sdk/resourcemanager/msi/armmsi/userassignedidentities_client.go @@ -20,7 +20,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" - "strconv" "strings" ) @@ -33,9 +32,9 @@ type UserAssignedIdentitiesClient struct { } // NewUserAssignedIdentitiesClient creates a new instance of UserAssignedIdentitiesClient with the specified values. -// subscriptionID - The Id of the Subscription to which the identity belongs. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The Id of the Subscription to which the identity belongs. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewUserAssignedIdentitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UserAssignedIdentitiesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,12 +57,13 @@ func NewUserAssignedIdentitiesClient(subscriptionID string, credential azcore.To // CreateOrUpdate - Create or update an identity in the specified subscription and resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// parameters - Parameters to create or update the identity -// options - UserAssignedIdentitiesClientCreateOrUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.CreateOrUpdate -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the Resource Group to which the identity belongs. +// - resourceName - The name of the identity resource. +// - parameters - Parameters to create or update the identity +// - options - UserAssignedIdentitiesClientCreateOrUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.CreateOrUpdate +// method. func (client *UserAssignedIdentitiesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Identity, options *UserAssignedIdentitiesClientCreateOrUpdateOptions) (UserAssignedIdentitiesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -99,7 +99,7 @@ func (client *UserAssignedIdentitiesClient) createOrUpdateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -116,11 +116,12 @@ func (client *UserAssignedIdentitiesClient) createOrUpdateHandleResponse(resp *h // Delete - Deletes the identity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// options - UserAssignedIdentitiesClientDeleteOptions contains the optional parameters for the UserAssignedIdentitiesClient.Delete -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the Resource Group to which the identity belongs. +// - resourceName - The name of the identity resource. +// - options - UserAssignedIdentitiesClientDeleteOptions contains the optional parameters for the UserAssignedIdentitiesClient.Delete +// method. func (client *UserAssignedIdentitiesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, options *UserAssignedIdentitiesClientDeleteOptions) (UserAssignedIdentitiesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -156,7 +157,7 @@ func (client *UserAssignedIdentitiesClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -164,11 +165,12 @@ func (client *UserAssignedIdentitiesClient) deleteCreateRequest(ctx context.Cont // Get - Gets the identity. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// options - UserAssignedIdentitiesClientGetOptions contains the optional parameters for the UserAssignedIdentitiesClient.Get -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the Resource Group to which the identity belongs. +// - resourceName - The name of the identity resource. +// - options - UserAssignedIdentitiesClientGetOptions contains the optional parameters for the UserAssignedIdentitiesClient.Get +// method. func (client *UserAssignedIdentitiesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, options *UserAssignedIdentitiesClientGetOptions) (UserAssignedIdentitiesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -204,7 +206,7 @@ func (client *UserAssignedIdentitiesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -219,97 +221,12 @@ func (client *UserAssignedIdentitiesClient) getHandleResponse(resp *http.Respons return result, nil } -// NewListAssociatedResourcesPager - Lists the associated resources for this identity. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// options - UserAssignedIdentitiesClientListAssociatedResourcesOptions contains the optional parameters for the UserAssignedIdentitiesClient.ListAssociatedResources -// method. -func (client *UserAssignedIdentitiesClient) NewListAssociatedResourcesPager(resourceGroupName string, resourceName string, options *UserAssignedIdentitiesClientListAssociatedResourcesOptions) *runtime.Pager[UserAssignedIdentitiesClientListAssociatedResourcesResponse] { - return runtime.NewPager(runtime.PagingHandler[UserAssignedIdentitiesClientListAssociatedResourcesResponse]{ - More: func(page UserAssignedIdentitiesClientListAssociatedResourcesResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *UserAssignedIdentitiesClientListAssociatedResourcesResponse) (UserAssignedIdentitiesClientListAssociatedResourcesResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listAssociatedResourcesCreateRequest(ctx, resourceGroupName, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return UserAssignedIdentitiesClientListAssociatedResourcesResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return UserAssignedIdentitiesClientListAssociatedResourcesResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UserAssignedIdentitiesClientListAssociatedResourcesResponse{}, runtime.NewResponseError(resp) - } - return client.listAssociatedResourcesHandleResponse(resp) - }, - }) -} - -// listAssociatedResourcesCreateRequest creates the ListAssociatedResources request. -func (client *UserAssignedIdentitiesClient) listAssociatedResourcesCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *UserAssignedIdentitiesClientListAssociatedResourcesOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resourceName}/listAssociatedResources" - 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 resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Orderby != nil { - reqQP.Set("$orderby", *options.Orderby) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - if options != nil && options.Skip != nil { - reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) - } - if options != nil && options.Skiptoken != nil { - reqQP.Set("$skiptoken", *options.Skiptoken) - } - reqQP.Set("api-version", "2022-01-31-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAssociatedResourcesHandleResponse handles the ListAssociatedResources response. -func (client *UserAssignedIdentitiesClient) listAssociatedResourcesHandleResponse(resp *http.Response) (UserAssignedIdentitiesClientListAssociatedResourcesResponse, error) { - result := UserAssignedIdentitiesClientListAssociatedResourcesResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AssociatedResourcesListResult); err != nil { - return UserAssignedIdentitiesClientListAssociatedResourcesResponse{}, err - } - return result, nil -} - // NewListByResourceGroupPager - Lists all the userAssignedIdentities available under the specified ResourceGroup. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// options - UserAssignedIdentitiesClientListByResourceGroupOptions contains the optional parameters for the UserAssignedIdentitiesClient.ListByResourceGroup -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the Resource Group to which the identity belongs. +// - options - UserAssignedIdentitiesClientListByResourceGroupOptions contains the optional parameters for the UserAssignedIdentitiesClient.NewListByResourceGroupPager +// method. func (client *UserAssignedIdentitiesClient) NewListByResourceGroupPager(resourceGroupName string, options *UserAssignedIdentitiesClientListByResourceGroupOptions) *runtime.Pager[UserAssignedIdentitiesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[UserAssignedIdentitiesClientListByResourceGroupResponse]{ More: func(page UserAssignedIdentitiesClientListByResourceGroupResponse) bool { @@ -354,7 +271,7 @@ func (client *UserAssignedIdentitiesClient) listByResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -370,10 +287,10 @@ func (client *UserAssignedIdentitiesClient) listByResourceGroupHandleResponse(re } // NewListBySubscriptionPager - Lists all the userAssignedIdentities available under the specified subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// options - UserAssignedIdentitiesClientListBySubscriptionOptions contains the optional parameters for the UserAssignedIdentitiesClient.ListBySubscription -// method. +// +// Generated from API version 2023-01-31 +// - options - UserAssignedIdentitiesClientListBySubscriptionOptions contains the optional parameters for the UserAssignedIdentitiesClient.NewListBySubscriptionPager +// method. func (client *UserAssignedIdentitiesClient) NewListBySubscriptionPager(options *UserAssignedIdentitiesClientListBySubscriptionOptions) *runtime.Pager[UserAssignedIdentitiesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[UserAssignedIdentitiesClientListBySubscriptionResponse]{ More: func(page UserAssignedIdentitiesClientListBySubscriptionResponse) bool { @@ -414,7 +331,7 @@ func (client *UserAssignedIdentitiesClient) listBySubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -431,12 +348,13 @@ func (client *UserAssignedIdentitiesClient) listBySubscriptionHandleResponse(res // Update - Update an identity in the specified subscription and resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-01-31-preview -// resourceGroupName - The name of the Resource Group to which the identity belongs. -// resourceName - The name of the identity resource. -// parameters - Parameters to update the identity -// options - UserAssignedIdentitiesClientUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.Update -// method. +// +// Generated from API version 2023-01-31 +// - resourceGroupName - The name of the Resource Group to which the identity belongs. +// - resourceName - The name of the identity resource. +// - parameters - Parameters to update the identity +// - options - UserAssignedIdentitiesClientUpdateOptions contains the optional parameters for the UserAssignedIdentitiesClient.Update +// method. func (client *UserAssignedIdentitiesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, parameters IdentityUpdate, options *UserAssignedIdentitiesClientUpdateOptions) (UserAssignedIdentitiesClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -472,7 +390,7 @@ func (client *UserAssignedIdentitiesClient) updateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-31-preview") + reqQP.Set("api-version", "2023-01-31") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/msi/armmsi/userassignedidentities_client_example_test.go b/sdk/resourcemanager/msi/armmsi/userassignedidentities_client_example_test.go index 8f79c7aadca2..37c851d5bb76 100644 --- a/sdk/resourcemanager/msi/armmsi/userassignedidentities_client_example_test.go +++ b/sdk/resourcemanager/msi/armmsi/userassignedidentities_client_example_test.go @@ -5,6 +5,7 @@ // 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 armmsi_test @@ -17,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/IdentityListBySubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListBySubscription.json func ExampleUserAssignedIdentitiesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -30,18 +31,37 @@ func ExampleUserAssignedIdentitiesClient_NewListBySubscriptionPager() { } pager := client.NewListBySubscriptionPager(nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.UserAssignedIdentitiesListResult = armmsi.UserAssignedIdentitiesListResult{ + // Value: []*armmsi.Identity{ + // { + // Name: to.Ptr("identityName"), + // Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"), + // ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // Properties: &armmsi.UserAssignedIdentityProperties{ + // ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"), + // PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"), + // TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/IdentityListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListByResourceGroup.json func ExampleUserAssignedIdentitiesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,52 +72,39 @@ func ExampleUserAssignedIdentitiesClient_NewListByResourceGroupPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := client.NewListByResourceGroupPager("rgName", - nil) + pager := client.NewListByResourceGroupPager("rgName", nil) for pager.More() { - nextResult, err := pager.NextPage(ctx) + page, err := pager.NextPage(ctx) if err != nil { log.Fatalf("failed to advance page: %v", err) } - for _, v := range nextResult.Value { - // TODO: use page item + 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.UserAssignedIdentitiesListResult = armmsi.UserAssignedIdentitiesListResult{ + // Value: []*armmsi.Identity{ + // { + // Name: to.Ptr("identityName"), + // Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"), + // ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // Properties: &armmsi.UserAssignedIdentityProperties{ + // ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"), + // PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"), + // TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"), + // }, + // }}, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/IdentityListAssociatedResources.json -func ExampleUserAssignedIdentitiesClient_NewListAssociatedResourcesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armmsi.NewUserAssignedIdentitiesClient("1cscb752-d7c9-463f-9731-fd31edada74a", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAssociatedResourcesPager("testrg", - "testid", - &armmsi.UserAssignedIdentitiesClientListAssociatedResourcesOptions{Filter: to.Ptr("contains(name, 'test')"), - Orderby: to.Ptr("name asc"), - Top: to.Ptr[int32](10), - Skip: to.Ptr[int32](1), - Skiptoken: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/IdentityCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityCreate.json func ExampleUserAssignedIdentitiesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -108,25 +115,37 @@ func ExampleUserAssignedIdentitiesClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.CreateOrUpdate(ctx, - "rgName", - "resourceName", - armmsi.Identity{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, + res, err := client.CreateOrUpdate(ctx, "rgName", "resourceName", armmsi.Identity{ + Location: to.Ptr("eastus"), + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + "key2": to.Ptr("value2"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // 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.Identity = armmsi.Identity{ + // Name: to.Ptr("identityName"), + // Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"), + // ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // Properties: &armmsi.UserAssignedIdentityProperties{ + // ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"), + // PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"), + // TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/IdentityUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityUpdate.json func ExampleUserAssignedIdentitiesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,25 +156,37 @@ func ExampleUserAssignedIdentitiesClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Update(ctx, - "rgName", - "resourceName", - armmsi.IdentityUpdate{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, + res, err := client.Update(ctx, "rgName", "resourceName", armmsi.IdentityUpdate{ + Location: to.Ptr("eastus"), + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + "key2": to.Ptr("value2"), }, - nil) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // 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.Identity = armmsi.Identity{ + // Name: to.Ptr("identityName"), + // Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"), + // ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // Properties: &armmsi.UserAssignedIdentityProperties{ + // ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"), + // PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"), + // TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/IdentityGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json func ExampleUserAssignedIdentitiesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -166,18 +197,31 @@ func ExampleUserAssignedIdentitiesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := client.Get(ctx, - "rgName", - "resourceName", - nil) + res, err := client.Get(ctx, "rgName", "resourceName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - // TODO: use response item + // 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.Identity = armmsi.Identity{ + // Name: to.Ptr("identityName"), + // Type: to.Ptr("Microsoft.ManagedIdentity/userAssignedIdentities"), + // ID: to.Ptr("/subscriptions/subid/resourcegroups/rgName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // Properties: &armmsi.UserAssignedIdentityProperties{ + // ClientID: to.Ptr("4024ab25-56a8-4370-aea6-6389221caf29"), + // PrincipalID: to.Ptr("25cc773c-7f05-40fc-a104-32d2300754ad"), + // TenantID: to.Ptr("b6c948ef-f6b5-4384-8354-da3a15eca969"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2022-01-31-preview/examples/IdentityDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3d7a3848106b831a4a7f46976fe38aa605c4f44d/specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityDelete.json func ExampleUserAssignedIdentitiesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -188,10 +232,7 @@ func ExampleUserAssignedIdentitiesClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = client.Delete(ctx, - "rgName", - "resourceName", - nil) + _, err = client.Delete(ctx, "rgName", "resourceName", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) }