-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32614 from vespa-engine/freva/sd
ZtsClient: Support getting Azure temporary credentials
- Loading branch information
Showing
8 changed files
with
109 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
vespa-athenz/src/main/java/com/yahoo/vespa/athenz/api/AzureTemporaryCredentials.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
package com.yahoo.vespa.athenz.api; | ||
|
||
import java.time.Instant; | ||
|
||
/** | ||
* @author freva | ||
*/ | ||
public record AzureTemporaryCredentials(String azureSubscription, | ||
String azureTenant, | ||
String accessToken, | ||
Instant expiration) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...a/com/yahoo/vespa/athenz/client/zts/bindings/AzureTemporaryCredentialsResponseEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
package com.yahoo.vespa.athenz.client.zts.bindings; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.yahoo.vespa.athenz.api.AzureTemporaryCredentials; | ||
|
||
import java.time.Instant; | ||
|
||
/** | ||
* @author freva | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class AzureTemporaryCredentialsResponseEntity implements TemporaryCredentialsResponse<AzureTemporaryCredentials> { | ||
private final AzureTemporaryCredentials credentials; | ||
|
||
public AzureTemporaryCredentialsResponseEntity( | ||
@JsonProperty("attributes") Attributes attributes, | ||
@JsonProperty("expiration") Instant expiration) { | ||
this.credentials = new AzureTemporaryCredentials( | ||
attributes.azureSubscription(), | ||
attributes.azureTenant(), | ||
attributes.accessToken(), | ||
expiration); | ||
} | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record Attributes(@JsonProperty("azureSubscription") String azureSubscription, | ||
@JsonProperty("azureTenant") String azureTenant, | ||
@JsonProperty("accessToken") String accessToken) { } | ||
|
||
public AzureTemporaryCredentials credentials() { | ||
return credentials; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...rc/main/java/com/yahoo/vespa/athenz/client/zts/bindings/TemporaryCredentialsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
package com.yahoo.vespa.athenz.client.zts.bindings; | ||
|
||
/** | ||
* @author freva | ||
*/ | ||
public interface TemporaryCredentialsResponse<T> { | ||
T credentials(); | ||
} |