use of com.microsoft.azure.management.containerregistry.Registries in project azure-tools-for-java by Microsoft.
the class ContainerRegistryMvpModel method setAdminUserEnabled.
/**
* Set AdminUser enabled status of container registry.
*/
public Registry setAdminUserEnabled(String sid, String id, boolean enabled) {
Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
Registries registries = azure.containerRegistries();
if (registries != null) {
Registry registry = registries.getById(id);
if (registry != null) {
clearTags(registry);
if (enabled) {
registry.update().withRegistryNameAsAdminUser().apply();
} else {
registry.update().withoutRegistryNameAsAdminUser().apply();
}
}
return registry;
} else {
return null;
}
}
use of com.microsoft.azure.management.containerregistry.Registries in project azure-tools-for-java by Microsoft.
the class ContainerRegistryMvpModel method getContainerRegistry.
/**
* Get ACR by Id.
*/
@NotNull
public Registry getContainerRegistry(String sid, String id) throws Exception {
Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
Registries registries = azure.containerRegistries();
if (registries == null) {
throw new Exception(CANNOT_GET_REGISTRY + id);
}
Registry registry = registries.getById(id);
if (registry == null) {
throw new Exception(CANNOT_GET_REGISTRY + id);
}
return registry;
}
Aggregations