Skip to content

Commit

Permalink
Fix bug when retrieving container logs (#96)
Browse files Browse the repository at this point in the history
* Fix bug while retrieving container logs
 The corresponding REST API was changed and the order of some of the arguments was reversed.

* Update for the sample test recording file

* Update the 1.5 release notes
  • Loading branch information
milismsft authored Dec 14, 2017
1 parent f5b324d commit baa9f8f
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,47 +46,51 @@ public interface ContainerGroups extends
* Get the log content for the specified container instance within a container group.
*
* @param resourceGroupName the Azure resource group name
* @param containerName the container instance name
* @param containerGroupName the container group name
* @param containerName the container instance name
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return all available log lines
*/
String getLogContent(String resourceGroupName, String containerName, String containerGroupName);
@Beta(Beta.SinceVersion.V1_5_0)
String getLogContent(String resourceGroupName, String containerGroupName, String containerName);

/**
* Get the log content for the specified container instance within a container group.
*
* @param resourceGroupName the Azure resource group name
* @param containerName the container instance name
* @param containerGroupName the container group name
* @param containerName the container instance name
* @param tailLineCount only get the last log lines up to this
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the log lines from the end, up to the number specified
*/
String getLogContent(String resourceGroupName, String containerName, String containerGroupName, int tailLineCount);
@Beta(Beta.SinceVersion.V1_5_0)
String getLogContent(String resourceGroupName, String containerGroupName, String containerName, int tailLineCount);

/**
* Get the log content for the specified container instance within a container group.
*
* @param resourceGroupName the Azure resource group name
* @param containerName the container instance name
* @param containerGroupName the container group name
* @param containerName the container instance name
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return a representation of the future computation of this call
*/
Observable<String> getLogContentAsync(String resourceGroupName, String containerName, String containerGroupName);
@Beta(Beta.SinceVersion.V1_5_0)
Observable<String> getLogContentAsync(String resourceGroupName, String containerGroupName, String containerName);

/**
* Get the log content for the specified container instance within a container group.
*
* @param resourceGroupName the Azure resource group name
* @param containerName the container instance name
* @param containerGroupName the container group name
* @param containerName the container instance name
* @param tailLineCount only get the last log lines up to this
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return a representation of the future computation of this call
*/
Observable<String> getLogContentAsync(String resourceGroupName, String containerName, String containerGroupName, int tailLineCount);
@Beta(Beta.SinceVersion.V1_5_0)
Observable<String> getLogContentAsync(String resourceGroupName, String containerGroupName, String containerName, int tailLineCount);

/**
* Lists all operations for Azure Container Instance service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,21 +417,21 @@ public Set<Event> events() {

@Override
public String getLogContent(String containerName) {
return this.manager().containerGroups().getLogContent(this.resourceGroupName(), containerName, this.name());
return this.manager().containerGroups().getLogContent(this.resourceGroupName(), this.name(), containerName);
}

@Override
public String getLogContent(String containerName, int tailLineCount) {
return this.manager().containerGroups().getLogContent(this.resourceGroupName(), containerName, this.name(), tailLineCount);
return this.manager().containerGroups().getLogContent(this.resourceGroupName(), this.name(), containerName, tailLineCount);
}

@Override
public Observable<String> getLogContentAsync(String containerName) {
return this.manager().containerGroups().getLogContentAsync(this.resourceGroupName(), containerName, this.name());
return this.manager().containerGroups().getLogContentAsync(this.resourceGroupName(), this.name(), containerName);
}

@Override
public Observable<String> getLogContentAsync(String containerName, int tailLineCount) {
return this.manager().containerGroups().getLogContentAsync(this.resourceGroupName(), containerName, this.name(), tailLineCount);
return this.manager().containerGroups().getLogContentAsync(this.resourceGroupName(), this.name(), containerName, tailLineCount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ public ContainerGroup.DefinitionStages.Blank define(String name) {
}

@Override
public String getLogContent(String resourceGroupName, String containerName, String containerGroupName) {
LogsInner logsInner = this.manager().inner().containerLogs().list(resourceGroupName, containerName, containerGroupName);
public String getLogContent(String resourceGroupName, String containerGroupName, String containerName) {
LogsInner logsInner = this.manager().inner().containerLogs().list(resourceGroupName, containerGroupName, containerName);

return logsInner != null ? logsInner.content() : null;
}

@Override
public String getLogContent(String resourceGroupName, String containerName, String containerGroupName, int tailLineCount) {
LogsInner logsInner = this.manager().inner().containerLogs().list(resourceGroupName, containerName, containerGroupName, tailLineCount);
public String getLogContent(String resourceGroupName, String containerGroupName, String containerName, int tailLineCount) {
LogsInner logsInner = this.manager().inner().containerLogs().list(resourceGroupName, containerGroupName, containerName, tailLineCount);

return logsInner != null ? logsInner.content() : null;
}

@Override
public Observable<String> getLogContentAsync(String resourceGroupName, String containerName, String containerGroupName) {
return this.manager().inner().containerLogs().listAsync(resourceGroupName, containerName, containerGroupName)
public Observable<String> getLogContentAsync(String resourceGroupName, String containerGroupName, String containerName) {
return this.manager().inner().containerLogs().listAsync(resourceGroupName, containerGroupName, containerName)
.map(new Func1<LogsInner, String>() {
@Override
public String call(LogsInner logsInner) {
Expand All @@ -93,8 +93,8 @@ public String call(LogsInner logsInner) {
}

@Override
public Observable<String> getLogContentAsync(String resourceGroupName, String containerName, String containerGroupName, int tailLineCount) {
return this.manager().inner().containerLogs().listAsync(resourceGroupName, containerName, containerGroupName, tailLineCount)
public Observable<String> getLogContentAsync(String resourceGroupName, String containerGroupName, String containerName, int tailLineCount) {
return this.manager().inner().containerLogs().listAsync(resourceGroupName, containerGroupName, containerName, tailLineCount)
.map(new Func1<LogsInner, String>() {
@Override
public String call(LogsInner logsInner) {
Expand Down
Loading

0 comments on commit baa9f8f

Please sign in to comment.