Skip to content

Commit

Permalink
Updating based on e285fd33
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-tf-azure committed Feb 27, 2024
1 parent 26c368c commit 09fe9f0
Show file tree
Hide file tree
Showing 2,161 changed files with 19,064 additions and 4,353 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,19 @@ func (o *HealthAlert) GetLastDetectedAsTime() (*time.Time, error) {
return dates.ParseAsFormat(o.LastDetected, "2006-01-02T15:04:05Z07:00")
}

func (o *HealthAlert) SetLastDetectedAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.LastDetected = &formatted
}

func (o *HealthAlert) GetRaisedAsTime() (*time.Time, error) {
if o.Raised == nil {
return nil, nil
}
return dates.ParseAsFormat(o.Raised, "2006-01-02T15:04:05Z07:00")
}

func (o *HealthAlert) SetRaisedAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.Raised = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ func (o *LdapsSettings) GetCertificateNotAfterAsTime() (*time.Time, error) {
}
return dates.ParseAsFormat(o.CertificateNotAfter, "2006-01-02T15:04:05Z07:00")
}

func (o *LdapsSettings) SetCertificateNotAfterAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CertificateNotAfter = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ func (o *SuppressionProperties) GetExpirationTimeStampAsTime() (*time.Time, erro
}
return dates.ParseAsFormat(o.ExpirationTimeStamp, "2006-01-02T15:04:05Z07:00")
}

func (o *SuppressionProperties) SetExpirationTimeStampAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.ExpirationTimeStamp = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ func (o *SuppressionProperties) GetExpirationTimeStampAsTime() (*time.Time, erro
}
return dates.ParseAsFormat(o.ExpirationTimeStamp, "2006-01-02T15:04:05Z07:00")
}

func (o *SuppressionProperties) SetExpirationTimeStampAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.ExpirationTimeStamp = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ func (o *SuppressionProperties) GetExpirationTimeStampAsTime() (*time.Time, erro
}
return dates.ParseAsFormat(o.ExpirationTimeStamp, "2006-01-02T15:04:05Z07:00")
}

func (o *SuppressionProperties) SetExpirationTimeStampAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.ExpirationTimeStamp = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,31 @@ func (o *Essentials) GetLastModifiedDateTimeAsTime() (*time.Time, error) {
return dates.ParseAsFormat(o.LastModifiedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *Essentials) SetLastModifiedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.LastModifiedDateTime = &formatted
}

func (o *Essentials) GetMonitorConditionResolvedDateTimeAsTime() (*time.Time, error) {
if o.MonitorConditionResolvedDateTime == nil {
return nil, nil
}
return dates.ParseAsFormat(o.MonitorConditionResolvedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *Essentials) SetMonitorConditionResolvedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.MonitorConditionResolvedDateTime = &formatted
}

