Exemplo n.º 1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonLakeFormationConfig config = new AmazonLakeFormationConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonLakeFormationClient client = new AmazonLakeFormationClient(creds, config);

            ListPermissionsResponse resp = new ListPermissionsResponse();

            do
            {
                ListPermissionsRequest req = new ListPermissionsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.ListPermissions(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.PrincipalResourcePermissions)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListPermissionsResponse response = new ListPermissionsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("permissions", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <ResourceSharePermissionSummary, ResourceSharePermissionSummaryUnmarshaller>(ResourceSharePermissionSummaryUnmarshaller.Instance);
                    response.Permissions = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemplo n.º 3
0
        public ListPermissionsResponse List()
        {
            ListPermissionsResponse response = new ListPermissionsResponse();

            try
            {
                using (IDbConnection conn = GetConnection())
                {
                    response.permissions = conn.GetList <Permissions>().ToList();
                    if (response.permissions.Count > 0)
                    {
                        response.Status      = true;
                        response.Description = "Successful";
                    }
                    else
                    {
                        response.Status      = false;
                        response.Description = "No data";
                    }
                }
            }
            catch (Exception ex)
            {
                response.Status      = false;
                response.Description = ex.Message;
            }
            return(response);
        }