public static System.Collections.IEnumerable GetDeploymentsPersistentVMRolesWithInputEndpoints( SqlString certificateThumbprint, SqlGuid sgSubscriptionId, SqlString serviceName, SqlString deploymentSlots) { X509Certificate2 certificate = RetrieveCertificateInStore(certificateThumbprint.Value); Azure.Management.Deployment result = Azure.Internal.Management.GetDeployments( certificate, sgSubscriptionId.Value, serviceName.Value, deploymentSlots.Value); List <CallbackSupport.DeploymentsPersistentVMRolesWithInputEndpoints> lDps = new List <CallbackSupport.DeploymentsPersistentVMRolesWithInputEndpoints>(); for (int iRole = 0; iRole < result.RoleList.Length; iRole++) { for (int iEndPoint = 0; iEndPoint < result.RoleList[iRole].ConfigurationSets.ConfigurationSet.InputEndpoints.Length; iEndPoint++) { lDps.Add(new CallbackSupport.DeploymentsPersistentVMRolesWithInputEndpoints() { Deployment = result, DeploymentRole = result.RoleList[iRole], InputEndpoint = result.RoleList[iRole].ConfigurationSets.ConfigurationSet.InputEndpoints[iEndPoint] }); } } return(lDps); }
public static void RemoveEndpointFromPersistentVM( SqlString certificateThumbprint, SqlGuid sgSubscriptionId, SqlString serviceName, SqlString deploymentSlots, SqlString vmName, SqlString EndpointName, SqlBoolean fBlocking) { X509Certificate2 certificate = RetrieveCertificateInStore(certificateThumbprint.Value); Azure.Management.Deployment result = Azure.Internal.Management.GetDeployments( certificate, sgSubscriptionId.Value, serviceName.Value, deploymentSlots.Value); var vmToAdd = (ITPCfSQL.Azure.Management.PersistentVMRole)result.RoleList.FirstOrDefault(item => item.RoleName == vmName.Value); if (vmToAdd == null) { throw new ArgumentException("No PersistentVMRole with name " + vmName.Value + " found in sgSubscriptionId = " + sgSubscriptionId.Value + ", serviceName = " + serviceName.Value + ", deploymentSlots = " + deploymentSlots.Value + "."); } // Remove the endpoint ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint[] driiesTemp = new ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint[vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints.Length - 1]; int iTemp = 0; foreach (ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint ie in vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints) { if (!(ie.Name == EndpointName.Value)) { driiesTemp[iTemp++] = ie; } } vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints = driiesTemp; var output = ITPCfSQL.Azure.Internal.Management.UpdatePersistentVMRole( certificate, sgSubscriptionId.Value, serviceName.Value, result.Name, vmToAdd); PushOperationStatus( certificate, sgSubscriptionId.Value, new Guid(output[ITPCfSQL.Azure.Internal.Constants.HEADER_REQUEST_ID]), fBlocking.IsNull ? false : fBlocking.Value); }
public static void AddInputEndpointToPersistentVM( SqlString certificateThumbprint, SqlGuid sgSubscriptionId, SqlString serviceName, SqlString deploymentSlots, SqlString vmName, SqlString EndpointName, SqlInt32 LocalPort, SqlBoolean EnableDirectServerReturn, SqlInt32 Port, SqlString Protocol, SqlString Vip, SqlBoolean fBlocking) { X509Certificate2 certificate = RetrieveCertificateInStore(certificateThumbprint.Value); Azure.Management.Deployment result = Azure.Internal.Management.GetDeployments( certificate, sgSubscriptionId.Value, serviceName.Value, deploymentSlots.Value); var vmToAdd = (ITPCfSQL.Azure.Management.PersistentVMRole)result.RoleList.FirstOrDefault(item => item.RoleName.Equals(vmName.Value, StringComparison.InvariantCultureIgnoreCase)); if (vmToAdd == null) { throw new ArgumentException("No PersistentVMRole with name " + vmName.Value + " found in sgSubscriptionId = " + sgSubscriptionId.Value + ", serviceName = " + serviceName.Value + ", deploymentSlots = " + deploymentSlots.Value + "."); } ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint[] driiesTemp = new ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint[vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints.Length + 1]; Array.Copy(vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints, driiesTemp, vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints.Length); driiesTemp[driiesTemp.Length - 1] = new ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint() { Name = EndpointName.Value, LocalPort = LocalPort.Value, EnableDirectServerReturn = EnableDirectServerReturn.Value, Port = Port.Value, Protocol = Protocol.Value, Vip = Vip.Value }; vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints = driiesTemp; var output = ITPCfSQL.Azure.Internal.Management.UpdatePersistentVMRole( certificate, sgSubscriptionId.Value, serviceName.Value, result.Name, vmToAdd); PushOperationStatus( certificate, sgSubscriptionId.Value, new Guid(output[ITPCfSQL.Azure.Internal.Constants.HEADER_REQUEST_ID]), fBlocking.IsNull ? false : fBlocking.Value); }