func (o *Essentials) GetStartDateTimeAsTime() (*time.Time, error) {
if o.StartDateTime == nil {
return nil, nil
}
return dates.ParseAsFormat(o.StartDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *Essentials) SetStartDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.StartDateTime = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ func (o *SmartGroupProperties) GetLastModifiedDateTimeAsTime() (*time.Time, erro
return dates.ParseAsFormat(o.LastModifiedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *SmartGroupProperties) SetLastModifiedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.LastModifiedDateTime = &formatted
}

func (o *SmartGroupProperties) GetStartDateTimeAsTime() (*time.Time, error) {
if o.StartDateTime == nil {
return nil, nil
}
return dates.ParseAsFormat(o.StartDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *SmartGroupProperties) SetStartDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.StartDateTime = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ func (o *ApiManagementServiceProperties) GetCreatedAtUtcAsTime() (*time.Time, er
}
return dates.ParseAsFormat(o.CreatedAtUtc, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiManagementServiceProperties) SetCreatedAtUtcAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedAtUtc = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ func (o *ApiManagementServiceUpdateProperties) GetCreatedAtUtcAsTime() (*time.Ti
}
return dates.ParseAsFormat(o.CreatedAtUtc, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiManagementServiceUpdateProperties) SetCreatedAtUtcAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedAtUtc = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ func (o *ApiReleaseContractProperties) GetCreatedDateTimeAsTime() (*time.Time, e
return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiReleaseContractProperties) SetCreatedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedDateTime = &formatted
}

func (o *ApiReleaseContractProperties) GetUpdatedDateTimeAsTime() (*time.Time, error) {
if o.UpdatedDateTime == nil {
return nil, nil
}
return dates.ParseAsFormat(o.UpdatedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiReleaseContractProperties) SetUpdatedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.UpdatedDateTime = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@ func (o *ApiRevisionContract) GetCreatedDateTimeAsTime() (*time.Time, error) {
return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiRevisionContract) SetCreatedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedDateTime = &formatted
}

func (o *ApiRevisionContract) GetUpdatedDateTimeAsTime() (*time.Time, error) {
if o.UpdatedDateTime == nil {
return nil, nil
}
return dates.ParseAsFormat(o.UpdatedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiRevisionContract) SetUpdatedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.UpdatedDateTime = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ for _, item := range items {
ctx := context.TODO()
id := policyfragment.NewPolicyFragmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "serviceValue", "policyFragmentValue")

read, err := client.ListReferences(ctx, id, policyfragment.DefaultListReferencesOperationOptions())
// alternatively `client.ListReferences(ctx, id, policyfragment.DefaultListReferencesOperationOptions())` can be used to do batched pagination
items, err := client.ListReferencesComplete(ctx, id, policyfragment.DefaultListReferencesOperationOptions())
if err != nil {
// handle the error
}
if model := read.Model; model != nil {
// do something with the model/response object
for _, item := range items {
// do something
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import (
type ListReferencesOperationResponse struct {
HttpResponse *http.Response
OData *odata.OData
Model *ResourceCollection
Model *[]Resource
}

type ListReferencesCompleteResult struct {
LatestHttpResponse *http.Response
Items []Resource
}

type ListReferencesOperationOptions struct {
Expand Down Expand Up @@ -67,7 +72,7 @@ func (c PolicyFragmentClient) ListReferences(ctx context.Context, id PolicyFragm
}

var resp *client.Response
resp, err = req.Execute(ctx)
resp, err = req.ExecutePaged(ctx)
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response
Expand All @@ -76,12 +81,43 @@ func (c PolicyFragmentClient) ListReferences(ctx context.Context, id PolicyFragm
return
}

var model ResourceCollection
result.Model = &model
var values struct {
Values *[]Resource `json:"value"`
}
if err = resp.Unmarshal(&values); err != nil {
return
}

result.Model = values.Values

if err = resp.Unmarshal(result.Model); err != nil {
return
}

// ListReferencesComplete retrieves all the results into a single object
func (c PolicyFragmentClient) ListReferencesComplete(ctx context.Context, id PolicyFragmentId, options ListReferencesOperationOptions) (ListReferencesCompleteResult, error) {
return c.ListReferencesCompleteMatchingPredicate(ctx, id, options, ResourceOperationPredicate{})
}

// ListReferencesCompleteMatchingPredicate retrieves all the results and then applies the predicate
func (c PolicyFragmentClient) ListReferencesCompleteMatchingPredicate(ctx context.Context, id PolicyFragmentId, options ListReferencesOperationOptions, predicate ResourceOperationPredicate) (result ListReferencesCompleteResult, err error) {
items := make([]Resource, 0)

resp, err := c.ListReferences(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 = ListReferencesCompleteResult{
LatestHttpResponse: resp.HttpResponse,
Items: items,
}
return
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,26 @@ func (p PolicyFragmentContractOperationPredicate) Matches(input PolicyFragmentCo

return true
}

type ResourceOperationPredicate struct {
Id *string
Name *string
Type *string
}

func (p ResourceOperationPredicate) Matches(input Resource) bool {

if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) {
return false
}

if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) {
return false
}

if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) {
return false
}

return true
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ func (o *PortalRevisionContractProperties) GetCreatedDateTimeAsTime() (*time.Tim
return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *PortalRevisionContractProperties) SetCreatedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedDateTime = &formatted
}

func (o *PortalRevisionContractProperties) GetUpdatedDateTimeAsTime() (*time.Time, error) {
if o.UpdatedDateTime == nil {
return nil, nil
}
return dates.ParseAsFormat(o.UpdatedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *PortalRevisionContractProperties) SetUpdatedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.UpdatedDateTime = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func (o *SubscriptionContractProperties) GetCreatedDateAsTime() (*time.Time, err
return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00")
}

func (o *SubscriptionContractProperties) SetCreatedDateAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedDate = &formatted
}

func (o *SubscriptionContractProperties) GetEndDateAsTime() (*time.Time, error) {
if o.EndDate == nil {
return nil, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func (o *SubscriptionContractProperties) GetCreatedDateAsTime() (*time.Time, err
return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00")
}

func (o *SubscriptionContractProperties) SetCreatedDateAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedDate = &formatted
}

func (o *SubscriptionContractProperties) GetEndDateAsTime() (*time.Time, error) {
if o.EndDate == nil {
return nil, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func (o *SubscriptionContractProperties) GetCreatedDateAsTime() (*time.Time, err
return dates.ParseAsFormat(o.CreatedDate, "2006-01-02T15:04:05Z07:00")
}

func (o *SubscriptionContractProperties) SetCreatedDateAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedDate = &formatted
}

func (o *SubscriptionContractProperties) GetEndDateAsTime() (*time.Time, error) {
if o.EndDate == nil {
return nil, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ func (o *ApiManagementServiceProperties) GetCreatedAtUtcAsTime() (*time.Time, er
}
return dates.ParseAsFormat(o.CreatedAtUtc, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiManagementServiceProperties) SetCreatedAtUtcAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedAtUtc = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ func (o *ApiManagementServiceUpdateProperties) GetCreatedAtUtcAsTime() (*time.Ti
}
return dates.ParseAsFormat(o.CreatedAtUtc, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiManagementServiceUpdateProperties) SetCreatedAtUtcAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedAtUtc = &formatted
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ func (o *ApiReleaseContractProperties) GetCreatedDateTimeAsTime() (*time.Time, e
return dates.ParseAsFormat(o.CreatedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiReleaseContractProperties) SetCreatedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.CreatedDateTime = &formatted
}

func (o *ApiReleaseContractProperties) GetUpdatedDateTimeAsTime() (*time.Time, error) {
if o.UpdatedDateTime == nil {
return nil, nil
}
return dates.ParseAsFormat(o.UpdatedDateTime, "2006-01-02T15:04:05Z07:00")
}

func (o *ApiReleaseContractProperties) SetUpdatedDateTimeAsTime(input time.Time) {
formatted := input.Format("2006-01-02T15:04:05Z07:00")
o.UpdatedDateTime = &formatted
}
Loading

0 comments on commit 09fe9f0

Please sign in to comment.