can i list the parameters of my container or my storage account using azure for go sdk?
i want to list something like storage capacity etc
this is my code:
func GetContainer() gin.HandlerFunc {
return func(c *gin.Context) {
err := godotenv.Load("./.env")
if err != nil {
log.Println("Erro ao carregar variavel de ambiente", err)
c.JSON(http.StatusInternalServerError, gin.H{
"Erro ao carregar variavel de ambiente": err,
})
return
}
accountKey := os.Getenv("ACCOUNTKEY")
storageAccountName := os.Getenv("ACCOUNTNAME")
//containerName := os.Getenv("CONTAINERNAME")
client, err := storage.NewBasicClient(storageAccountName, accountKey)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"Erro ao criar cliente: ": err,
})
log.Fatal("Erro ao criar cliente: ", err)
return
}
containerSvc := client.GetBlobService()
containerListResponse, err := containerSvc.ListContainers(storage.ListContainersParameters{})
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"Erro ao listar containers: ": err,
})
log.Fatal("Erro ao listar containers: ", err)
return
}
for _, container := range containerListResponse.Containers {
c.JSON(http.StatusOK, gin.H{
"Containers": container.Name,
"Propriedades": container.Properties,
})
}
}
}
list the configurations of these containers that I'm going to list, what I mainly want is to list the storage capacity of this account
I can list some parameters, but I can't list the storage capacity
You can use GetProperties function in your azure golang sdk to get the blob properties and its capacity like below:-
Command :-
Output:- Got blob properties like below:-
Code 2 with container and blob properties:-
Output:-