Skip to content

Commit

Permalink
Merge pull request #11 from andrerod/multimodule_12
Browse files Browse the repository at this point in the history
Add subscription module
  • Loading branch information
André Rodrigues committed Dec 13, 2013
2 parents 983ecb9 + 50820a3 commit c567aa8
Show file tree
Hide file tree
Showing 208 changed files with 47,814 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.microsoft.windowsazure;

import org.apache.http.impl.client.CloseableHttpClient;

public abstract class CloudCredentials {
public abstract CloseableHttpClient initializeClient();
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/*
* Copyright 2013 andrerod.
*
/**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -23,7 +22,7 @@
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

public class CertificateCloudCredentials implements SubscriptionCloudCredentials {
public class CertificateCloudCredentials extends SubscriptionCloudCredentials {
private String _subscriptionId;
private KeyStoreCredential _keyStoreCredential;

Expand All @@ -38,6 +37,7 @@ public CertificateCloudCredentials(String subscriptionId, KeyStoreCredential key
this._keyStoreCredential = keyStoreCredential;
}

@Override
public String getSubscriptionId()
{
return _subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/*
* Copyright 2013 andrerod.
*
/**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/*
* Copyright 2013 andrerod.
*
/**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -16,15 +15,13 @@

package com.microsoft.windowsazure.management;

import org.apache.http.impl.client.CloseableHttpClient;
import com.microsoft.windowsazure.CloudCredentials;

public interface SubscriptionCloudCredentials {
public abstract class SubscriptionCloudCredentials extends CloudCredentials {
/*
* When you create a Windows Azure subscription, it is uniquely
* identified by a subscription ID. The subscription ID forms part of
* the URI for every call that you make to the Service Management API.
*/
public String getSubscriptionId();

public CloseableHttpClient initializeClient();
public abstract String getSubscriptionId();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.microsoft.windowsazure.services.core.utils;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class StreamUtils {
public static String toString(InputStream in) throws IOException {
BufferedInputStream bis = new BufferedInputStream(in);
ByteArrayOutputStream buf = new ByteArrayOutputStream();

int result = bis.read();
while(result != -1) {
byte b = (byte)result;
buf.write(b);
result = bis.read();
}
return buf.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.microsoft.windowsazure.services.core.utils.pipeline;

import org.apache.http.client.methods.HttpPost;

public class CustomHttpDelete extends HttpPost {
public CustomHttpDelete(String url)
{
super(url);
}

@Override
public String getMethod() {
return "DELETE";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
Loading

0 comments on commit c567aa8

Please sign in to comment.