Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.dasein.cloud.azure.platform;
  
Created by Vlad_Munthiu on 11/19/2014.
 
     private Azure provider;
 
     private final String RESOURCE_SERVERS = "https://management.core.windows.net/%s/services/sqlservers/servers?contentview=generic";
     private final String RESOURCE_SERVERS_NONGEN = "https://management.core.windows.net/%s/services/sqlservers/servers";
     private final String RESOURCE_SERVER = "https://management.core.windows.net/%s/services/sqlservers/servers/%s";
     private final String RESOURCE_DATABASES = "https://management.core.windows.net/%s/services/sqlservers/servers/%s/databases";
     private final String RESOURCE_DATABASE = "https://management.core.windows.net/%s/services/sqlservers/servers/%s/databases/%s";
     private final String RESOURCE_LIST_DATABASES = "https://management.core.windows.net/%s/services/sqlservers/servers/%s/databases?contentview=generic";
     private final String RESOURCE_SUBSCRIPTION_META = "https://management.core.windows.net/%s/services/sqlservers/subscriptioninfo";
     private final String RESOURCE_LIST_RECOVERABLE_DATABASES = "https://management.core.windows.net/%s/services/sqlservers/servers/%s/recoverabledatabases?contentview=generic";
     private final String RESOURCE_RESTORE_DATABASE_OPERATIONS = "https://management.core.windows.net/%s/services/sqlservers/servers/%s/restoredatabaseoperations";
 
     public AzureSQLDatabaseSupportRequests(Azure provider){
         this. = provider;
     }
 
     public RequestBuilder createServer(ServerModel serverToCreate){
         RequestBuilder requestBuilder = RequestBuilder.post();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber()));
         requestBuilder.setEntity(new DaseinObjectToXmlEntity<ServerModel>(serverToCreate));
         return requestBuilder;
     }
 
     public RequestBuilder listServers(){
         RequestBuilder requestBuilder = RequestBuilder.get();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber()));
         return requestBuilder;
     }
 
     public RequestBuilder listServersNonGen(){
         RequestBuilder requestBuilder = RequestBuilder.get();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber()));
         return requestBuilder;
     }
 
     public RequestBuilder deleteServer(String serverName){
         RequestBuilder requestBuilder = RequestBuilder.delete();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber(), serverName));
         return requestBuilder;
     }
 
     public RequestBuilder createDatabase(String serverNameDatabaseServiceResourceModel dbToCreate){
         RequestBuilder requestBuilder = RequestBuilder.post();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber(), serverName));
         requestBuilder.setEntity(new DaseinObjectToXmlEntity<DatabaseServiceResourceModel>(dbToCreate));
         return requestBuilder;
     }
 
     public RequestBuilder createDatabaseFromBackup(String serverNameCreateDatabaseRestoreModel createDatabaseRestoreModel){
         RequestBuilder requestBuilder = RequestBuilder.post();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber(), serverName));
         requestBuilder.setEntity(new DaseinObjectToXmlEntity<CreateDatabaseRestoreModel>(createDatabaseRestoreModel));
         return requestBuilder;
     }
 
     public RequestBuilder listDatabases(String serverName){
         RequestBuilder requestBuilder = RequestBuilder.get();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber(), serverName));
         return requestBuilder;
     }
 
     public RequestBuilder deleteDatabase(String serverNameString databaseName){
         RequestBuilder requestBuilder = RequestBuilder.delete();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber(), serverNamedatabaseName));
         return requestBuilder;
     }
         RequestBuilder requestBuilder = RequestBuilder.get();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber()));
         return requestBuilder;
     }
 
     public RequestBuilder getDatabase(String serverNameString databaseName){
         RequestBuilder requestBuilder = RequestBuilder.get();
         addAzureCommonHeaders(requestBuilder);
         requestBuilder.setUri(String.format(this..getContext().getAccountNumber(), serverNamedatabaseName));
         return requestBuilder;
    }
    public RequestBuilder getRecoverableDatabases(String serverName){
        RequestBuilder requestBuilder = RequestBuilder.get();
        addAzureCommonHeaders(requestBuilder);
        requestBuilder.setUri(String.format(this..getContext().getAccountNumber(), serverName));
        return requestBuilder;
    }
    private void addAzureCommonHeaders(RequestBuilder requestBuilder){
        requestBuilder.addHeader("x-ms-version""2012-03-01");
        requestBuilder.addHeader("Content-Type""application/xml;charset=UTF-8");
    }
New to GrepCode? Check out our FAQ X