/** * Required. A name for the cloud service. The name can be up to 100 * characters in length. The name can be used to identify the storage * account for your tracking purposes. * @return The Label value. */ public String getLabel() { if (this.label == null) { return this.getServiceName(); } else { return this.label; } }
/** * Initializes a new instance of the HostedServiceCreateParameters class * with required arguments. * * @param serviceName A name for the cloud service that is unique within * Azure. This name is the DNS prefix name and can be used to access the * service. * @param label A name for the cloud service. The name can be up to 100 * characters in length. The name can be used to identify the storage * account for your tracking purposes. */ public HostedServiceCreateParameters(String serviceName, String label) { this(); if (serviceName == null) { throw new NullPointerException("serviceName"); } if (label == null) { throw new NullPointerException("label"); } this.setServiceName(serviceName); this.setLabel(label); } }
if (parameters.getDescription() != null && parameters.getDescription().length() > 1024) { throw new IllegalArgumentException("parameters.Description"); if (parameters.getLabel() == null) { throw new NullPointerException("parameters.Label"); if (parameters.getServiceName() == null) { throw new NullPointerException("parameters.ServiceName"); serviceNameElement.appendChild(requestDoc.createTextNode(parameters.getServiceName())); createHostedServiceElement.appendChild(serviceNameElement); labelElement.appendChild(requestDoc.createTextNode(Base64.encode(parameters.getLabel().getBytes()))); createHostedServiceElement.appendChild(labelElement); if (parameters.getDescription() != null) { Element descriptionElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Description"); descriptionElement.appendChild(requestDoc.createTextNode(parameters.getDescription())); createHostedServiceElement.appendChild(descriptionElement); if (parameters.getLocation() != null) { Element locationElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Location"); locationElement.appendChild(requestDoc.createTextNode(parameters.getLocation())); createHostedServiceElement.appendChild(locationElement); if (parameters.getAffinityGroup() != null) { Element affinityGroupElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "AffinityGroup"); affinityGroupElement.appendChild(requestDoc.createTextNode(parameters.getAffinityGroup())); createHostedServiceElement.appendChild(affinityGroupElement);
private void createHostedService(String hostedServiceName, String loc, String certPath) throws SAXException, InterruptedException, ExecutionException, TransformerException, ServiceException, URISyntaxException, ParserConfigurationException, IOException { //hosted service required for vm deployment HostedServiceCreateParameters createParameters = new HostedServiceCreateParameters(); //required createParameters.setLabel(hostedServiceName); //required createParameters.setServiceName(hostedServiceName); createParameters.setDescription(hostedServiceName); //required String location="North Europe"; if(!loc.equals("")) location=loc; createParameters.setLocation(location); OperationResponse hostedServiceOperationResponse = hostedServicesOperations.create(createParameters); uploadCerts(computeManagementClient,hostedServiceName,getCertData(certPath)); }
if (parameters.getDescription() != null && parameters.getDescription().length() > 1024) { throw new IllegalArgumentException("parameters.Description"); if (parameters.getLabel() == null) { throw new NullPointerException("parameters.Label"); if (parameters.getServiceName() == null) { throw new NullPointerException("parameters.ServiceName"); int locationCount = (parameters.getAffinityGroup() != null ? 1 : 0) + (parameters.getLocation() != null ? 1 : 0); if (locationCount != 1) { throw new IllegalArgumentException("Only one of parameters.AffinityGroup, parameters.Location may be provided."); serviceNameElement.appendChild(requestDoc.createTextNode(parameters.getServiceName())); createHostedServiceElement.appendChild(serviceNameElement); labelElement.appendChild(requestDoc.createTextNode(Base64.encode(parameters.getLabel().getBytes()))); createHostedServiceElement.appendChild(labelElement); if (parameters.getDescription() != null) { Element descriptionElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Description"); descriptionElement.appendChild(requestDoc.createTextNode(parameters.getDescription())); createHostedServiceElement.appendChild(descriptionElement); if (parameters.getLocation() != null) { Element locationElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Location"); locationElement.appendChild(requestDoc.createTextNode(parameters.getLocation())); createHostedServiceElement.appendChild(locationElement);
/** * Required. A name for the cloud service. The name can be up to 100 * characters in length. The name can be used to identify the storage * account for your tracking purposes. * @return The Label value. */ public String getLabel() { if (this.label == null) { return this.getServiceName(); } else { return this.label; } }