Skip to content

Commit

Permalink
chore: adjust get queries to filter for name (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil91 authored Apr 30, 2024
1 parent 50320b9 commit 4762a50
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions charts/dim/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
apiVersion: v2
name: dim
type: application
version: 0.0.5
appVersion: 0.0.5
version: 0.0.6
appVersion: 0.0.6
description: Helm chart for DIM Middle Layer
home: https://github.com/catenax-ng/dim-repo
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion charts/dim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ To use the helm chart as a dependency:
dependencies:
- name: dim
repository: https://phil91.github.io/dim-client
version: 0.0.5
version: 0.0.6
```
## Requirements
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Project>
<PropertyGroup>
<VersionPrefix>0.0.5</VersionPrefix>
<VersionPrefix>0.0.6</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
8 changes: 4 additions & 4 deletions src/clients/Dim.Clients/Api/Cf/CfClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async Task<Guid> CreateCloudFoundrySpace(string tenantName, CancellationT

private static async Task<Guid> GetEnvironmentId(string tenantName, CancellationToken cancellationToken, HttpClient client)
{
var environmentsResponse = await client.GetAsync("/v3/organizations", cancellationToken)
var environmentsResponse = await client.GetAsync($"/v3/organizations?names={tenantName}", cancellationToken)
.CatchingIntoServiceExceptionFor("get-organizations", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE);
var environments = await environmentsResponse.Content
.ReadFromJsonAsync<GetEnvironmentsResponse>(JsonSerializerExtensions.Options, cancellationToken)
Expand Down Expand Up @@ -136,7 +136,7 @@ public async Task<Guid> GetSpace(string tenantName, CancellationToken cancellati
{
var spaceName = $"{tenantName}-space";
var client = await _basicAuthTokenService.GetBasicAuthorizedLegacyClient<CfClient>(_settings, cancellationToken).ConfigureAwait(false);
var result = await client.GetAsync("/v3/spaces", cancellationToken)
var result = await client.GetAsync($"/v3/spaces?names={spaceName}", cancellationToken)
.CatchingIntoServiceExceptionFor("get-space", HttpAsyncResponseMessageExtension.RecoverOptions.ALLWAYS).ConfigureAwait(false);
try
{
Expand Down Expand Up @@ -180,8 +180,9 @@ await client.PostAsJsonAsync("/v3/service_instances", data, JsonSerializerExtens

private async Task<Guid> GetServiceInstances(string tenantName, Guid? spaceId, CancellationToken cancellationToken)
{
var name = $"{tenantName}-dim-instance";
var client = await _basicAuthTokenService.GetBasicAuthorizedLegacyClient<CfClient>(_settings, cancellationToken).ConfigureAwait(false);
var result = await client.GetAsync("/v3/service_instances", cancellationToken)
var result = await client.GetAsync($"/v3/service_instances?names={name}", cancellationToken)
.CatchingIntoServiceExceptionFor("get-si", HttpAsyncResponseMessageExtension.RecoverOptions.INFRASTRUCTURE).ConfigureAwait(false);
try
{
Expand All @@ -193,7 +194,6 @@ private async Task<Guid> GetServiceInstances(string tenantName, Guid? spaceId, C
throw new ServiceException("Response must not be null");
}

var name = $"{tenantName}-dim-instance";
var resources = response.Resources.Where(x => x.Name == name && x.Type == "managed" && (spaceId == null || x.Relationships.Space.Data.Id == spaceId.Value) && x.LastOperation.State == "succeeded");
if (resources.Count() != 1)
{
Expand Down

0 comments on commit 4762a50

Please sign in to comment.