Skip to content

Commit

Permalink
Remove dead code from AwsConfigService
Browse files Browse the repository at this point in the history
  • Loading branch information
hocinehacherouf committed Jun 1, 2023
1 parent b5a4703 commit d967674
Showing 1 changed file with 1 addition and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private async Task<Dictionary<string, ComponentDeploymentSpecification>> CreateG
{
var componentArn = !string.IsNullOrEmpty(component.Id) ?
$"{component.Id}:versions:{component.Version}" : // Public greengrass component
$"arn:aws:greengrass:{config.AWSRegion}:{config.AWSAccountId}:components:{component.ModuleName}:versions:{component.Version}"; // Private greengrass component
$"arn:aws:greengrass:{config.AWSRegion}:{config.AWSAccountId}:components:{component.ModuleName}:versions:{component.Version}"; //

_ = await this.greengrass.DescribeComponentAsync(new DescribeComponentRequest
{
Expand All @@ -175,51 +175,6 @@ private async Task<Dictionary<string, ComponentDeploymentSpecification>> CreateG

return components;
}

// TODO: To delete if no more needed
//private static JObject JsonCreateComponent(IoTEdgeModule component)
//{

// var environmentVariableObject = new JObject();

// foreach (var env in component.EnvironmentVariables)
// {
// environmentVariableObject.Add(new JProperty(env.Name, env.Value));
// }

// var recipeJson =new JObject(
// new JProperty("RecipeFormatVersion", "2020-01-25"),
// new JProperty("ComponentName", component.ModuleName),
// new JProperty("ComponentVersion", component.Version),
// new JProperty("ComponentPublisher", "IotHub"),
// new JProperty("ComponentDependencies",
// new JObject(
// new JProperty("aws.greengrass.DockerApplicationManager",
// new JObject(new JProperty("VersionRequirement", "~2.0.0"))),
// new JProperty("aws.greengrass.TokenExchangeService",
// new JObject(new JProperty("VersionRequirement", "~2.0.0")))
// )
// ),
// new JProperty("Manifests",
// new JArray(
// new JObject(
// new JProperty("Platform",
// new JObject(new JProperty("os", "linux"))),
// new JProperty("Lifecycle",
// new JObject(new JProperty("Run", $"docker run {component.ImageURI}"),
// new JProperty("Environment",environmentVariableObject))),
// new JProperty("Artifacts",
// new JArray(
// new JObject(new JProperty("URI", $"docker:{component.ImageURI}"))
// )
// )
// )
// )
// )
// );

// return recipeJson;
//}

//AWS Not implemented methods

Expand Down Expand Up @@ -365,96 +320,6 @@ public async Task<List<IoTEdgeModule>> GetConfigModuleList(string modelId)

}
}

// TODO: Delete if no more needed
//private static string retreiveImageUri(string parent, string child, string recipeJsonString)
//{
// var uriImage = "";
// // Parse the string as a JSON object
// var recipeJsonObject = JObject.Parse(recipeJsonString);

// // Extract the "Manifests" array
// var jArray = recipeJsonObject["Manifests"] as JArray;
// var manifests = jArray;

// if (manifests != null && manifests.Count > 0)
// {
// // Get the first manifest in the array
// var firstManifest = manifests[0] as JObject;

// // Extract the "Lifecycle" object
// var jObject = firstManifest?[parent] as JObject;
// var lifecycle = jObject;

// if (lifecycle != null)
// {
// // Extract the value of "Run"
// var runValue = lifecycle[child]?.ToString();

// // Search the index of the 1st whitespace
// var firstSpaceIndex = runValue.IndexOf(' ');

// if (firstSpaceIndex != -1)
// {
// // // Search the index of the 2nd whitespace
// var secondSpaceIndex = runValue.IndexOf(' ', firstSpaceIndex + 1);

// if (secondSpaceIndex != -1)
// {
// // Extract the URI iamge
// uriImage = runValue[(secondSpaceIndex + 1)..];
// }

// }
// }
// }

// return uriImage;
//}

//private static List<IoTEdgeModuleEnvironmentVariable> retreiveEnvVariableAttr(string parent, string child, string recipeJsonString)
//{

// // Parse the string as a JSON object
// var recipeJsonObject = JObject.Parse(recipeJsonString);

// var environmentVariables = new List<IoTEdgeModuleEnvironmentVariable>();

// // Extract the "Manifests" array
// var jArray = recipeJsonObject["Manifests"] as JArray;
// var manifests = jArray;

// if (manifests != null && manifests.Count > 0)
// {
// // Get the first manifest in the array
// var firstManifest = manifests[0] as JObject;

// // Extract the "Lifecycle" object
// var jObject = firstManifest?[parent] as JObject;
// var lifecycle = jObject;

// if (lifecycle != null)
// {
// // Extract the value of "Environment"
// var env = lifecycle?[child] as JObject;

// // Convert Environment JSON Object as a dictionnary
// var keyValuePairs = env!.ToObject<Dictionary<string, string>>();

// foreach (var kvp in keyValuePairs!)
// {
// var iotEnvVariable = new IoTEdgeModuleEnvironmentVariable
// {
// Name = kvp.Key,
// Value = kvp.Value
// };

// environmentVariables.Add(iotEnvVariable);
// }
// }
// }
// return environmentVariables;
//}

public Task<List<EdgeModelSystemModule>> GetModelSystemModule(string modelId)
{
Expand Down

0 comments on commit d967674

Please sign in to comment.