Skip to content

Commit d83161f

Browse files
authored
[SSH] Upgrade HybridConnectivity SDK to stable version and other GA changes (#22146)
* Update HybridConnectivity SDK to the latest stable version * Consider Service Configuration when retrieving Relay Information * Check if arc agent is up to date for arc server * Add retry logic for when service configuration gets created * Check chmod exit code to determine if we were able to fix the permissions of the proxy to allow execution * Re-record the scenario tests * Update help files * Add -Force parameter for creating service configuration with no prompt. Fix messages * Fix Typo * Update changelog
1 parent 924859c commit d83161f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3364
-885
lines changed

src/Ssh/Ssh.Helpers/HybridConnectivity/EndpointsOperations.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ internal EndpointsOperations(HybridConnectivityManagementAPIClient client)
275275
/// <param name='expiresin'>
276276
/// The is how long the endpoint access token is valid (in seconds).
277277
/// </param>
278+
/// <param name='listCredentialsRequest'>
279+
/// Object of type ListCredentialsRequest
280+
/// </param>
278281
/// <param name='customHeaders'>
279282
/// Headers that will be added to request.
280283
/// </param>
@@ -296,7 +299,7 @@ internal EndpointsOperations(HybridConnectivityManagementAPIClient client)
296299
/// <return>
297300
/// A response object containing the response body and response headers.
298301
/// </return>
299-
public async Task<AzureOperationResponse<EndpointAccessResource>> ListCredentialsWithHttpMessagesAsync(string resourceUri, string endpointName, long? expiresin = 10800, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
302+
public async Task<AzureOperationResponse<EndpointAccessResource>> ListCredentialsWithHttpMessagesAsync(string resourceUri, string endpointName, long? expiresin = 10800, ListCredentialsRequest listCredentialsRequest = default(ListCredentialsRequest), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
300303
{
301304
if (Client.ApiVersion == null)
302305
{
@@ -335,6 +338,7 @@ internal EndpointsOperations(HybridConnectivityManagementAPIClient client)
335338
tracingParameters.Add("resourceUri", resourceUri);
336339
tracingParameters.Add("endpointName", endpointName);
337340
tracingParameters.Add("expiresin", expiresin);
341+
tracingParameters.Add("listCredentialsRequest", listCredentialsRequest);
338342
tracingParameters.Add("cancellationToken", cancellationToken);
339343
ServiceClientTracing.Enter(_invocationId, this, "ListCredentials", tracingParameters);
340344
}
@@ -390,6 +394,12 @@ internal EndpointsOperations(HybridConnectivityManagementAPIClient client)
390394

391395
// Serialize Request
392396
string _requestContent = null;
397+
if(listCredentialsRequest != null)
398+
{
399+
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(listCredentialsRequest, Client.SerializationSettings);
400+
_httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
401+
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
402+
}
393403
// Set Credentials
394404
if (Client.Credentials != null)
395405
{

src/Ssh/Ssh.Helpers/HybridConnectivity/EndpointsOperationsExtensions.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ public static EndpointResource CreateOrUpdate(this IEndpointsOperations operatio
8585
/// <param name='expiresin'>
8686
/// The is how long the endpoint access token is valid (in seconds).
8787
/// </param>
88-
public static EndpointAccessResource ListCredentials(this IEndpointsOperations operations, string resourceUri, string endpointName, long? expiresin = 10800)
88+
/// <param name='listCredentialsRequest'>
89+
/// Object of type ListCredentialsRequest
90+
/// </param>
91+
public static EndpointAccessResource ListCredentials(this IEndpointsOperations operations, string resourceUri, string endpointName, long? expiresin = 10800, ListCredentialsRequest listCredentialsRequest = default(ListCredentialsRequest))
8992
{
90-
return operations.ListCredentialsAsync(resourceUri, endpointName, expiresin).GetAwaiter().GetResult();
93+
return operations.ListCredentialsAsync(resourceUri, endpointName, expiresin, listCredentialsRequest).GetAwaiter().GetResult();
9194
}
9295

9396
/// <summary>
@@ -106,12 +109,15 @@ public static EndpointAccessResource ListCredentials(this IEndpointsOperations o
106109
/// <param name='expiresin'>
107110
/// The is how long the endpoint access token is valid (in seconds).
108111
/// </param>
112+
/// <param name='listCredentialsRequest'>
113+
/// Object of type ListCredentialsRequest
114+
/// </param>
109115
/// <param name='cancellationToken'>
110116
/// The cancellation token.
111117
/// </param>
112-
public static async Task<EndpointAccessResource> ListCredentialsAsync(this IEndpointsOperations operations, string resourceUri, string endpointName, long? expiresin = 10800, CancellationToken cancellationToken = default(CancellationToken))
118+
public static async Task<EndpointAccessResource> ListCredentialsAsync(this IEndpointsOperations operations, string resourceUri, string endpointName, long? expiresin = 10800, ListCredentialsRequest listCredentialsRequest = default(ListCredentialsRequest), CancellationToken cancellationToken = default(CancellationToken))
113119
{
114-
using (var _result = await operations.ListCredentialsWithHttpMessagesAsync(resourceUri, endpointName, expiresin, null, cancellationToken).ConfigureAwait(false))
120+
using (var _result = await operations.ListCredentialsWithHttpMessagesAsync(resourceUri, endpointName, expiresin, listCredentialsRequest, null, cancellationToken).ConfigureAwait(false))
115121
{
116122
return _result.Body;
117123
}

src/Ssh/Ssh.Helpers/HybridConnectivity/HybridConnectivityManagementAPIClient.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ public partial class HybridConnectivityManagementAPIClient : ServiceClient<Hybri
7474
/// </summary>
7575
public virtual IEndpointsOperations Endpoints { get; private set; }
7676

77+
/// <summary>
78+
/// Gets the IServiceConfigurationsOperations.
79+
/// </summary>
80+
public virtual IServiceConfigurationsOperations ServiceConfigurations { get; private set; }
81+
7782
/// <summary>
7883
/// Initializes a new instance of the HybridConnectivityManagementAPIClient class.
7984
/// </summary>
@@ -316,8 +321,9 @@ public HybridConnectivityManagementAPIClient(System.Uri baseUri, ServiceClientCr
316321
private void Initialize()
317322
{
318323
Endpoints = new EndpointsOperations(this);
324+
ServiceConfigurations = new ServiceConfigurationsOperations(this);
319325
BaseUri = new System.Uri("https://management.azure.com");
320-
ApiVersion = "2022-05-01-preview";
326+
ApiVersion = "2023-03-15";
321327
AcceptLanguage = "en-US";
322328
LongRunningOperationRetryTimeout = 30;
323329
GenerateClientRequestId = true;

src/Ssh/Ssh.Helpers/HybridConnectivity/IEndpointsOperations.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public partial interface IEndpointsOperations
6565
/// <param name='expiresin'>
6666
/// The is how long the endpoint access token is valid (in seconds).
6767
/// </param>
68+
/// <param name='listCredentialsRequest'>
69+
/// Object of type ListCredentialsRequest
70+
/// </param>
6871
/// <param name='customHeaders'>
6972
/// The headers that will be added to request.
7073
/// </param>
@@ -80,6 +83,6 @@ public partial interface IEndpointsOperations
8083
/// <exception cref="Microsoft.Rest.ValidationException">
8184
/// Thrown when a required parameter is null
8285
/// </exception>
83-
Task<AzureOperationResponse<EndpointAccessResource>> ListCredentialsWithHttpMessagesAsync(string resourceUri, string endpointName, long? expiresin = 10800, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
86+
Task<AzureOperationResponse<EndpointAccessResource>> ListCredentialsWithHttpMessagesAsync(string resourceUri, string endpointName, long? expiresin = 10800, ListCredentialsRequest listCredentialsRequest = default(ListCredentialsRequest), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
8487
}
8588
}

src/Ssh/Ssh.Helpers/HybridConnectivity/IHybridConnectivityManagementAPIClient.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,10 @@ public partial interface IHybridConnectivityManagementAPIClient : System.IDispos
6969
/// </summary>
7070
IEndpointsOperations Endpoints { get; }
7171

72+
/// <summary>
73+
/// Gets the IServiceConfigurationsOperations.
74+
/// </summary>
75+
IServiceConfigurationsOperations ServiceConfigurations { get; }
76+
7277
}
7378
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// <auto-generated>
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License. See License.txt in the project root for
4+
// license information.
5+
//
6+
// Code generated by Microsoft (R) AutoRest Code Generator.
7+
// Changes may cause incorrect behavior and will be lost if the code is
8+
// regenerated.
9+
// </auto-generated>
10+
11+
namespace Microsoft.Azure.PowerShell.Ssh.Helpers.HybridConnectivity
12+
{
13+
using Microsoft.Rest;
14+
using Microsoft.Rest.Azure;
15+
using Models;
16+
using System.Collections;
17+
using System.Collections.Generic;
18+
using System.Threading;
19+
using System.Threading.Tasks;
20+
21+
/// <summary>
22+
/// ServiceConfigurationsOperations operations.
23+
/// </summary>
24+
public partial interface IServiceConfigurationsOperations
25+
{
26+
/// <summary>
27+
/// Gets the details about the service to the resource.
28+
/// </summary>
29+
/// <param name='resourceUri'>
30+
/// The fully qualified Azure Resource manager identifier of the
31+
/// resource to be connected.
32+
/// </param>
33+
/// <param name='endpointName'>
34+
/// The endpoint name.
35+
/// </param>
36+
/// <param name='serviceConfigurationName'>
37+
/// The service name.
38+
/// </param>
39+
/// <param name='customHeaders'>
40+
/// The headers that will be added to request.
41+
/// </param>
42+
/// <param name='cancellationToken'>
43+
/// The cancellation token.
44+
/// </param>
45+
/// <exception cref="ErrorResponseException">
46+
/// Thrown when the operation returned an invalid status code
47+
/// </exception>
48+
/// <exception cref="Microsoft.Rest.SerializationException">
49+
/// Thrown when unable to deserialize the response
50+
/// </exception>
51+
/// <exception cref="Microsoft.Rest.ValidationException">
52+
/// Thrown when a required parameter is null
53+
/// </exception>
54+
Task<AzureOperationResponse<ServiceConfigurationResource>> GetWithHttpMessagesAsync(string resourceUri, string endpointName, string serviceConfigurationName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
55+
/// <summary>
56+
/// Create or update a service in serviceConfiguration for the endpoint
57+
/// resource.
58+
/// </summary>
59+
/// <param name='resourceUri'>
60+
/// The fully qualified Azure Resource manager identifier of the
61+
/// resource to be connected.
62+
/// </param>
63+
/// <param name='endpointName'>
64+
/// The endpoint name.
65+
/// </param>
66+
/// <param name='serviceConfigurationName'>
67+
/// The service name.
68+
/// </param>
69+
/// <param name='serviceConfigurationResource'>
70+
/// Service details
71+
/// </param>
72+
/// <param name='customHeaders'>
73+
/// The headers that will be added to request.
74+
/// </param>
75+
/// <param name='cancellationToken'>
76+
/// The cancellation token.
77+
/// </param>
78+
/// <exception cref="ErrorResponseException">
79+
/// Thrown when the operation returned an invalid status code
80+
/// </exception>
81+
/// <exception cref="Microsoft.Rest.SerializationException">
82+
/// Thrown when unable to deserialize the response
83+
/// </exception>
84+
/// <exception cref="Microsoft.Rest.ValidationException">
85+
/// Thrown when a required parameter is null
86+
/// </exception>
87+
Task<AzureOperationResponse<ServiceConfigurationResource>> CreateOrupdateWithHttpMessagesAsync(string resourceUri, string endpointName, string serviceConfigurationName, ServiceConfigurationResource serviceConfigurationResource, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
88+
}
89+
}

src/Ssh/Ssh.Helpers/HybridConnectivity/Models/AzureEntityResource.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ public AzureEntityResource()
3333
/// <summary>
3434
/// Initializes a new instance of the AzureEntityResource class.
3535
/// </summary>
36-
/// <param name="id">Fully qualified resource ID for the resource. Ex -
37-
/// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}</param>
36+
/// <param name="id">Fully qualified resource ID for the resource. E.g.
37+
/// "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"</param>
3838
/// <param name="name">The name of the resource</param>
3939
/// <param name="type">The type of the resource. E.g.
4040
/// "Microsoft.Compute/virtualMachines" or
4141
/// "Microsoft.Storage/storageAccounts"</param>
42+
/// <param name="systemData">Azure Resource Manager metadata containing
43+
/// createdBy and modifiedBy information.</param>
4244
/// <param name="etag">Resource Etag.</param>
43-
public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string))
44-
: base(id, name, type)
45+
public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string))
46+
: base(id, name, type, systemData)
4547
{
4648
Etag = etag;
4749
CustomInit();

src/Ssh/Ssh.Helpers/HybridConnectivity/Models/EndpointAccessResource.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ public EndpointAccessResource()
4040
/// <param name="accessKey">Access key for hybrid connection.</param>
4141
/// <param name="expiresOn">The expiration of access key in unix
4242
/// time.</param>
43-
public EndpointAccessResource(string namespaceName, string namespaceNameSuffix, string hybridConnectionName, string accessKey = default(string), long? expiresOn = default(long?))
43+
/// <param name="serviceConfigurationToken">The token to access the
44+
/// enabled service.</param>
45+
public EndpointAccessResource(string namespaceName, string namespaceNameSuffix, string hybridConnectionName, string accessKey = default(string), long? expiresOn = default(long?), string serviceConfigurationToken = default(string))
4446
{
4547
NamespaceName = namespaceName;
4648
NamespaceNameSuffix = namespaceNameSuffix;
4749
HybridConnectionName = hybridConnectionName;
4850
AccessKey = accessKey;
4951
ExpiresOn = expiresOn;
52+
ServiceConfigurationToken = serviceConfigurationToken;
5053
CustomInit();
5154
}
5255

@@ -85,6 +88,12 @@ public EndpointAccessResource()
8588
[JsonProperty(PropertyName = "relay.expiresOn")]
8689
public long? ExpiresOn { get; set; }
8790

91+
/// <summary>
92+
/// Gets or sets the token to access the enabled service.
93+
/// </summary>
94+
[JsonProperty(PropertyName = "relay.serviceConfigurationToken")]
95+
public string ServiceConfigurationToken { get; set; }
96+
8897
/// <summary>
8998
/// Validate the object.
9099
/// </summary>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// <auto-generated>
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License. See License.txt in the project root for
4+
// license information.
5+
//
6+
// Code generated by Microsoft (R) AutoRest Code Generator.
7+
// Changes may cause incorrect behavior and will be lost if the code is
8+
// regenerated.
9+
// </auto-generated>
10+
11+
namespace Microsoft.Azure.PowerShell.Ssh.Helpers.HybridConnectivity.Models
12+
{
13+
using Microsoft.Rest;
14+
using Newtonsoft.Json;
15+
using System.Linq;
16+
17+
/// <summary>
18+
/// Endpoint details
19+
/// </summary>
20+
public partial class EndpointProperties
21+
{
22+
/// <summary>
23+
/// Initializes a new instance of the EndpointProperties class.
24+
/// </summary>
25+
public EndpointProperties()
26+
{
27+
CustomInit();
28+
}
29+
30+
/// <summary>
31+
/// Initializes a new instance of the EndpointProperties class.
32+
/// </summary>
33+
/// <param name="type">The type of endpoint. Possible values include:
34+
/// 'default', 'custom'</param>
35+
/// <param name="resourceId">The resource Id of the connectivity
36+
/// endpoint (optional).</param>
37+
/// <param name="provisioningState">The resource provisioning
38+
/// state.</param>
39+
public EndpointProperties(string type, string resourceId = default(string), string provisioningState = default(string))
40+
{
41+
Type = type;
42+
ResourceId = resourceId;
43+
ProvisioningState = provisioningState;
44+
CustomInit();
45+
}
46+
47+
/// <summary>
48+
/// An initialization method that performs custom operations like setting defaults
49+
/// </summary>
50+
partial void CustomInit();
51+
52+
/// <summary>
53+
/// Gets or sets the type of endpoint. Possible values include:
54+
/// 'default', 'custom'
55+
/// </summary>
56+
[JsonProperty(PropertyName = "type")]
57+
public string Type { get; set; }
58+
59+
/// <summary>
60+
/// Gets or sets the resource Id of the connectivity endpoint
61+
/// (optional).
62+
/// </summary>
63+
[JsonProperty(PropertyName = "resourceId")]
64+
public string ResourceId { get; set; }
65+
66+
/// <summary>
67+
/// Gets the resource provisioning state.
68+
/// </summary>
69+
[JsonProperty(PropertyName = "provisioningState")]
70+
public string ProvisioningState { get; private set; }
71+
72+
/// <summary>
73+
/// Validate the object.
74+
/// </summary>
75+
/// <exception cref="ValidationException">
76+
/// Thrown if validation fails
77+
/// </exception>
78+
public virtual void Validate()
79+
{
80+
if (Type == null)
81+
{
82+
throw new ValidationException(ValidationRules.CannotBeNull, "Type");
83+
}
84+
}
85+
}
86+
}

0 commit comments

Comments
 (0)