Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Scheduler ARM SDK. #1298

Merged
merged 13 commits into from Aug 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/ResourceManagement/Scheduler/NuGet.Config
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an old file format. Please copy the file from Storage folder.

<configuration>
<config>
<add key="repositorypath" value="..\..\..\packages" />
</config>
</configuration>
@@ -0,0 +1,110 @@
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// 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.
// Code generated by Microsoft (R) AutoRest Code Generator {0}
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
//

using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

namespace Scheduler.Test.Helpers
{
public class RecordedDelegatingHandler : DelegatingHandler
{
private HttpResponseMessage _response;

public RecordedDelegatingHandler()
{
StatusCodeToReturn = HttpStatusCode.Created;
SubsequentStatusCodeToReturn = StatusCodeToReturn;
}

public RecordedDelegatingHandler(HttpResponseMessage response)
{
StatusCodeToReturn = HttpStatusCode.Created;
SubsequentStatusCodeToReturn = StatusCodeToReturn;
_response = response;
if (_response.Content == null)
{
_response.Content = new StringContent(string.Empty);
}
}

public HttpStatusCode StatusCodeToReturn { get; set; }

public HttpStatusCode SubsequentStatusCodeToReturn { get; set; }

public string Request { get; private set; }

public HttpRequestHeaders RequestHeaders { get; private set; }

public HttpContentHeaders ContentHeaders { get; private set; }

public HttpMethod Method { get; private set; }

public Uri Uri { get; private set; }

public bool IsPassThrough { get; set; }

private int counter;

protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
counter++;
// Save request
if (request.Content == null)
{
Request = string.Empty;
}
else
{
Request = await request.Content.ReadAsStringAsync();
}
RequestHeaders = request.Headers;
if (request.Content != null)
{
ContentHeaders = request.Content.Headers;
}
Method = request.Method;
Uri = request.RequestUri;

// Prepare response
if (IsPassThrough)
{
return await base.SendAsync(request, cancellationToken);
}
else
{
if (_response != null && counter == 1)
{
return _response;
}
else
{
var statusCode = StatusCodeToReturn;
if (counter > 1)
statusCode = SubsequentStatusCodeToReturn;
HttpResponseMessage response = new HttpResponseMessage(statusCode);
response.Content = new StringContent("");
return response;
}
}
}
}
}
@@ -0,0 +1,39 @@
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// 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.
// Code generated by Microsoft (R) AutoRest Code Generator {0}
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
//

using Microsoft.Azure;
using Microsoft.Azure.Management.Scheduler;
using Microsoft.Rest;
using Scheduler.Test.Helpers;
using System;

namespace Scheduler.Test.InMemoryTests
{
public class Base
{
protected SchedulerManagementClient GetSchedulerManagementClient(RecordedDelegatingHandler handler)
{
var tokenCredential = new TokenCredentials(Guid.NewGuid().ToString(), "abc123");
handler.IsPassThrough = false;
var schedulerManagementClient = new SchedulerManagementClient(credentials: tokenCredential, handlers: handler);
schedulerManagementClient.SubscriptionId = "12345";
return schedulerManagementClient;
}
}
}