From e186fa9acc62966688faab8cdda7b06a1a4614cf Mon Sep 17 00:00:00 2001 From: ziyeqf <51212351+ziyeqf@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:01:36 +0800 Subject: [PATCH] update code Signed-off-by: ziyeqf <51212351+ziyeqf@users.noreply.github.com> --- .../recoveryservices/client/client.go | 9 +- .../replicationprotectableitems/client.go | 22 +- .../replicationprotectableitems/constants.go | 32 ++- .../replicationprotectableitems/method_get.go | 51 ++++ .../method_get_autorest.go | 68 ------ ...d_listbyreplicationprotectioncontainers.go | 121 ++++++++++ ...eplicationprotectioncontainers_autorest.go | 220 ------------------ .../model_configurationsettings.go | 13 +- .../replicationprotectableitems/predicates.go | 8 +- 9 files changed, 237 insertions(+), 307 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_get.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_listbyreplicationprotectioncontainers.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_listbyreplicationprotectioncontainers_autorest.go diff --git a/internal/services/recoveryservices/client/client.go b/internal/services/recoveryservices/client/client.go index 5c61100ec61e..9886d9ba0113 100644 --- a/internal/services/recoveryservices/client/client.go +++ b/internal/services/recoveryservices/client/client.go @@ -146,8 +146,11 @@ func NewClient(o *common.ClientOptions) (*Client, error) { } o.Configure(replicationMigrationItemsClient.Client, o.Authorizers.ResourceManager) - replicationProtectableItemsCLient := replicationprotectableitems.NewReplicationProtectableItemsClientWithBaseURI(o.ResourceManagerEndpoint) - o.ConfigureClient(&replicationProtectableItemsCLient.Client, o.ResourceManagerAuthorizer) + replicationProtectableItemsCLient, err := replicationprotectableitems.NewReplicationProtectableItemsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building replicationProtectableItems client: %+v", err) + } + o.Configure(replicationProtectableItemsCLient.Client, o.Authorizers.ResourceManager) replicationRecoveryPlanClient, err := replicationrecoveryplans.NewReplicationRecoveryPlansClientWithBaseURI(o.Environment.ResourceManager) if err != nil { @@ -182,7 +185,7 @@ func NewClient(o *common.ClientOptions) (*Client, error) { VaultCertificatesClient: &vaultCertificatesClient, VaultsSettingsClient: vaultSettingsClient, StorageConfigsClient: &storageConfigsClient, - ReplicationProtectableItemsClient: &replicationProtectableItemsCLient, + ReplicationProtectableItemsClient: replicationProtectableItemsCLient, ReplicationProtectedItemsClient: replicationMigrationItemsClient, ReplicationRecoveryPlansClient: replicationRecoveryPlanClient, ReplicationNetworksClient: replicationNetworksClient, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/client.go index cd1356d41c0a..20a533cfe434 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/client.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/client.go @@ -1,18 +1,26 @@ package replicationprotectableitems -import "github.com/Azure/go-autorest/autorest" +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ReplicationProtectableItemsClient struct { - Client autorest.Client - baseUri string + Client *resourcemanager.Client } -func NewReplicationProtectableItemsClientWithBaseURI(endpoint string) ReplicationProtectableItemsClient { - return ReplicationProtectableItemsClient{ - Client: autorest.NewClientWithUserAgent(userAgent()), - baseUri: endpoint, +func NewReplicationProtectableItemsClientWithBaseURI(sdkApi sdkEnv.Api) (*ReplicationProtectableItemsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "replicationprotectableitems", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ReplicationProtectableItemsClient: %+v", err) } + + return &ReplicationProtectableItemsClient{ + Client: client, + }, nil } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/constants.go index 7ae2eaa30c8b..ba651c886679 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/constants.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/constants.go @@ -1,6 +1,10 @@ package replicationprotectableitems -import "strings" +import ( + "encoding/json" + "fmt" + "strings" +) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. @@ -19,6 +23,19 @@ func PossibleValuesForHealthErrorCustomerResolvability() []string { } } +func (s *HealthErrorCustomerResolvability) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHealthErrorCustomerResolvability(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parseHealthErrorCustomerResolvability(input string) (*HealthErrorCustomerResolvability, error) { vals := map[string]HealthErrorCustomerResolvability{ "allowed": HealthErrorCustomerResolvabilityAllowed, @@ -49,6 +66,19 @@ func PossibleValuesForPresenceStatus() []string { } } +func (s *PresenceStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePresenceStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + func parsePresenceStatus(input string) (*PresenceStatus, error) { vals := map[string]PresenceStatus{ "notpresent": PresenceStatusNotPresent, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_get.go new file mode 100644 index 000000000000..c54f2d84c12e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_get.go @@ -0,0 +1,51 @@ +package replicationprotectableitems + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProtectableItem +} + +// Get ... +func (c ReplicationProtectableItemsClient) Get(ctx context.Context, id ReplicationProtectableItemId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_get_autorest.go deleted file mode 100644 index 5f174d7a1ccf..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_get_autorest.go +++ /dev/null @@ -1,68 +0,0 @@ -package replicationprotectableitems - -import ( - "context" - "net/http" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetOperationResponse struct { - HttpResponse *http.Response - Model *ProtectableItem -} - -// Get ... -func (c ReplicationProtectableItemsClient) Get(ctx context.Context, id ReplicationProtectableItemId) (result GetOperationResponse, err error) { - req, err := c.preparerForGet(ctx, id) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "Get", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "Get", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForGet(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "Get", result.HttpResponse, "Failure responding to request") - return - } - - return -} - -// preparerForGet prepares the Get request. -func (c ReplicationProtectableItemsClient) preparerForGet(ctx context.Context, id ReplicationProtectableItemId) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(id.ID()), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForGet handles the response to the Get request. The method always -// closes the http.Response Body. -func (c ReplicationProtectableItemsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Model), - autorest.ByClosing()) - result.HttpResponse = resp - - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_listbyreplicationprotectioncontainers.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_listbyreplicationprotectioncontainers.go new file mode 100644 index 000000000000..2164fcd89fe0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_listbyreplicationprotectioncontainers.go @@ -0,0 +1,121 @@ +package replicationprotectableitems + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByReplicationProtectionContainersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProtectableItem +} + +type ListByReplicationProtectionContainersCompleteResult struct { + Items []ProtectableItem +} + +type ListByReplicationProtectionContainersOperationOptions struct { + Filter *string + Take *string +} + +func DefaultListByReplicationProtectionContainersOperationOptions() ListByReplicationProtectionContainersOperationOptions { + return ListByReplicationProtectionContainersOperationOptions{} +} + +func (o ListByReplicationProtectionContainersOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByReplicationProtectionContainersOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + return &out +} + +func (o ListByReplicationProtectionContainersOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Take != nil { + out.Append("$take", fmt.Sprintf("%v", *o.Take)) + } + return &out +} + +// ListByReplicationProtectionContainers ... +func (c ReplicationProtectableItemsClient) ListByReplicationProtectionContainers(ctx context.Context, id ReplicationProtectionContainerId, options ListByReplicationProtectionContainersOperationOptions) (result ListByReplicationProtectionContainersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/replicationProtectableItems", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]ProtectableItem `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByReplicationProtectionContainersComplete retrieves all the results into a single object +func (c ReplicationProtectableItemsClient) ListByReplicationProtectionContainersComplete(ctx context.Context, id ReplicationProtectionContainerId, options ListByReplicationProtectionContainersOperationOptions) (ListByReplicationProtectionContainersCompleteResult, error) { + return c.ListByReplicationProtectionContainersCompleteMatchingPredicate(ctx, id, options, ProtectableItemOperationPredicate{}) +} + +// ListByReplicationProtectionContainersCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ReplicationProtectableItemsClient) ListByReplicationProtectionContainersCompleteMatchingPredicate(ctx context.Context, id ReplicationProtectionContainerId, options ListByReplicationProtectionContainersOperationOptions, predicate ProtectableItemOperationPredicate) (result ListByReplicationProtectionContainersCompleteResult, err error) { + items := make([]ProtectableItem, 0) + + resp, err := c.ListByReplicationProtectionContainers(ctx, id, options) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByReplicationProtectionContainersCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_listbyreplicationprotectioncontainers_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_listbyreplicationprotectioncontainers_autorest.go deleted file mode 100644 index 5c77821d594b..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/method_listbyreplicationprotectioncontainers_autorest.go +++ /dev/null @@ -1,220 +0,0 @@ -package replicationprotectableitems - -import ( - "context" - "fmt" - "net/http" - "net/url" - - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListByReplicationProtectionContainersOperationResponse struct { - HttpResponse *http.Response - Model *[]ProtectableItem - - nextLink *string - nextPageFunc func(ctx context.Context, nextLink string) (ListByReplicationProtectionContainersOperationResponse, error) -} - -type ListByReplicationProtectionContainersCompleteResult struct { - Items []ProtectableItem -} - -func (r ListByReplicationProtectionContainersOperationResponse) HasMore() bool { - return r.nextLink != nil -} - -func (r ListByReplicationProtectionContainersOperationResponse) LoadMore(ctx context.Context) (resp ListByReplicationProtectionContainersOperationResponse, err error) { - if !r.HasMore() { - err = fmt.Errorf("no more pages returned") - return - } - return r.nextPageFunc(ctx, *r.nextLink) -} - -type ListByReplicationProtectionContainersOperationOptions struct { - Filter *string - Take *string -} - -func DefaultListByReplicationProtectionContainersOperationOptions() ListByReplicationProtectionContainersOperationOptions { - return ListByReplicationProtectionContainersOperationOptions{} -} - -func (o ListByReplicationProtectionContainersOperationOptions) toHeaders() map[string]interface{} { - out := make(map[string]interface{}) - - return out -} - -func (o ListByReplicationProtectionContainersOperationOptions) toQueryString() map[string]interface{} { - out := make(map[string]interface{}) - - if o.Filter != nil { - out["$filter"] = *o.Filter - } - - if o.Take != nil { - out["$take"] = *o.Take - } - - return out -} - -// ListByReplicationProtectionContainers ... -func (c ReplicationProtectableItemsClient) ListByReplicationProtectionContainers(ctx context.Context, id ReplicationProtectionContainerId, options ListByReplicationProtectionContainersOperationOptions) (resp ListByReplicationProtectionContainersOperationResponse, err error) { - req, err := c.preparerForListByReplicationProtectionContainers(ctx, id, options) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", nil, "Failure preparing request") - return - } - - resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", resp.HttpResponse, "Failure sending request") - return - } - - resp, err = c.responderForListByReplicationProtectionContainers(resp.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", resp.HttpResponse, "Failure responding to request") - return - } - return -} - -// preparerForListByReplicationProtectionContainers prepares the ListByReplicationProtectionContainers request. -func (c ReplicationProtectableItemsClient) preparerForListByReplicationProtectionContainers(ctx context.Context, id ReplicationProtectionContainerId, options ListByReplicationProtectionContainersOperationOptions) (*http.Request, error) { - queryParameters := map[string]interface{}{ - "api-version": defaultApiVersion, - } - - for k, v := range options.toQueryString() { - queryParameters[k] = autorest.Encode("query", v) - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithHeaders(options.toHeaders()), - autorest.WithPath(fmt.Sprintf("%s/replicationProtectableItems", id.ID())), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// preparerForListByReplicationProtectionContainersWithNextLink prepares the ListByReplicationProtectionContainers request with the given nextLink token. -func (c ReplicationProtectableItemsClient) preparerForListByReplicationProtectionContainersWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { - uri, err := url.Parse(nextLink) - if err != nil { - return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) - } - queryParameters := map[string]interface{}{} - for k, v := range uri.Query() { - if len(v) == 0 { - continue - } - val := v[0] - val = autorest.Encode("query", val) - queryParameters[k] = val - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsGet(), - autorest.WithBaseURL(c.baseUri), - autorest.WithPath(uri.Path), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// responderForListByReplicationProtectionContainers handles the response to the ListByReplicationProtectionContainers request. The method always -// closes the http.Response Body. -func (c ReplicationProtectableItemsClient) responderForListByReplicationProtectionContainers(resp *http.Response) (result ListByReplicationProtectionContainersOperationResponse, err error) { - type page struct { - Values []ProtectableItem `json:"value"` - NextLink *string `json:"nextLink"` - } - var respObj page - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&respObj), - autorest.ByClosing()) - result.HttpResponse = resp - result.Model = &respObj.Values - result.nextLink = respObj.NextLink - if respObj.NextLink != nil { - result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListByReplicationProtectionContainersOperationResponse, err error) { - req, err := c.preparerForListByReplicationProtectionContainersWithNextLink(ctx, nextLink) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", nil, "Failure preparing request") - return - } - - result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", result.HttpResponse, "Failure sending request") - return - } - - result, err = c.responderForListByReplicationProtectionContainers(result.HttpResponse) - if err != nil { - err = autorest.NewErrorWithError(err, "replicationprotectableitems.ReplicationProtectableItemsClient", "ListByReplicationProtectionContainers", result.HttpResponse, "Failure responding to request") - return - } - - return - } - } - return -} - -// ListByReplicationProtectionContainersComplete retrieves all of the results into a single object -func (c ReplicationProtectableItemsClient) ListByReplicationProtectionContainersComplete(ctx context.Context, id ReplicationProtectionContainerId, options ListByReplicationProtectionContainersOperationOptions) (ListByReplicationProtectionContainersCompleteResult, error) { - return c.ListByReplicationProtectionContainersCompleteMatchingPredicate(ctx, id, options, ProtectableItemOperationPredicate{}) -} - -// ListByReplicationProtectionContainersCompleteMatchingPredicate retrieves all of the results and then applied the predicate -func (c ReplicationProtectableItemsClient) ListByReplicationProtectionContainersCompleteMatchingPredicate(ctx context.Context, id ReplicationProtectionContainerId, options ListByReplicationProtectionContainersOperationOptions, predicate ProtectableItemOperationPredicate) (resp ListByReplicationProtectionContainersCompleteResult, err error) { - items := make([]ProtectableItem, 0) - - page, err := c.ListByReplicationProtectionContainers(ctx, id, options) - if err != nil { - err = fmt.Errorf("loading the initial page: %+v", err) - return - } - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - for page.HasMore() { - page, err = page.LoadMore(ctx) - if err != nil { - err = fmt.Errorf("loading the next page: %+v", err) - return - } - - if page.Model != nil { - for _, v := range *page.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - } - - out := ListByReplicationProtectionContainersCompleteResult{ - Items: items, - } - return out, nil -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/model_configurationsettings.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/model_configurationsettings.go index 4d071558c6cb..c03a8b1acf1f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/model_configurationsettings.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/model_configurationsettings.go @@ -12,6 +12,15 @@ import ( type ConfigurationSettings interface { } +// RawModeOfTransitImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawConfigurationSettingsImpl struct { + Type string + Values map[string]interface{} +} + func unmarshalConfigurationSettingsImplementation(input []byte) (ConfigurationSettings, error) { if input == nil { return nil, nil @@ -51,10 +60,6 @@ func unmarshalConfigurationSettingsImplementation(input []byte) (ConfigurationSe return out, nil } - type RawConfigurationSettingsImpl struct { - Type string `json:"-"` - Values map[string]interface{} `json:"-"` - } out := RawConfigurationSettingsImpl{ Type: value, Values: temp, diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/predicates.go index 06bc4485e632..cd7684d64334 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/predicates.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/predicates.go @@ -12,19 +12,19 @@ type ProtectableItemOperationPredicate struct { func (p ProtectableItemOperationPredicate) Matches(input ProtectableItem) bool { - if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { return false } - if p.Location != nil && (input.Location == nil && *p.Location != *input.Location) { + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { return false } - if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { return false } - if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { return false }