コード例 #1
0
 protected override IGatewayServiceManagement CreateChannel()
 {
     if (base.get_ServiceBinding() == null)
     {
         base.set_ServiceBinding(ConfigurationConstants.WebHttpBinding());
     }
     if (!string.IsNullOrEmpty(base.get_CurrentSubscription().get_ServiceEndpoint()))
     {
         base.set_ServiceEndpoint(base.get_CurrentSubscription().get_ServiceEndpoint());
     }
     else
     {
         base.set_ServiceEndpoint("https://management.core.windows.net");
     }
     return(GatewayManagementHelper.CreateGatewayManagementChannel(base.get_ServiceBinding(), new Uri(base.get_ServiceEndpoint()), base.get_CurrentSubscription().get_Certificate()));
 }
コード例 #2
0
        protected override IGatewayServiceManagement CreateChannel()
        {
            if (ServiceBinding == null)
            {
                ServiceBinding = ConfigurationConstants.WebHttpBinding();
            }

            if (string.IsNullOrEmpty(CurrentSubscription.ServiceEndpoint))
            {
                ServiceEndpoint = ConfigurationConstants.ServiceManagementEndpoint;
            }
            else
            {
                ServiceEndpoint = CurrentSubscription.ServiceEndpoint;
            }

            return(GatewayManagementHelper.CreateGatewayManagementChannel(ServiceBinding, new Uri(ServiceEndpoint), CurrentSubscription.Certificate));
        }
コード例 #3
0
        protected override void WriteErrorDetails(CommunicationException exception)
        {
            ServiceManagementError serviceManagementError = null;

            GatewayManagementHelper.TryGetExceptionDetails(exception, out serviceManagementError);
            if (serviceManagementError != null)
            {
                object[] code = new object[2];
                code[0] = serviceManagementError.Code;
                code[1] = serviceManagementError.Message;
                string str = string.Format(CultureInfo.InvariantCulture, "HTTP Status Code: {0} - HTTP Error Message: {1}", code);
                base.WriteError(new ErrorRecord(new CommunicationException(str), string.Empty, ErrorCategory.CloseError, null));
                return;
            }
            else
            {
                base.WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
                return;
            }
        }
コード例 #4
0
        protected override void WriteErrorDetails(CommunicationException exception)
        {
            ServiceManagementError error;

            GatewayManagementHelper.TryGetExceptionDetails(exception, out error);

            if (error == null)
            {
                WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
            }
            else
            {
                string errorDetails = string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.HttpStatusCodeAndErrorMessage,
                    error.Code,
                    error.Message);

                WriteError(new ErrorRecord(new CommunicationException(errorDetails), string.Empty, ErrorCategory.CloseError, null));
            }
        }