Пример #1
0
        public PSWcfRelayAttributes CreateOrUpdateWcfRelay(string resourceGroupName, string namespaceName, string wcfRelayName, PSWcfRelayAttributes parameter)
        {
            var Parameter1 = new WcfRelay();

            if (!string.IsNullOrEmpty(parameter.RelayType))
            {
                Parameter1.RelayType = (Relaytype?)Enum.Parse(typeof(Relaytype), parameter.RelayType);
            }

            if (parameter.RequiresClientAuthorization.HasValue)
            {
                Parameter1.RequiresClientAuthorization = parameter.RequiresClientAuthorization;
            }

            if (parameter.RequiresTransportSecurity.HasValue)
            {
                Parameter1.RequiresTransportSecurity = parameter.RequiresTransportSecurity;
            }

            if (!string.IsNullOrEmpty(parameter.UserMetadata))
            {
                Parameter1.UserMetadata = parameter.UserMetadata;
            }

            var response = Client.WCFRelays.CreateOrUpdate(resourceGroupName, namespaceName, wcfRelayName, Parameter1);

            return(new PSWcfRelayAttributes(response));
        }
        /// <summary>
        /// Initializes a new instance of the WcfRelay class.
        /// </summary>
        /// <param name="id">Resource Id</param>
        /// <param name="name">Resource name</param>
        /// <param name="type">Resource type</param>
        /// <param name="relayType">WCFRelay Type. Possible values include:
        /// 'NetTcp', 'Http'</param>
        /// <param name="createdAt">The time the WCFRelay was created.</param>
        /// <param name="updatedAt">The time the namespace was updated.</param>
        /// <param name="listenerCount">The number of listeners for this relay.
        /// min : 1 and max:25 supported</param>
        /// <param name="requiresClientAuthorization">true if client
        /// authorization is needed for this relay; otherwise, false.</param>
        /// <param name="requiresTransportSecurity">true if transport security
        /// is needed for this relay; otherwise, false.</param>
        /// <param name="isDynamic">true if the relay is dynamic; otherwise,
        /// false.</param>
        /// <param name="userMetadata">usermetadata is a placeholder to store
        /// user-defined string data for the HybridConnection endpoint.e.g. it
        /// can be used to store  descriptive data, such as list of teams and
        /// their contact information also user-defined configuration settings
        /// can be stored.</param>

        public PSWcfRelayAttributes(WcfRelay wcfRelay)
        {
            Id            = wcfRelay.Id;
            Name          = wcfRelay.Name;
            RelayType     = wcfRelay.RelayType.ToString();
            Type          = wcfRelay.Type;
            CreatedAt     = wcfRelay.CreatedAt;
            UpdatedAt     = wcfRelay.UpdatedAt;
            ListenerCount = wcfRelay.ListenerCount;
            RequiresClientAuthorization = wcfRelay.RequiresClientAuthorization;
            RequiresTransportSecurity   = wcfRelay.RequiresTransportSecurity;
            IsDynamic    = wcfRelay.IsDynamic;
            UserMetadata = wcfRelay.UserMetadata;
        }
 /// <summary>
 /// Creates or Updates a WCFRelay. This operation is idempotent.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Name of the Resource group within the Azure subscription.
 /// </param>
 /// <param name='namespaceName'>
 /// The Namespace Name
 /// </param>
 /// <param name='relayName'>
 /// The relay name
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to create a WCFRelays.
 /// </param>
 public static WcfRelay CreateOrUpdate(this IWCFRelaysOperations operations, string resourceGroupName, string namespaceName, string relayName, WcfRelay parameters)
 {
     return(operations.CreateOrUpdateAsync(resourceGroupName, namespaceName, relayName, parameters).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Creates or Updates a WCFRelay. This operation is idempotent.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Name of the Resource group within the Azure subscription.
 /// </param>
 /// <param name='namespaceName'>
 /// The Namespace Name
 /// </param>
 /// <param name='relayName'>
 /// The relay name
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to create a WCFRelays.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <WcfRelay> CreateOrUpdateAsync(this IWCFRelaysOperations operations, string resourceGroupName, string namespaceName, string relayName, WcfRelay parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, relayName, parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }