diff --git a/sdk/resourcemanager/orbital/armorbital/CHANGELOG.md b/sdk/resourcemanager/orbital/armorbital/CHANGELOG.md index 23de10d77feb..5bde20e3daa3 100644 --- a/sdk/resourcemanager/orbital/armorbital/CHANGELOG.md +++ b/sdk/resourcemanager/orbital/armorbital/CHANGELOG.md @@ -1,5 +1,27 @@ # Release History +## 2.0.0 (2023-03-24) +### Breaking Changes + +- Type alias `APIVersionParameter` has been removed +- Function `*AvailableGroundStationsClient.Get` has been removed +- Field `Etag` of struct `Contact` has been removed +- Field `Etag` of struct `ContactProfile` has been removed +- Field `Etag` of struct `Spacecraft` has been removed + +### Features Added + +- New struct `ClientFactory` which is a client factory used to create any client in this module +- New struct `ContactProfileThirdPartyConfiguration` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponse` +- New field `ThirdPartyConfigurations` in struct `ContactProfileProperties` +- New field `ThirdPartyConfigurations` in struct `ContactProfilesProperties` +- New field `NextLink` in struct `OperationResult` +- New field `Value` in struct `OperationResult` + + ## 1.0.0 (2022-05-19) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/orbital/armorbital/README.md b/sdk/resourcemanager/orbital/armorbital/README.md index 6d4ab756d461..f19b071f711d 100644 --- a/sdk/resourcemanager/orbital/armorbital/README.md +++ b/sdk/resourcemanager/orbital/armorbital/README.md @@ -33,12 +33,12 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Clients +## Client Factory -Azure Orbital modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. +Azure Orbital module consists of one or more clients. We provide a client factory which could be used to create any client in this module. ```go -client, err := armorbital.NewContactsClient(, cred, nil) +clientFactory, err := armorbital.NewClientFactory(, cred, nil) ``` You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). @@ -49,7 +49,15 @@ options := arm.ClientOptions { Cloud: cloud.AzureChina, }, } -client, err := armorbital.NewContactsClient(, cred, &options) +clientFactory, err := armorbital.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewContactsClient() ``` ## Provide Feedback diff --git a/sdk/resourcemanager/orbital/armorbital/autorest.md b/sdk/resourcemanager/orbital/armorbital/autorest.md index e8dc78b35cc2..35e1712e454b 100644 --- a/sdk/resourcemanager/orbital/armorbital/autorest.md +++ b/sdk/resourcemanager/orbital/armorbital/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/08a74065e38665d8a9bb5f2653e92b2abd45bf99/specification/orbital/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/08a74065e38665d8a9bb5f2653e92b2abd45bf99/specification/orbital/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_availablegroundstations_client.go b/sdk/resourcemanager/orbital/armorbital/availablegroundstations_client.go similarity index 52% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_availablegroundstations_client.go rename to sdk/resourcemanager/orbital/armorbital/availablegroundstations_client.go index 33ddd1fd8fdc..2d38a9bac19f 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_availablegroundstations_client.go +++ b/sdk/resourcemanager/orbital/armorbital/availablegroundstations_client.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 armorbital @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,93 +24,32 @@ import ( // AvailableGroundStationsClient contains the methods for the AvailableGroundStations group. // Don't use this type directly, use NewAvailableGroundStationsClient() instead. type AvailableGroundStationsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewAvailableGroundStationsClient creates a new instance of AvailableGroundStationsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAvailableGroundStationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableGroundStationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".AvailableGroundStationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &AvailableGroundStationsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } -// Get - Gets the specified available ground station -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// groundStationName - Ground Station name -// options - AvailableGroundStationsClientGetOptions contains the optional parameters for the AvailableGroundStationsClient.Get -// method. -func (client *AvailableGroundStationsClient) Get(ctx context.Context, groundStationName string, options *AvailableGroundStationsClientGetOptions) (AvailableGroundStationsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, groundStationName, options) - if err != nil { - return AvailableGroundStationsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return AvailableGroundStationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AvailableGroundStationsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *AvailableGroundStationsClient) getCreateRequest(ctx context.Context, groundStationName string, options *AvailableGroundStationsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Orbital/availableGroundStations/{groundStationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if groundStationName == "" { - return nil, errors.New("parameter groundStationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groundStationName}", url.PathEscape(groundStationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AvailableGroundStationsClient) getHandleResponse(resp *http.Response) (AvailableGroundStationsClientGetResponse, error) { - result := AvailableGroundStationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AvailableGroundStation); err != nil { - return AvailableGroundStationsClientGetResponse{}, err - } - return result, nil -} - -// NewListByCapabilityPager - Returns list of available ground stations -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// capability - Ground Station Capability -// options - AvailableGroundStationsClientListByCapabilityOptions contains the optional parameters for the AvailableGroundStationsClient.ListByCapability -// method. +// NewListByCapabilityPager - Returns list of available ground stations. +// +// Generated from API version 2022-11-01 +// - capability - Ground Station Capability. +// - options - AvailableGroundStationsClientListByCapabilityOptions contains the optional parameters for the AvailableGroundStationsClient.NewListByCapabilityPager +// method. func (client *AvailableGroundStationsClient) NewListByCapabilityPager(capability CapabilityParameter, options *AvailableGroundStationsClientListByCapabilityOptions) *runtime.Pager[AvailableGroundStationsClientListByCapabilityResponse] { return runtime.NewPager(runtime.PagingHandler[AvailableGroundStationsClientListByCapabilityResponse]{ More: func(page AvailableGroundStationsClientListByCapabilityResponse) bool { @@ -128,7 +66,7 @@ func (client *AvailableGroundStationsClient) NewListByCapabilityPager(capability if err != nil { return AvailableGroundStationsClientListByCapabilityResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return AvailableGroundStationsClientListByCapabilityResponse{}, err } @@ -147,12 +85,12 @@ func (client *AvailableGroundStationsClient) listByCapabilityCreateRequest(ctx c return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") reqQP.Set("capability", string(capability)) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} diff --git a/sdk/resourcemanager/orbital/armorbital/availablegroundstations_client_example_test.go b/sdk/resourcemanager/orbital/armorbital/availablegroundstations_client_example_test.go new file mode 100644 index 000000000000..aaa6058af65a --- /dev/null +++ b/sdk/resourcemanager/orbital/armorbital/availablegroundstations_client_example_test.go @@ -0,0 +1,72 @@ +//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 armorbital_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/AvailableGroundStationsByCapabilityList.json +func ExampleAvailableGroundStationsClient_NewListByCapabilityPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAvailableGroundStationsClient().NewListByCapabilityPager(armorbital.CapabilityParameterEarthObservation, nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AvailableGroundStationListResult = armorbital.AvailableGroundStationListResult{ + // Value: []*armorbital.AvailableGroundStation{ + // { + // Name: to.Ptr("EASTUS2_0"), + // Type: to.Ptr("Microsoft.Orbital/availableGroundStations"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/providers/Microsoft.Orbital/availableGroundStations/EASTUS2_0"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.AvailableGroundStationProperties{ + // AltitudeMeters: to.Ptr[float32](1641), + // City: to.Ptr("Atlanta"), + // LatitudeDegrees: to.Ptr[float32](33.74831), + // LongitudeDegrees: to.Ptr[float32](-84.39111), + // ProviderName: to.Ptr("Microsoft"), + // }, + // }, + // { + // Name: to.Ptr("EASTUS_1"), + // Type: to.Ptr("Microsoft.Orbital/availableGroundStations"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/providers/Microsoft.Orbital/availableGroundStations/EASTUS_1"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.AvailableGroundStationProperties{ + // AltitudeMeters: to.Ptr[float32](128), + // City: to.Ptr("Reston"), + // LatitudeDegrees: to.Ptr[float32](38.9586307), + // LongitudeDegrees: to.Ptr[float32](-77.357002), + // ProviderName: to.Ptr("Microsoft"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/orbital/armorbital/client_factory.go b/sdk/resourcemanager/orbital/armorbital/client_factory.go new file mode 100644 index 000000000000..17393744ff0e --- /dev/null +++ b/sdk/resourcemanager/orbital/armorbital/client_factory.go @@ -0,0 +1,69 @@ +//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 armorbital + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSpacecraftsClient() *SpacecraftsClient { + subClient, _ := NewSpacecraftsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewContactsClient() *ContactsClient { + subClient, _ := NewContactsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewContactProfilesClient() *ContactProfilesClient { + subClient, _ := NewContactProfilesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAvailableGroundStationsClient() *AvailableGroundStationsClient { + subClient, _ := NewAvailableGroundStationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsResultsClient() *OperationsResultsClient { + subClient, _ := NewOperationsResultsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_constants.go b/sdk/resourcemanager/orbital/armorbital/constants.go similarity index 81% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_constants.go rename to sdk/resourcemanager/orbital/armorbital/constants.go index 14f241071afd..c7363b1e9848 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_constants.go +++ b/sdk/resourcemanager/orbital/armorbital/constants.go @@ -5,31 +5,15 @@ // 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 armorbital const ( moduleName = "armorbital" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) -type APIVersionParameter string - -const ( - APIVersionParameterTwoThousandTwenty0901Preview APIVersionParameter = "2020-09-01-preview" - APIVersionParameterTwoThousandTwentyOne0404Preview APIVersionParameter = "2021-04-04-preview" - APIVersionParameterTwoThousandTwentyTwo0301 APIVersionParameter = "2022-03-01" -) - -// PossibleAPIVersionParameterValues returns the possible values for the APIVersionParameter const type. -func PossibleAPIVersionParameterValues() []APIVersionParameter { - return []APIVersionParameter{ - APIVersionParameterTwoThousandTwenty0901Preview, - APIVersionParameterTwoThousandTwentyOne0404Preview, - APIVersionParameterTwoThousandTwentyTwo0301, - } -} - // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string @@ -44,7 +28,7 @@ func PossibleActionTypeValues() []ActionType { } } -// AutoTrackingConfiguration - Auto track configuration. +// AutoTrackingConfiguration - Auto-tracking configuration. type AutoTrackingConfiguration string const ( @@ -93,16 +77,16 @@ func PossibleCapabilityParameterValues() []CapabilityParameter { } } -// ContactProfilesPropertiesProvisioningState - The current state of the resource's creation, deletion, or modification +// ContactProfilesPropertiesProvisioningState - The current state of the resource's creation, deletion, or modification. type ContactProfilesPropertiesProvisioningState string const ( - ContactProfilesPropertiesProvisioningStateCanceled ContactProfilesPropertiesProvisioningState = "Canceled" - ContactProfilesPropertiesProvisioningStateCreating ContactProfilesPropertiesProvisioningState = "Creating" - ContactProfilesPropertiesProvisioningStateDeleting ContactProfilesPropertiesProvisioningState = "Deleting" - ContactProfilesPropertiesProvisioningStateFailed ContactProfilesPropertiesProvisioningState = "Failed" - ContactProfilesPropertiesProvisioningStateSucceeded ContactProfilesPropertiesProvisioningState = "Succeeded" - ContactProfilesPropertiesProvisioningStateUpdating ContactProfilesPropertiesProvisioningState = "Updating" + ContactProfilesPropertiesProvisioningStateCanceled ContactProfilesPropertiesProvisioningState = "canceled" + ContactProfilesPropertiesProvisioningStateCreating ContactProfilesPropertiesProvisioningState = "creating" + ContactProfilesPropertiesProvisioningStateDeleting ContactProfilesPropertiesProvisioningState = "deleting" + ContactProfilesPropertiesProvisioningStateFailed ContactProfilesPropertiesProvisioningState = "failed" + ContactProfilesPropertiesProvisioningStateSucceeded ContactProfilesPropertiesProvisioningState = "succeeded" + ContactProfilesPropertiesProvisioningStateUpdating ContactProfilesPropertiesProvisioningState = "updating" ) // PossibleContactProfilesPropertiesProvisioningStateValues returns the possible values for the ContactProfilesPropertiesProvisioningState const type. @@ -117,16 +101,16 @@ func PossibleContactProfilesPropertiesProvisioningStateValues() []ContactProfile } } -// ContactsPropertiesProvisioningState - The current state of the resource's creation, deletion, or modification +// ContactsPropertiesProvisioningState - The current state of the resource's creation, deletion, or modification. type ContactsPropertiesProvisioningState string const ( - ContactsPropertiesProvisioningStateCanceled ContactsPropertiesProvisioningState = "Canceled" - ContactsPropertiesProvisioningStateCreating ContactsPropertiesProvisioningState = "Creating" - ContactsPropertiesProvisioningStateDeleting ContactsPropertiesProvisioningState = "Deleting" - ContactsPropertiesProvisioningStateFailed ContactsPropertiesProvisioningState = "Failed" - ContactsPropertiesProvisioningStateSucceeded ContactsPropertiesProvisioningState = "Succeeded" - ContactsPropertiesProvisioningStateUpdating ContactsPropertiesProvisioningState = "Updating" + ContactsPropertiesProvisioningStateCanceled ContactsPropertiesProvisioningState = "canceled" + ContactsPropertiesProvisioningStateCreating ContactsPropertiesProvisioningState = "creating" + ContactsPropertiesProvisioningStateDeleting ContactsPropertiesProvisioningState = "deleting" + ContactsPropertiesProvisioningStateFailed ContactsPropertiesProvisioningState = "failed" + ContactsPropertiesProvisioningStateSucceeded ContactsPropertiesProvisioningState = "succeeded" + ContactsPropertiesProvisioningStateUpdating ContactsPropertiesProvisioningState = "updating" ) // PossibleContactsPropertiesProvisioningStateValues returns the possible values for the ContactsPropertiesProvisioningState const type. @@ -145,21 +129,21 @@ func PossibleContactsPropertiesProvisioningStateValues() []ContactsPropertiesPro type ContactsStatus string const ( - ContactsStatusScheduled ContactsStatus = "scheduled" ContactsStatusCancelled ContactsStatus = "cancelled" - ContactsStatusSucceeded ContactsStatus = "succeeded" ContactsStatusFailed ContactsStatus = "failed" ContactsStatusProviderCancelled ContactsStatus = "providerCancelled" + ContactsStatusScheduled ContactsStatus = "scheduled" + ContactsStatusSucceeded ContactsStatus = "succeeded" ) // PossibleContactsStatusValues returns the possible values for the ContactsStatus const type. func PossibleContactsStatusValues() []ContactsStatus { return []ContactsStatus{ - ContactsStatusScheduled, ContactsStatusCancelled, - ContactsStatusSucceeded, ContactsStatusFailed, ContactsStatusProviderCancelled, + ContactsStatusScheduled, + ContactsStatusSucceeded, } } @@ -183,12 +167,12 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// Direction - Direction (uplink or downlink) +// Direction - Direction (Uplink or Downlink). type Direction string const ( - DirectionDownlink Direction = "downlink" - DirectionUplink Direction = "uplink" + DirectionDownlink Direction = "Downlink" + DirectionUplink Direction = "Uplink" ) // PossibleDirectionValues returns the possible values for the Direction const type. @@ -218,7 +202,7 @@ func PossibleOriginValues() []Origin { } } -// Polarization - polarization. eg (RHCP, LHCP) +// Polarization - Polarization. e.g. (RHCP, LHCP). type Polarization string const ( @@ -254,16 +238,16 @@ func PossibleProtocolValues() []Protocol { } } -// ProvisioningState - The current state of the resource's creation, deletion, or modification +// ProvisioningState - The current state of the resource's creation, deletion, or modification. type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + ProvisioningStateCanceled ProvisioningState = "canceled" + ProvisioningStateCreating ProvisioningState = "creating" + ProvisioningStateDeleting ProvisioningState = "deleting" + ProvisioningStateFailed ProvisioningState = "failed" + ProvisioningStateSucceeded ProvisioningState = "succeeded" + ProvisioningStateUpdating ProvisioningState = "updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. @@ -278,7 +262,7 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ReleaseMode - Release Status of a ground station +// ReleaseMode - Release Status of a ground station. type ReleaseMode string const ( @@ -294,16 +278,16 @@ func PossibleReleaseModeValues() []ReleaseMode { } } -// SpacecraftsPropertiesProvisioningState - The current state of the resource's creation, deletion, or modification +// SpacecraftsPropertiesProvisioningState - The current state of the resource's creation, deletion, or modification. type SpacecraftsPropertiesProvisioningState string const ( - SpacecraftsPropertiesProvisioningStateCanceled SpacecraftsPropertiesProvisioningState = "Canceled" - SpacecraftsPropertiesProvisioningStateCreating SpacecraftsPropertiesProvisioningState = "Creating" - SpacecraftsPropertiesProvisioningStateDeleting SpacecraftsPropertiesProvisioningState = "Deleting" - SpacecraftsPropertiesProvisioningStateFailed SpacecraftsPropertiesProvisioningState = "Failed" - SpacecraftsPropertiesProvisioningStateSucceeded SpacecraftsPropertiesProvisioningState = "Succeeded" - SpacecraftsPropertiesProvisioningStateUpdating SpacecraftsPropertiesProvisioningState = "Updating" + SpacecraftsPropertiesProvisioningStateCanceled SpacecraftsPropertiesProvisioningState = "canceled" + SpacecraftsPropertiesProvisioningStateCreating SpacecraftsPropertiesProvisioningState = "creating" + SpacecraftsPropertiesProvisioningStateDeleting SpacecraftsPropertiesProvisioningState = "deleting" + SpacecraftsPropertiesProvisioningStateFailed SpacecraftsPropertiesProvisioningState = "failed" + SpacecraftsPropertiesProvisioningStateSucceeded SpacecraftsPropertiesProvisioningState = "succeeded" + SpacecraftsPropertiesProvisioningStateUpdating SpacecraftsPropertiesProvisioningState = "updating" ) // PossibleSpacecraftsPropertiesProvisioningStateValues returns the possible values for the SpacecraftsPropertiesProvisioningState const type. diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_contactprofiles_client.go b/sdk/resourcemanager/orbital/armorbital/contactprofiles_client.go similarity index 80% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_contactprofiles_client.go rename to sdk/resourcemanager/orbital/armorbital/contactprofiles_client.go index c935248ae0f8..515964f7e457 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_contactprofiles_client.go +++ b/sdk/resourcemanager/orbital/armorbital/contactprofiles_client.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 armorbital @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,66 +24,59 @@ import ( // ContactProfilesClient contains the methods for the ContactProfiles group. // Don't use this type directly, use NewContactProfilesClient() instead. type ContactProfilesClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewContactProfilesClient creates a new instance of ContactProfilesClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewContactProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContactProfilesClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ContactProfilesClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ContactProfilesClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } -// BeginCreateOrUpdate - Creates or updates a contact profile +// BeginCreateOrUpdate - Creates or updates a contact profile. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// contactProfileName - Contact Profile Name -// parameters - The parameters to provide for the created Contact Profile. -// options - ContactProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the ContactProfilesClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - contactProfileName - Contact Profile name. +// - parameters - The parameters to provide for the created Contact Profile. +// - options - ContactProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the ContactProfilesClient.BeginCreateOrUpdate +// method. func (client *ContactProfilesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, contactProfileName string, parameters ContactProfile, options *ContactProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ContactProfilesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, contactProfileName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ContactProfilesClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContactProfilesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[ContactProfilesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ContactProfilesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } -// CreateOrUpdate - Creates or updates a contact profile +// CreateOrUpdate - Creates or updates a contact profile. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *ContactProfilesClient) createOrUpdate(ctx context.Context, resourceGroupName string, contactProfileName string, parameters ContactProfile, options *ContactProfilesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, contactProfileName, parameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -109,12 +101,12 @@ func (client *ContactProfilesClient) createOrUpdateCreateRequest(ctx context.Con return nil, errors.New("parameter contactProfileName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{contactProfileName}", url.PathEscape(contactProfileName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,34 +114,36 @@ func (client *ContactProfilesClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Deletes a specified contact profile resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// contactProfileName - Contact Profile Name -// options - ContactProfilesClientBeginDeleteOptions contains the optional parameters for the ContactProfilesClient.BeginDelete -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - contactProfileName - Contact Profile name. +// - options - ContactProfilesClientBeginDeleteOptions contains the optional parameters for the ContactProfilesClient.BeginDelete +// method. func (client *ContactProfilesClient) BeginDelete(ctx context.Context, resourceGroupName string, contactProfileName string, options *ContactProfilesClientBeginDeleteOptions) (*runtime.Poller[ContactProfilesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, contactProfileName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ContactProfilesClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContactProfilesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[ContactProfilesClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ContactProfilesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a specified contact profile resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *ContactProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, contactProfileName string, options *ContactProfilesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, contactProfileName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -174,29 +168,30 @@ func (client *ContactProfilesClient) deleteCreateRequest(ctx context.Context, re return nil, errors.New("parameter contactProfileName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{contactProfileName}", url.PathEscape(contactProfileName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Gets the specified contact Profile in a specified resource group +// Get - Gets the specified contact Profile in a specified resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// contactProfileName - Contact Profile Name -// options - ContactProfilesClientGetOptions contains the optional parameters for the ContactProfilesClient.Get method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - contactProfileName - Contact Profile name. +// - options - ContactProfilesClientGetOptions contains the optional parameters for the ContactProfilesClient.Get method. func (client *ContactProfilesClient) Get(ctx context.Context, resourceGroupName string, contactProfileName string, options *ContactProfilesClientGetOptions) (ContactProfilesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, contactProfileName, options) if err != nil { return ContactProfilesClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContactProfilesClientGetResponse{}, err } @@ -221,12 +216,12 @@ func (client *ContactProfilesClient) getCreateRequest(ctx context.Context, resou return nil, errors.New("parameter contactProfileName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{contactProfileName}", url.PathEscape(contactProfileName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -241,11 +236,12 @@ func (client *ContactProfilesClient) getHandleResponse(resp *http.Response) (Con return result, nil } -// NewListPager - Returns list of contact profiles by Resource Group -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ContactProfilesClientListOptions contains the optional parameters for the ContactProfilesClient.List method. +// NewListPager - Returns list of contact profiles by Resource Group. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ContactProfilesClientListOptions contains the optional parameters for the ContactProfilesClient.NewListPager +// method. func (client *ContactProfilesClient) NewListPager(resourceGroupName string, options *ContactProfilesClientListOptions) *runtime.Pager[ContactProfilesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ContactProfilesClientListResponse]{ More: func(page ContactProfilesClientListResponse) bool { @@ -262,7 +258,7 @@ func (client *ContactProfilesClient) NewListPager(resourceGroupName string, opti if err != nil { return ContactProfilesClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContactProfilesClientListResponse{}, err } @@ -285,12 +281,12 @@ func (client *ContactProfilesClient) listCreateRequest(ctx context.Context, reso return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } @@ -308,11 +304,11 @@ func (client *ContactProfilesClient) listHandleResponse(resp *http.Response) (Co return result, nil } -// NewListBySubscriptionPager - Returns list of contact profiles by Subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// options - ContactProfilesClientListBySubscriptionOptions contains the optional parameters for the ContactProfilesClient.ListBySubscription -// method. +// NewListBySubscriptionPager - Returns list of contact profiles by Subscription. +// +// Generated from API version 2022-11-01 +// - options - ContactProfilesClientListBySubscriptionOptions contains the optional parameters for the ContactProfilesClient.NewListBySubscriptionPager +// method. func (client *ContactProfilesClient) NewListBySubscriptionPager(options *ContactProfilesClientListBySubscriptionOptions) *runtime.Pager[ContactProfilesClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ContactProfilesClientListBySubscriptionResponse]{ More: func(page ContactProfilesClientListBySubscriptionResponse) bool { @@ -329,7 +325,7 @@ func (client *ContactProfilesClient) NewListBySubscriptionPager(options *Contact if err != nil { return ContactProfilesClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContactProfilesClientListBySubscriptionResponse{}, err } @@ -348,12 +344,12 @@ func (client *ContactProfilesClient) listBySubscriptionCreateRequest(ctx context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } @@ -373,35 +369,37 @@ func (client *ContactProfilesClient) listBySubscriptionHandleResponse(resp *http // BeginUpdateTags - Updates the specified contact profile tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// contactProfileName - Contact Profile Name -// parameters - Parameters supplied to update contact profile tags. -// options - ContactProfilesClientBeginUpdateTagsOptions contains the optional parameters for the ContactProfilesClient.BeginUpdateTags -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - contactProfileName - Contact Profile name. +// - parameters - Parameters supplied to update contact profile tags. +// - options - ContactProfilesClientBeginUpdateTagsOptions contains the optional parameters for the ContactProfilesClient.BeginUpdateTags +// method. func (client *ContactProfilesClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, contactProfileName string, parameters TagsObject, options *ContactProfilesClientBeginUpdateTagsOptions) (*runtime.Poller[ContactProfilesClientUpdateTagsResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.updateTags(ctx, resourceGroupName, contactProfileName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ContactProfilesClientUpdateTagsResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContactProfilesClientUpdateTagsResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[ContactProfilesClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ContactProfilesClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // UpdateTags - Updates the specified contact profile tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *ContactProfilesClient) updateTags(ctx context.Context, resourceGroupName string, contactProfileName string, parameters TagsObject, options *ContactProfilesClientBeginUpdateTagsOptions) (*http.Response, error) { req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, contactProfileName, parameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -426,12 +424,12 @@ func (client *ContactProfilesClient) updateTagsCreateRequest(ctx context.Context return nil, errors.New("parameter contactProfileName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{contactProfileName}", url.PathEscape(contactProfileName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/orbital/armorbital/contactprofiles_client_example_test.go b/sdk/resourcemanager/orbital/armorbital/contactprofiles_client_example_test.go new file mode 100644 index 000000000000..99c001512aa2 --- /dev/null +++ b/sdk/resourcemanager/orbital/armorbital/contactprofiles_client_example_test.go @@ -0,0 +1,552 @@ +//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 armorbital_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactProfileGet.json +func ExampleContactProfilesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewContactProfilesClient().Get(ctx, "contoso-Rgp", "CONTOSO-CP", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContactProfile = armorbital.ContactProfile{ + // Name: to.Ptr("CONTOSO-CP"), + // Type: to.Ptr("Microsoft.Orbital/contactProfiles"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.ContactProfileProperties{ + // AutoTrackingConfiguration: to.Ptr(armorbital.AutoTrackingConfigurationDisabled), + // EventHubURI: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.EventHub/namespaces/contosoHub/eventhubs/contosoHub"), + // Links: []*armorbital.ContactProfileLink{ + // { + // Name: to.Ptr("contoso-uplink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-uplink-channel"), + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Uplink"), + // IPAddress: to.Ptr("10.1.0.4"), + // Port: to.Ptr("50000"), + // Protocol: to.Ptr(armorbital.ProtocolTCP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionUplink), + // EirpdBW: to.Ptr[float32](45), + // GainOverTemperature: to.Ptr[float32](0), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("contoso-downlink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-downlink-channel"), + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Downlink"), + // IPAddress: to.Ptr("10.1.0.5"), + // Port: to.Ptr("51103"), + // Protocol: to.Ptr(armorbital.ProtocolUDP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionDownlink), + // EirpdBW: to.Ptr[float32](0), + // GainOverTemperature: to.Ptr[float32](25), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // MinimumElevationDegrees: to.Ptr[float32](5), + // MinimumViableContactDuration: to.Ptr("PT1M"), + // NetworkConfiguration: &armorbital.ContactProfilesPropertiesNetworkConfiguration{ + // SubnetID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Network/virtualNetworks/contoso-vnet/subnets/orbital-delegated-subnet"), + // }, + // ProvisioningState: to.Ptr(armorbital.ContactProfilesPropertiesProvisioningState("Succeeded")), + // ThirdPartyConfigurations: []*armorbital.ContactProfileThirdPartyConfiguration{ + // { + // MissionConfiguration: to.Ptr("Ksat_MissionConfiguration"), + // ProviderName: to.Ptr("KSAT"), + // }, + // { + // MissionConfiguration: to.Ptr("Viasat_Configuration"), + // ProviderName: to.Ptr("VIASAT"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactProfileCreate.json +func ExampleContactProfilesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewContactProfilesClient().BeginCreateOrUpdate(ctx, "contoso-Rgp", "CONTOSO-CP", armorbital.ContactProfile{ + Location: to.Ptr("eastus2"), + Properties: &armorbital.ContactProfileProperties{ + AutoTrackingConfiguration: to.Ptr(armorbital.AutoTrackingConfigurationDisabled), + EventHubURI: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.EventHub/namespaces/contosoHub/eventhubs/contosoHub"), + Links: []*armorbital.ContactProfileLink{ + { + Name: to.Ptr("contoso-uplink"), + Channels: []*armorbital.ContactProfileLinkChannel{ + { + Name: to.Ptr("contoso-uplink-channel"), + BandwidthMHz: to.Ptr[float32](2), + CenterFrequencyMHz: to.Ptr[float32](2250), + EndPoint: &armorbital.EndPoint{ + EndPointName: to.Ptr("ContosoTest_Uplink"), + IPAddress: to.Ptr("10.1.0.4"), + Port: to.Ptr("50000"), + Protocol: to.Ptr(armorbital.ProtocolTCP), + }, + }}, + Direction: to.Ptr(armorbital.DirectionUplink), + EirpdBW: to.Ptr[float32](45), + GainOverTemperature: to.Ptr[float32](0), + Polarization: to.Ptr(armorbital.PolarizationLHCP), + }, + { + Name: to.Ptr("contoso-downlink"), + Channels: []*armorbital.ContactProfileLinkChannel{ + { + Name: to.Ptr("contoso-downlink-channel"), + BandwidthMHz: to.Ptr[float32](15), + CenterFrequencyMHz: to.Ptr[float32](8160), + EndPoint: &armorbital.EndPoint{ + EndPointName: to.Ptr("ContosoTest_Downlink"), + IPAddress: to.Ptr("10.1.0.5"), + Port: to.Ptr("50001"), + Protocol: to.Ptr(armorbital.ProtocolUDP), + }, + }}, + Direction: to.Ptr(armorbital.DirectionDownlink), + EirpdBW: to.Ptr[float32](0), + GainOverTemperature: to.Ptr[float32](25), + Polarization: to.Ptr(armorbital.PolarizationRHCP), + }}, + MinimumElevationDegrees: to.Ptr[float32](5), + MinimumViableContactDuration: to.Ptr("PT1M"), + NetworkConfiguration: &armorbital.ContactProfilesPropertiesNetworkConfiguration{ + SubnetID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Network/virtualNetworks/contoso-vnet/subnets/orbital-delegated-subnet"), + }, + ThirdPartyConfigurations: []*armorbital.ContactProfileThirdPartyConfiguration{ + { + MissionConfiguration: to.Ptr("Ksat_MissionConfiguration"), + ProviderName: to.Ptr("KSAT"), + }, + { + MissionConfiguration: to.Ptr("Viasat_Configuration"), + ProviderName: to.Ptr("VIASAT"), + }}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContactProfile = armorbital.ContactProfile{ + // Name: to.Ptr("CONTOSO-CP"), + // Type: to.Ptr("Microsoft.Orbital/contactProfiles"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.ContactProfileProperties{ + // AutoTrackingConfiguration: to.Ptr(armorbital.AutoTrackingConfigurationDisabled), + // EventHubURI: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.EventHub/namespaces/contosoHub/eventhubs/contosoHub"), + // Links: []*armorbital.ContactProfileLink{ + // { + // Name: to.Ptr("contoso-uplink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-uplink-channel"), + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Uplink"), + // IPAddress: to.Ptr("10.1.0.4"), + // Port: to.Ptr("50000"), + // Protocol: to.Ptr(armorbital.ProtocolTCP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionUplink), + // EirpdBW: to.Ptr[float32](45), + // GainOverTemperature: to.Ptr[float32](0), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("contoso-downlink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-downlink-channel"), + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Downlink"), + // IPAddress: to.Ptr("10.1.0.5"), + // Port: to.Ptr("50001"), + // Protocol: to.Ptr(armorbital.ProtocolUDP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionDownlink), + // EirpdBW: to.Ptr[float32](0), + // GainOverTemperature: to.Ptr[float32](25), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // MinimumElevationDegrees: to.Ptr[float32](5), + // MinimumViableContactDuration: to.Ptr("PT1M"), + // NetworkConfiguration: &armorbital.ContactProfilesPropertiesNetworkConfiguration{ + // SubnetID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Network/virtualNetworks/contoso-vnet/subnets/orbital-delegated-subnet"), + // }, + // ProvisioningState: to.Ptr(armorbital.ContactProfilesPropertiesProvisioningState("Succeeded")), + // ThirdPartyConfigurations: []*armorbital.ContactProfileThirdPartyConfiguration{ + // { + // MissionConfiguration: to.Ptr("Ksat_MissionConfiguration"), + // ProviderName: to.Ptr("KSAT"), + // }, + // { + // MissionConfiguration: to.Ptr("Viasat_Configuration"), + // ProviderName: to.Ptr("VIASAT"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactProfileDelete.json +func ExampleContactProfilesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewContactProfilesClient().BeginDelete(ctx, "contoso-Rgp", "CONTOSO-CP", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactProfileUpdateTag.json +func ExampleContactProfilesClient_BeginUpdateTags() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewContactProfilesClient().BeginUpdateTags(ctx, "contoso-Rgp", "CONTOSO-CP", armorbital.TagsObject{ + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ContactProfile = armorbital.ContactProfile{ + // Name: to.Ptr("CONTOSO-CP"), + // Type: to.Ptr("Microsoft.Orbital/contactProfiles"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // Properties: &armorbital.ContactProfileProperties{ + // AutoTrackingConfiguration: to.Ptr(armorbital.AutoTrackingConfigurationDisabled), + // EventHubURI: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.EventHub/namespaces/contosoHub/eventhubs/contosoHub"), + // Links: []*armorbital.ContactProfileLink{ + // { + // Name: to.Ptr("contoso-uplink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-uplink-channel"), + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Uplink"), + // IPAddress: to.Ptr("10.1.0.4"), + // Port: to.Ptr("50000"), + // Protocol: to.Ptr(armorbital.ProtocolTCP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionUplink), + // EirpdBW: to.Ptr[float32](45), + // GainOverTemperature: to.Ptr[float32](0), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("contoso-downlink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-downlink-channel"), + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Downlink"), + // IPAddress: to.Ptr("10.1.0.5"), + // Port: to.Ptr("50001"), + // Protocol: to.Ptr(armorbital.ProtocolUDP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionDownlink), + // EirpdBW: to.Ptr[float32](0), + // GainOverTemperature: to.Ptr[float32](25), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // MinimumElevationDegrees: to.Ptr[float32](5), + // MinimumViableContactDuration: to.Ptr("PT1M"), + // NetworkConfiguration: &armorbital.ContactProfilesPropertiesNetworkConfiguration{ + // SubnetID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Network/virtualNetworks/contoso-vnet/subnets/orbital-delegated-subnet"), + // }, + // ProvisioningState: to.Ptr(armorbital.ContactProfilesPropertiesProvisioningState("Succeeded")), + // ThirdPartyConfigurations: []*armorbital.ContactProfileThirdPartyConfiguration{ + // { + // MissionConfiguration: to.Ptr("Ksat_MissionConfiguration"), + // ProviderName: to.Ptr("KSAT"), + // }, + // { + // MissionConfiguration: to.Ptr("Viasat_Configuration"), + // ProviderName: to.Ptr("VIASAT"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactProfilesBySubscriptionList.json +func ExampleContactProfilesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewContactProfilesClient().NewListBySubscriptionPager(&armorbital.ContactProfilesClientListBySubscriptionOptions{Skiptoken: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ContactProfileListResult = armorbital.ContactProfileListResult{ + // Value: []*armorbital.ContactProfile{ + // { + // Name: to.Ptr("CONTOSO-CP"), + // Type: to.Ptr("Microsoft.Orbital/contactProfiles"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.ContactProfileProperties{ + // AutoTrackingConfiguration: to.Ptr(armorbital.AutoTrackingConfigurationDisabled), + // EventHubURI: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.EventHub/namespaces/contosoHub/eventhubs/contosoHub"), + // Links: []*armorbital.ContactProfileLink{ + // { + // Name: to.Ptr("contoso-uplink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-uplink-channel"), + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Uplink"), + // IPAddress: to.Ptr("10.1.0.4"), + // Port: to.Ptr("50000"), + // Protocol: to.Ptr(armorbital.ProtocolTCP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionUplink), + // EirpdBW: to.Ptr[float32](45), + // GainOverTemperature: to.Ptr[float32](0), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("contoso-downlink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-downlink-channel"), + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Downlink"), + // IPAddress: to.Ptr("10.1.0.5"), + // Port: to.Ptr("50001"), + // Protocol: to.Ptr(armorbital.ProtocolUDP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionDownlink), + // EirpdBW: to.Ptr[float32](0), + // GainOverTemperature: to.Ptr[float32](25), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // MinimumElevationDegrees: to.Ptr[float32](5), + // MinimumViableContactDuration: to.Ptr("PT1M"), + // NetworkConfiguration: &armorbital.ContactProfilesPropertiesNetworkConfiguration{ + // SubnetID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Network/virtualNetworks/contoso-vnet/subnets/orbital-delegated-subnet"), + // }, + // ProvisioningState: to.Ptr(armorbital.ContactProfilesPropertiesProvisioningState("Succeeded")), + // ThirdPartyConfigurations: []*armorbital.ContactProfileThirdPartyConfiguration{ + // { + // MissionConfiguration: to.Ptr("Ksat_MissionConfiguration"), + // ProviderName: to.Ptr("KSAT"), + // }, + // { + // MissionConfiguration: to.Ptr("Viasat_Configuration"), + // ProviderName: to.Ptr("VIASAT"), + // }}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactProfilesByResourceGroupList.json +func ExampleContactProfilesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewContactProfilesClient().NewListPager("contoso-Rgp", &armorbital.ContactProfilesClientListOptions{Skiptoken: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ContactProfileListResult = armorbital.ContactProfileListResult{ + // Value: []*armorbital.ContactProfile{ + // { + // Name: to.Ptr("CONTOSO-CP"), + // Type: to.Ptr("Microsoft.Orbital/contactProfiles"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.ContactProfileProperties{ + // AutoTrackingConfiguration: to.Ptr(armorbital.AutoTrackingConfigurationDisabled), + // EventHubURI: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.EventHub/namespaces/contosoHub/eventhubs/contosoHub"), + // Links: []*armorbital.ContactProfileLink{ + // { + // Name: to.Ptr("contoso-uplink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-uplink-channel"), + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Uplink"), + // IPAddress: to.Ptr("10.1.0.4"), + // Port: to.Ptr("50000"), + // Protocol: to.Ptr(armorbital.ProtocolTCP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionUplink), + // EirpdBW: to.Ptr[float32](45), + // GainOverTemperature: to.Ptr[float32](0), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("contoso-downlink"), + // Channels: []*armorbital.ContactProfileLinkChannel{ + // { + // Name: to.Ptr("contoso-downlink-channel"), + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // EndPoint: &armorbital.EndPoint{ + // EndPointName: to.Ptr("ContosoTest_Downlink"), + // IPAddress: to.Ptr("10.1.0.5"), + // Port: to.Ptr("50001"), + // Protocol: to.Ptr(armorbital.ProtocolUDP), + // }, + // }}, + // Direction: to.Ptr(armorbital.DirectionDownlink), + // EirpdBW: to.Ptr[float32](0), + // GainOverTemperature: to.Ptr[float32](25), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // MinimumElevationDegrees: to.Ptr[float32](5), + // MinimumViableContactDuration: to.Ptr("PT1M"), + // NetworkConfiguration: &armorbital.ContactProfilesPropertiesNetworkConfiguration{ + // SubnetID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Network/virtualNetworks/contoso-vnet/subnets/orbital-delegated-subnet"), + // }, + // ProvisioningState: to.Ptr(armorbital.ContactProfilesPropertiesProvisioningState("Succeeded")), + // ThirdPartyConfigurations: []*armorbital.ContactProfileThirdPartyConfiguration{ + // { + // MissionConfiguration: to.Ptr("Ksat_MissionConfiguration"), + // ProviderName: to.Ptr("KSAT"), + // }, + // { + // MissionConfiguration: to.Ptr("Viasat_Configuration"), + // ProviderName: to.Ptr("VIASAT"), + // }}, + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_contacts_client.go b/sdk/resourcemanager/orbital/armorbital/contacts_client.go similarity index 79% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_contacts_client.go rename to sdk/resourcemanager/orbital/armorbital/contacts_client.go index 6ba388d32c23..39defa8995b5 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_contacts_client.go +++ b/sdk/resourcemanager/orbital/armorbital/contacts_client.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 armorbital @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,66 +24,59 @@ import ( // ContactsClient contains the methods for the Contacts group. // Don't use this type directly, use NewContactsClient() instead. type ContactsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewContactsClient creates a new instance of ContactsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewContactsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContactsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".ContactsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &ContactsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginCreate - Creates a contact. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// contactName - Contact Name -// parameters - The parameters to provide for the created contact. -// options - ContactsClientBeginCreateOptions contains the optional parameters for the ContactsClient.BeginCreate method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - contactName - Contact name. +// - parameters - The parameters to provide for the created contact. +// - options - ContactsClientBeginCreateOptions contains the optional parameters for the ContactsClient.BeginCreate method. func (client *ContactsClient) BeginCreate(ctx context.Context, resourceGroupName string, spacecraftName string, contactName string, parameters Contact, options *ContactsClientBeginCreateOptions) (*runtime.Poller[ContactsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, resourceGroupName, spacecraftName, contactName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ContactsClientCreateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContactsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[ContactsClientCreateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ContactsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Create - Creates a contact. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *ContactsClient) create(ctx context.Context, resourceGroupName string, spacecraftName string, contactName string, parameters Contact, options *ContactsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, spacecraftName, contactName, parameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -113,47 +105,49 @@ func (client *ContactsClient) createCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter contactName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{contactName}", url.PathEscape(contactName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } -// BeginDelete - Deletes a specified contact +// BeginDelete - Deletes a specified contact. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// contactName - Contact Name -// options - ContactsClientBeginDeleteOptions contains the optional parameters for the ContactsClient.BeginDelete method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - contactName - Contact name. +// - options - ContactsClientBeginDeleteOptions contains the optional parameters for the ContactsClient.BeginDelete method. func (client *ContactsClient) BeginDelete(ctx context.Context, resourceGroupName string, spacecraftName string, contactName string, options *ContactsClientBeginDeleteOptions) (*runtime.Poller[ContactsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, spacecraftName, contactName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ContactsClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContactsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[ContactsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[ContactsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } -// Delete - Deletes a specified contact +// Delete - Deletes a specified contact. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *ContactsClient) deleteOperation(ctx context.Context, resourceGroupName string, spacecraftName string, contactName string, options *ContactsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, spacecraftName, contactName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -182,30 +176,31 @@ func (client *ContactsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter contactName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{contactName}", url.PathEscape(contactName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Gets the specified contact in a specified resource group +// Get - Gets the specified contact in a specified resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// contactName - Contact Name -// options - ContactsClientGetOptions contains the optional parameters for the ContactsClient.Get method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - contactName - Contact name. +// - options - ContactsClientGetOptions contains the optional parameters for the ContactsClient.Get method. func (client *ContactsClient) Get(ctx context.Context, resourceGroupName string, spacecraftName string, contactName string, options *ContactsClientGetOptions) (ContactsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, spacecraftName, contactName, options) if err != nil { return ContactsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContactsClientGetResponse{}, err } @@ -234,12 +229,12 @@ func (client *ContactsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, errors.New("parameter contactName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{contactName}", url.PathEscape(contactName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,12 +249,12 @@ func (client *ContactsClient) getHandleResponse(resp *http.Response) (ContactsCl return result, nil } -// NewListPager - Returns list of contacts by spacecraftName -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// options - ContactsClientListOptions contains the optional parameters for the ContactsClient.List method. +// NewListPager - Returns list of contacts by spacecraftName. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - options - ContactsClientListOptions contains the optional parameters for the ContactsClient.NewListPager method. func (client *ContactsClient) NewListPager(resourceGroupName string, spacecraftName string, options *ContactsClientListOptions) *runtime.Pager[ContactsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ContactsClientListResponse]{ More: func(page ContactsClientListResponse) bool { @@ -276,7 +271,7 @@ func (client *ContactsClient) NewListPager(resourceGroupName string, spacecraftN if err != nil { return ContactsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return ContactsClientListResponse{}, err } @@ -303,12 +298,12 @@ func (client *ContactsClient) listCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter spacecraftName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{spacecraftName}", url.PathEscape(spacecraftName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } diff --git a/sdk/resourcemanager/orbital/armorbital/contacts_client_example_test.go b/sdk/resourcemanager/orbital/armorbital/contacts_client_example_test.go new file mode 100644 index 000000000000..2b92eec0bc1c --- /dev/null +++ b/sdk/resourcemanager/orbital/armorbital/contacts_client_example_test.go @@ -0,0 +1,236 @@ +//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 armorbital_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactsBySpacecraftNameList.json +func ExampleContactsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewContactsClient().NewListPager("contoso-Rgp", "CONTOSO_SAT", &armorbital.ContactsClientListOptions{Skiptoken: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.ContactListResult = armorbital.ContactListResult{ + // Value: []*armorbital.Contact{ + // { + // Name: to.Ptr("contact1"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts/contacts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT/contacts/contact2"), + // Properties: &armorbital.ContactsProperties{ + // AntennaConfiguration: &armorbital.ContactsPropertiesAntennaConfiguration{ + // DestinationIP: to.Ptr("10.1.1.171"), + // SourceIPs: []*string{ + // to.Ptr("10.1.1.4"), + // to.Ptr("10.1.1.5")}, + // }, + // ContactProfile: &armorbital.ContactsPropertiesContactProfile{ + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // }, + // EndAzimuthDegrees: to.Ptr[float32](330.489627), + // EndElevationDegrees: to.Ptr[float32](5.040625), + // GroundStationName: to.Ptr("EASTUS2_0"), + // MaximumElevationDegrees: to.Ptr[float32](26.617297), + // ProvisioningState: to.Ptr(armorbital.ContactsPropertiesProvisioningState("Succeeded")), + // ReservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-01T12:05:25Z"); return t}()), + // ReservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-01T11:55:01Z"); return t}()), + // RxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-01T12:05:25Z"); return t}()), + // RxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-01T11:55:01Z"); return t}()), + // StartAzimuthDegrees: to.Ptr[float32](201.340472), + // StartElevationDegrees: to.Ptr[float32](5), + // Status: to.Ptr(armorbital.ContactsStatusSucceeded), + // TxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-01T12:05:25Z"); return t}()), + // TxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-01T11:55:01Z"); return t}()), + // }, + // }, + // { + // Name: to.Ptr("contact2"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts/contacts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT/contacts/contact1"), + // Properties: &armorbital.ContactsProperties{ + // AntennaConfiguration: &armorbital.ContactsPropertiesAntennaConfiguration{ + // DestinationIP: to.Ptr("10.1.1.171"), + // SourceIPs: []*string{ + // to.Ptr("10.1.1.4"), + // to.Ptr("10.1.1.5")}, + // }, + // ContactProfile: &armorbital.ContactsPropertiesContactProfile{ + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // }, + // EndAzimuthDegrees: to.Ptr[float32](345.848482), + // EndElevationDegrees: to.Ptr[float32](5.048656), + // GroundStationName: to.Ptr("EASTUS2_0"), + // MaximumElevationDegrees: to.Ptr[float32](85.9796), + // ProvisioningState: to.Ptr(armorbital.ContactsPropertiesProvisioningState("Succeeded")), + // ReservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T11:10:45Z"); return t}()), + // ReservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T10:58:30Z"); return t}()), + // RxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T11:10:45Z"); return t}()), + // RxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T10:58:30Z"); return t}()), + // StartAzimuthDegrees: to.Ptr[float32](165.758896), + // StartElevationDegrees: to.Ptr[float32](5), + // Status: to.Ptr(armorbital.ContactsStatusSucceeded), + // TxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T11:10:45Z"); return t}()), + // TxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T10:58:30Z"); return t}()), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactGet.json +func ExampleContactsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewContactsClient().Get(ctx, "contoso-Rgp", "CONTOSO_SAT", "contact1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Contact = armorbital.Contact{ + // Name: to.Ptr("contact1"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts/contacts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT/contacts/contact1"), + // Properties: &armorbital.ContactsProperties{ + // AntennaConfiguration: &armorbital.ContactsPropertiesAntennaConfiguration{ + // DestinationIP: to.Ptr("10.1.1.171"), + // SourceIPs: []*string{ + // to.Ptr("10.1.1.4"), + // to.Ptr("10.1.1.5")}, + // }, + // ContactProfile: &armorbital.ContactsPropertiesContactProfile{ + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // }, + // EndAzimuthDegrees: to.Ptr[float32](345.848482), + // EndElevationDegrees: to.Ptr[float32](5.048656), + // GroundStationName: to.Ptr("EASTUS2_0"), + // MaximumElevationDegrees: to.Ptr[float32](85.9796), + // ProvisioningState: to.Ptr(armorbital.ContactsPropertiesProvisioningState("Succeeded")), + // ReservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T11:10:45Z"); return t}()), + // ReservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T10:58:30Z"); return t}()), + // RxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T11:10:45Z"); return t}()), + // RxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T10:58:30Z"); return t}()), + // StartAzimuthDegrees: to.Ptr[float32](165.758896), + // StartElevationDegrees: to.Ptr[float32](5), + // Status: to.Ptr(armorbital.ContactsStatusScheduled), + // TxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T11:10:45Z"); return t}()), + // TxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T10:58:30Z"); return t}()), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactCreate.json +func ExampleContactsClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewContactsClient().BeginCreate(ctx, "contoso-Rgp", "CONTOSO_SAT", "contact1", armorbital.Contact{ + Properties: &armorbital.ContactsProperties{ + ContactProfile: &armorbital.ContactsPropertiesContactProfile{ + ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + }, + GroundStationName: to.Ptr("EASTUS2_0"), + ReservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-22T11:10:45Z"); return t }()), + ReservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-22T10:58:30Z"); return t }()), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Contact = armorbital.Contact{ + // Name: to.Ptr("contact1"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts/contacts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT/contacts/contact1"), + // Properties: &armorbital.ContactsProperties{ + // ContactProfile: &armorbital.ContactsPropertiesContactProfile{ + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + // }, + // EndAzimuthDegrees: to.Ptr[float32](345.848482), + // EndElevationDegrees: to.Ptr[float32](5.048656), + // GroundStationName: to.Ptr("EASTUS2_0"), + // MaximumElevationDegrees: to.Ptr[float32](85.9796), + // ReservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-22T11:10:45Z"); return t}()), + // ReservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-22T10:58:30Z"); return t}()), + // RxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-22T11:10:45Z"); return t}()), + // RxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-22T10:58:30Z"); return t}()), + // StartAzimuthDegrees: to.Ptr[float32](165.758896), + // StartElevationDegrees: to.Ptr[float32](5), + // Status: to.Ptr(armorbital.ContactsStatusScheduled), + // TxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-22T11:10:45Z"); return t}()), + // TxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-02-22T10:58:30Z"); return t}()), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/ContactDelete.json +func ExampleContactsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewContactsClient().BeginDelete(ctx, "contoso-Rgp", "CONTOSO_SAT", "contact1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_date_type.go b/sdk/resourcemanager/orbital/armorbital/date_type.go similarity index 94% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_date_type.go rename to sdk/resourcemanager/orbital/armorbital/date_type.go index 8e8dc7249a5f..0e58322ac74c 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_date_type.go +++ b/sdk/resourcemanager/orbital/armorbital/date_type.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 armorbital @@ -34,7 +35,7 @@ func (d *dateType) UnmarshalJSON(data []byte) (err error) { return err } -func populateDateType(m map[string]interface{}, k string, t *time.Time) { +func populateDateType(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/orbital/armorbital/go.mod b/sdk/resourcemanager/orbital/armorbital/go.mod index c960d96ee3a1..f06cf681d442 100644 --- a/sdk/resourcemanager/orbital/armorbital/go.mod +++ b/sdk/resourcemanager/orbital/armorbital/go.mod @@ -1,21 +1,21 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital/v2 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.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/text v0.3.7 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect ) diff --git a/sdk/resourcemanager/orbital/armorbital/go.sum b/sdk/resourcemanager/orbital/armorbital/go.sum index ed5b814680ee..8ba445a8c4da 100644 --- a/sdk/resourcemanager/orbital/armorbital/go.sum +++ b/sdk/resourcemanager/orbital/armorbital/go.sum @@ -1,33 +1,31 @@ -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.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= -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.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= 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/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/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/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/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -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= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_models.go b/sdk/resourcemanager/orbital/armorbital/models.go similarity index 78% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_models.go rename to sdk/resourcemanager/orbital/armorbital/models.go index 3194a88db9de..1686ffd20b40 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_models.go +++ b/sdk/resourcemanager/orbital/armorbital/models.go @@ -5,17 +5,18 @@ // 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 armorbital import "time" -// AuthorizedGroundstation - Authorized groundstation +// AuthorizedGroundstation - Authorized groundstation. type AuthorizedGroundstation struct { - // Date of authorization expiration + // REQUIRED; Date of authorization expiration. ExpirationDate *time.Time `json:"expirationDate,omitempty"` - // Groundstation name + // REQUIRED; Groundstation name. GroundStation *string `json:"groundStation,omitempty"` } @@ -34,7 +35,7 @@ type AvailableContacts struct { // AvailableContactsListResult - Response for the ListAvailableContacts API service call. type AvailableContactsListResult struct { - // A list of available contacts + // A list of available contacts. Value []*AvailableContacts `json:"value,omitempty"` // READ-ONLY; The URL to get the next set of results. @@ -52,10 +53,10 @@ type AvailableContactsProperties struct { // READ-ONLY; Maximum elevation of the antenna during the contact in decimal degrees. MaximumElevationDegrees *float32 `json:"maximumElevationDegrees,omitempty" azure:"ro"` - // READ-ONLY; Time to lost receiving a signal. + // READ-ONLY; Time to lost receiving a signal (ISO 8601 UTC standard). RxEndTime *time.Time `json:"rxEndTime,omitempty" azure:"ro"` - // READ-ONLY; Earliest time to receive a signal. + // READ-ONLY; Earliest time to receive a signal (ISO 8601 UTC standard). RxStartTime *time.Time `json:"rxStartTime,omitempty" azure:"ro"` // READ-ONLY; Azimuth of the antenna at the start of the contact in decimal degrees. @@ -64,28 +65,28 @@ type AvailableContactsProperties struct { // READ-ONLY; Spacecraft elevation above the horizon at contact start. StartElevationDegrees *float32 `json:"startElevationDegrees,omitempty" azure:"ro"` - // READ-ONLY; Time at which antenna transmit will be disabled. + // READ-ONLY; Time at which antenna transmit will be disabled (ISO 8601 UTC standard). TxEndTime *time.Time `json:"txEndTime,omitempty" azure:"ro"` - // READ-ONLY; Time at which antenna transmit will be enabled. + // READ-ONLY; Time at which antenna transmit will be enabled (ISO 8601 UTC standard). TxStartTime *time.Time `json:"txStartTime,omitempty" azure:"ro"` } // AvailableContactsSpacecraft - The reference to the spacecraft resource. type AvailableContactsSpacecraft struct { - // Resource ID. + // REQUIRED; Resource ID. ID *string `json:"id,omitempty"` } -// AvailableGroundStation - GroundStations available to schedule Contacts +// AvailableGroundStation - Ground Stations available to schedule Contacts. type AvailableGroundStation struct { - // Azure region - Location *string `json:"location,omitempty"` - - // The properties bag for this resource + // REQUIRED; The properties bag for this resource. Properties *AvailableGroundStationProperties `json:"properties,omitempty"` - // READ-ONLY; Id of groundStation + // Azure region. + Location *string `json:"location,omitempty"` + + // READ-ONLY; ID of groundStation. ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; Name of the ground station. @@ -104,9 +105,9 @@ type AvailableGroundStationListResult struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// AvailableGroundStationProperties - The properties bag for this resource +// AvailableGroundStationProperties - The properties bag for this resource. type AvailableGroundStationProperties struct { - // Altitude of the ground station + // Altitude of the ground station. AltitudeMeters *float32 `json:"altitudeMeters,omitempty"` // City of ground station. @@ -121,13 +122,13 @@ type AvailableGroundStationProperties struct { // Ground station provider name. ProviderName *string `json:"providerName,omitempty"` - // Release Status of a ground station + // Release Status of a ground station. ReleaseMode *ReleaseMode `json:"releaseMode,omitempty"` } // AvailableGroundStationPropertiesAutoGenerated - Properties object for Available groundstation. type AvailableGroundStationPropertiesAutoGenerated struct { - // Altitude of the ground station + // Altitude of the ground station. AltitudeMeters *float32 `json:"altitudeMeters,omitempty"` // City of ground station. @@ -142,50 +143,21 @@ type AvailableGroundStationPropertiesAutoGenerated struct { // Ground station provider name. ProviderName *string `json:"providerName,omitempty"` - // Release Status of a ground station + // Release Status of a ground station. ReleaseMode *ReleaseMode `json:"releaseMode,omitempty"` } -// AvailableGroundStationsClientGetOptions contains the optional parameters for the AvailableGroundStationsClient.Get method. -type AvailableGroundStationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AvailableGroundStationsClientListByCapabilityOptions contains the optional parameters for the AvailableGroundStationsClient.ListByCapability +// AvailableGroundStationsClientListByCapabilityOptions contains the optional parameters for the AvailableGroundStationsClient.NewListByCapabilityPager // method. type AvailableGroundStationsClientListByCapabilityOptions struct { // placeholder for future optional parameters } -// CloudError - An error response from the service. -type CloudError struct { - // An error response from the service. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from the service. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - 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"` -} - // Contact - Customer creates a contact resource for a spacecraft resource. type Contact struct { - // Properties of the Contact Resource. + // REQUIRED; Properties of the Contact Resource. Properties *ContactsProperties `json:"properties,omitempty"` - // READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty" azure:"ro"` - // 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"` @@ -199,7 +171,7 @@ type Contact struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ContactInstanceProperties - Contact Instance Properties +// ContactInstanceProperties - Contact Instance Properties. type ContactInstanceProperties struct { // READ-ONLY; Azimuth of the antenna at the end of the contact in decimal degrees. EndAzimuthDegrees *float32 `json:"endAzimuthDegrees,omitempty" azure:"ro"` @@ -210,10 +182,10 @@ type ContactInstanceProperties struct { // READ-ONLY; Maximum elevation of the antenna during the contact in decimal degrees. MaximumElevationDegrees *float32 `json:"maximumElevationDegrees,omitempty" azure:"ro"` - // READ-ONLY; Time to lost receiving a signal. + // READ-ONLY; Time to lost receiving a signal (ISO 8601 UTC standard). RxEndTime *time.Time `json:"rxEndTime,omitempty" azure:"ro"` - // READ-ONLY; Earliest time to receive a signal. + // READ-ONLY; Earliest time to receive a signal (ISO 8601 UTC standard). RxStartTime *time.Time `json:"rxStartTime,omitempty" azure:"ro"` // READ-ONLY; Azimuth of the antenna at the start of the contact in decimal degrees. @@ -222,10 +194,10 @@ type ContactInstanceProperties struct { // READ-ONLY; Spacecraft elevation above the horizon at contact start. StartElevationDegrees *float32 `json:"startElevationDegrees,omitempty" azure:"ro"` - // READ-ONLY; Time at which antenna transmit will be disabled. + // READ-ONLY; Time at which antenna transmit will be disabled (ISO 8601 UTC standard). TxEndTime *time.Time `json:"txEndTime,omitempty" azure:"ro"` - // READ-ONLY; Time at which antenna transmit will be enabled. + // READ-ONLY; Time at which antenna transmit will be enabled (ISO 8601 UTC standard). TxStartTime *time.Time `json:"txStartTime,omitempty" azure:"ro"` } @@ -243,19 +215,19 @@ type ContactParameters struct { // REQUIRED; The reference to the contact profile resource. ContactProfile *ContactParametersContactProfile `json:"contactProfile,omitempty"` - // REQUIRED; End time of a contact. + // REQUIRED; End time of a contact (ISO 8601 UTC standard). EndTime *time.Time `json:"endTime,omitempty"` // REQUIRED; Name of Azure Ground Station. GroundStationName *string `json:"groundStationName,omitempty"` - // REQUIRED; Start time of a contact. + // REQUIRED; Start time of a contact (ISO 8601 UTC standard). StartTime *time.Time `json:"startTime,omitempty"` } // ContactParametersContactProfile - The reference to the contact profile resource. type ContactParametersContactProfile struct { - // Resource ID. + // REQUIRED; Resource ID. ID *string `json:"id,omitempty"` } @@ -265,15 +237,12 @@ type ContactProfile struct { // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` - // Properties of the contact profile resource. + // REQUIRED; Properties of the contact profile resource. Properties *ContactProfileProperties `json:"properties,omitempty"` // Resource tags. Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty" azure:"ro"` - // 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"` @@ -287,51 +256,55 @@ type ContactProfile struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ContactProfileLink - Contact Profile Link +// ContactProfileLink - Contact Profile Link. type ContactProfileLink struct { - // REQUIRED; Contact Profile Link Channel + // REQUIRED; Contact Profile Link Channel. Channels []*ContactProfileLinkChannel `json:"channels,omitempty"` - // REQUIRED; Direction (uplink or downlink) + // REQUIRED; Direction (Uplink or Downlink). Direction *Direction `json:"direction,omitempty"` - // REQUIRED; Link name + // REQUIRED; Link name. Name *string `json:"name,omitempty"` - // REQUIRED; polarization. eg (RHCP, LHCP) + // REQUIRED; Polarization. e.g. (RHCP, LHCP). Polarization *Polarization `json:"polarization,omitempty"` - // Effective Isotropic Radiated Power (EIRP) in dBW. + // Effective Isotropic Radiated Power (EIRP) in dBW. It is the required EIRP by the customer. Not used yet. EirpdBW *float32 `json:"eirpdBW,omitempty"` - // Gain To Noise Temperature in db/K. + // Gain to noise temperature in db/K. It is the required G/T by the customer. Not used yet. GainOverTemperature *float32 `json:"gainOverTemperature,omitempty"` } -// ContactProfileLinkChannel - Contact Profile Link Channel +// ContactProfileLinkChannel - Contact Profile Link Channel. type ContactProfileLinkChannel struct { - // REQUIRED; Bandwidth in MHz + // REQUIRED; Bandwidth in MHz. BandwidthMHz *float32 `json:"bandwidthMHz,omitempty"` - // REQUIRED; Center Frequency in MHz + // REQUIRED; Center Frequency in MHz. CenterFrequencyMHz *float32 `json:"centerFrequencyMHz,omitempty"` - // REQUIRED; Customer End point to store/retrieve data during a contact. + // REQUIRED; Customer end point to store and retrieve data during a contact with the spacecraft. EndPoint *EndPoint `json:"endPoint,omitempty"` - // REQUIRED; Channel name + // REQUIRED; Channel name. Name *string `json:"name,omitempty"` - // Configuration for decoding + // Currently unused. DecodingConfiguration *string `json:"decodingConfiguration,omitempty"` - // Configuration for demodulation + // Copy of the modem configuration file such as Kratos QRadio or Kratos QuantumRx. Only valid for downlink directions. If + // provided, the modem connects to the customer endpoint and sends demodulated data + // instead of a VITA.49 stream. DemodulationConfiguration *string `json:"demodulationConfiguration,omitempty"` - // Configuration for encoding + // Currently unused. EncodingConfiguration *string `json:"encodingConfiguration,omitempty"` - // Configuration for modulation + // Copy of the modem configuration file such as Kratos QRadio. Only valid for uplink directions. If provided, the modem connects + // to the customer endpoint and accepts commands from the customer instead of + // a VITA.49 stream. ModulationConfiguration *string `json:"modulationConfiguration,omitempty"` } @@ -346,26 +319,42 @@ type ContactProfileListResult struct { // ContactProfileProperties - Properties of the contact profile resource. type ContactProfileProperties struct { - // REQUIRED; Links of the Contact Profile + // REQUIRED; Links of the Contact Profile. Describes RF links, modem processing, and IP endpoints. Links []*ContactProfileLink `json:"links,omitempty"` // REQUIRED; Network configuration of customer virtual network. NetworkConfiguration *ContactProfilesPropertiesNetworkConfiguration `json:"networkConfiguration,omitempty"` - // Auto track configuration. + // Auto-tracking configuration. AutoTrackingConfiguration *AutoTrackingConfiguration `json:"autoTrackingConfiguration,omitempty"` - // The URI of the Event Hub used for telemetry + // ARM resource identifier of the Event Hub used for telemetry. Requires granting Orbital Resource Provider the rights to + // send telemetry into the hub. EventHubURI *string `json:"eventHubUri,omitempty"` - // Minimum viable elevation for the contact in decimal degrees. + // Minimum viable elevation for the contact in decimal degrees. Used for listing the available contacts with a spacecraft + // at a given ground station. MinimumElevationDegrees *float32 `json:"minimumElevationDegrees,omitempty"` - // Minimum viable contact duration in ISO 8601 format. + // Minimum viable contact duration in ISO 8601 format. Used for listing the available contacts with a spacecraft at a given + // ground station. MinimumViableContactDuration *string `json:"minimumViableContactDuration,omitempty"` - // The current state of the resource's creation, deletion, or modification + // The current state of the resource's creation, deletion, or modification. ProvisioningState *ContactProfilesPropertiesProvisioningState `json:"provisioningState,omitempty"` + + // Third-party mission configuration of the Contact Profile. Describes RF links, modem processing, and IP endpoints. + ThirdPartyConfigurations []*ContactProfileThirdPartyConfiguration `json:"thirdPartyConfigurations,omitempty"` +} + +// ContactProfileThirdPartyConfiguration - Contact Profile third-party partner configuration. +type ContactProfileThirdPartyConfiguration struct { + // REQUIRED; Name of string referencing the configuration describing contact set-up for a particular mission. Expected values + // are those which have been created in collaboration with the partner network. + MissionConfiguration *string `json:"missionConfiguration,omitempty"` + + // REQUIRED; Name of the third-party provider. + ProviderName *string `json:"providerName,omitempty"` } // ContactProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the ContactProfilesClient.BeginCreateOrUpdate @@ -393,7 +382,7 @@ type ContactProfilesClientGetOptions struct { // placeholder for future optional parameters } -// ContactProfilesClientListBySubscriptionOptions contains the optional parameters for the ContactProfilesClient.ListBySubscription +// ContactProfilesClientListBySubscriptionOptions contains the optional parameters for the ContactProfilesClient.NewListBySubscriptionPager // method. type ContactProfilesClientListBySubscriptionOptions struct { // An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous @@ -403,7 +392,7 @@ type ContactProfilesClientListBySubscriptionOptions struct { Skiptoken *string } -// ContactProfilesClientListOptions contains the optional parameters for the ContactProfilesClient.List method. +// ContactProfilesClientListOptions contains the optional parameters for the ContactProfilesClient.NewListPager method. type ContactProfilesClientListOptions struct { // An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous // list operation call returned a partial result. If a previous response contains a @@ -414,31 +403,38 @@ type ContactProfilesClientListOptions struct { // ContactProfilesProperties - List of Contact Profile Resource Properties. type ContactProfilesProperties struct { - // REQUIRED; Links of the Contact Profile + // REQUIRED; Links of the Contact Profile. Describes RF links, modem processing, and IP endpoints. Links []*ContactProfileLink `json:"links,omitempty"` // REQUIRED; Network configuration of customer virtual network. NetworkConfiguration *ContactProfilesPropertiesNetworkConfiguration `json:"networkConfiguration,omitempty"` - // Auto track configuration. + // Auto-tracking configuration. AutoTrackingConfiguration *AutoTrackingConfiguration `json:"autoTrackingConfiguration,omitempty"` - // The URI of the Event Hub used for telemetry + // ARM resource identifier of the Event Hub used for telemetry. Requires granting Orbital Resource Provider the rights to + // send telemetry into the hub. EventHubURI *string `json:"eventHubUri,omitempty"` - // Minimum viable elevation for the contact in decimal degrees. + // Minimum viable elevation for the contact in decimal degrees. Used for listing the available contacts with a spacecraft + // at a given ground station. MinimumElevationDegrees *float32 `json:"minimumElevationDegrees,omitempty"` - // Minimum viable contact duration in ISO 8601 format. + // Minimum viable contact duration in ISO 8601 format. Used for listing the available contacts with a spacecraft at a given + // ground station. MinimumViableContactDuration *string `json:"minimumViableContactDuration,omitempty"` - // The current state of the resource's creation, deletion, or modification + // The current state of the resource's creation, deletion, or modification. ProvisioningState *ContactProfilesPropertiesProvisioningState `json:"provisioningState,omitempty"` + + // Third-party mission configuration of the Contact Profile. Describes RF links, modem processing, and IP endpoints. + ThirdPartyConfigurations []*ContactProfileThirdPartyConfiguration `json:"thirdPartyConfigurations,omitempty"` } // ContactProfilesPropertiesNetworkConfiguration - Network configuration of customer virtual network. type ContactProfilesPropertiesNetworkConfiguration struct { - // REQUIRED; Customer subnet ARM resource identifier. + // REQUIRED; ARM resource identifier of the subnet delegated to the Microsoft.Orbital/orbitalGateways. Needs to be at least + // a class C subnet, and should not have any IP created in it. SubnetID *string `json:"subnetId,omitempty"` } @@ -459,7 +455,7 @@ type ContactsClientGetOptions struct { // placeholder for future optional parameters } -// ContactsClientListOptions contains the optional parameters for the ContactsClient.List method. +// ContactsClientListOptions contains the optional parameters for the ContactsClient.NewListPager method. type ContactsClientListOptions struct { // An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous // list operation call returned a partial result. If a previous response contains a @@ -476,13 +472,13 @@ type ContactsProperties struct { // REQUIRED; Azure Ground Station name. GroundStationName *string `json:"groundStationName,omitempty"` - // REQUIRED; Reservation end time of a contact. + // REQUIRED; Reservation end time of a contact (ISO 8601 UTC standard). ReservationEndTime *time.Time `json:"reservationEndTime,omitempty"` - // REQUIRED; Reservation start time of a contact. + // REQUIRED; Reservation start time of a contact (ISO 8601 UTC standard). ReservationStartTime *time.Time `json:"reservationStartTime,omitempty"` - // The current state of the resource's creation, deletion, or modification + // The current state of the resource's creation, deletion, or modification. ProvisioningState *ContactsPropertiesProvisioningState `json:"provisioningState,omitempty"` // READ-ONLY; The configuration associated with the allocated antenna. @@ -500,10 +496,10 @@ type ContactsProperties struct { // READ-ONLY; Maximum elevation of the antenna during the contact in decimal degrees. MaximumElevationDegrees *float32 `json:"maximumElevationDegrees,omitempty" azure:"ro"` - // READ-ONLY; Receive end time of a contact. + // READ-ONLY; Receive end time of a contact (ISO 8601 UTC standard). RxEndTime *time.Time `json:"rxEndTime,omitempty" azure:"ro"` - // READ-ONLY; Receive start time of a contact. + // READ-ONLY; Receive start time of a contact (ISO 8601 UTC standard). RxStartTime *time.Time `json:"rxStartTime,omitempty" azure:"ro"` // READ-ONLY; Azimuth of the antenna at the start of the contact in decimal degrees. @@ -515,10 +511,10 @@ type ContactsProperties struct { // READ-ONLY; Status of a contact. Status *ContactsStatus `json:"status,omitempty" azure:"ro"` - // READ-ONLY; Transmit end time of a contact. + // READ-ONLY; Transmit end time of a contact (ISO 8601 UTC standard). TxEndTime *time.Time `json:"txEndTime,omitempty" azure:"ro"` - // READ-ONLY; Transmit start time of a contact. + // READ-ONLY; Transmit start time of a contact (ISO 8601 UTC standard). TxStartTime *time.Time `json:"txStartTime,omitempty" azure:"ro"` } @@ -533,16 +529,16 @@ type ContactsPropertiesAntennaConfiguration struct { // ContactsPropertiesContactProfile - The reference to the contact profile resource. type ContactsPropertiesContactProfile struct { - // Resource ID. + // REQUIRED; Resource ID. ID *string `json:"id,omitempty"` } -// EndPoint - Customer End point to store/retrieve data during a contact. +// EndPoint - Customer end point to store and retrieve data during a contact with the spacecraft. type EndPoint struct { // REQUIRED; Name of an end point. EndPointName *string `json:"endPointName,omitempty"` - // REQUIRED; IP Address. + // REQUIRED; IP Address (IPv4). IPAddress *string `json:"ipAddress,omitempty"` // REQUIRED; TCP port to listen on to receive data. @@ -552,6 +548,40 @@ type EndPoint struct { Protocol *Protocol `json:"protocol,omitempty"` } +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -603,13 +633,13 @@ type OperationListResult struct { // OperationResult - Operation Result Entity. type OperationResult struct { - // Operation result error properties + // Operation result error properties. Error *OperationResultErrorProperties `json:"error,omitempty"` - // Operation result properties - Properties interface{} `json:"properties,omitempty"` + // Operation result properties. + Properties any `json:"properties,omitempty"` - // READ-ONLY; The operation end time + // READ-ONLY; The operation end time (ISO 8601 UTC standard). EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` // READ-ONLY; ID of the resource. @@ -618,17 +648,23 @@ type OperationResult struct { // READ-ONLY; Name of the resource. Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + // READ-ONLY; Percentage completed. PercentComplete *float64 `json:"percentComplete,omitempty" azure:"ro"` - // READ-ONLY; The operation start time + // READ-ONLY; The operation start time (ISO 8601 UTC standard). StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` // READ-ONLY; The status of operation. Status *Status `json:"status,omitempty" azure:"ro"` + + // READ-ONLY; A list of results when the operation returns multiple results. + Value []any `json:"value,omitempty" azure:"ro"` } -// OperationResultErrorProperties - Operation result error properties +// OperationResultErrorProperties - Operation result error properties. type OperationResultErrorProperties struct { // READ-ONLY; The code of the error. Code *string `json:"code,omitempty" azure:"ro"` @@ -637,7 +673,7 @@ type OperationResultErrorProperties struct { Message *string `json:"message,omitempty" azure:"ro"` } -// 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 } @@ -690,13 +726,13 @@ type ResourceIDListResult struct { } type ResourceIDListResultValueItem struct { - // The Azure Resource ID + // The Azure Resource ID. ID *string `json:"id,omitempty"` } -// ResourceReference - Resource Reference +// ResourceReference - Resource Reference. type ResourceReference struct { - // Resource ID. + // REQUIRED; Resource ID. ID *string `json:"id,omitempty"` } @@ -705,15 +741,12 @@ type Spacecraft struct { // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` - // Spacecraft Properties + // REQUIRED; Spacecraft Properties Properties *SpacecraftsProperties `json:"properties,omitempty"` // Resource tags. Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty" azure:"ro"` - // 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"` @@ -727,21 +760,21 @@ type Spacecraft struct { Type *string `json:"type,omitempty" azure:"ro"` } -// SpacecraftLink - Authorized Ground Stations for the link +// SpacecraftLink - List of authorized spacecraft links per ground station and the expiration date of the authorization. type SpacecraftLink struct { - // REQUIRED; Bandwidth in MHz + // REQUIRED; Bandwidth in MHz. BandwidthMHz *float32 `json:"bandwidthMHz,omitempty"` - // REQUIRED; Center Frequency in MHz + // REQUIRED; Center Frequency in MHz. CenterFrequencyMHz *float32 `json:"centerFrequencyMHz,omitempty"` - // REQUIRED; Direction (uplink or downlink) + // REQUIRED; Direction (Uplink or Downlink). Direction *Direction `json:"direction,omitempty"` - // REQUIRED; Link name + // REQUIRED; Link name. Name *string `json:"name,omitempty"` - // REQUIRED; polarization. eg (RHCP, LHCP) + // REQUIRED; Polarization. e.g. (RHCP, LHCP). Polarization *Polarization `json:"polarization,omitempty"` // READ-ONLY; Authorized Ground Stations @@ -788,7 +821,7 @@ type SpacecraftsClientGetOptions struct { // placeholder for future optional parameters } -// SpacecraftsClientListBySubscriptionOptions contains the optional parameters for the SpacecraftsClient.ListBySubscription +// SpacecraftsClientListBySubscriptionOptions contains the optional parameters for the SpacecraftsClient.NewListBySubscriptionPager // method. type SpacecraftsClientListBySubscriptionOptions struct { // An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous @@ -798,7 +831,7 @@ type SpacecraftsClientListBySubscriptionOptions struct { Skiptoken *string } -// SpacecraftsClientListOptions contains the optional parameters for the SpacecraftsClient.List method. +// SpacecraftsClientListOptions contains the optional parameters for the SpacecraftsClient.NewListPager method. type SpacecraftsClientListOptions struct { // An opaque string that the resource provider uses to skip over previously-returned results. This is used when a previous // list operation call returned a partial result. If a previous response contains a @@ -809,23 +842,23 @@ type SpacecraftsClientListOptions struct { // SpacecraftsProperties - List of Spacecraft Resource Properties. type SpacecraftsProperties struct { - // REQUIRED; NORAD ID of the spacecraft. - NoradID *string `json:"noradId,omitempty"` - - // Links of the Spacecraft + // REQUIRED; Immutable list of Spacecraft links. Links []*SpacecraftLink `json:"links,omitempty"` - // The current state of the resource's creation, deletion, or modification - ProvisioningState *SpacecraftsPropertiesProvisioningState `json:"provisioningState,omitempty"` - - // Title line of Two Line Element (TLE). + // REQUIRED; Title line of the two-line element set (TLE). TitleLine *string `json:"titleLine,omitempty"` - // Line 1 of Two Line Element (TLE). + // REQUIRED; Line 1 of the two-line element set (TLE). TleLine1 *string `json:"tleLine1,omitempty"` - // Line 2 of Two Line Element (TLE). + // REQUIRED; Line 2 of the two-line element set (TLE). TleLine2 *string `json:"tleLine2,omitempty"` + + // NORAD ID of the spacecraft. + NoradID *string `json:"noradId,omitempty"` + + // The current state of the resource's creation, deletion, or modification. + ProvisioningState *SpacecraftsPropertiesProvisioningState `json:"provisioningState,omitempty"` } // SystemData - Metadata pertaining to creation and last modification of the resource. diff --git a/sdk/resourcemanager/orbital/armorbital/models_serde.go b/sdk/resourcemanager/orbital/armorbital/models_serde.go new file mode 100644 index 000000000000..b509abb3e161 --- /dev/null +++ b/sdk/resourcemanager/orbital/armorbital/models_serde.go @@ -0,0 +1,1895 @@ +//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 armorbital + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AuthorizedGroundstation. +func (a AuthorizedGroundstation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateType(objectMap, "expirationDate", a.ExpirationDate) + populate(objectMap, "groundStation", a.GroundStation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizedGroundstation. +func (a *AuthorizedGroundstation) 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 "expirationDate": + err = unpopulateDateType(val, "ExpirationDate", &a.ExpirationDate) + delete(rawMsg, key) + case "groundStation": + err = unpopulate(val, "GroundStation", &a.GroundStation) + 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 AvailableContacts. +func (a AvailableContacts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groundStationName", a.GroundStationName) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "spacecraft", a.Spacecraft) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableContacts. +func (a *AvailableContacts) 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 "groundStationName": + err = unpopulate(val, "GroundStationName", &a.GroundStationName) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "spacecraft": + err = unpopulate(val, "Spacecraft", &a.Spacecraft) + 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 AvailableContactsListResult. +func (a AvailableContactsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableContactsListResult. +func (a *AvailableContactsListResult) 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 "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 AvailableContactsProperties. +func (a AvailableContactsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endAzimuthDegrees", a.EndAzimuthDegrees) + populate(objectMap, "endElevationDegrees", a.EndElevationDegrees) + populate(objectMap, "maximumElevationDegrees", a.MaximumElevationDegrees) + populateTimeRFC3339(objectMap, "rxEndTime", a.RxEndTime) + populateTimeRFC3339(objectMap, "rxStartTime", a.RxStartTime) + populate(objectMap, "startAzimuthDegrees", a.StartAzimuthDegrees) + populate(objectMap, "startElevationDegrees", a.StartElevationDegrees) + populateTimeRFC3339(objectMap, "txEndTime", a.TxEndTime) + populateTimeRFC3339(objectMap, "txStartTime", a.TxStartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableContactsProperties. +func (a *AvailableContactsProperties) 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 "endAzimuthDegrees": + err = unpopulate(val, "EndAzimuthDegrees", &a.EndAzimuthDegrees) + delete(rawMsg, key) + case "endElevationDegrees": + err = unpopulate(val, "EndElevationDegrees", &a.EndElevationDegrees) + delete(rawMsg, key) + case "maximumElevationDegrees": + err = unpopulate(val, "MaximumElevationDegrees", &a.MaximumElevationDegrees) + delete(rawMsg, key) + case "rxEndTime": + err = unpopulateTimeRFC3339(val, "RxEndTime", &a.RxEndTime) + delete(rawMsg, key) + case "rxStartTime": + err = unpopulateTimeRFC3339(val, "RxStartTime", &a.RxStartTime) + delete(rawMsg, key) + case "startAzimuthDegrees": + err = unpopulate(val, "StartAzimuthDegrees", &a.StartAzimuthDegrees) + delete(rawMsg, key) + case "startElevationDegrees": + err = unpopulate(val, "StartElevationDegrees", &a.StartElevationDegrees) + delete(rawMsg, key) + case "txEndTime": + err = unpopulateTimeRFC3339(val, "TxEndTime", &a.TxEndTime) + delete(rawMsg, key) + case "txStartTime": + err = unpopulateTimeRFC3339(val, "TxStartTime", &a.TxStartTime) + 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 AvailableContactsSpacecraft. +func (a AvailableContactsSpacecraft) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableContactsSpacecraft. +func (a *AvailableContactsSpacecraft) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableGroundStation. +func (a AvailableGroundStation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableGroundStation. +func (a *AvailableGroundStation) 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 "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + 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 AvailableGroundStationListResult. +func (a AvailableGroundStationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableGroundStationListResult. +func (a *AvailableGroundStationListResult) 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 "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 AvailableGroundStationProperties. +func (a AvailableGroundStationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "altitudeMeters", a.AltitudeMeters) + populate(objectMap, "city", a.City) + populate(objectMap, "latitudeDegrees", a.LatitudeDegrees) + populate(objectMap, "longitudeDegrees", a.LongitudeDegrees) + populate(objectMap, "providerName", a.ProviderName) + populate(objectMap, "releaseMode", a.ReleaseMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableGroundStationProperties. +func (a *AvailableGroundStationProperties) 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 "altitudeMeters": + err = unpopulate(val, "AltitudeMeters", &a.AltitudeMeters) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &a.City) + delete(rawMsg, key) + case "latitudeDegrees": + err = unpopulate(val, "LatitudeDegrees", &a.LatitudeDegrees) + delete(rawMsg, key) + case "longitudeDegrees": + err = unpopulate(val, "LongitudeDegrees", &a.LongitudeDegrees) + delete(rawMsg, key) + case "providerName": + err = unpopulate(val, "ProviderName", &a.ProviderName) + delete(rawMsg, key) + case "releaseMode": + err = unpopulate(val, "ReleaseMode", &a.ReleaseMode) + 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 AvailableGroundStationPropertiesAutoGenerated. +func (a AvailableGroundStationPropertiesAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "altitudeMeters", a.AltitudeMeters) + populate(objectMap, "city", a.City) + populate(objectMap, "latitudeDegrees", a.LatitudeDegrees) + populate(objectMap, "longitudeDegrees", a.LongitudeDegrees) + populate(objectMap, "providerName", a.ProviderName) + populate(objectMap, "releaseMode", a.ReleaseMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableGroundStationPropertiesAutoGenerated. +func (a *AvailableGroundStationPropertiesAutoGenerated) 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 "altitudeMeters": + err = unpopulate(val, "AltitudeMeters", &a.AltitudeMeters) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &a.City) + delete(rawMsg, key) + case "latitudeDegrees": + err = unpopulate(val, "LatitudeDegrees", &a.LatitudeDegrees) + delete(rawMsg, key) + case "longitudeDegrees": + err = unpopulate(val, "LongitudeDegrees", &a.LongitudeDegrees) + delete(rawMsg, key) + case "providerName": + err = unpopulate(val, "ProviderName", &a.ProviderName) + delete(rawMsg, key) + case "releaseMode": + err = unpopulate(val, "ReleaseMode", &a.ReleaseMode) + 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 Contact. +func (c Contact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Contact. +func (c *Contact) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + 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 ContactInstanceProperties. +func (c ContactInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endAzimuthDegrees", c.EndAzimuthDegrees) + populate(objectMap, "endElevationDegrees", c.EndElevationDegrees) + populate(objectMap, "maximumElevationDegrees", c.MaximumElevationDegrees) + populateTimeRFC3339(objectMap, "rxEndTime", c.RxEndTime) + populateTimeRFC3339(objectMap, "rxStartTime", c.RxStartTime) + populate(objectMap, "startAzimuthDegrees", c.StartAzimuthDegrees) + populate(objectMap, "startElevationDegrees", c.StartElevationDegrees) + populateTimeRFC3339(objectMap, "txEndTime", c.TxEndTime) + populateTimeRFC3339(objectMap, "txStartTime", c.TxStartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactInstanceProperties. +func (c *ContactInstanceProperties) 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 "endAzimuthDegrees": + err = unpopulate(val, "EndAzimuthDegrees", &c.EndAzimuthDegrees) + delete(rawMsg, key) + case "endElevationDegrees": + err = unpopulate(val, "EndElevationDegrees", &c.EndElevationDegrees) + delete(rawMsg, key) + case "maximumElevationDegrees": + err = unpopulate(val, "MaximumElevationDegrees", &c.MaximumElevationDegrees) + delete(rawMsg, key) + case "rxEndTime": + err = unpopulateTimeRFC3339(val, "RxEndTime", &c.RxEndTime) + delete(rawMsg, key) + case "rxStartTime": + err = unpopulateTimeRFC3339(val, "RxStartTime", &c.RxStartTime) + delete(rawMsg, key) + case "startAzimuthDegrees": + err = unpopulate(val, "StartAzimuthDegrees", &c.StartAzimuthDegrees) + delete(rawMsg, key) + case "startElevationDegrees": + err = unpopulate(val, "StartElevationDegrees", &c.StartElevationDegrees) + delete(rawMsg, key) + case "txEndTime": + err = unpopulateTimeRFC3339(val, "TxEndTime", &c.TxEndTime) + delete(rawMsg, key) + case "txStartTime": + err = unpopulateTimeRFC3339(val, "TxStartTime", &c.TxStartTime) + 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 ContactListResult. +func (c ContactListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactListResult. +func (c *ContactListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactParameters. +func (c ContactParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "contactProfile", c.ContactProfile) + populateTimeRFC3339(objectMap, "endTime", c.EndTime) + populate(objectMap, "groundStationName", c.GroundStationName) + populateTimeRFC3339(objectMap, "startTime", c.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactParameters. +func (c *ContactParameters) 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 "contactProfile": + err = unpopulate(val, "ContactProfile", &c.ContactProfile) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &c.EndTime) + delete(rawMsg, key) + case "groundStationName": + err = unpopulate(val, "GroundStationName", &c.GroundStationName) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &c.StartTime) + 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 ContactParametersContactProfile. +func (c ContactParametersContactProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactParametersContactProfile. +func (c *ContactParametersContactProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactProfile. +func (c ContactProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfile. +func (c *ContactProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactProfileLink. +func (c ContactProfileLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "channels", c.Channels) + populate(objectMap, "direction", c.Direction) + populate(objectMap, "eirpdBW", c.EirpdBW) + populate(objectMap, "gainOverTemperature", c.GainOverTemperature) + populate(objectMap, "name", c.Name) + populate(objectMap, "polarization", c.Polarization) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfileLink. +func (c *ContactProfileLink) 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 "channels": + err = unpopulate(val, "Channels", &c.Channels) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &c.Direction) + delete(rawMsg, key) + case "eirpdBW": + err = unpopulate(val, "EirpdBW", &c.EirpdBW) + delete(rawMsg, key) + case "gainOverTemperature": + err = unpopulate(val, "GainOverTemperature", &c.GainOverTemperature) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "polarization": + err = unpopulate(val, "Polarization", &c.Polarization) + 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 ContactProfileLinkChannel. +func (c ContactProfileLinkChannel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "bandwidthMHz", c.BandwidthMHz) + populate(objectMap, "centerFrequencyMHz", c.CenterFrequencyMHz) + populate(objectMap, "decodingConfiguration", c.DecodingConfiguration) + populate(objectMap, "demodulationConfiguration", c.DemodulationConfiguration) + populate(objectMap, "encodingConfiguration", c.EncodingConfiguration) + populate(objectMap, "endPoint", c.EndPoint) + populate(objectMap, "modulationConfiguration", c.ModulationConfiguration) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfileLinkChannel. +func (c *ContactProfileLinkChannel) 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 "bandwidthMHz": + err = unpopulate(val, "BandwidthMHz", &c.BandwidthMHz) + delete(rawMsg, key) + case "centerFrequencyMHz": + err = unpopulate(val, "CenterFrequencyMHz", &c.CenterFrequencyMHz) + delete(rawMsg, key) + case "decodingConfiguration": + err = unpopulate(val, "DecodingConfiguration", &c.DecodingConfiguration) + delete(rawMsg, key) + case "demodulationConfiguration": + err = unpopulate(val, "DemodulationConfiguration", &c.DemodulationConfiguration) + delete(rawMsg, key) + case "encodingConfiguration": + err = unpopulate(val, "EncodingConfiguration", &c.EncodingConfiguration) + delete(rawMsg, key) + case "endPoint": + err = unpopulate(val, "EndPoint", &c.EndPoint) + delete(rawMsg, key) + case "modulationConfiguration": + err = unpopulate(val, "ModulationConfiguration", &c.ModulationConfiguration) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + 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 ContactProfileListResult. +func (c ContactProfileListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfileListResult. +func (c *ContactProfileListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactProfileProperties. +func (c ContactProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoTrackingConfiguration", c.AutoTrackingConfiguration) + populate(objectMap, "eventHubUri", c.EventHubURI) + populate(objectMap, "links", c.Links) + populate(objectMap, "minimumElevationDegrees", c.MinimumElevationDegrees) + populate(objectMap, "minimumViableContactDuration", c.MinimumViableContactDuration) + populate(objectMap, "networkConfiguration", c.NetworkConfiguration) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "thirdPartyConfigurations", c.ThirdPartyConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfileProperties. +func (c *ContactProfileProperties) 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 "autoTrackingConfiguration": + err = unpopulate(val, "AutoTrackingConfiguration", &c.AutoTrackingConfiguration) + delete(rawMsg, key) + case "eventHubUri": + err = unpopulate(val, "EventHubURI", &c.EventHubURI) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &c.Links) + delete(rawMsg, key) + case "minimumElevationDegrees": + err = unpopulate(val, "MinimumElevationDegrees", &c.MinimumElevationDegrees) + delete(rawMsg, key) + case "minimumViableContactDuration": + err = unpopulate(val, "MinimumViableContactDuration", &c.MinimumViableContactDuration) + delete(rawMsg, key) + case "networkConfiguration": + err = unpopulate(val, "NetworkConfiguration", &c.NetworkConfiguration) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "thirdPartyConfigurations": + err = unpopulate(val, "ThirdPartyConfigurations", &c.ThirdPartyConfigurations) + 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 ContactProfileThirdPartyConfiguration. +func (c ContactProfileThirdPartyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "missionConfiguration", c.MissionConfiguration) + populate(objectMap, "providerName", c.ProviderName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfileThirdPartyConfiguration. +func (c *ContactProfileThirdPartyConfiguration) 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 "missionConfiguration": + err = unpopulate(val, "MissionConfiguration", &c.MissionConfiguration) + delete(rawMsg, key) + case "providerName": + err = unpopulate(val, "ProviderName", &c.ProviderName) + 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 ContactProfilesProperties. +func (c ContactProfilesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "autoTrackingConfiguration", c.AutoTrackingConfiguration) + populate(objectMap, "eventHubUri", c.EventHubURI) + populate(objectMap, "links", c.Links) + populate(objectMap, "minimumElevationDegrees", c.MinimumElevationDegrees) + populate(objectMap, "minimumViableContactDuration", c.MinimumViableContactDuration) + populate(objectMap, "networkConfiguration", c.NetworkConfiguration) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "thirdPartyConfigurations", c.ThirdPartyConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfilesProperties. +func (c *ContactProfilesProperties) 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 "autoTrackingConfiguration": + err = unpopulate(val, "AutoTrackingConfiguration", &c.AutoTrackingConfiguration) + delete(rawMsg, key) + case "eventHubUri": + err = unpopulate(val, "EventHubURI", &c.EventHubURI) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &c.Links) + delete(rawMsg, key) + case "minimumElevationDegrees": + err = unpopulate(val, "MinimumElevationDegrees", &c.MinimumElevationDegrees) + delete(rawMsg, key) + case "minimumViableContactDuration": + err = unpopulate(val, "MinimumViableContactDuration", &c.MinimumViableContactDuration) + delete(rawMsg, key) + case "networkConfiguration": + err = unpopulate(val, "NetworkConfiguration", &c.NetworkConfiguration) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "thirdPartyConfigurations": + err = unpopulate(val, "ThirdPartyConfigurations", &c.ThirdPartyConfigurations) + 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 ContactProfilesPropertiesNetworkConfiguration. +func (c ContactProfilesPropertiesNetworkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "subnetId", c.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProfilesPropertiesNetworkConfiguration. +func (c *ContactProfilesPropertiesNetworkConfiguration) 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 "subnetId": + err = unpopulate(val, "SubnetID", &c.SubnetID) + 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 ContactsProperties. +func (c ContactsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "antennaConfiguration", c.AntennaConfiguration) + populate(objectMap, "contactProfile", c.ContactProfile) + populate(objectMap, "endAzimuthDegrees", c.EndAzimuthDegrees) + populate(objectMap, "endElevationDegrees", c.EndElevationDegrees) + populate(objectMap, "errorMessage", c.ErrorMessage) + populate(objectMap, "groundStationName", c.GroundStationName) + populate(objectMap, "maximumElevationDegrees", c.MaximumElevationDegrees) + populate(objectMap, "provisioningState", c.ProvisioningState) + populateTimeRFC3339(objectMap, "reservationEndTime", c.ReservationEndTime) + populateTimeRFC3339(objectMap, "reservationStartTime", c.ReservationStartTime) + populateTimeRFC3339(objectMap, "rxEndTime", c.RxEndTime) + populateTimeRFC3339(objectMap, "rxStartTime", c.RxStartTime) + populate(objectMap, "startAzimuthDegrees", c.StartAzimuthDegrees) + populate(objectMap, "startElevationDegrees", c.StartElevationDegrees) + populate(objectMap, "status", c.Status) + populateTimeRFC3339(objectMap, "txEndTime", c.TxEndTime) + populateTimeRFC3339(objectMap, "txStartTime", c.TxStartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactsProperties. +func (c *ContactsProperties) 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 "antennaConfiguration": + err = unpopulate(val, "AntennaConfiguration", &c.AntennaConfiguration) + delete(rawMsg, key) + case "contactProfile": + err = unpopulate(val, "ContactProfile", &c.ContactProfile) + delete(rawMsg, key) + case "endAzimuthDegrees": + err = unpopulate(val, "EndAzimuthDegrees", &c.EndAzimuthDegrees) + delete(rawMsg, key) + case "endElevationDegrees": + err = unpopulate(val, "EndElevationDegrees", &c.EndElevationDegrees) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &c.ErrorMessage) + delete(rawMsg, key) + case "groundStationName": + err = unpopulate(val, "GroundStationName", &c.GroundStationName) + delete(rawMsg, key) + case "maximumElevationDegrees": + err = unpopulate(val, "MaximumElevationDegrees", &c.MaximumElevationDegrees) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "reservationEndTime": + err = unpopulateTimeRFC3339(val, "ReservationEndTime", &c.ReservationEndTime) + delete(rawMsg, key) + case "reservationStartTime": + err = unpopulateTimeRFC3339(val, "ReservationStartTime", &c.ReservationStartTime) + delete(rawMsg, key) + case "rxEndTime": + err = unpopulateTimeRFC3339(val, "RxEndTime", &c.RxEndTime) + delete(rawMsg, key) + case "rxStartTime": + err = unpopulateTimeRFC3339(val, "RxStartTime", &c.RxStartTime) + delete(rawMsg, key) + case "startAzimuthDegrees": + err = unpopulate(val, "StartAzimuthDegrees", &c.StartAzimuthDegrees) + delete(rawMsg, key) + case "startElevationDegrees": + err = unpopulate(val, "StartElevationDegrees", &c.StartElevationDegrees) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "txEndTime": + err = unpopulateTimeRFC3339(val, "TxEndTime", &c.TxEndTime) + delete(rawMsg, key) + case "txStartTime": + err = unpopulateTimeRFC3339(val, "TxStartTime", &c.TxStartTime) + 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 ContactsPropertiesAntennaConfiguration. +func (c ContactsPropertiesAntennaConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationIp", c.DestinationIP) + populate(objectMap, "sourceIps", c.SourceIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactsPropertiesAntennaConfiguration. +func (c *ContactsPropertiesAntennaConfiguration) 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 "destinationIp": + err = unpopulate(val, "DestinationIP", &c.DestinationIP) + delete(rawMsg, key) + case "sourceIps": + err = unpopulate(val, "SourceIPs", &c.SourceIPs) + 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 ContactsPropertiesContactProfile. +func (c ContactsPropertiesContactProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactsPropertiesContactProfile. +func (c *ContactsPropertiesContactProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndPoint. +func (e EndPoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endPointName", e.EndPointName) + populate(objectMap, "ipAddress", e.IPAddress) + populate(objectMap, "port", e.Port) + populate(objectMap, "protocol", e.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndPoint. +func (e *EndPoint) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endPointName": + err = unpopulate(val, "EndPointName", &e.EndPointName) + delete(rawMsg, key) + case "ipAddress": + err = unpopulate(val, "IPAddress", &e.IPAddress) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &e.Port) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &e.Protocol) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResult. +func (o OperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "properties", &o.Properties) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResult. +func (o *OperationResult) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResultErrorProperties. +func (o OperationResultErrorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", o.Code) + populate(objectMap, "message", o.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultErrorProperties. +func (o *OperationResultErrorProperties) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &o.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &o.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + 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]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + 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 "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + 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 ResourceIDListResult. +func (r ResourceIDListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIDListResult. +func (r *ResourceIDListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + 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 ResourceIDListResultValueItem. +func (r ResourceIDListResultValueItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIDListResultValueItem. +func (r *ResourceIDListResultValueItem) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceReference. +func (r ResourceReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceReference. +func (r *ResourceReference) 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Spacecraft. +func (s Spacecraft) MarshalJSON() ([]byte, error) { + 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) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Spacecraft. +func (s *Spacecraft) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + 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) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpacecraftLink. +func (s SpacecraftLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authorizations", s.Authorizations) + populate(objectMap, "bandwidthMHz", s.BandwidthMHz) + populate(objectMap, "centerFrequencyMHz", s.CenterFrequencyMHz) + populate(objectMap, "direction", s.Direction) + populate(objectMap, "name", s.Name) + populate(objectMap, "polarization", s.Polarization) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpacecraftLink. +func (s *SpacecraftLink) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authorizations": + err = unpopulate(val, "Authorizations", &s.Authorizations) + delete(rawMsg, key) + case "bandwidthMHz": + err = unpopulate(val, "BandwidthMHz", &s.BandwidthMHz) + delete(rawMsg, key) + case "centerFrequencyMHz": + err = unpopulate(val, "CenterFrequencyMHz", &s.CenterFrequencyMHz) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &s.Direction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "polarization": + err = unpopulate(val, "Polarization", &s.Polarization) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpacecraftListResult. +func (s SpacecraftListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpacecraftListResult. +func (s *SpacecraftListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpacecraftsProperties. +func (s SpacecraftsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "links", s.Links) + populate(objectMap, "noradId", s.NoradID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "titleLine", s.TitleLine) + populate(objectMap, "tleLine1", s.TleLine1) + populate(objectMap, "tleLine2", s.TleLine2) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpacecraftsProperties. +func (s *SpacecraftsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "links": + err = unpopulate(val, "Links", &s.Links) + delete(rawMsg, key) + case "noradId": + err = unpopulate(val, "NoradID", &s.NoradID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "titleLine": + err = unpopulate(val, "TitleLine", &s.TitleLine) + delete(rawMsg, key) + case "tleLine1": + err = unpopulate(val, "TleLine1", &s.TleLine1) + delete(rawMsg, key) + case "tleLine2": + err = unpopulate(val, "TleLine2", &s.TleLine2) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + 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", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TagsObject. +func (t TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsObject. +func (t *TagsObject) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_operations_client.go b/sdk/resourcemanager/orbital/armorbital/operations_client.go similarity index 74% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_operations_client.go rename to sdk/resourcemanager/orbital/armorbital/operations_client.go index 9e13a168d7ad..f317602f3c3f 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_operations_client.go +++ b/sdk/resourcemanager/orbital/armorbital/operations_client.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 armorbital @@ -12,8 +13,6 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -22,36 +21,27 @@ import ( // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - host string - pl runtime.Pipeline + internal *arm.Client } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - 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{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsClient{ - host: ep, - pl: pl, + internal: cl, } return client, nil } // NewListPager - Lists all of the available Orbital Rest API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2022-11-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -62,7 +52,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } @@ -77,12 +67,12 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Orbital/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/orbital/armorbital/operations_client_example_test.go b/sdk/resourcemanager/orbital/armorbital/operations_client_example_test.go new file mode 100644 index 000000000000..746e2f641e08 --- /dev/null +++ b/sdk/resourcemanager/orbital/armorbital/operations_client_example_test.go @@ -0,0 +1,55 @@ +//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 armorbital_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/OperationsList.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.OperationListResult = armorbital.OperationListResult{ + // Value: []*armorbital.Operation{ + // { + // Name: to.Ptr("Microsoft.Orbital/spacecrafts/write"), + // Display: &armorbital.OperationDisplay{ + // Description: to.Ptr("Creates or Update a spacecraft."), + // Operation: to.Ptr("Create/Update a spacecraft"), + // Provider: to.Ptr("Microsoft Orbital"), + // Resource: to.Ptr("Spacecraft"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_operationsresults_client.go b/sdk/resourcemanager/orbital/armorbital/operationsresults_client.go similarity index 73% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_operationsresults_client.go rename to sdk/resourcemanager/orbital/armorbital/operationsresults_client.go index 316415778047..cbcbbfa051c3 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_operationsresults_client.go +++ b/sdk/resourcemanager/orbital/armorbital/operationsresults_client.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 armorbital @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,63 +24,58 @@ import ( // OperationsResultsClient contains the methods for the OperationsResults group. // Don't use this type directly, use NewOperationsResultsClient() instead. type OperationsResultsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewOperationsResultsClient creates a new instance of OperationsResultsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsResultsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".OperationsResultsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &OperationsResultsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } // BeginGet - Returns operation results. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// location - The name of Azure region. -// operationID - The ID of an ongoing async operation. -// options - OperationsResultsClientBeginGetOptions contains the optional parameters for the OperationsResultsClient.BeginGet -// method. +// +// Generated from API version 2022-11-01 +// - location - The name of Azure region. +// - operationID - The ID of an ongoing async operation. +// - options - OperationsResultsClientBeginGetOptions contains the optional parameters for the OperationsResultsClient.BeginGet +// method. func (client *OperationsResultsClient) BeginGet(ctx context.Context, location string, operationID string, options *OperationsResultsClientBeginGetOptions) (*runtime.Poller[OperationsResultsClientGetResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.get(ctx, location, operationID, options) if err != nil { return nil, err } - return runtime.NewPoller[OperationsResultsClientGetResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OperationsResultsClientGetResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { - return runtime.NewPollerFromResumeToken[OperationsResultsClientGetResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[OperationsResultsClientGetResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Get - Returns operation results. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *OperationsResultsClient) get(ctx context.Context, location string, operationID string, options *OperationsResultsClientBeginGetOptions) (*http.Response, error) { req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -106,12 +100,12 @@ func (client *OperationsResultsClient) getCreateRequest(ctx context.Context, loc return nil, errors.New("parameter operationID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/orbital/armorbital/operationsresults_client_example_test.go b/sdk/resourcemanager/orbital/armorbital/operationsresults_client_example_test.go new file mode 100644 index 000000000000..265b65e52ebc --- /dev/null +++ b/sdk/resourcemanager/orbital/armorbital/operationsresults_client_example_test.go @@ -0,0 +1,56 @@ +//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 armorbital_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/OperationResultsGet.json +func ExampleOperationsResultsClient_BeginGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewOperationsResultsClient().BeginGet(ctx, "eastus2", "30972f1b-b61d-4fd8-bd34-3dcfa24670f3", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.OperationResult = armorbital.OperationResult{ + // Name: to.Ptr("30972f1b-b61d-4fd8-bd34-3dcfa24670f3"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-06-10T13:54:55.7025301Z"); return t}()), + // Error: &armorbital.OperationResultErrorProperties{ + // Code: to.Ptr("ReadOnlyPropertyError"), + // Message: to.Ptr("Cannot write to property, AuthorizationStatus, as it is read-only."), + // }, + // ID: to.Ptr("https://management.azure.com/Microsoft.Orbital/operationResults/4e2ffff7-b331-4fcb-ab11-b5fa49368188?api-version=2022-11-01"), + // PercentComplete: to.Ptr[float64](1), + // Properties: map[string]any{ + // }, + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-06-10T13:54:53.6554616Z"); return t}()), + // Status: to.Ptr(armorbital.StatusFailed), + // } +} diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_response_types.go b/sdk/resourcemanager/orbital/armorbital/response_types.go similarity index 78% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_response_types.go rename to sdk/resourcemanager/orbital/armorbital/response_types.go index bc0f29cdbb34..ced90c8ae98a 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_response_types.go +++ b/sdk/resourcemanager/orbital/armorbital/response_types.go @@ -5,25 +5,21 @@ // 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 armorbital -// AvailableGroundStationsClientGetResponse contains the response from method AvailableGroundStationsClient.Get. -type AvailableGroundStationsClientGetResponse struct { - AvailableGroundStation -} - -// AvailableGroundStationsClientListByCapabilityResponse contains the response from method AvailableGroundStationsClient.ListByCapability. +// AvailableGroundStationsClientListByCapabilityResponse contains the response from method AvailableGroundStationsClient.NewListByCapabilityPager. type AvailableGroundStationsClientListByCapabilityResponse struct { AvailableGroundStationListResult } -// ContactProfilesClientCreateOrUpdateResponse contains the response from method ContactProfilesClient.CreateOrUpdate. +// ContactProfilesClientCreateOrUpdateResponse contains the response from method ContactProfilesClient.BeginCreateOrUpdate. type ContactProfilesClientCreateOrUpdateResponse struct { ContactProfile } -// ContactProfilesClientDeleteResponse contains the response from method ContactProfilesClient.Delete. +// ContactProfilesClientDeleteResponse contains the response from method ContactProfilesClient.BeginDelete. type ContactProfilesClientDeleteResponse struct { // placeholder for future response values } @@ -33,27 +29,27 @@ type ContactProfilesClientGetResponse struct { ContactProfile } -// ContactProfilesClientListBySubscriptionResponse contains the response from method ContactProfilesClient.ListBySubscription. +// ContactProfilesClientListBySubscriptionResponse contains the response from method ContactProfilesClient.NewListBySubscriptionPager. type ContactProfilesClientListBySubscriptionResponse struct { ContactProfileListResult } -// ContactProfilesClientListResponse contains the response from method ContactProfilesClient.List. +// ContactProfilesClientListResponse contains the response from method ContactProfilesClient.NewListPager. type ContactProfilesClientListResponse struct { ContactProfileListResult } -// ContactProfilesClientUpdateTagsResponse contains the response from method ContactProfilesClient.UpdateTags. +// ContactProfilesClientUpdateTagsResponse contains the response from method ContactProfilesClient.BeginUpdateTags. type ContactProfilesClientUpdateTagsResponse struct { ContactProfile } -// ContactsClientCreateResponse contains the response from method ContactsClient.Create. +// ContactsClientCreateResponse contains the response from method ContactsClient.BeginCreate. type ContactsClientCreateResponse struct { Contact } -// ContactsClientDeleteResponse contains the response from method ContactsClient.Delete. +// ContactsClientDeleteResponse contains the response from method ContactsClient.BeginDelete. type ContactsClientDeleteResponse struct { // placeholder for future response values } @@ -63,27 +59,27 @@ type ContactsClientGetResponse struct { Contact } -// ContactsClientListResponse contains the response from method ContactsClient.List. +// ContactsClientListResponse contains the response from method ContactsClient.NewListPager. type ContactsClientListResponse struct { ContactListResult } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } -// OperationsResultsClientGetResponse contains the response from method OperationsResultsClient.Get. +// OperationsResultsClientGetResponse contains the response from method OperationsResultsClient.BeginGet. type OperationsResultsClientGetResponse struct { OperationResult } -// SpacecraftsClientCreateOrUpdateResponse contains the response from method SpacecraftsClient.CreateOrUpdate. +// SpacecraftsClientCreateOrUpdateResponse contains the response from method SpacecraftsClient.BeginCreateOrUpdate. type SpacecraftsClientCreateOrUpdateResponse struct { Spacecraft } -// SpacecraftsClientDeleteResponse contains the response from method SpacecraftsClient.Delete. +// SpacecraftsClientDeleteResponse contains the response from method SpacecraftsClient.BeginDelete. type SpacecraftsClientDeleteResponse struct { // placeholder for future response values } @@ -93,22 +89,22 @@ type SpacecraftsClientGetResponse struct { Spacecraft } -// SpacecraftsClientListAvailableContactsResponse contains the response from method SpacecraftsClient.ListAvailableContacts. +// SpacecraftsClientListAvailableContactsResponse contains the response from method SpacecraftsClient.BeginListAvailableContacts. type SpacecraftsClientListAvailableContactsResponse struct { AvailableContactsListResult } -// SpacecraftsClientListBySubscriptionResponse contains the response from method SpacecraftsClient.ListBySubscription. +// SpacecraftsClientListBySubscriptionResponse contains the response from method SpacecraftsClient.NewListBySubscriptionPager. type SpacecraftsClientListBySubscriptionResponse struct { SpacecraftListResult } -// SpacecraftsClientListResponse contains the response from method SpacecraftsClient.List. +// SpacecraftsClientListResponse contains the response from method SpacecraftsClient.NewListPager. type SpacecraftsClientListResponse struct { SpacecraftListResult } -// SpacecraftsClientUpdateTagsResponse contains the response from method SpacecraftsClient.UpdateTags. +// SpacecraftsClientUpdateTagsResponse contains the response from method SpacecraftsClient.BeginUpdateTags. type SpacecraftsClientUpdateTagsResponse struct { Spacecraft } diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_spacecrafts_client.go b/sdk/resourcemanager/orbital/armorbital/spacecrafts_client.go similarity index 79% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_spacecrafts_client.go rename to sdk/resourcemanager/orbital/armorbital/spacecrafts_client.go index bf77e7b248c6..e3d9d6f67a8f 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_spacecrafts_client.go +++ b/sdk/resourcemanager/orbital/armorbital/spacecrafts_client.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 armorbital @@ -13,8 +14,6 @@ import ( "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,66 +24,59 @@ import ( // SpacecraftsClient contains the methods for the Spacecrafts group. // Don't use this type directly, use NewSpacecraftsClient() instead. type SpacecraftsClient struct { - host string + internal *arm.Client subscriptionID string - pl runtime.Pipeline } // NewSpacecraftsClient creates a new instance of SpacecraftsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSpacecraftsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SpacecraftsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + cl, err := arm.NewClient(moduleName+".SpacecraftsClient", moduleVersion, credential, options) if err != nil { return nil, err } client := &SpacecraftsClient{ subscriptionID: subscriptionID, - host: ep, - pl: pl, + internal: cl, } return client, nil } -// BeginCreateOrUpdate - Creates or updates a spacecraft resource +// BeginCreateOrUpdate - Creates or updates a spacecraft resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// parameters - The parameters to provide for the created spacecraft. -// options - SpacecraftsClientBeginCreateOrUpdateOptions contains the optional parameters for the SpacecraftsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - parameters - The parameters to provide for the created spacecraft. +// - options - SpacecraftsClientBeginCreateOrUpdateOptions contains the optional parameters for the SpacecraftsClient.BeginCreateOrUpdate +// method. func (client *SpacecraftsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, spacecraftName string, parameters Spacecraft, options *SpacecraftsClientBeginCreateOrUpdateOptions) (*runtime.Poller[SpacecraftsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, spacecraftName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SpacecraftsClientCreateOrUpdateResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpacecraftsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { - return runtime.NewPollerFromResumeToken[SpacecraftsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SpacecraftsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } -// CreateOrUpdate - Creates or updates a spacecraft resource +// CreateOrUpdate - Creates or updates a spacecraft resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *SpacecraftsClient) createOrUpdate(ctx context.Context, resourceGroupName string, spacecraftName string, parameters Spacecraft, options *SpacecraftsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, spacecraftName, parameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -109,12 +101,12 @@ func (client *SpacecraftsClient) createOrUpdateCreateRequest(ctx context.Context return nil, errors.New("parameter spacecraftName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{spacecraftName}", url.PathEscape(spacecraftName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,33 +114,35 @@ func (client *SpacecraftsClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Deletes a specified spacecraft resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// options - SpacecraftsClientBeginDeleteOptions contains the optional parameters for the SpacecraftsClient.BeginDelete method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - options - SpacecraftsClientBeginDeleteOptions contains the optional parameters for the SpacecraftsClient.BeginDelete method. func (client *SpacecraftsClient) BeginDelete(ctx context.Context, resourceGroupName string, spacecraftName string, options *SpacecraftsClientBeginDeleteOptions) (*runtime.Poller[SpacecraftsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, spacecraftName, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SpacecraftsClientDeleteResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpacecraftsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[SpacecraftsClientDeleteResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SpacecraftsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // Delete - Deletes a specified spacecraft resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *SpacecraftsClient) deleteOperation(ctx context.Context, resourceGroupName string, spacecraftName string, options *SpacecraftsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, spacecraftName, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -173,29 +167,30 @@ func (client *SpacecraftsClient) deleteCreateRequest(ctx context.Context, resour return nil, errors.New("parameter spacecraftName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{spacecraftName}", url.PathEscape(spacecraftName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Gets the specified spacecraft in a specified resource group +// Get - Gets the specified spacecraft in a specified resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// options - SpacecraftsClientGetOptions contains the optional parameters for the SpacecraftsClient.Get method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - options - SpacecraftsClientGetOptions contains the optional parameters for the SpacecraftsClient.Get method. func (client *SpacecraftsClient) Get(ctx context.Context, resourceGroupName string, spacecraftName string, options *SpacecraftsClientGetOptions) (SpacecraftsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, spacecraftName, options) if err != nil { return SpacecraftsClientGetResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SpacecraftsClientGetResponse{}, err } @@ -220,12 +215,12 @@ func (client *SpacecraftsClient) getCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter spacecraftName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{spacecraftName}", url.PathEscape(spacecraftName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,11 +235,11 @@ func (client *SpacecraftsClient) getHandleResponse(resp *http.Response) (Spacecr return result, nil } -// NewListPager - Return list of spacecrafts -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - SpacecraftsClientListOptions contains the optional parameters for the SpacecraftsClient.List method. +// NewListPager - Returns list of spacecrafts by resource group. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SpacecraftsClientListOptions contains the optional parameters for the SpacecraftsClient.NewListPager method. func (client *SpacecraftsClient) NewListPager(resourceGroupName string, options *SpacecraftsClientListOptions) *runtime.Pager[SpacecraftsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SpacecraftsClientListResponse]{ More: func(page SpacecraftsClientListResponse) bool { @@ -261,7 +256,7 @@ func (client *SpacecraftsClient) NewListPager(resourceGroupName string, options if err != nil { return SpacecraftsClientListResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SpacecraftsClientListResponse{}, err } @@ -284,12 +279,12 @@ func (client *SpacecraftsClient) listCreateRequest(ctx context.Context, resource return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } @@ -307,14 +302,15 @@ func (client *SpacecraftsClient) listHandleResponse(resp *http.Response) (Spacec return result, nil } -// BeginListAvailableContacts - Return list of available contacts -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// parameters - The parameters to provide for the contacts. -// options - SpacecraftsClientBeginListAvailableContactsOptions contains the optional parameters for the SpacecraftsClient.BeginListAvailableContacts -// method. +// BeginListAvailableContacts - Returns list of available contacts. A contact is available if the spacecraft is visible from +// the ground station for more than the minimum viable contact duration provided in the contact profile. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - parameters - The parameters to provide for the contacts. +// - options - SpacecraftsClientBeginListAvailableContactsOptions contains the optional parameters for the SpacecraftsClient.BeginListAvailableContacts +// method. func (client *SpacecraftsClient) BeginListAvailableContacts(ctx context.Context, resourceGroupName string, spacecraftName string, parameters ContactParameters, options *SpacecraftsClientBeginListAvailableContactsOptions) (*runtime.Poller[*runtime.Pager[SpacecraftsClientListAvailableContactsResponse]], error) { pager := runtime.NewPager(runtime.PagingHandler[SpacecraftsClientListAvailableContactsResponse]{ More: func(page SpacecraftsClientListAvailableContactsResponse) bool { @@ -325,7 +321,7 @@ func (client *SpacecraftsClient) BeginListAvailableContacts(ctx context.Context, if err != nil { return SpacecraftsClientListAvailableContactsResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SpacecraftsClientListAvailableContactsResponse{}, err } @@ -340,26 +336,27 @@ func (client *SpacecraftsClient) BeginListAvailableContacts(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[*runtime.Pager[SpacecraftsClientListAvailableContactsResponse]]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[*runtime.Pager[SpacecraftsClientListAvailableContactsResponse]]{ FinalStateVia: runtime.FinalStateViaLocation, Response: &pager, }) } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.pl, &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[SpacecraftsClientListAvailableContactsResponse]]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[*runtime.Pager[SpacecraftsClientListAvailableContactsResponse]]{ Response: &pager, }) } } -// ListAvailableContacts - Return list of available contacts -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// ListAvailableContacts - Returns list of available contacts. A contact is available if the spacecraft is visible from the +// ground station for more than the minimum viable contact duration provided in the contact profile. +// +// Generated from API version 2022-11-01 func (client *SpacecraftsClient) listAvailableContacts(ctx context.Context, resourceGroupName string, spacecraftName string, parameters ContactParameters, options *SpacecraftsClientBeginListAvailableContactsOptions) (*http.Response, error) { req, err := client.listAvailableContactsCreateRequest(ctx, resourceGroupName, spacecraftName, parameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -384,12 +381,12 @@ func (client *SpacecraftsClient) listAvailableContactsCreateRequest(ctx context. return nil, errors.New("parameter spacecraftName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{spacecraftName}", url.PathEscape(spacecraftName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -404,11 +401,11 @@ func (client *SpacecraftsClient) listAvailableContactsHandleResponse(resp *http. return result, nil } -// NewListBySubscriptionPager - Return list of spacecrafts -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// options - SpacecraftsClientListBySubscriptionOptions contains the optional parameters for the SpacecraftsClient.ListBySubscription -// method. +// NewListBySubscriptionPager - Returns list of spacecrafts by subscription. +// +// Generated from API version 2022-11-01 +// - options - SpacecraftsClientListBySubscriptionOptions contains the optional parameters for the SpacecraftsClient.NewListBySubscriptionPager +// method. func (client *SpacecraftsClient) NewListBySubscriptionPager(options *SpacecraftsClientListBySubscriptionOptions) *runtime.Pager[SpacecraftsClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[SpacecraftsClientListBySubscriptionResponse]{ More: func(page SpacecraftsClientListBySubscriptionResponse) bool { @@ -425,7 +422,7 @@ func (client *SpacecraftsClient) NewListBySubscriptionPager(options *Spacecrafts if err != nil { return SpacecraftsClientListBySubscriptionResponse{}, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return SpacecraftsClientListBySubscriptionResponse{}, err } @@ -444,12 +441,12 @@ func (client *SpacecraftsClient) listBySubscriptionCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") if options != nil && options.Skiptoken != nil { reqQP.Set("$skiptoken", *options.Skiptoken) } @@ -469,35 +466,37 @@ func (client *SpacecraftsClient) listBySubscriptionHandleResponse(resp *http.Res // BeginUpdateTags - Updates the specified spacecraft tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 -// resourceGroupName - The name of the resource group. The name is case insensitive. -// spacecraftName - Spacecraft ID -// parameters - Parameters supplied to update spacecraft tags. -// options - SpacecraftsClientBeginUpdateTagsOptions contains the optional parameters for the SpacecraftsClient.BeginUpdateTags -// method. +// +// Generated from API version 2022-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spacecraftName - Spacecraft ID. +// - parameters - Parameters supplied to update spacecraft tags. +// - options - SpacecraftsClientBeginUpdateTagsOptions contains the optional parameters for the SpacecraftsClient.BeginUpdateTags +// method. func (client *SpacecraftsClient) BeginUpdateTags(ctx context.Context, resourceGroupName string, spacecraftName string, parameters TagsObject, options *SpacecraftsClientBeginUpdateTagsOptions) (*runtime.Poller[SpacecraftsClientUpdateTagsResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.updateTags(ctx, resourceGroupName, spacecraftName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SpacecraftsClientUpdateTagsResponse]{ + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SpacecraftsClientUpdateTagsResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) } else { - return runtime.NewPollerFromResumeToken[SpacecraftsClientUpdateTagsResponse](options.ResumeToken, client.pl, nil) + return runtime.NewPollerFromResumeToken[SpacecraftsClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } } // UpdateTags - Updates the specified spacecraft tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-03-01 +// +// Generated from API version 2022-11-01 func (client *SpacecraftsClient) updateTags(ctx context.Context, resourceGroupName string, spacecraftName string, parameters TagsObject, options *SpacecraftsClientBeginUpdateTagsOptions) (*http.Response, error) { req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, spacecraftName, parameters, options) if err != nil { return nil, err } - resp, err := client.pl.Do(req) + resp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } @@ -522,12 +521,12 @@ func (client *SpacecraftsClient) updateTagsCreateRequest(ctx context.Context, re return nil, errors.New("parameter spacecraftName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{spacecraftName}", url.PathEscape(spacecraftName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-03-01") + reqQP.Set("api-version", "2022-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/orbital/armorbital/spacecrafts_client_example_test.go b/sdk/resourcemanager/orbital/armorbital/spacecrafts_client_example_test.go new file mode 100644 index 000000000000..0f9e129fc0cd --- /dev/null +++ b/sdk/resourcemanager/orbital/armorbital/spacecrafts_client_example_test.go @@ -0,0 +1,464 @@ +//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 armorbital_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital/v2" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/SpacecraftsBySubscriptionList.json +func ExampleSpacecraftsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpacecraftsClient().NewListBySubscriptionPager(&armorbital.SpacecraftsClientListBySubscriptionOptions{Skiptoken: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpacecraftListResult = armorbital.SpacecraftListResult{ + // Value: []*armorbital.Spacecraft{ + // { + // Name: to.Ptr("CONTOSO_SAT"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.SpacecraftsProperties{ + // Links: []*armorbital.SpacecraftLink{ + // { + // Name: to.Ptr("uplink_lhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // Direction: to.Ptr(armorbital.DirectionUplink), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("downlink_rhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // Direction: to.Ptr(armorbital.DirectionDownlink), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // NoradID: to.Ptr("36411"), + // ProvisioningState: to.Ptr(armorbital.SpacecraftsPropertiesProvisioningState("Succeeded")), + // TitleLine: to.Ptr("CONTOSO_SAT"), + // TleLine1: to.Ptr("1 27424U 02022A 22167.05119303 .00000638 00000+0 15103-3 0 9994"), + // TleLine2: to.Ptr("2 27424 98.2477 108.9546 0000928 92.9194 327.0802 14.57300770 69982"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/SpacecraftsByResourceGroupList.json +func ExampleSpacecraftsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSpacecraftsClient().NewListPager("contoso-Rgp", &armorbital.SpacecraftsClientListOptions{Skiptoken: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.SpacecraftListResult = armorbital.SpacecraftListResult{ + // Value: []*armorbital.Spacecraft{ + // { + // Name: to.Ptr("CONTOSO_SAT"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.SpacecraftsProperties{ + // Links: []*armorbital.SpacecraftLink{ + // { + // Name: to.Ptr("uplink_lhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // Direction: to.Ptr(armorbital.DirectionUplink), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("downlink_rhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // Direction: to.Ptr(armorbital.DirectionDownlink), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // NoradID: to.Ptr("36411"), + // ProvisioningState: to.Ptr(armorbital.SpacecraftsPropertiesProvisioningState("Succeeded")), + // TitleLine: to.Ptr("CONTOSO_SAT"), + // TleLine1: to.Ptr("1 27424U 02022A 22167.05119303 .00000638 00000+0 15103-3 0 9994"), + // TleLine2: to.Ptr("2 27424 98.2477 108.9546 0000928 92.9194 327.0802 14.57300770 69982"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/SpacecraftGet.json +func ExampleSpacecraftsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSpacecraftsClient().Get(ctx, "contoso-Rgp", "CONTOSO_SAT", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Spacecraft = armorbital.Spacecraft{ + // Name: to.Ptr("CONTOSO_SAT"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.SpacecraftsProperties{ + // Links: []*armorbital.SpacecraftLink{ + // { + // Name: to.Ptr("uplink_lhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // Direction: to.Ptr(armorbital.DirectionUplink), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("downlink_rhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // Direction: to.Ptr(armorbital.DirectionDownlink), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // NoradID: to.Ptr("36411"), + // ProvisioningState: to.Ptr(armorbital.SpacecraftsPropertiesProvisioningState("Succeeded")), + // TitleLine: to.Ptr("CONTOSO_SAT"), + // TleLine1: to.Ptr("1 27424U 02022A 22167.05119303 .00000638 00000+0 15103-3 0 9994"), + // TleLine2: to.Ptr("2 27424 98.2477 108.9546 0000928 92.9194 327.0802 14.57300770 69982"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/SpacecraftCreate.json +func ExampleSpacecraftsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpacecraftsClient().BeginCreateOrUpdate(ctx, "contoso-Rgp", "CONTOSO_SAT", armorbital.Spacecraft{ + Location: to.Ptr("eastus2"), + Properties: &armorbital.SpacecraftsProperties{ + Links: []*armorbital.SpacecraftLink{ + { + Name: to.Ptr("uplink_lhcp1"), + BandwidthMHz: to.Ptr[float32](2), + CenterFrequencyMHz: to.Ptr[float32](2250), + Direction: to.Ptr(armorbital.DirectionUplink), + Polarization: to.Ptr(armorbital.PolarizationLHCP), + }, + { + Name: to.Ptr("downlink_rhcp1"), + BandwidthMHz: to.Ptr[float32](15), + CenterFrequencyMHz: to.Ptr[float32](8160), + Direction: to.Ptr(armorbital.DirectionDownlink), + Polarization: to.Ptr(armorbital.PolarizationRHCP), + }}, + NoradID: to.Ptr("36411"), + TitleLine: to.Ptr("CONTOSO_SAT"), + TleLine1: to.Ptr("1 27424U 02022A 22167.05119303 .00000638 00000+0 15103-3 0 9994"), + TleLine2: to.Ptr("2 27424 98.2477 108.9546 0000928 92.9194 327.0802 14.57300770 69982"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Spacecraft = armorbital.Spacecraft{ + // Name: to.Ptr("CONTOSO_SAT"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT"), + // Location: to.Ptr("eastus2"), + // Properties: &armorbital.SpacecraftsProperties{ + // Links: []*armorbital.SpacecraftLink{ + // { + // Name: to.Ptr("uplink_lhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // Direction: to.Ptr(armorbital.DirectionUplink), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("downlink_rhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // Direction: to.Ptr(armorbital.DirectionDownlink), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // NoradID: to.Ptr("36411"), + // ProvisioningState: to.Ptr(armorbital.SpacecraftsPropertiesProvisioningState("Succeeded")), + // TitleLine: to.Ptr("CONTOSO_SAT"), + // TleLine1: to.Ptr("1 27424U 02022A 22167.05119303 .00000638 00000+0 15103-3 0 9994"), + // TleLine2: to.Ptr("2 27424 98.2477 108.9546 0000928 92.9194 327.0802 14.57300770 69982"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/SpacecraftDelete.json +func ExampleSpacecraftsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpacecraftsClient().BeginDelete(ctx, "contoso-Rgp", "CONTOSO_SAT", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/SpacecraftUpdateTags.json +func ExampleSpacecraftsClient_BeginUpdateTags() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpacecraftsClient().BeginUpdateTags(ctx, "contoso-Rgp", "CONTOSO_SAT", armorbital.TagsObject{ + Tags: map[string]*string{ + "tag1": to.Ptr("value1"), + "tag2": to.Ptr("value2"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Spacecraft = armorbital.Spacecraft{ + // Name: to.Ptr("CONTOSO_SAT"), + // Type: to.Ptr("Microsoft.Orbital/spacecrafts"), + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT"), + // Location: to.Ptr("eastus2"), + // Tags: map[string]*string{ + // "tag1": to.Ptr("value1"), + // "tag2": to.Ptr("value2"), + // }, + // Properties: &armorbital.SpacecraftsProperties{ + // Links: []*armorbital.SpacecraftLink{ + // { + // Name: to.Ptr("uplink_lhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](2), + // CenterFrequencyMHz: to.Ptr[float32](2250), + // Direction: to.Ptr(armorbital.DirectionUplink), + // Polarization: to.Ptr(armorbital.PolarizationLHCP), + // }, + // { + // Name: to.Ptr("downlink_rhcp1"), + // Authorizations: []*armorbital.AuthorizedGroundstation{ + // { + // ExpirationDate: to.Ptr(func() time.Time { t, _ := time.Parse("2006-01-02", "2023-06-02"); return t}()), + // GroundStation: to.Ptr("EASTUS2_0"), + // }}, + // BandwidthMHz: to.Ptr[float32](15), + // CenterFrequencyMHz: to.Ptr[float32](8160), + // Direction: to.Ptr(armorbital.DirectionDownlink), + // Polarization: to.Ptr(armorbital.PolarizationRHCP), + // }}, + // NoradID: to.Ptr("36411"), + // ProvisioningState: to.Ptr(armorbital.SpacecraftsPropertiesProvisioningState("Succeeded")), + // TitleLine: to.Ptr("CONTOSO_SAT"), + // TleLine1: to.Ptr("1 27424U 02022A 22167.05119303 .00000638 00000+0 15103-3 0 9994"), + // TleLine2: to.Ptr("2 27424 98.2477 108.9546 0000928 92.9194 327.0802 14.57300770 69982"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-11-01/examples/AvailableContactsList.json +func ExampleSpacecraftsClient_BeginListAvailableContacts() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armorbital.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSpacecraftsClient().BeginListAvailableContacts(ctx, "contoso-Rgp", "CONTOSO_SAT", armorbital.ContactParameters{ + ContactProfile: &armorbital.ContactParametersContactProfile{ + ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/contactProfiles/CONTOSO-CP"), + }, + EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-02T11:30:00Z"); return t }()), + GroundStationName: to.Ptr("EASTUS2_0"), + StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T11:30:00Z"); return t }()), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + for res.More() { + page, err := res.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AvailableContactsListResult = armorbital.AvailableContactsListResult{ + // Value: []*armorbital.AvailableContacts{ + // { + // GroundStationName: to.Ptr("EASTUS2_0"), + // Properties: &armorbital.AvailableContactsProperties{ + // EndAzimuthDegrees: to.Ptr[float32](330.489627), + // EndElevationDegrees: to.Ptr[float32](5.040625), + // MaximumElevationDegrees: to.Ptr[float32](26.617297), + // RxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T12:05:25Z"); return t}()), + // RxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T11:55:01Z"); return t}()), + // StartAzimuthDegrees: to.Ptr[float32](201.340472), + // StartElevationDegrees: to.Ptr[float32](5), + // TxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T12:05:25Z"); return t}()), + // TxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-01T11:55:01Z"); return t}()), + // }, + // Spacecraft: &armorbital.AvailableContactsSpacecraft{ + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT"), + // }, + // }, + // { + // GroundStationName: to.Ptr("EASTUS2_0"), + // Properties: &armorbital.AvailableContactsProperties{ + // EndAzimuthDegrees: to.Ptr[float32](345.848482), + // EndElevationDegrees: to.Ptr[float32](5.048656), + // MaximumElevationDegrees: to.Ptr[float32](85.9796), + // RxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-02T11:10:45Z"); return t}()), + // RxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-02T10:58:30Z"); return t}()), + // StartAzimuthDegrees: to.Ptr[float32](165.758896), + // StartElevationDegrees: to.Ptr[float32](5), + // TxEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-02T11:10:45Z"); return t}()), + // TxStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-02T10:58:30Z"); return t}()), + // }, + // Spacecraft: &armorbital.AvailableContactsSpacecraft{ + // ID: to.Ptr("/subscriptions/c1be1141-a7c9-4aac-9608-3c2e2f1152c3/resourceGroups/contoso-Rgp/providers/Microsoft.Orbital/spacecrafts/CONTOSO_SAT"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_time_rfc3339.go b/sdk/resourcemanager/orbital/armorbital/time_rfc3339.go similarity index 96% rename from sdk/resourcemanager/orbital/armorbital/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/orbital/armorbital/time_rfc3339.go index 3b19e783796c..59ceae835720 100644 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/orbital/armorbital/time_rfc3339.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 armorbital @@ -61,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_availablegroundstations_client_test.go b/sdk/resourcemanager/orbital/armorbital/ze_generated_example_availablegroundstations_client_test.go deleted file mode 100644 index 59e35ae614da..000000000000 --- a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_availablegroundstations_client_test.go +++ /dev/null @@ -1,63 +0,0 @@ -//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. - -package armorbital_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/AvailableGroundStationsByCapabilityList.json -func ExampleAvailableGroundStationsClient_NewListByCapabilityPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewAvailableGroundStationsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByCapabilityPager(armorbital.CapabilityParameterEarthObservation, - 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/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/AvailableGroundStationGet.json -func ExampleAvailableGroundStationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewAvailableGroundStationsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "westus_gs1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_contactprofiles_client_test.go b/sdk/resourcemanager/orbital/armorbital/ze_generated_example_contactprofiles_client_test.go deleted file mode 100644 index 159abb3f0188..000000000000 --- a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_contactprofiles_client_test.go +++ /dev/null @@ -1,230 +0,0 @@ -//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. - -package armorbital_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactProfileGet.json -func ExampleContactProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "AQUA_DIRECTPLAYBACK_WITH_UPLINK", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactProfileCreate.json -func ExampleContactProfilesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "AQUA_DIRECTPLAYBACK_WITH_UPLINK", - armorbital.ContactProfile{ - Location: to.Ptr("westus"), - Properties: &armorbital.ContactProfileProperties{ - AutoTrackingConfiguration: to.Ptr(armorbital.AutoTrackingConfigurationXBand), - EventHubURI: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.EventHub/namespaces/orbitalppewestus2-ns/eventhubs/telemetry-hub/"), - Links: []*armorbital.ContactProfileLink{ - { - Name: to.Ptr("RHCP_UL"), - Channels: []*armorbital.ContactProfileLinkChannel{ - { - Name: to.Ptr("channel1"), - BandwidthMHz: to.Ptr[float32](0.036), - CenterFrequencyMHz: to.Ptr[float32](2106.4063), - DecodingConfiguration: to.Ptr("na"), - DemodulationConfiguration: to.Ptr("na"), - EncodingConfiguration: to.Ptr("AQUA_CMD_CCSDS"), - EndPoint: &armorbital.EndPoint{ - EndPointName: to.Ptr("AQUA_command"), - IPAddress: to.Ptr("10.0.1.0"), - Port: to.Ptr("4000"), - Protocol: to.Ptr(armorbital.ProtocolTCP), - }, - ModulationConfiguration: to.Ptr("AQUA_UPLINK_BPSK"), - }}, - Direction: to.Ptr(armorbital.DirectionUplink), - EirpdBW: to.Ptr[float32](45), - GainOverTemperature: to.Ptr[float32](0), - Polarization: to.Ptr(armorbital.PolarizationRHCP), - }, - { - Name: to.Ptr("RHCP_DL"), - Channels: []*armorbital.ContactProfileLinkChannel{ - { - Name: to.Ptr("channel1"), - BandwidthMHz: to.Ptr[float32](150), - CenterFrequencyMHz: to.Ptr[float32](8160), - DecodingConfiguration: to.Ptr("AQUA_DIRECTPLAYBACK_CCSDS"), - DemodulationConfiguration: to.Ptr("AQUA_DOWNLINK_QPSK"), - EncodingConfiguration: to.Ptr("na"), - EndPoint: &armorbital.EndPoint{ - EndPointName: to.Ptr("AQUA_directplayback"), - IPAddress: to.Ptr("10.0.2.0"), - Port: to.Ptr("4000"), - Protocol: to.Ptr(armorbital.ProtocolTCP), - }, - ModulationConfiguration: to.Ptr("na"), - }}, - Direction: to.Ptr(armorbital.DirectionDownlink), - EirpdBW: to.Ptr[float32](0), - GainOverTemperature: to.Ptr[float32](25), - Polarization: to.Ptr(armorbital.PolarizationRHCP), - }}, - MinimumElevationDegrees: to.Ptr[float32](10), - MinimumViableContactDuration: to.Ptr("PT1M"), - NetworkConfiguration: &armorbital.ContactProfilesPropertiesNetworkConfiguration{ - SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnetName"), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactProfileDelete.json -func ExampleContactProfilesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "AQUA_DIRECTPLAYBACK_WITH_UPLINK", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactProfileUpdateTag.json -func ExampleContactProfilesClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateTags(ctx, - "rg1", - "AQUA_DIRECTPLAYBACK_WITH_UPLINK", - armorbital.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactProfilesBySubscriptionList.json -func ExampleContactProfilesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armorbital.ContactProfilesClientListBySubscriptionOptions{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/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactProfilesByResourceGroupList.json -func ExampleContactProfilesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactProfilesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rg1", - &armorbital.ContactProfilesClientListOptions{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 - } - } -} diff --git a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_contacts_client_test.go b/sdk/resourcemanager/orbital/armorbital/ze_generated_example_contacts_client_test.go deleted file mode 100644 index 8940f649ee99..000000000000 --- a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_contacts_client_test.go +++ /dev/null @@ -1,131 +0,0 @@ -//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. - -package armorbital_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactsBySpacecraftNameList.json -func ExampleContactsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rg1", - "AQUA", - &armorbital.ContactsClientListOptions{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/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactGet.json -func ExampleContactsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "AQUA", - "contact1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactCreate.json -func ExampleContactsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "rg1", - "AQUA", - "contact1", - armorbital.Contact{ - Properties: &armorbital.ContactsProperties{ - ContactProfile: &armorbital.ContactsPropertiesContactProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/Microsoft.Orbital/contactProfiles/AQUA_DIRECTPLAYBACK_WITH_UPLINK"), - }, - GroundStationName: to.Ptr("westus_gs1"), - ReservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-16T20:55:00.00Z"); return t }()), - ReservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-16T20:35:00.00Z"); return t }()), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/ContactDelete.json -func ExampleContactsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewContactsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "AQUA", - "contact1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/orbital/armorbital/ze_generated_example_operations_client_test.go deleted file mode 100644 index e3f785636671..000000000000 --- a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//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. - -package armorbital_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/OperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(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 - } - } -} diff --git a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_operationsresults_client_test.go b/sdk/resourcemanager/orbital/armorbital/ze_generated_example_operationsresults_client_test.go deleted file mode 100644 index 2214bd65e95c..000000000000 --- a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_operationsresults_client_test.go +++ /dev/null @@ -1,43 +0,0 @@ -//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. - -package armorbital_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/OperationResultsGet.json -func ExampleOperationsResultsClient_BeginGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewOperationsResultsClient("12345678-1234-1234-1234-123456789098", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginGet(ctx, - "westus", - "30972f1b-b61d-4fd8-bd34-3dcfa24670f3", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_spacecrafts_client_test.go b/sdk/resourcemanager/orbital/armorbital/ze_generated_example_spacecrafts_client_test.go deleted file mode 100644 index cf59eafc40c9..000000000000 --- a/sdk/resourcemanager/orbital/armorbital/ze_generated_example_spacecrafts_client_test.go +++ /dev/null @@ -1,239 +0,0 @@ -//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. - -package armorbital_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/orbital/armorbital" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/SpacecraftsBySubscriptionList.json -func ExampleSpacecraftsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewSpacecraftsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armorbital.SpacecraftsClientListBySubscriptionOptions{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/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/SpacecraftsByResourceGroupList.json -func ExampleSpacecraftsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewSpacecraftsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("rg1", - &armorbital.SpacecraftsClientListOptions{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/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/SpacecraftGet.json -func ExampleSpacecraftsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewSpacecraftsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "AQUA", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/SpacecraftCreate.json -func ExampleSpacecraftsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewSpacecraftsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "AQUA", - armorbital.Spacecraft{ - Location: to.Ptr("westus"), - Properties: &armorbital.SpacecraftsProperties{ - Links: []*armorbital.SpacecraftLink{ - { - Name: to.Ptr("S_RHCP_UL"), - BandwidthMHz: to.Ptr[float32](0.036), - CenterFrequencyMHz: to.Ptr[float32](2106.4063), - Direction: to.Ptr(armorbital.DirectionUplink), - Polarization: to.Ptr(armorbital.PolarizationRHCP), - }, - { - Name: to.Ptr("X_RHCP_DL"), - BandwidthMHz: to.Ptr[float32](150), - CenterFrequencyMHz: to.Ptr[float32](8125), - Direction: to.Ptr(armorbital.DirectionDownlink), - Polarization: to.Ptr(armorbital.PolarizationRHCP), - }}, - NoradID: to.Ptr("27424"), - TitleLine: to.Ptr("(AQUA)"), - TleLine1: to.Ptr("1 27424U 02022A 20195.59202355 .00000039 00000-0 18634-4 0 9991"), - TleLine2: to.Ptr("2 27424 98.2098 135.8486 0000176 28.4050 144.5909 14.57108832967671"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/SpacecraftDelete.json -func ExampleSpacecraftsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewSpacecraftsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "AQUA", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/SpacecraftUpdateTags.json -func ExampleSpacecraftsClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewSpacecraftsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdateTags(ctx, - "rg1", - "AQUA", - armorbital.TagsObject{ - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - "tag2": to.Ptr("value2"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/orbital/resource-manager/Microsoft.Orbital/stable/2022-03-01/examples/AvailableContactsList.json -func ExampleSpacecraftsClient_BeginListAvailableContacts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armorbital.NewSpacecraftsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginListAvailableContacts(ctx, - "rgName", - "AQUA", - armorbital.ContactParameters{ - ContactProfile: &armorbital.ContactParametersContactProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/Microsoft.Orbital/contactProfiles/AQUA_DIRECTPLAYBACK_WITH_UPLINK"), - }, - EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-17T23:49:40.00Z"); return t }()), - GroundStationName: to.Ptr("westus_gs1"), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-16T05:40:21.00Z"); return t }()), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - for res.More() { - nextResult, err := res.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/orbital/armorbital/zz_generated_models_serde.go b/sdk/resourcemanager/orbital/armorbital/zz_generated_models_serde.go deleted file mode 100644 index 78a1b797c9e3..000000000000 --- a/sdk/resourcemanager/orbital/armorbital/zz_generated_models_serde.go +++ /dev/null @@ -1,490 +0,0 @@ -//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. - -package armorbital - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AuthorizedGroundstation. -func (a AuthorizedGroundstation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateDateType(objectMap, "expirationDate", a.ExpirationDate) - populate(objectMap, "groundStation", a.GroundStation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorizedGroundstation. -func (a *AuthorizedGroundstation) 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 "expirationDate": - err = unpopulateDateType(val, "ExpirationDate", &a.ExpirationDate) - delete(rawMsg, key) - case "groundStation": - err = unpopulate(val, "GroundStation", &a.GroundStation) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableContactsProperties. -func (a *AvailableContactsProperties) 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 "endAzimuthDegrees": - err = unpopulate(val, "EndAzimuthDegrees", &a.EndAzimuthDegrees) - delete(rawMsg, key) - case "endElevationDegrees": - err = unpopulate(val, "EndElevationDegrees", &a.EndElevationDegrees) - delete(rawMsg, key) - case "maximumElevationDegrees": - err = unpopulate(val, "MaximumElevationDegrees", &a.MaximumElevationDegrees) - delete(rawMsg, key) - case "rxEndTime": - err = unpopulateTimeRFC3339(val, "RxEndTime", &a.RxEndTime) - delete(rawMsg, key) - case "rxStartTime": - err = unpopulateTimeRFC3339(val, "RxStartTime", &a.RxStartTime) - delete(rawMsg, key) - case "startAzimuthDegrees": - err = unpopulate(val, "StartAzimuthDegrees", &a.StartAzimuthDegrees) - delete(rawMsg, key) - case "startElevationDegrees": - err = unpopulate(val, "StartElevationDegrees", &a.StartElevationDegrees) - delete(rawMsg, key) - case "txEndTime": - err = unpopulateTimeRFC3339(val, "TxEndTime", &a.TxEndTime) - delete(rawMsg, key) - case "txStartTime": - err = unpopulateTimeRFC3339(val, "TxStartTime", &a.TxStartTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContactInstanceProperties. -func (c *ContactInstanceProperties) 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 "endAzimuthDegrees": - err = unpopulate(val, "EndAzimuthDegrees", &c.EndAzimuthDegrees) - delete(rawMsg, key) - case "endElevationDegrees": - err = unpopulate(val, "EndElevationDegrees", &c.EndElevationDegrees) - delete(rawMsg, key) - case "maximumElevationDegrees": - err = unpopulate(val, "MaximumElevationDegrees", &c.MaximumElevationDegrees) - delete(rawMsg, key) - case "rxEndTime": - err = unpopulateTimeRFC3339(val, "RxEndTime", &c.RxEndTime) - delete(rawMsg, key) - case "rxStartTime": - err = unpopulateTimeRFC3339(val, "RxStartTime", &c.RxStartTime) - delete(rawMsg, key) - case "startAzimuthDegrees": - err = unpopulate(val, "StartAzimuthDegrees", &c.StartAzimuthDegrees) - delete(rawMsg, key) - case "startElevationDegrees": - err = unpopulate(val, "StartElevationDegrees", &c.StartElevationDegrees) - delete(rawMsg, key) - case "txEndTime": - err = unpopulateTimeRFC3339(val, "TxEndTime", &c.TxEndTime) - delete(rawMsg, key) - case "txStartTime": - err = unpopulateTimeRFC3339(val, "TxStartTime", &c.TxStartTime) - 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 ContactParameters. -func (c ContactParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "contactProfile", c.ContactProfile) - populateTimeRFC3339(objectMap, "endTime", c.EndTime) - populate(objectMap, "groundStationName", c.GroundStationName) - populateTimeRFC3339(objectMap, "startTime", c.StartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContactParameters. -func (c *ContactParameters) 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 "contactProfile": - err = unpopulate(val, "ContactProfile", &c.ContactProfile) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &c.EndTime) - delete(rawMsg, key) - case "groundStationName": - err = unpopulate(val, "GroundStationName", &c.GroundStationName) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &c.StartTime) - 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 ContactProfile. -func (c ContactProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", c.Etag) - populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContactProfileLink. -func (c ContactProfileLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "channels", c.Channels) - populate(objectMap, "direction", c.Direction) - populate(objectMap, "eirpdBW", c.EirpdBW) - populate(objectMap, "gainOverTemperature", c.GainOverTemperature) - populate(objectMap, "name", c.Name) - populate(objectMap, "polarization", c.Polarization) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContactProfileProperties. -func (c ContactProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "autoTrackingConfiguration", c.AutoTrackingConfiguration) - populate(objectMap, "eventHubUri", c.EventHubURI) - populate(objectMap, "links", c.Links) - populate(objectMap, "minimumElevationDegrees", c.MinimumElevationDegrees) - populate(objectMap, "minimumViableContactDuration", c.MinimumViableContactDuration) - populate(objectMap, "networkConfiguration", c.NetworkConfiguration) - populate(objectMap, "provisioningState", c.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContactProfilesProperties. -func (c ContactProfilesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "autoTrackingConfiguration", c.AutoTrackingConfiguration) - populate(objectMap, "eventHubUri", c.EventHubURI) - populate(objectMap, "links", c.Links) - populate(objectMap, "minimumElevationDegrees", c.MinimumElevationDegrees) - populate(objectMap, "minimumViableContactDuration", c.MinimumViableContactDuration) - populate(objectMap, "networkConfiguration", c.NetworkConfiguration) - populate(objectMap, "provisioningState", c.ProvisioningState) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContactsProperties. -func (c ContactsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "antennaConfiguration", c.AntennaConfiguration) - populate(objectMap, "contactProfile", c.ContactProfile) - populate(objectMap, "endAzimuthDegrees", c.EndAzimuthDegrees) - populate(objectMap, "endElevationDegrees", c.EndElevationDegrees) - populate(objectMap, "errorMessage", c.ErrorMessage) - populate(objectMap, "groundStationName", c.GroundStationName) - populate(objectMap, "maximumElevationDegrees", c.MaximumElevationDegrees) - populate(objectMap, "provisioningState", c.ProvisioningState) - populateTimeRFC3339(objectMap, "reservationEndTime", c.ReservationEndTime) - populateTimeRFC3339(objectMap, "reservationStartTime", c.ReservationStartTime) - populateTimeRFC3339(objectMap, "rxEndTime", c.RxEndTime) - populateTimeRFC3339(objectMap, "rxStartTime", c.RxStartTime) - populate(objectMap, "startAzimuthDegrees", c.StartAzimuthDegrees) - populate(objectMap, "startElevationDegrees", c.StartElevationDegrees) - populate(objectMap, "status", c.Status) - populateTimeRFC3339(objectMap, "txEndTime", c.TxEndTime) - populateTimeRFC3339(objectMap, "txStartTime", c.TxStartTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContactsProperties. -func (c *ContactsProperties) 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 "antennaConfiguration": - err = unpopulate(val, "AntennaConfiguration", &c.AntennaConfiguration) - delete(rawMsg, key) - case "contactProfile": - err = unpopulate(val, "ContactProfile", &c.ContactProfile) - delete(rawMsg, key) - case "endAzimuthDegrees": - err = unpopulate(val, "EndAzimuthDegrees", &c.EndAzimuthDegrees) - delete(rawMsg, key) - case "endElevationDegrees": - err = unpopulate(val, "EndElevationDegrees", &c.EndElevationDegrees) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &c.ErrorMessage) - delete(rawMsg, key) - case "groundStationName": - err = unpopulate(val, "GroundStationName", &c.GroundStationName) - delete(rawMsg, key) - case "maximumElevationDegrees": - err = unpopulate(val, "MaximumElevationDegrees", &c.MaximumElevationDegrees) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "reservationEndTime": - err = unpopulateTimeRFC3339(val, "ReservationEndTime", &c.ReservationEndTime) - delete(rawMsg, key) - case "reservationStartTime": - err = unpopulateTimeRFC3339(val, "ReservationStartTime", &c.ReservationStartTime) - delete(rawMsg, key) - case "rxEndTime": - err = unpopulateTimeRFC3339(val, "RxEndTime", &c.RxEndTime) - delete(rawMsg, key) - case "rxStartTime": - err = unpopulateTimeRFC3339(val, "RxStartTime", &c.RxStartTime) - delete(rawMsg, key) - case "startAzimuthDegrees": - err = unpopulate(val, "StartAzimuthDegrees", &c.StartAzimuthDegrees) - delete(rawMsg, key) - case "startElevationDegrees": - err = unpopulate(val, "StartElevationDegrees", &c.StartElevationDegrees) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &c.Status) - delete(rawMsg, key) - case "txEndTime": - err = unpopulateTimeRFC3339(val, "TxEndTime", &c.TxEndTime) - delete(rawMsg, key) - case "txStartTime": - err = unpopulateTimeRFC3339(val, "TxStartTime", &c.TxStartTime) - 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 ContactsPropertiesAntennaConfiguration. -func (c ContactsPropertiesAntennaConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "destinationIp", c.DestinationIP) - populate(objectMap, "sourceIps", c.SourceIPs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResult. -func (o *OperationResult) 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", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "percentComplete": - err = unpopulate(val, "PercentComplete", &o.PercentComplete) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Spacecraft. -func (s Spacecraft) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", s.Etag) - 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) -} - -// MarshalJSON implements the json.Marshaller interface for type SpacecraftLink. -func (s SpacecraftLink) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authorizations", s.Authorizations) - populate(objectMap, "bandwidthMHz", s.BandwidthMHz) - populate(objectMap, "centerFrequencyMHz", s.CenterFrequencyMHz) - populate(objectMap, "direction", s.Direction) - populate(objectMap, "name", s.Name) - populate(objectMap, "polarization", s.Polarization) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SpacecraftsProperties. -func (s SpacecraftsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "links", s.Links) - populate(objectMap, "noradId", s.NoradID) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "titleLine", s.TitleLine) - populate(objectMap, "tleLine1", s.TleLine1) - populate(objectMap, "tleLine2", s.TleLine2) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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 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", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - 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", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TagsObject. -func (t TagsObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// 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, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}